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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( l( M: Y! x1 x
  1. [code]EDMA sample test application" k3 F) b6 k7 o, d
  2. /*9 B6 t1 g$ X5 |9 N' x
  3. * edma_test.c
    5 F- f# B2 Y% x3 y2 h0 K
  4. *
    & U6 L( ?' F4 ~' L5 O
  5. * brief  EDMA3 Test Application
    2 k- k6 \7 L, }1 H% z
  6. *% ?2 L4 S, z% M" M- T2 p
  7. *   This file contains EDMA3 Test code.
    3 E( G: ^: W# N& v$ W" k
  8. *
    * m/ B8 d; {. i$ v5 e0 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. B) ]9 e! Z/ V% g) R( X# u5 h, ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 j7 K" W6 A/ M, Z, V4 e- ?. {# b; _
  11. *         TO CHANGE." p) _9 q1 B- t6 Z
  12. *
    : U) Y# }* J2 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ r0 U; l) X' G  w: O7 }4 y$ U
  14. *
    ( c6 g, o/ u7 Q4 l# G
  15. * This program is free software; you can redistribute it and/or+ }5 n: [+ l# J' ~
  16. * modify it under the terms of the GNU General Public License as* P2 A0 u( v: F! j- M# |
  17. * published by the Free Software Foundation version 2.  C  d  n# q( G3 ~7 s3 c
  18. */ C; K% G) K6 t  U+ Y! ^$ B4 {, k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 x  ?# B9 ]0 ~* c
  20. * kind, whether express or implied; without even the implied warranty6 z+ S+ B1 ~3 \6 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. b' _( t# z" [# [
  22. * GNU General Public License for more details.- Q5 v$ r" X9 E" b, b2 z1 a) ^, [
  23. */
    # ?2 \. Y9 _, W( i6 q0 ^
  24. 3 g0 j6 W; `# D  X
  25. #include <linux/module.h>
    * w% O, E9 J, f% v
  26. #include <linux/init.h>" a0 p, o( H# f& n- v, _0 g
  27. #include <linux/errno.h>
    * B  V; G/ ^0 h) w( Y
  28. #include <linux/types.h>" J1 }% p0 I, t! R1 P7 [- e
  29. #include <linux/interrupt.h>* ?; n% M+ T" V2 R  Y2 Y
  30. #include <asm/io.h>( l/ c- h5 U" {
  31. #include <linux/moduleparam.h>
    ' G& m* g$ Y8 o: }5 ~/ p. G# p
  32. #include <linux/sysctl.h>7 d7 @; o% a' T+ T! \' [
  33. #include <linux/mm.h>/ a2 m. }9 X5 U; D
  34. #include <linux/dma-mapping.h>
    0 j2 o9 {1 O& w5 |4 P' _

  35. 2 @' K3 w: a6 J0 _" g9 X( B+ I* ^
  36. #include <mach/memory.h>
    # P% ]8 [: A0 y* {' D1 Q
  37. #include <mach/hardware.h>
    * F. A6 {* @1 |2 x7 ~$ g
  38. #include <mach/irqs.h>
    ) _. h2 ?  a' j$ G
  39. #include <asm/hardware/edma.h>
    6 h) v2 X; q6 @" Y+ g; G
  40. , b$ r) V- n8 k9 S* i9 q% h- g/ k
  41. #undef EDMA3_DEBUG) ]* f  ^' Z- a/ h) M
  42. /*#define EDMA3_DEBUG*/; P5 P" d" `2 `2 e. m; j" O/ n) v4 X

  43. 0 U& t. j* H. z6 X" y
  44. #ifdef EDMA3_DEBUG7 l4 x2 s5 c% d& x- _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 S; p! i$ z5 ?* G: {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 P% D7 Q: D, r- R/ I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 F. Y! e8 K) |1 v1 X
  48. #else2 t* r2 b& p, A4 N  I7 n1 g/ g$ Z. Q
  49. #define DMA_PRINTK( x... )
      b2 P( Y. p7 ]" T1 ^
  50. #define DMA_FN_IN
    # W1 M, T5 V7 j  f- I- e4 o' j  Q
  51. #define DMA_FN_OUT
    / ?  L/ y' g% n3 y1 p! x: q
  52. #endif
    4 l: A2 G' h' f( s$ x" }9 e

  53. + J7 _' k1 t( R+ A& b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 x( d* \) Y1 {2 e$ c
  55. #define STATIC_SHIFT                3" p5 Y7 `- {. U0 V( X+ R* U. b
  56. #define TCINTEN_SHIFT               20
    : x6 q6 _2 G8 _/ M3 [
  57. #define ITCINTEN_SHIFT              21) l" i0 ~5 `6 |! h0 a
  58. #define TCCHEN_SHIFT                228 {+ I6 c1 i1 K6 `! s
  59. #define ITCCHEN_SHIFT               23: S% O9 R- A( @- n/ D8 L

  60. * O, K( l2 c/ n" H/ f
  61. static volatile int irqraised1 = 0;
    ! T) Z) s% B+ N( \' E" Y
  62. static volatile int irqraised2 = 0;, b# P! j( ^0 m4 X
  63. : T+ ?% Z' }6 R( `& f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 o3 g7 X: P2 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) y# y* H  Z. S  p8 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' `6 n5 r6 D8 j) H9 `/ T. a  O/ P0 D

  67. 8 M6 {) D% Z( y) U2 \5 \
  68. dma_addr_t dmaphyssrc1 = 0;
    + Z# P& ?; m+ c! q' I1 t* ^
  69. dma_addr_t dmaphyssrc2 = 0;6 ^- i0 y) P' t( `  I- k3 u: p: \
  70. dma_addr_t dmaphysdest1 = 0;
    ; w+ ]  x9 I6 V1 S4 w0 D
  71. dma_addr_t dmaphysdest2 = 0;% Q9 }% F8 |% ^+ V: b7 Y
  72. ; f. O1 p( ]9 K
  73. char *dmabufsrc1 = NULL;
    & y, b' n- s& B
  74. char *dmabufsrc2 = NULL;
    3 V" @/ ]' Q" Z7 @5 O5 l2 x, g9 K  C( }
  75. char *dmabufdest1 = NULL;) b+ y. B' W9 M. Z% H9 ]5 ]# e
  76. char *dmabufdest2 = NULL;9 q# }7 R+ w. w+ X$ U' h  m
  77. $ f' \4 v5 D- w
  78. static int acnt = 512;0 U" X' n8 z- m# V, B0 L! t
  79. static int bcnt = 8;; y7 P9 X; h* {) f" P1 N7 U
  80. static int ccnt = 8;0 f, }. ^) c6 f# g( c

  81. ( q1 }7 D1 L1 o( |
  82. module_param(acnt, int, S_IRUGO);
    * l' i% K: j$ _' ?
  83. module_param(bcnt, int, S_IRUGO);
    # [0 ]6 K9 \9 u# ]( J' J6 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( j" |# F* }$ a, Y: K0 Z4 Q
4 u. V( t$ t( G3 \. e) ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ |+ Y% R& W2 i& k- _7 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 A; b$ C3 Y! F* b" B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 H# h- P! P) h& h+ P9 a- a1 B% Q3 o; J+ ]$ Q3 w
  s' A8 F; f! i  E( ?( E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 18:16 , Processed in 0.038541 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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