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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % m. z9 Y. H4 S' d3 ?  e4 ~
  1. [code]EDMA sample test application
    6 j% s! D5 z/ I( @9 ]! R0 v. [
  2. /*4 \' {7 U  D4 E& ~5 E& \# f4 _4 y
  3. * edma_test.c
    4 {9 C8 E6 [( w, g
  4. *5 q5 p0 m- ~9 H  M9 k& k
  5. * brief  EDMA3 Test Application( V2 r+ h+ x' g* d9 j; r! ?7 E8 b% l
  6. *
    : I+ H9 n8 O/ c! _& S! x8 q8 R1 l
  7. *   This file contains EDMA3 Test code.
    4 H5 D  B! c8 u, u3 ~
  8. *
    & w5 k% M- w* ^; N9 m* Z* z3 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & e$ I, r$ n& X& d9 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & H8 R  W$ V9 [9 q& ~$ s
  11. *         TO CHANGE., \4 y* W/ G8 J" o  Y8 |9 m$ _
  12. *
    , P4 P/ M, C0 Y, t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) ^8 n/ d' R8 s. j7 `
  14. *
    4 M& C6 y1 n! y2 k) V; }" }: _8 G
  15. * This program is free software; you can redistribute it and/or* q8 \. z# c1 Q$ S
  16. * modify it under the terms of the GNU General Public License as
    7 H& }' j/ T" a5 L4 G
  17. * published by the Free Software Foundation version 2.
    . o! f5 E' ]( n5 N
  18. *3 o4 G5 J/ w; s2 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & Q; Z5 i$ {( R
  20. * kind, whether express or implied; without even the implied warranty
    0 H1 F0 p5 x9 ]' W' k+ H$ w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" d" q& K; i, p- f  N6 Y: e& |8 H
  22. * GNU General Public License for more details.
    ' l  H+ n( S* Y* g+ t7 y5 H1 D
  23. */, D: P  D/ t: k8 j" D

  24. 0 {/ v9 B" A& z" @
  25. #include <linux/module.h>0 D) F' v/ S' C. U" U: @
  26. #include <linux/init.h>1 l1 j6 [* t$ z, c: t
  27. #include <linux/errno.h>, h0 q' B6 I4 }$ u# m8 G; \( L
  28. #include <linux/types.h>+ q: ?" L  A) Q4 }& K2 P% S
  29. #include <linux/interrupt.h>! T" B: z) ~; n5 g
  30. #include <asm/io.h># Z4 \! A5 X9 Z: J6 Q
  31. #include <linux/moduleparam.h>
    ( s5 o! h- }# ]  P$ ^, s7 w( r
  32. #include <linux/sysctl.h>
    2 Y( G5 q. R3 r' Z- d& A
  33. #include <linux/mm.h>' x* |& L- v& r
  34. #include <linux/dma-mapping.h>
    + u) T1 @  E0 H! q& D" s; n
  35. ' y: U# |+ Q9 y+ k+ E
  36. #include <mach/memory.h>6 b/ K1 u1 P$ a  L. ^9 M, j, ~/ l
  37. #include <mach/hardware.h>0 E' g) i4 U3 ?# b' P& b, H
  38. #include <mach/irqs.h>3 {7 J% G5 m+ f' T
  39. #include <asm/hardware/edma.h>
    . H( j  Z$ T/ ~. _$ y9 g2 F( v  K

  40. " D* p4 B8 i7 ?0 Y5 ^; @
  41. #undef EDMA3_DEBUG
    * W6 s2 P0 R  }- s' c! P; h
  42. /*#define EDMA3_DEBUG*/! ?7 T& C: X  E; K& t# [( z3 Q

  43. : A; t/ K' i0 ~' P3 r
  44. #ifdef EDMA3_DEBUG& r- F! |7 q1 X' F6 Z3 q: l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! ~' J# o0 H! R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 q5 P4 y8 A1 T1 H- Y* W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), b8 w& H+ e( C" ]6 m1 E# J
  48. #else& U4 d  `; M0 ]
  49. #define DMA_PRINTK( x... )1 b. a2 Y! Y9 ~% K0 @- [* ~
  50. #define DMA_FN_IN. T$ z/ A2 j7 E' l- V" L* X7 p3 d
  51. #define DMA_FN_OUT
    : {+ y& S! w: s+ U9 e) b$ K
  52. #endif
    ' E) l' X$ u5 [

  53. ( d2 b' q( L5 ]7 c( g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( @7 X' Z- `- X% b
  55. #define STATIC_SHIFT                3
    $ }1 R  e- C6 A% ?6 A
  56. #define TCINTEN_SHIFT               20
    , ]( T7 ?1 Y2 \( ~5 O6 ?
  57. #define ITCINTEN_SHIFT              21
    ; l' H" i5 x1 m: R& _
  58. #define TCCHEN_SHIFT                22
    ; S; f4 x) E' j( |" u' C& S
  59. #define ITCCHEN_SHIFT               238 W6 a- Y. X: J' m* ^' e& s

  60. 6 R  y% y: i0 `7 T: K1 ^
  61. static volatile int irqraised1 = 0;
    - i! c  C# i& Y5 w1 ^: s
  62. static volatile int irqraised2 = 0;5 A$ b0 t! J0 s$ a! U1 H4 J$ j

  63. 2 p% g' j/ C9 G% P+ i1 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) @, E! H; m4 s7 \7 Y; I2 S( R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ \+ {5 l. ?  ~, `) v1 M, _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 p% l4 U1 L7 F7 w, J& S& M; \0 B* g' D
  67. ! D0 ^' J; t9 {! q) @% e
  68. dma_addr_t dmaphyssrc1 = 0;% F9 p! z# i$ p/ B  W: t
  69. dma_addr_t dmaphyssrc2 = 0;3 w, {& s" T5 j! r, w
  70. dma_addr_t dmaphysdest1 = 0;* j7 @0 G6 o- J) s
  71. dma_addr_t dmaphysdest2 = 0;
    8 k; [5 V- n& l: P
  72. + R7 i% `  j4 x) U# O2 _0 F9 `
  73. char *dmabufsrc1 = NULL;. v  J! _0 D( B3 i  @: Z
  74. char *dmabufsrc2 = NULL;+ B: L, f8 S! g. ?+ U! V
  75. char *dmabufdest1 = NULL;* E( y% h* ^3 x9 Y3 ]- g1 Z
  76. char *dmabufdest2 = NULL;
    & C2 R3 ^8 g7 y8 ~
  77. ) k) w. W" `9 ?& M
  78. static int acnt = 512;. {" @" n: @: c. b
  79. static int bcnt = 8;6 I6 d2 W! Y( g" \: p, H
  80. static int ccnt = 8;# F& J$ P  D0 v2 C) _; s

  81. " ^6 o1 b) O# T+ H
  82. module_param(acnt, int, S_IRUGO);% |6 P8 v+ V' X/ @$ I. Q5 m* Z
  83. module_param(bcnt, int, S_IRUGO);
    9 _2 G  r: |& K6 n8 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) X. u/ z7 _' N
6 v# ]# s8 w/ U  Q% Q; R- j* S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! R- H, s: {+ A% z! i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; i; ^6 g! V, W. l- B3 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) x4 t) T2 ^. Q0 W3 {* |
( w0 |7 R0 q. u+ f4 m1 b0 p

% \% a5 w; X# H3 V( X1 d: R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 06:31 , Processed in 0.041746 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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