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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + V  }0 v2 @: z/ q% z
  1. [code]EDMA sample test application
    " @  l  u+ ?3 e' `1 Q
  2. /*
    " F8 c% g/ @* Z6 |/ K
  3. * edma_test.c2 J0 J  W7 O. k0 z/ X# _* ^) A
  4. *
    ; R) z2 @' P8 v
  5. * brief  EDMA3 Test Application
    ; k3 A, X$ R1 ^" r# y$ B
  6. *
    * j. G# s2 @) v! v0 k5 U
  7. *   This file contains EDMA3 Test code.9 V6 D+ O* V- Y' ?. G
  8. *
    7 D" P* N2 c8 U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' |% E$ ^) @7 @$ O1 {! R, G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 r$ r1 F' u- x/ O- F
  11. *         TO CHANGE.
    / e! F' C' Z7 Z6 x& b+ H: Z- _
  12. *
    & U4 N8 ~5 A% o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" w& m* I: V6 F$ H# V
  14. *
    % _7 |. B) I6 s! }$ T
  15. * This program is free software; you can redistribute it and/or: H* M# h' }3 z) g) R) R
  16. * modify it under the terms of the GNU General Public License as3 U: Z0 N1 i: U. `* l$ Y: i
  17. * published by the Free Software Foundation version 2.
    ! f& {7 O" @% S; Q8 M
  18. *
    $ m0 x" |4 D3 ]& g  H9 {$ v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# ?1 I7 G4 u7 c
  20. * kind, whether express or implied; without even the implied warranty
    * |+ k0 n8 y) }" t5 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . V. n5 r6 V+ s
  22. * GNU General Public License for more details." L$ v: B; H" ^) x9 y) d4 m" ]
  23. */  W+ b/ S' b- R/ Y: J7 f9 W
  24. 3 l/ g' r$ P/ T2 Y+ @" p! @$ \
  25. #include <linux/module.h>
    % o' R+ k' C4 B/ z5 R' Y
  26. #include <linux/init.h>
    4 ?% {" I/ R; n8 r) _) a
  27. #include <linux/errno.h>; h( u0 g$ u( s5 K$ i+ E9 }
  28. #include <linux/types.h>' O' z/ z5 k* t( t
  29. #include <linux/interrupt.h>5 ]( U4 V* j5 I( ~4 q
  30. #include <asm/io.h>. j2 F: V0 k5 |" w$ j4 r+ e2 ?
  31. #include <linux/moduleparam.h>
    , J7 z% w9 N# O' @% o! G6 q/ L
  32. #include <linux/sysctl.h>
    ( C, B1 D/ }: H0 i
  33. #include <linux/mm.h>
    - E: ~, a  h" m
  34. #include <linux/dma-mapping.h>
    8 H0 t( T- f6 y5 @# \$ F

  35. & [: w8 O9 n) C1 Y3 w0 {
  36. #include <mach/memory.h>
    ( Q3 w+ ]1 D* W7 p: k$ O$ B
  37. #include <mach/hardware.h>: {  i/ W) e, R8 j3 x; Y) A
  38. #include <mach/irqs.h>
    2 \' N) I2 `3 l0 Q" z+ c
  39. #include <asm/hardware/edma.h>
    3 A; X' B' u5 i( L/ Y

  40. 4 `- R; d0 G9 |5 a  V+ U1 }, L
  41. #undef EDMA3_DEBUG0 o8 F8 ?* L  m- I4 b
  42. /*#define EDMA3_DEBUG*/
    ( P1 c. d6 J9 R% U7 R

  43. 0 R1 q! e! E$ D
  44. #ifdef EDMA3_DEBUG" W% J% v6 z+ L6 |- u0 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 M% A5 p  l" n: O( M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + O( _( V: Q& [& F  {+ @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      y, V) H; s  U
  48. #else5 }. ]0 K( @& l
  49. #define DMA_PRINTK( x... )
    $ w, r1 ?2 e' ^% K( o$ B1 }
  50. #define DMA_FN_IN
    + O+ o8 c- f- d7 U( x
  51. #define DMA_FN_OUT
    ; r$ r' Q6 n) O: x. O9 j, E
  52. #endif2 y2 Q4 N. I, T  m

  53. $ p( p  a9 ]( a1 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 e/ A  y! Z1 w
  55. #define STATIC_SHIFT                3
    2 I/ ]+ \1 c& m. ^1 T3 V
  56. #define TCINTEN_SHIFT               20
    * \1 |. {" A( b& `$ L0 Q) z0 A* Z
  57. #define ITCINTEN_SHIFT              21
    # L: ^7 ]! Y( Z5 d1 z5 n- d
  58. #define TCCHEN_SHIFT                229 K) u9 t+ K( J$ L, \1 d
  59. #define ITCCHEN_SHIFT               23
    $ g* Q" z' B/ D+ e, u' ~3 @3 e

  60. % {( @7 t1 s! ^
  61. static volatile int irqraised1 = 0;- c/ `  g# `$ y
  62. static volatile int irqraised2 = 0;
    . L0 r' h7 t. W! L3 `* ?

  63. - U* z1 w- g6 c( s# x' |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' p- V0 `9 m1 Y* I; Q8 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 {2 ]9 a$ M3 {  m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 w0 o) k& e0 \
  67. 0 \* o7 D: ?0 V6 B( V0 ~3 D! a  M- O
  68. dma_addr_t dmaphyssrc1 = 0;6 q! _) ]- i9 R; c) S6 ], ~' l
  69. dma_addr_t dmaphyssrc2 = 0;
    " J$ l) y9 G: h5 O! }
  70. dma_addr_t dmaphysdest1 = 0;5 f3 F/ O7 K8 u0 i# p
  71. dma_addr_t dmaphysdest2 = 0;* _  L2 l7 _6 S; @

  72. ! x6 L2 J7 u2 l* M
  73. char *dmabufsrc1 = NULL;% p. g: G" d! ^$ F' E& G( f
  74. char *dmabufsrc2 = NULL;4 G, [9 Z: u7 |. Q1 D1 u& _
  75. char *dmabufdest1 = NULL;
    4 I. |: q  x4 c
  76. char *dmabufdest2 = NULL;
    . w0 R' Q4 u5 K3 Y7 V7 \
  77. 4 u- x4 f3 Y- V* U; S6 O) J) Z
  78. static int acnt = 512;
    3 |' h8 h% ]9 r& ]6 T
  79. static int bcnt = 8;
      e0 v7 u. x& S2 q. N5 N! V
  80. static int ccnt = 8;" D  G$ m2 M# F( p9 ]  g3 Z. s
  81. " d9 a( m7 Y  d/ d7 [6 w2 J) I4 `  k5 P
  82. module_param(acnt, int, S_IRUGO);4 x; S: i# S; A8 `. Y
  83. module_param(bcnt, int, S_IRUGO);: J) Y3 S7 _7 P2 n* D- |! F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 P( l, z5 z- b& \5 D$ L' `; }! s# Z
2 |5 H; H' }8 p3 L: ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( t9 S/ ~" Q/ ]/ P# x* t  x0 oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" U7 I6 l3 z, J" ]  m1 f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& g2 u* d5 ~9 N: X: n" q2 i8 o
& B7 L& G& b, r# F: ]2 T3 q- F5 s/ c1 j( A: s8 N3 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-29 13:48 , Processed in 0.040869 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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