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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 Q: d* R. I7 B1 \
  1. [code]EDMA sample test application/ Z. f0 b8 Y& O& `- Z
  2. /*. j9 i& P" o$ ~1 s0 k  [& p
  3. * edma_test.c
    % S' w: M# T9 B9 Z, p8 Y: q: u
  4. *
    : L% p3 `7 W8 r) \' M, f
  5. * brief  EDMA3 Test Application
    0 f$ R6 m6 E5 s4 r% i( p3 n
  6. *
    ; a( v. `+ Y4 H: ?% H. X
  7. *   This file contains EDMA3 Test code.0 W5 U. u: S6 {8 ?4 k, ^' U3 q& D6 f
  8. *, j' Y6 N+ l6 w& A2 ?3 k9 v. d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! }$ U+ V/ ~; d4 q8 Y; t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 u$ {& X8 H  H3 c( ]% d
  11. *         TO CHANGE.$ }. d( {8 b; l2 [' Q& I
  12. *1 g) p3 u/ `# e. P0 z4 A+ z6 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * J/ e. Q6 x0 V2 K3 h8 M
  14. *. P) |$ Y" G9 U
  15. * This program is free software; you can redistribute it and/or
    7 B( C0 z7 H8 J( V) a7 W
  16. * modify it under the terms of the GNU General Public License as) R5 H% r6 m9 R4 U  L6 f
  17. * published by the Free Software Foundation version 2.
    - t1 _. T. p) Z
  18. *! D  d0 o! d" }5 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 W" n$ n! k$ j. ?) y4 h* {" ]
  20. * kind, whether express or implied; without even the implied warranty$ V! i  ]" I( c7 E, A7 s2 ]0 |: ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 Q6 z( L: b9 i# f& v) m( [
  22. * GNU General Public License for more details.
    - o4 Q+ h2 S. J1 z
  23. */7 V5 h6 c2 e! {* H9 g3 @  @

  24. 1 n& e4 t4 [% x+ a4 Y
  25. #include <linux/module.h>6 d& E& y2 f) g! L8 g
  26. #include <linux/init.h>, E+ \. b& u+ I# V1 I( p; T
  27. #include <linux/errno.h>
    ' w6 ~# `" i9 j% |4 k
  28. #include <linux/types.h>
    $ m% M5 `1 j- o* U1 O! X
  29. #include <linux/interrupt.h>: w/ V) v$ S. X5 s" V1 I; P' X6 B
  30. #include <asm/io.h>
    0 O/ q$ f+ G* _; i$ b
  31. #include <linux/moduleparam.h>$ W0 x+ x1 X! E" g* C* F5 W& h
  32. #include <linux/sysctl.h>
    / O: x4 {3 ?. c6 z' x# V0 Y- G# K
  33. #include <linux/mm.h>
    * ]* Z& J& d# r6 ]9 p
  34. #include <linux/dma-mapping.h>
    4 ~4 m7 k# |+ S- t9 k

  35. & U9 U# u# Q4 p9 U1 E% S
  36. #include <mach/memory.h>
    / B5 v5 Y0 t4 [6 v5 E
  37. #include <mach/hardware.h>! a( j; U& U/ L) f0 g8 k
  38. #include <mach/irqs.h>
    % a: a8 k4 ^( o. q
  39. #include <asm/hardware/edma.h>
    0 J  {6 H  N9 s9 B) o; }) u
  40. ! ]- F8 [8 P+ |
  41. #undef EDMA3_DEBUG
    ; t, B& K$ g! ~4 w6 {1 n0 _
  42. /*#define EDMA3_DEBUG*/$ ^8 y$ I$ a9 m& Q* ^5 q" ?
  43. 4 V8 d# ]! O1 h
  44. #ifdef EDMA3_DEBUG3 N8 v; j# J. N. h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ J" j$ E* N7 \) d- A3 K! m$ p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 x; V. ~, [, Z5 c# ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % L) s6 _( O9 |3 n
  48. #else
    & f  \4 {- _" W: a# a/ B) X" U
  49. #define DMA_PRINTK( x... )$ u  L/ m3 @' a. {
  50. #define DMA_FN_IN9 F8 {# Q& H4 M# f5 V- A
  51. #define DMA_FN_OUT
    & l0 V, e4 X# P
  52. #endif
    . J2 o, m8 u! ^! i. r5 b

  53. - Z$ c" d/ G8 M4 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 I* F' ~  }* w* x6 a1 y. P# _: ?
  55. #define STATIC_SHIFT                31 a) M3 [( x' i
  56. #define TCINTEN_SHIFT               20% L9 |/ J# i$ W* \% v; h4 G2 L' |2 B! y! m
  57. #define ITCINTEN_SHIFT              21
    7 S: J3 r+ z/ }0 L5 k7 K- r
  58. #define TCCHEN_SHIFT                22" K- H! W, M7 S) f# u( k
  59. #define ITCCHEN_SHIFT               23  J2 `( w8 O8 ]; P9 ?' a0 [9 m; f
  60. " c; U6 O% s) M; v9 d6 G5 h1 B
  61. static volatile int irqraised1 = 0;
    / @- ?/ O) x- x  u3 G
  62. static volatile int irqraised2 = 0;
    ! z+ c) e5 k3 H
  63. ( o9 b$ w6 c+ n6 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E( F  ?' b6 j* Y/ B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 Y: Q# }$ u% o+ N7 y2 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , k* c0 e' Q4 R& ]% u
  67. * k& X; K$ p; P
  68. dma_addr_t dmaphyssrc1 = 0;
    9 R$ w1 j" X! o/ a4 W- c* K: g
  69. dma_addr_t dmaphyssrc2 = 0;
    + q" a- Y7 ^1 c+ v# G
  70. dma_addr_t dmaphysdest1 = 0;
    8 E4 n' K3 b) K  k9 W4 s: ~
  71. dma_addr_t dmaphysdest2 = 0;
    + C; i' ^: A) f$ d  |

  72. 1 _2 }9 W% Y/ L0 u5 t0 j6 \+ S8 M
  73. char *dmabufsrc1 = NULL;# \1 W8 L' ^5 j8 ~. t2 M* U
  74. char *dmabufsrc2 = NULL;2 @9 m: |0 ]* J
  75. char *dmabufdest1 = NULL;$ u! q5 p, P: i/ J; o
  76. char *dmabufdest2 = NULL;
    + S. t! C3 Y  W' M4 [0 q

  77. ' ]4 o$ F) o* J5 W  o  o
  78. static int acnt = 512;6 l  b5 V5 w$ h
  79. static int bcnt = 8;
    2 R+ O2 ?% G" A9 ]
  80. static int ccnt = 8;
    : z% s* i. G2 F, F/ |( z
  81. & S  d6 O6 {6 p, S+ m3 N" M
  82. module_param(acnt, int, S_IRUGO);8 Z: f5 t, t% p' E; f/ H' T
  83. module_param(bcnt, int, S_IRUGO);) [8 o  M  w" b; I% ?) n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 |1 D# i# Q1 H# {; |

' O9 F7 W3 R* J. f" `, d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 \& _( |! p% l1 O0 o5 W! U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% \7 l' j1 d* x. R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 u: U4 i% K# f: E

& g4 U- X6 r: J3 d: x5 ~- g; r+ S. P* B3 V: z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 11:53 , Processed in 0.060938 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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