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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 z2 d9 V- W3 ~6 j
  1. [code]EDMA sample test application, r/ g7 v7 h8 t: a
  2. /*7 r8 ^0 {' F' A5 y) ]" g; k9 {
  3. * edma_test.c
    9 Z! e, c0 q, ?4 g. g
  4. *: ]1 y) u4 T) s& \
  5. * brief  EDMA3 Test Application  [4 u5 @8 N  u0 H
  6. *
    ; N& E6 _4 f( }4 t0 q1 _% y1 Z
  7. *   This file contains EDMA3 Test code.% k1 O( Q6 }9 G8 K7 `& p
  8. *
    : t& d; u& w1 V! D* F3 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' H4 p: x9 L. g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 n5 r/ V* x; m/ `& }3 ], B/ `
  11. *         TO CHANGE.
    0 \( M+ _; k! J5 ~- q
  12. *( m, f8 S' A# x! d1 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 t+ A  m$ c+ [3 i6 ?1 f- }
  14. *4 _2 D) i* ?2 j# b% K7 y
  15. * This program is free software; you can redistribute it and/or
    ' P5 {6 Y1 H1 t: S1 A
  16. * modify it under the terms of the GNU General Public License as: D2 {" S. O; ~( k! o5 {
  17. * published by the Free Software Foundation version 2.; N- w& ~# H6 _; q# M+ p  Y/ t6 @
  18. *; v. d: R' |) d  J  v  i* b7 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 e* u) _; g  H7 n7 |) G& n
  20. * kind, whether express or implied; without even the implied warranty0 R, c" y0 U2 M/ v9 F  O, g: p& j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) C' A  S+ c4 ?5 U+ N! u
  22. * GNU General Public License for more details.+ J. o& p7 L5 q! ?! q/ K6 e# _
  23. */
    ( P. |$ |/ W2 c& z3 `

  24. * i" d; |2 ~& l1 Z8 y
  25. #include <linux/module.h>
    + N! T1 j0 s/ `
  26. #include <linux/init.h>8 m# j- N( W# T) V+ Z% V9 _
  27. #include <linux/errno.h>  O' `# t7 d2 X  v+ ]- c
  28. #include <linux/types.h>$ _) T+ f: \7 e4 `7 a
  29. #include <linux/interrupt.h>
    # b" [) m# S. i. t" n& E
  30. #include <asm/io.h>
    & ?4 I  m  V" R3 u7 L8 A( e
  31. #include <linux/moduleparam.h>
    ; V8 ^  w  q5 T3 H
  32. #include <linux/sysctl.h>
    ; r" u' B6 C! d4 `0 t+ C
  33. #include <linux/mm.h>
    ( w$ \5 M! v8 J; B4 a. g0 p/ m2 X
  34. #include <linux/dma-mapping.h>
    " \+ s( y. N6 a8 n' n, w

  35. 6 {& |$ ?% ~. m8 g9 C" V- c- v' x
  36. #include <mach/memory.h>, i7 Z! K1 P* g- f0 v
  37. #include <mach/hardware.h>' h7 M) K: l4 f
  38. #include <mach/irqs.h>8 {8 C6 \8 j% _5 j" X1 M
  39. #include <asm/hardware/edma.h>
    # c5 c  x9 n1 [- k* t, j5 z

  40. ; p  O' a1 ]' s8 D4 }
  41. #undef EDMA3_DEBUG
    7 `! t- p2 q! e7 n5 g
  42. /*#define EDMA3_DEBUG*/* s9 l; D2 n. T' X. `# A' _, q$ E

  43.   P2 h* o9 \. M
  44. #ifdef EDMA3_DEBUG
    . y0 ~- f) B! {# J, \. K; g: ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 j0 Q' M7 k3 w. x- X1 o( X1 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 f2 z: {1 {) j% Q2 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & f2 w; [/ d( q
  48. #else
    4 @$ S" |! h; a2 n7 d* U6 Z. D
  49. #define DMA_PRINTK( x... )
    # `1 t8 v' n2 q& A, q5 P8 j% f- {
  50. #define DMA_FN_IN' B! @8 ]. X4 Y4 Q8 p% V, D
  51. #define DMA_FN_OUT
    % W* z: G9 M8 `% {2 K$ Q$ T9 G
  52. #endif
    + E  ]9 G% e- o
  53. - X# _* z. C" w& c; g8 u0 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" j* t* ~" m$ f, h1 u( g- t; C
  55. #define STATIC_SHIFT                30 t7 G1 W7 M, x" j
  56. #define TCINTEN_SHIFT               20
    ; w- i9 u6 M, h- s. j; u; S
  57. #define ITCINTEN_SHIFT              21- y, X0 g9 h" E5 E- i
  58. #define TCCHEN_SHIFT                22
    8 y# H% H5 m! x
  59. #define ITCCHEN_SHIFT               23( n' |6 u  C9 w0 g  ]
  60. 0 O/ m5 t5 g8 s7 i) j+ \
  61. static volatile int irqraised1 = 0;5 l& z. l7 |8 f' i1 j7 n3 m
  62. static volatile int irqraised2 = 0;8 w+ V! L9 r5 T9 ?& o+ W3 e

  63. ; m0 X! b' j9 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # R+ n5 L+ c+ s4 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* a: T  d# ^: q8 m4 o8 d% M$ n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' W6 ]3 L0 z' w6 [9 j/ h7 A
  67. / C. d8 j2 z0 x" W9 P5 a8 z
  68. dma_addr_t dmaphyssrc1 = 0;
    4 U6 K5 U  E' C% \5 C1 ]
  69. dma_addr_t dmaphyssrc2 = 0;
    3 G/ j2 ]6 h& z- L
  70. dma_addr_t dmaphysdest1 = 0;+ a& C7 U# s3 R7 G0 K/ x# c# ~/ c
  71. dma_addr_t dmaphysdest2 = 0;# }. g  h9 m! _0 s, Z
  72. 9 X+ N  |& O& I) p; P
  73. char *dmabufsrc1 = NULL;5 W& z/ M: G1 }& [  K& }1 E9 O8 x
  74. char *dmabufsrc2 = NULL;
    " k% r) q) V% o' j0 l; H* c: i
  75. char *dmabufdest1 = NULL;
    ( L- B( U! [& Z- _
  76. char *dmabufdest2 = NULL;
    % d4 |9 g( X0 a. x
  77.   Z+ ?! B  U9 j! ]
  78. static int acnt = 512;! y0 o7 z7 i- v9 g) d/ Q
  79. static int bcnt = 8;1 F4 |" P2 p8 }# t8 D: r9 R3 _' j
  80. static int ccnt = 8;
    4 @/ l" ~8 `4 B# g

  81. % E/ p# t# G/ j  Y( D' c  j
  82. module_param(acnt, int, S_IRUGO);
    6 G+ ~* b+ }+ H' V- B
  83. module_param(bcnt, int, S_IRUGO);
    9 P8 T" X/ P+ U& D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 [& ?/ @& d* }1 {' c* M. }, l6 u+ `; J
3 t! @6 O8 f6 U+ B! T/ l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  c, g9 Z" P  N- Q/ N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 {2 ^; |& |, M1 t% \' J! D3 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. K3 [9 O4 ]: l) h7 c" ]+ u

, J* E% p; o: j# F6 X4 P# {* ^. \. W3 n0 M  z$ D. [0 s3 o8 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 18:04 , Processed in 0.039069 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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