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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, x& s  W8 H3 g
  1. [code]EDMA sample test application$ P3 h) h& E3 H$ o0 d& R) d
  2. /*
    6 V) i. I$ L, k2 n/ Z
  3. * edma_test.c6 i, W- @( b' H1 q- U# N# C0 q+ M# ]
  4. *
    - k: l0 M/ V6 k2 o, ?0 D
  5. * brief  EDMA3 Test Application
    / {' C* r; A8 Y8 A$ s9 x8 e
  6. *
    ! T# M, }/ G7 K# O4 f9 _
  7. *   This file contains EDMA3 Test code.* p* d6 T( K/ G3 I$ V, C
  8. *
    ! F6 n- k( K, u& B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( B1 P& f" j, V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. d( k1 I+ T+ ?% o2 Z% v- L
  11. *         TO CHANGE.5 p) s% Y+ D/ N9 r+ N
  12. *
    ( t0 B8 |" a5 m4 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 L4 R. \: \( d! w  M( f7 K; O/ h* j
  14. *
      }% h1 T6 [; z
  15. * This program is free software; you can redistribute it and/or
    8 Y" f# T/ ~- V. a1 d
  16. * modify it under the terms of the GNU General Public License as
    ! e7 a' n; h8 a$ O) s9 i( T. i+ u
  17. * published by the Free Software Foundation version 2.0 G+ W7 o, |. {( h1 o
  18. *
    0 ~: c) H9 r& Q4 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) a5 [( F& _: z
  20. * kind, whether express or implied; without even the implied warranty
    2 W* p5 E0 i$ m2 t/ r) D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 p7 @/ v1 u) o. n0 ~& {3 A: F# l
  22. * GNU General Public License for more details.
    1 h/ K' @: k% t/ B# w( I! X
  23. */3 T+ {+ ^/ a3 N+ u/ A
  24. 4 n" y- ^/ g5 e( C2 Q1 ]
  25. #include <linux/module.h>4 W, m4 R  ^+ g3 h* m2 H" P* c) C
  26. #include <linux/init.h>$ V3 i' C, Q: J7 H
  27. #include <linux/errno.h>1 Z2 v1 u$ J: U9 {: J2 d
  28. #include <linux/types.h>+ L/ j/ w$ @8 k
  29. #include <linux/interrupt.h>* L/ c% V  H$ _7 h
  30. #include <asm/io.h>
    - a3 j9 e4 ?0 E. f
  31. #include <linux/moduleparam.h>
    ( O7 t9 W6 w* {9 H* [6 G
  32. #include <linux/sysctl.h>+ {) H* M% r# M7 ]
  33. #include <linux/mm.h>& R0 S6 Y3 |. g( }$ m
  34. #include <linux/dma-mapping.h>
    1 X: L8 D3 C6 O0 H: b8 a6 f& L
  35. ! D* B+ y" v: m& N( n
  36. #include <mach/memory.h># a# z5 _' B$ X& a- t
  37. #include <mach/hardware.h>! t8 ~7 z3 w. P7 P3 S% i& a5 A( K
  38. #include <mach/irqs.h>
    ( E1 w) o- I' X1 U# E$ B
  39. #include <asm/hardware/edma.h>) m2 Z0 {; L$ M! ?+ R
  40. / P1 h% }; ^" |* I% J: L6 {+ C
  41. #undef EDMA3_DEBUG
    6 W& V+ s0 r# p; ^3 A1 R1 {9 F) k
  42. /*#define EDMA3_DEBUG*/: m6 D) @% n% v, ?1 n/ |

  43. 7 @4 ]. v0 J4 F0 O3 H! Q
  44. #ifdef EDMA3_DEBUG
    ( o. z) l( j( M3 a1 G4 c! B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - J2 g2 S) @. D) J& o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 r4 U- ~* c+ o: o; t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 ]0 ]4 ^# Z- N/ s  Y* }( H& N
  48. #else) M  N/ i5 ]/ Y& P# j0 z4 R3 e6 n0 I
  49. #define DMA_PRINTK( x... )
    8 Y% i0 T% i) F" x! H# L- ?
  50. #define DMA_FN_IN' q0 s8 o- l, ?0 Y
  51. #define DMA_FN_OUT8 c! N  q% D9 k! y% |# A
  52. #endif
    + Y7 w1 ^. F  j3 L5 N) Q! r

  53. ; ?2 l, w" Y  c) p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). i( `, u# V9 X9 F$ T
  55. #define STATIC_SHIFT                3. ?3 n( ]8 s; W3 p9 a
  56. #define TCINTEN_SHIFT               20  X1 r) \# _% r6 _+ k9 H( d
  57. #define ITCINTEN_SHIFT              21
    , R4 c; E7 V9 k, y& U
  58. #define TCCHEN_SHIFT                22- W) ?" [& G( `7 c* B; @' v3 }
  59. #define ITCCHEN_SHIFT               23% r; g: F: [. {; b7 c8 k
  60. + S  ]3 R: l; P
  61. static volatile int irqraised1 = 0;
    ; y  l: A: I, h) I7 t
  62. static volatile int irqraised2 = 0;+ p; }3 ]" W4 \
  63. 4 s- _2 `, m" \% z, S; r" N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ H! Z1 e& d% n% X1 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 I2 X2 E' D' M6 v2 `4 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Q+ Z8 V4 n3 a7 ]& f4 i
  67. & ~2 z- f( O) \$ O" @: ^
  68. dma_addr_t dmaphyssrc1 = 0;4 X# U: [" [7 ?7 t* L
  69. dma_addr_t dmaphyssrc2 = 0;
    6 Q: b0 a6 U* ~+ I
  70. dma_addr_t dmaphysdest1 = 0;
    ; ~( @9 R7 H0 y7 x' D% V
  71. dma_addr_t dmaphysdest2 = 0;  V7 b" z* @; n4 Q  j

  72. % t! _0 d  T' a% C; p, o7 t
  73. char *dmabufsrc1 = NULL;
    2 V* h: j" r$ q% ]9 ~
  74. char *dmabufsrc2 = NULL;
    0 f* t5 H% `8 j( i1 |; {$ _. `4 s6 b! u
  75. char *dmabufdest1 = NULL;9 P/ l& T9 B, }: L) X! o
  76. char *dmabufdest2 = NULL;
    + C7 n/ v9 Y! M) ^

  77. : J) B* s# I; e& A3 h3 ]; z
  78. static int acnt = 512;
    / s! n8 K! r/ a# V2 A* l* s5 N
  79. static int bcnt = 8;5 `* K3 c7 {% b4 r
  80. static int ccnt = 8;
    2 B7 T; ]5 f3 D1 ?+ n
  81. 3 F# E% N+ {5 }& B9 K( _7 U
  82. module_param(acnt, int, S_IRUGO);" n1 u0 |$ x, M. L- {+ T' L+ D
  83. module_param(bcnt, int, S_IRUGO);( P5 }7 d) |9 a% X: C0 v! O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! k/ D2 P4 Z, d# g# e/ k$ k: y

7 Q0 w0 F# Q" t" H; @5 B0 O9 u& e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; v+ o  M3 V5 Karm-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 M4 D1 W! `2 G* u& a9 V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 v( t2 ~/ n. S. M, A, i: {
$ s9 P  {7 G* i. h$ ?! x8 k7 L+ }- O3 ]+ M  i6 w' S# W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 00:43 , Processed in 0.038276 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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