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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 d& X; j- f5 ^  G4 ], y2 {
  1. [code]EDMA sample test application; R; L; S& ]) f6 Z3 N  h
  2. /*
    0 @; H# T. S8 t1 m" W6 N
  3. * edma_test.c
    7 W7 s2 Q7 {. B
  4. *
    4 v. f$ S- v1 v
  5. * brief  EDMA3 Test Application8 Z8 B3 B. R9 t0 j
  6. *" ?0 M) D' T& y& @
  7. *   This file contains EDMA3 Test code.- `  Z" Q8 q, V7 p: `8 a
  8. *
    : A  y5 P  H4 x( Z- y7 u. e" l& S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * H& i& Q& q* l- S; b2 j2 B. {, C6 r  ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 d9 y5 s' B2 q* g2 ~
  11. *         TO CHANGE.0 ^  e$ V6 R+ E& @
  12. *, z- B; [9 P$ C) l: `: a' E6 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" \+ `7 B5 p! q6 v
  14. *4 z2 R: v2 H$ s, m4 W% `
  15. * This program is free software; you can redistribute it and/or
    7 `3 H9 x% N+ ~5 n1 C3 y( j
  16. * modify it under the terms of the GNU General Public License as
    $ D& z# w1 x' _
  17. * published by the Free Software Foundation version 2.% ]6 A# u0 s% E6 W/ I
  18. *7 n( R0 d$ x/ B5 D4 Y% I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 |- `* y8 V) B4 `+ T2 X$ I/ n
  20. * kind, whether express or implied; without even the implied warranty
    1 k8 [0 x# q: u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & a0 I0 V( h: q: O: {( W
  22. * GNU General Public License for more details.: E: C2 I  O6 a; r0 u5 t
  23. */8 z8 Q% L6 p9 Z! D; d

  24. 4 P# b- X5 h5 Q7 o" U
  25. #include <linux/module.h>2 s& h3 _# B' O
  26. #include <linux/init.h>; \+ y9 d* G- e  J
  27. #include <linux/errno.h>
    # I- c) ?1 w1 k& x- a
  28. #include <linux/types.h>
    : }" j  q% A. |1 ~8 ^+ k
  29. #include <linux/interrupt.h>
    " I1 \, \3 X+ W
  30. #include <asm/io.h>
    $ X3 y. Y& f: F% H4 I& B* [
  31. #include <linux/moduleparam.h>
    # x# k& d. h0 f0 ^4 X
  32. #include <linux/sysctl.h>
    % }4 @4 D' I5 D" U' N4 L" Q
  33. #include <linux/mm.h>
    / G5 n! o6 t9 F! L, ?* Y0 ?
  34. #include <linux/dma-mapping.h>" q! Y; l. h$ P/ D% |" X
  35. . I& }4 d/ e) W* W9 q  S
  36. #include <mach/memory.h>
    ; e4 X$ m! a+ N" _$ x' p
  37. #include <mach/hardware.h>
    - f6 f7 j2 M0 u, a, o8 ~
  38. #include <mach/irqs.h>
    7 {# m" }9 y$ R& z& a# W
  39. #include <asm/hardware/edma.h>
    ! M+ y' o6 w0 z

  40. ; q" |/ T- v9 G, o; o7 C
  41. #undef EDMA3_DEBUG# K% l, a3 V2 A% W
  42. /*#define EDMA3_DEBUG*/+ Z3 }9 s* v' V- i: ~; {
  43. 3 S) z7 t9 ?, m4 l$ i) L' L+ i  e
  44. #ifdef EDMA3_DEBUG
    / r) n/ W& t8 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# r3 T+ p$ K  I" Q* r, g/ L. ]) E1 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 T0 i: g* c7 Z, X4 m2 M$ Q- F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). ?8 a( b! z/ D4 m+ x
  48. #else1 k7 g8 ?$ z+ A$ Q! q: Y) e9 D/ F7 v
  49. #define DMA_PRINTK( x... )- r/ ?- r& F: [5 C
  50. #define DMA_FN_IN
    " l9 P! V. Q4 a" K$ u
  51. #define DMA_FN_OUT  Q& Y3 N# l. O0 {" m& S
  52. #endif
    ; h1 I# ~1 z+ ]+ r" P0 s6 i9 t

  53. . p. M0 V" h# ^$ ~6 V& J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . v' p, O" i1 e. \/ s: m" L! A
  55. #define STATIC_SHIFT                3% O& X  ?2 S! w+ e0 W1 O
  56. #define TCINTEN_SHIFT               20
    ( c( Q) ~( `5 K
  57. #define ITCINTEN_SHIFT              218 H* P; H& ^5 U
  58. #define TCCHEN_SHIFT                22
    % c; b! i' }& L8 C  _( Z
  59. #define ITCCHEN_SHIFT               237 x" c  F  ^1 K( Z$ c) {$ }

  60. # M! h5 _6 B- J" z' p. A% h& X
  61. static volatile int irqraised1 = 0;
    * u- P* p1 Q0 k& A* b
  62. static volatile int irqraised2 = 0;
    / @' L: q% ^! J( b0 c8 D1 l1 E3 D8 w
  63. ' A) C5 o+ e1 D8 t% X* ?/ B9 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , }* j' F  L/ Q9 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* J1 ^2 M% g: ~3 r$ h( ?* P2 _9 Q$ [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" |( [( n- x- @$ J5 r
  67. ) t6 t( n5 Z8 }; t$ |5 \) G2 A
  68. dma_addr_t dmaphyssrc1 = 0;4 l( Q9 _' p$ ^. ]+ S
  69. dma_addr_t dmaphyssrc2 = 0;
    3 Z3 S; B. R; M/ z: x% [1 Y
  70. dma_addr_t dmaphysdest1 = 0;' L4 j5 ~5 Z; T5 v5 _+ l9 A9 o, n
  71. dma_addr_t dmaphysdest2 = 0;
    * y* y8 [; Z3 w( p
  72. ( b9 t. ?1 X9 H+ q! S6 B  g
  73. char *dmabufsrc1 = NULL;# t/ b) F( A) V1 N5 e
  74. char *dmabufsrc2 = NULL;) {8 S1 Y* O! g* n$ Q$ Z1 s
  75. char *dmabufdest1 = NULL;
    " f3 c7 z( x, R* R2 a# L5 |
  76. char *dmabufdest2 = NULL;
    2 f( z0 N1 z: |9 G+ d1 ~, w

  77. : Q* ^2 @+ A6 g  _9 n, y1 S' I8 t
  78. static int acnt = 512;7 c8 S/ j- ~3 d) S+ ^
  79. static int bcnt = 8;
    5 ~. e, a+ l: |+ Y9 ]# c" m
  80. static int ccnt = 8;0 a' S" A' t1 G6 x& e" z

  81. & p  |5 T8 U5 X$ [9 n
  82. module_param(acnt, int, S_IRUGO);4 Y9 ~) }4 Y, ~1 C
  83. module_param(bcnt, int, S_IRUGO);4 R: [" Y4 T) [* g- z- h' k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* p) U9 y$ k  d# x7 e5 B7 X
" f9 M+ W+ M9 m! l$ f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( v3 W& f, W5 k) N1 G# L6 {4 u6 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 b( M1 V: ?$ p' @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. m  ?  ^8 R4 t3 n/ ~2 a" I2 N! @
+ y# ?8 L  E% w  \9 @- k
. }7 ]- U+ O" f: U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 03:26 , Processed in 0.038891 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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