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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - x0 @( n0 g0 j! `/ C$ o
  1. [code]EDMA sample test application* z/ `* x1 X* }. x* T
  2. /*9 P  s1 {% f" w( F( J
  3. * edma_test.c4 P  `8 g. ~3 K+ m
  4. *4 [" `" ~8 l" v% m& p2 |$ l8 j
  5. * brief  EDMA3 Test Application' z# K  O2 o& V- B! V5 U9 L7 C8 O
  6. *) ^( A( b: [/ N
  7. *   This file contains EDMA3 Test code.' N2 F+ M. v' ]& O2 z
  8. *! _( v3 \9 e2 Q4 s: k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* {+ u% r$ `2 L: @) u4 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 c0 i! k1 c; u$ M
  11. *         TO CHANGE.
    ; h$ S, [: @* F  ?5 G
  12. *, K  ~8 z* X0 G- K5 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. Z" `, R  F, }$ t2 z8 c$ g
  14. *. i( S! f3 G7 C
  15. * This program is free software; you can redistribute it and/or
    0 f3 Q- ~# L) z; U3 p9 F; y- L
  16. * modify it under the terms of the GNU General Public License as
    $ L0 K7 T  R  l  Y5 f& R# G
  17. * published by the Free Software Foundation version 2.
    ! Y* y( S# z5 P2 W/ j
  18. *' t% f, [4 @% j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( ], p) j* e0 u, m; t' N! o! v
  20. * kind, whether express or implied; without even the implied warranty1 V2 x0 U' P1 Y! M& n6 K7 M; [9 a6 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 v3 j* P8 Y8 o: ~  ?4 L* i
  22. * GNU General Public License for more details.0 l+ R: Q, N' g" i8 ?# C. J$ w3 H: s
  23. */
    ; g$ a+ K6 b" i5 a9 f, J

  24. ' ?# F$ l# k* y# x' `* a8 ~7 q- E
  25. #include <linux/module.h>
    . ~2 z& x0 |$ R
  26. #include <linux/init.h>
    " `' C( j3 }: d! r
  27. #include <linux/errno.h>) i9 O( |; r3 p0 @' K
  28. #include <linux/types.h>
    ' O6 e+ J6 ^' K+ I5 n
  29. #include <linux/interrupt.h>( t( R  F) x/ Y# s( h: z/ |
  30. #include <asm/io.h>: D4 E4 X  F0 q9 U: t" B. x! t
  31. #include <linux/moduleparam.h>, j4 m2 f: L: I  w- m
  32. #include <linux/sysctl.h>8 V& ^6 y; f! F6 @+ q
  33. #include <linux/mm.h>. ]1 J0 j) S7 i* B( c6 Q- A4 I
  34. #include <linux/dma-mapping.h>' h6 \7 b; t+ e1 j' o4 @7 i; W: N
  35. , h7 _3 n+ E4 H, t  W- F) I
  36. #include <mach/memory.h>  C- u5 n3 _2 O' C, T
  37. #include <mach/hardware.h>
    * C$ e& q& ?* v: R2 }5 u$ |
  38. #include <mach/irqs.h>
    8 n/ m- R% M- ?# A
  39. #include <asm/hardware/edma.h>
    & X; k7 \/ g9 |

  40. * E& b! D" r& C2 F4 z
  41. #undef EDMA3_DEBUG- j/ {. a3 o  l; }1 m9 z" F
  42. /*#define EDMA3_DEBUG*/
    $ j, H4 n5 Z" E: R( L" [  v% y
  43. $ p9 n# S. c5 ~  R! H. N8 @
  44. #ifdef EDMA3_DEBUG5 o6 r# M  n' Z. `7 X$ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 W: X) z9 Q: h* J& V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! P" w5 l/ U( L% ^1 T7 _& V; y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% |* B# _8 g  F* S4 n0 W0 i
  48. #else
    ' P5 |8 ~$ l, S- F" [& r
  49. #define DMA_PRINTK( x... )
    9 h% i0 u7 h' O
  50. #define DMA_FN_IN
    + L6 |. e, r% Z
  51. #define DMA_FN_OUT+ C4 ~2 J- i1 L  h
  52. #endif! Z. `! ]2 j. Q, v

  53. 9 k& S; a9 [7 Q. j. W' ?& e. ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' d3 d  R$ g/ l: u, n
  55. #define STATIC_SHIFT                3
      d, x( `2 b# i& R; {$ Y+ a: m/ O
  56. #define TCINTEN_SHIFT               20
    . y" Y9 ^' H" ?8 ~. K" X, F
  57. #define ITCINTEN_SHIFT              21# i9 j7 A: `/ \; L+ G* q/ Z
  58. #define TCCHEN_SHIFT                22
      c* {( i% G$ z" [
  59. #define ITCCHEN_SHIFT               234 u, H# E0 c9 E  Q  v0 O

  60. ' p2 d5 y, M  M; {$ l: h
  61. static volatile int irqraised1 = 0;' A' w& g* x1 S6 O
  62. static volatile int irqraised2 = 0;* o' G! D2 f! f# J' Y- b

  63. 0 _- W5 ]+ n% T1 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 z1 X6 U- n5 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ]! f2 r  G. e% [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: F7 l& c: I: ?3 g) |( [
  67. % ~: K1 ~1 G3 p8 Q
  68. dma_addr_t dmaphyssrc1 = 0;: C$ W+ ?1 @% ]1 T9 v8 B
  69. dma_addr_t dmaphyssrc2 = 0;1 }; H2 V: ?0 g5 L" z( F
  70. dma_addr_t dmaphysdest1 = 0;2 R& Z% N; p# y- S
  71. dma_addr_t dmaphysdest2 = 0;! p6 u  i# l$ y! j, |( ?
  72. 4 [+ ^* R: i$ q' M
  73. char *dmabufsrc1 = NULL;
    / ~/ N6 f* F! f
  74. char *dmabufsrc2 = NULL;
    5 c* N; W" q% F# k7 B
  75. char *dmabufdest1 = NULL;
    - N+ n2 e1 x& `5 v( w9 N  i, O
  76. char *dmabufdest2 = NULL;' Q$ j  ~7 z' t- x. `0 n
  77. 2 B1 J, l3 O- g- g
  78. static int acnt = 512;. s+ ^5 R3 {6 a
  79. static int bcnt = 8;
      G( y8 h) v* F. Z
  80. static int ccnt = 8;
    0 x9 V. i$ E7 V$ A9 u: _

  81. & z+ O% D! Q; {3 m' S
  82. module_param(acnt, int, S_IRUGO);
    : }' m# P  e0 H, L) u% D( L& M! X
  83. module_param(bcnt, int, S_IRUGO);/ J& z7 t  `1 f' m; d3 k& w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& y2 ~/ l# O, [9 ^* u% e1 O; a- X
! j6 E  |5 Q! z! M) i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ?5 R7 C4 [. M* W. ]. i% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ p* h; E) |5 `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  N4 Y! Q* Z4 {( s$ _
4 j# N3 J5 r" ~# V! \  ^# c" p7 V$ s4 j( Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 22:46 , Processed in 0.038840 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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