OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 |& B( u$ _1 N* T- R; {
  1. [code]EDMA sample test application6 ~$ M# w3 [: a4 J" s7 M, g* q
  2. /*- N: J4 R3 |/ a- U1 H5 W6 m$ ^7 u+ ~
  3. * edma_test.c5 j$ w% ?  T# y
  4. *$ g8 z- h" u/ }* }; j9 X
  5. * brief  EDMA3 Test Application- G8 y2 L% U2 g3 a, m5 g
  6. *
    4 W+ o# i3 d$ Q' T5 U0 x% @0 S
  7. *   This file contains EDMA3 Test code.
    1 ~" C- \  H, |% c9 o1 y
  8. *
    2 n4 Z% p: r6 h/ Q5 H2 x8 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; C! l* ?  q* `- {' @0 ^7 r. ]3 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 {, o) W/ O+ u1 R
  11. *         TO CHANGE.
    0 v7 g8 |3 H, A
  12. *" j5 C- o* V( H! @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P) E! ~" d. l$ P6 ]) w/ S3 R
  14. *
    2 p5 l0 C* [1 I  l) k' z  c
  15. * This program is free software; you can redistribute it and/or
    1 U! {# d7 k, R
  16. * modify it under the terms of the GNU General Public License as' b* a; S" ]3 s& a5 R
  17. * published by the Free Software Foundation version 2.
      R) i$ Y5 |4 o+ i1 [. Z
  18. *3 Z  S' t& q6 D9 @$ `, R7 W2 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 M" p2 j, U  \* g3 M. e. @
  20. * kind, whether express or implied; without even the implied warranty5 H! ]' G0 F; j3 E4 M# g! g. W( \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- B" W- [0 {1 i" z
  22. * GNU General Public License for more details.5 l1 M# {% r, S( e
  23. */9 L; U. g( C( D0 c/ k2 G4 X
  24. $ ?, {3 ?3 X8 S, Q
  25. #include <linux/module.h>
    4 R, H: n6 i5 Z+ N  L0 b
  26. #include <linux/init.h>
    5 f; K% i, r/ N+ \0 l& g! ]
  27. #include <linux/errno.h>
    ; Q. @, M) }% U$ h8 Z' ?- B
  28. #include <linux/types.h>
    2 n( p  y' v8 e9 u
  29. #include <linux/interrupt.h>/ L7 [0 Y! L+ s! T! m1 G
  30. #include <asm/io.h>3 ?6 r  I; c$ q* O. P0 V8 [, D# S7 k
  31. #include <linux/moduleparam.h>' M0 t! ?* B- S1 I9 ]. J1 R/ j( ^6 f
  32. #include <linux/sysctl.h>
    ! l3 a  `4 f( v3 O/ h
  33. #include <linux/mm.h>0 c1 _8 ?8 @$ B" |+ S  E
  34. #include <linux/dma-mapping.h>
    6 H8 f" \2 D$ N+ t7 e
  35. 3 l  ]+ y) n7 F* Y8 C1 r) _+ S
  36. #include <mach/memory.h>: T# d" g2 V4 W5 w
  37. #include <mach/hardware.h>1 |- {9 g( P# D/ A+ u0 |+ B
  38. #include <mach/irqs.h>
    # f$ n$ \3 t! |5 v% t
  39. #include <asm/hardware/edma.h>: L' _) K+ [* _+ o
  40. ; ?, i0 f# J) T
  41. #undef EDMA3_DEBUG4 N4 P) V1 E0 ?* m0 Q6 d
  42. /*#define EDMA3_DEBUG*/" \7 R& x  q5 e0 ]1 w+ l. G8 u
  43. , }- X! k! j/ {" N
  44. #ifdef EDMA3_DEBUG
    ' \' D- s4 M- l0 q4 Z) r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 I8 A- {" k7 f1 J: E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ]4 V) L! }  s/ B5 F) w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 S; Z, C# D- C
  48. #else- o- A; f+ Z- J; z) m
  49. #define DMA_PRINTK( x... )0 T4 q: e! y2 Q4 o
  50. #define DMA_FN_IN
    1 l$ H* Q% Z3 Q' u7 }+ i
  51. #define DMA_FN_OUT6 M$ Q  X' B- `$ V/ W; C5 N- ~
  52. #endif* h, {0 I% J  M( j, E
  53. : h6 ^5 G: R1 r* H6 H7 U( M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 ?, Z5 _  m% k! {  _$ [
  55. #define STATIC_SHIFT                3" j+ s' x, a0 n- a5 a1 a
  56. #define TCINTEN_SHIFT               20
    5 t- v( W& o0 y; X
  57. #define ITCINTEN_SHIFT              21
    + L9 ~( e) Z5 ~% h
  58. #define TCCHEN_SHIFT                22. F# ?9 v1 Z" p4 f2 E' K  M: z
  59. #define ITCCHEN_SHIFT               23" Y7 A/ A) y0 w3 ]

  60. 3 D' q; f* D7 Y$ y  m
  61. static volatile int irqraised1 = 0;0 O8 `, [* j6 v
  62. static volatile int irqraised2 = 0;* w3 G# G( g& _, G* }9 l' A% v

  63. 0 z) w4 M% {7 r3 X/ O$ Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 a. |4 U& I# N; r' b5 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ~' D8 q/ D( p7 Z- a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & s8 M. U8 [& f0 f" y5 O" ~! Z, A5 R
  67. 5 K8 h# k  O7 O6 K6 D% C! o
  68. dma_addr_t dmaphyssrc1 = 0;/ u- J' b" i" Q5 `% {9 n
  69. dma_addr_t dmaphyssrc2 = 0;
    & S+ q, \) c/ V; R1 }0 }
  70. dma_addr_t dmaphysdest1 = 0;
    : \* b; I9 s2 t: s, j3 T
  71. dma_addr_t dmaphysdest2 = 0;( _5 c6 z) [! m7 w; z& o( {( r) A

  72. : g/ c9 P) u- [3 |/ X
  73. char *dmabufsrc1 = NULL;& e4 I0 Z, N1 X: x+ i9 @* G
  74. char *dmabufsrc2 = NULL;6 }' g5 \4 g7 {5 @; t1 J
  75. char *dmabufdest1 = NULL;
    * M1 Z; y1 I" A& t  X+ W3 R! s
  76. char *dmabufdest2 = NULL;6 P' ~% X1 P) }, r5 O! x

  77.   Z2 ^( c. j# r4 [7 g
  78. static int acnt = 512;
    : C2 ]% I# l5 E
  79. static int bcnt = 8;  r+ _9 W) ~' z4 K
  80. static int ccnt = 8;* k$ q/ v" V) i4 A
  81. + S% k4 z' H* Z  o8 [7 F, `( [
  82. module_param(acnt, int, S_IRUGO);3 u$ V7 r( V2 Y! ~! I$ Q! k* g5 Q
  83. module_param(bcnt, int, S_IRUGO);, u( n) B2 e3 ]5 i0 m2 S$ F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 {4 i, C0 u' x& ]
1 t7 s0 \0 B0 n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 y$ {. f; h+ T" y) b! F& ]* Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) j" w- O! {3 Q6 k  [$ l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 ~5 ~! c+ s! M0 a4 I
# t/ b; r% Y$ n* q4 }) W

8 J5 @2 H) i# j  d! z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 18:27 , Processed in 0.040591 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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