OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10871|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ G' ^* I! k9 c% N, D0 x3 A5 q
  1. [code]EDMA sample test application) G0 X# L$ F  T, I/ o
  2. /*
    * b8 {: |0 |# e3 d: ?! E
  3. * edma_test.c' s' H. G9 O$ z4 m3 o
  4. *
    2 j( j$ J: w9 u
  5. * brief  EDMA3 Test Application! ~6 l, @( y3 b( [% v7 T( n. E
  6. *, s$ `- F3 W; {
  7. *   This file contains EDMA3 Test code.0 F+ ^& V7 N6 g+ n: x! c) `) h
  8. *
    3 q) B" b9 T  }$ L/ ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " w: A+ c2 s% Z( Y+ P7 I$ w2 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) t- F" j$ S  d" [; G
  11. *         TO CHANGE.  o$ Q9 w$ t: t5 k- s7 X
  12. *
    1 R3 J% @3 x2 h9 W: P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ B, u. w8 L  L: g) F- n. {! ?
  14. *0 D9 ^3 M* B2 X8 P9 K
  15. * This program is free software; you can redistribute it and/or
    9 k- [  a. P/ K9 p! s8 U
  16. * modify it under the terms of the GNU General Public License as
    / a8 E; F: `- l% Z; {
  17. * published by the Free Software Foundation version 2.
    % V6 b1 U5 {) i3 v! |1 i! S1 l! v. o& R
  18. *
    7 a' ]' A: `6 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ i/ z5 Q. I5 u, R2 ?$ l; t$ A
  20. * kind, whether express or implied; without even the implied warranty9 Y8 L; u7 [5 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& A" F+ W0 [. v# u4 L3 `
  22. * GNU General Public License for more details.
    7 R: z" N' c% D2 a, s
  23. */
    ; d$ u% G1 y2 z# G" v$ p2 r

  24. , P1 l2 K  s1 E$ f9 M
  25. #include <linux/module.h>7 ^/ t  \- ~5 q2 y/ V
  26. #include <linux/init.h>( c* T' P' o( G+ Q- S7 k
  27. #include <linux/errno.h>% X# ^8 T1 b6 A
  28. #include <linux/types.h>
    / r" a8 C  j+ J1 U! n( P" i
  29. #include <linux/interrupt.h>
    : ~" f8 O, @" K% C0 F7 R' x
  30. #include <asm/io.h>0 o# u2 u3 Y7 e' G5 Y; t& Q
  31. #include <linux/moduleparam.h>
    2 F7 d& p+ x+ @1 W# I
  32. #include <linux/sysctl.h>6 w1 V4 g9 l& B/ H- P) V
  33. #include <linux/mm.h>
    8 q% k: g, c$ {; z9 b" Q# Z
  34. #include <linux/dma-mapping.h>1 B  G  ^' F" w# J  p1 L

  35. # m+ R8 T. A2 m* S0 C+ b' F
  36. #include <mach/memory.h>
    + `  J7 g6 G7 _' ]# P  c2 v5 r4 |
  37. #include <mach/hardware.h>: N) r1 J4 y* `) a' N7 E
  38. #include <mach/irqs.h>
    % R' Q. A9 J) h9 W: V
  39. #include <asm/hardware/edma.h>. D8 `5 A9 f  v* q
  40. ( _. S; X" o9 `5 S6 r! y
  41. #undef EDMA3_DEBUG
    3 C. J8 o, R; k( p8 {2 F! f
  42. /*#define EDMA3_DEBUG*/4 s2 V. p, X/ P% o/ ]* V, D

  43. - f7 l& a* a: P; U; `# k3 H+ W
  44. #ifdef EDMA3_DEBUG
    - J- N$ Z$ X# h; q# A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 r5 @5 E& F) u, e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 ]9 x7 I: `$ n) D; f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( _& ?% e6 U5 V9 w% k
  48. #else+ A$ Z; \- [: |! i, L
  49. #define DMA_PRINTK( x... )
    : g$ D7 P: f; t* \4 y7 R0 }
  50. #define DMA_FN_IN0 C, `% o" O& E/ L& |3 l! v
  51. #define DMA_FN_OUT% c2 x: y8 c: s7 E/ f0 i: ]7 x
  52. #endif. H2 \1 [$ v1 r0 b7 Y; g( }! r
  53.   A! i7 N3 v9 u* u0 s; E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % l' w8 V: t7 p1 L  T: V. S8 L& V
  55. #define STATIC_SHIFT                3
    $ D: h7 C- ], y' V' T
  56. #define TCINTEN_SHIFT               20! m& j; z1 `7 _' b* R; d
  57. #define ITCINTEN_SHIFT              21, J6 m: C7 j2 D$ D/ p
  58. #define TCCHEN_SHIFT                22% z+ B, q1 {3 ^/ L+ u
  59. #define ITCCHEN_SHIFT               23
    9 H- U4 Y1 i6 K+ K  q

  60. ! e9 p+ F1 e9 ~5 j* X7 i. \
  61. static volatile int irqraised1 = 0;
    6 G" \( _6 l! C% t3 ~) V5 x( [
  62. static volatile int irqraised2 = 0;
    & M# p4 W( e) D7 n& S
  63. 7 N5 `! ~; U) w7 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 o/ \3 y6 ^# S  x+ R. k  K1 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      x" h8 s' J  D/ y! O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 |6 C3 q/ z7 I$ D. Z) W, t% h

  67. 3 r2 k/ S* s: b/ z
  68. dma_addr_t dmaphyssrc1 = 0;6 D! h1 U( j: T7 M) ^, ]
  69. dma_addr_t dmaphyssrc2 = 0;
    . o+ A2 \2 z6 K' T; ^8 Q6 ?2 V
  70. dma_addr_t dmaphysdest1 = 0;, x2 ^  [1 F& Z& S
  71. dma_addr_t dmaphysdest2 = 0;3 j9 d5 z" x0 t/ G6 I( O
  72. 8 l7 W3 J9 @% {8 O! n
  73. char *dmabufsrc1 = NULL;- i& I/ n& |4 G
  74. char *dmabufsrc2 = NULL;
    1 w$ T5 w4 M; F. Z- v- h) O
  75. char *dmabufdest1 = NULL;! k2 [( k" G" X& D  x  J  t& v
  76. char *dmabufdest2 = NULL;
    / Q5 V" {) W. K2 p# \

  77. * X7 Z) m! x. j
  78. static int acnt = 512;
    4 ?" s& y5 i% [. d
  79. static int bcnt = 8;
    8 L  S$ w5 k3 c. y2 B4 c
  80. static int ccnt = 8;
    ( F) r8 g( K0 B) j" e4 T
  81. , Y7 u0 @) u$ {
  82. module_param(acnt, int, S_IRUGO);' Y, n& q+ e1 K! R( S2 {! K
  83. module_param(bcnt, int, S_IRUGO);, Y9 \1 A, i" x2 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 A" Q$ N1 b) s) j
0 Q+ P# S2 \" U- A$ e/ B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  `* H8 u! A4 \" Farm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 e( ?/ T) n3 K3 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# p: J- a- V0 J

5 \" R9 L5 Y- r2 s9 e0 \/ ?/ L' O0 j3 M8 v' b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-2-2 14:00 , Processed in 0.038645 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表