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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) L& {7 e' u: {# f# |
  1. [code]EDMA sample test application
    + c2 h4 P8 n, n
  2. /*
    9 Q: _6 @4 z) @, j  _
  3. * edma_test.c- ^. v* c4 }4 v$ e5 Z$ f6 R2 {0 m
  4. *
    8 n& K) N' M" C/ L2 S1 r! _
  5. * brief  EDMA3 Test Application
    ' k& n1 w3 C6 Q5 G# O
  6. *
    1 L( T' D% P4 s
  7. *   This file contains EDMA3 Test code.3 d7 l3 g4 t: c+ m. y& \: y' X
  8. *) [( Z* T& j7 ~; O+ ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) R3 f1 Z' ]# Z( \, [+ A7 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 N/ p  d/ i4 j8 ~9 Z; W
  11. *         TO CHANGE.8 E, i7 ?; \, \- ]: |3 r
  12. *
    " w# G3 H7 [/ j) R" ]" O" V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 z4 {0 E3 R: J: H
  14. *
    + O* o  B& M$ P# g! |! [
  15. * This program is free software; you can redistribute it and/or
    + z8 w8 `; H. a
  16. * modify it under the terms of the GNU General Public License as
    ( ~4 c5 {4 d, |% r0 Y' s) M: E
  17. * published by the Free Software Foundation version 2./ W. G' j/ C8 U7 ~, v2 R8 V+ x+ E  K
  18. *2 I0 ?3 N! l( ]" o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 N" f. `- v1 R5 V4 A& }* m; b. f
  20. * kind, whether express or implied; without even the implied warranty
    9 k( a! A, Q1 a9 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 }1 A$ }  E, n3 \8 R* v
  22. * GNU General Public License for more details.3 ^) }- H' j* k2 [! Z
  23. */
    2 H4 p+ R: W% I! T
  24. : ~8 Q& g7 g( q3 }* S- C
  25. #include <linux/module.h>
    - D+ |8 V' _& k  u& A. {5 {
  26. #include <linux/init.h>
    9 m1 R5 v: ?0 ~( y% N& O4 f( G& x$ Q
  27. #include <linux/errno.h>
    $ U: p3 w; C; P/ o+ }
  28. #include <linux/types.h>
    ; o9 e2 p- E5 o+ r! m6 [' N
  29. #include <linux/interrupt.h>
    4 o0 @2 P! n' ~* w
  30. #include <asm/io.h>
    ' v  a1 X6 z8 n+ s# L7 w
  31. #include <linux/moduleparam.h>, F+ i: J4 a! V/ V* T
  32. #include <linux/sysctl.h>
    & @7 U" O* ]7 x+ k3 Q' ]
  33. #include <linux/mm.h>$ ?7 _3 G, L0 I
  34. #include <linux/dma-mapping.h>
    7 i$ l5 M" e3 c3 f+ n1 M7 A0 f

  35. 4 T4 G3 m5 B5 c* U- k8 q# A
  36. #include <mach/memory.h>
    + V, D) g4 ?# W+ s6 |% D
  37. #include <mach/hardware.h>
    - D2 m; m4 h) j1 ~6 m# w3 d; Q
  38. #include <mach/irqs.h>
      @( O: o/ X4 u# E' J' k% O( ?
  39. #include <asm/hardware/edma.h>' b- j  ~. G' b2 w/ P/ h

  40. % K/ i6 F5 J( i& k% o. ]
  41. #undef EDMA3_DEBUG
    . B7 B1 U% Z3 e" Q" }! w
  42. /*#define EDMA3_DEBUG*/8 Y# q% b9 F. L4 w( O; A

  43. / `( E1 M2 U: E+ j. \2 o# n* D" [
  44. #ifdef EDMA3_DEBUG5 p" s! v6 x7 m' d+ I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# d) F  y1 ~, S4 R+ Z4 n7 ~3 o" H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! y4 [5 q3 }2 A# m3 z: y0 S# J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 b' ~: ^# y. D8 V$ Y, Q
  48. #else
    ; E! G; F: |3 J" a0 e  y4 k
  49. #define DMA_PRINTK( x... )
    & b/ S( S' I( o3 u
  50. #define DMA_FN_IN) o' O3 Y' m8 c5 c# q% R7 i8 q
  51. #define DMA_FN_OUT
    9 w0 Y+ r/ Y& s
  52. #endif: v! f6 u) G/ j3 u: n

  53. & ^3 h3 D! p1 O! W1 g9 i2 Q/ R" E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# ]( s" N/ P) Q! \* W% O* @
  55. #define STATIC_SHIFT                3% P! ]( w. R* F! Z9 x3 d# u- w
  56. #define TCINTEN_SHIFT               20
    ; {5 r3 m; }" t7 b% L4 c3 C* M
  57. #define ITCINTEN_SHIFT              21  Q/ C: T$ _( x  O
  58. #define TCCHEN_SHIFT                22: `. |% @' c  c! s' H' K5 P5 P
  59. #define ITCCHEN_SHIFT               23! H2 _. z* r% M5 C
  60. " i+ D. b5 Q! F' D4 @- |5 Y( n9 A
  61. static volatile int irqraised1 = 0;
    , `7 N& A8 D3 l) ^# n  V# H2 f4 r
  62. static volatile int irqraised2 = 0;3 K5 V+ c- M9 [  q' P( H9 f+ n

  63. ; ?1 Q  O) ^2 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M5 i' c( [" w, Z: C. U1 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; m( \* ^5 w5 q5 E  v0 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 E8 K5 N- U% d  [+ z0 U; m. T
  67. " Q0 J8 j) _7 ?& U) I
  68. dma_addr_t dmaphyssrc1 = 0;6 L" c/ ]1 j! ?- p. L
  69. dma_addr_t dmaphyssrc2 = 0;
    0 N+ T$ ^4 c5 O* i: {& I6 g
  70. dma_addr_t dmaphysdest1 = 0;
    # }) z7 j/ m! v5 ?& a
  71. dma_addr_t dmaphysdest2 = 0;: c2 ]% O9 R; a3 ?/ E9 t0 A8 N
  72. ) N" t  P& P: W( p2 A
  73. char *dmabufsrc1 = NULL;  Q& i: U7 [7 J5 i5 r" R
  74. char *dmabufsrc2 = NULL;
    ' g5 C, o0 J7 F) {. d( r+ `
  75. char *dmabufdest1 = NULL;- b: d2 t5 [3 x- z2 x3 B4 v1 X, r
  76. char *dmabufdest2 = NULL;
    ' W& i) E6 K5 Z' I  v+ v2 I

  77. / g% n' ~4 |: |) r7 M
  78. static int acnt = 512;7 ^( \7 n+ f2 w2 j, |
  79. static int bcnt = 8;
    " n5 S8 Z6 K. k4 g# i& T
  80. static int ccnt = 8;
    / k" m( u0 H. _( c& W0 E6 G

  81. ; S2 ?4 ~* w. M$ O3 p
  82. module_param(acnt, int, S_IRUGO);
    , K: T- x: c8 P/ B+ N. _
  83. module_param(bcnt, int, S_IRUGO);
    + U  l! y) J/ i6 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" z0 s* |  r0 c% l8 x3 h
  W# d( y2 ^; T1 m% @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: C+ j! U, J8 w) V" p0 R( G
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ N+ @& u6 a" w5 o% h* \) C# x" @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ]- `8 N& n, a4 f" J- O; ?0 G1 e- e/ W" O
8 {: B& t7 ?. d5 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 09:59 , Processed in 0.047730 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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