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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - h' c: h5 Y0 C' h
  1. [code]EDMA sample test application  U7 h' o1 A1 o1 {! l' o
  2. /*! x( c" f. O4 c3 f& e/ B. @- j( _
  3. * edma_test.c
    " c# H# M/ b# a6 d2 U; O2 U3 ?
  4. *
    2 m9 V: r5 A" C* Y" M$ X
  5. * brief  EDMA3 Test Application
    / j0 l5 `- O) V5 G& S+ o
  6. *) i3 d6 i3 h2 P& N4 r, e; Y! f
  7. *   This file contains EDMA3 Test code.; ^9 ]# k0 T: |1 ~$ ]3 L7 N3 E
  8. *! z% E( W$ \4 t. \% C; U2 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ C1 K' g0 I1 s" r0 y* q" _' E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  \) P9 b- O7 y( @, n
  11. *         TO CHANGE.' u3 Z4 S9 o. U3 z
  12. *, w1 M% z* N6 E5 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# G/ Z( |$ a) l: D! D) E/ N
  14. *; B' r5 M1 }# c! Y, q
  15. * This program is free software; you can redistribute it and/or" o$ h  l: y. e
  16. * modify it under the terms of the GNU General Public License as
    1 B( _( o. z: f
  17. * published by the Free Software Foundation version 2.
    8 d6 m( m& F" d) W; L- b
  18. *  H2 p3 }* Z; C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! `* Y# ]; a2 |7 K* d
  20. * kind, whether express or implied; without even the implied warranty+ q( Z1 ~9 W0 L$ `# z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' p+ n% P( a8 p: t( a  |0 N
  22. * GNU General Public License for more details.
    - z4 I9 V. Z" F9 U
  23. */
    1 ]: G: [' O8 a* V  s5 }

  24. $ _( H, G; R4 s
  25. #include <linux/module.h>
    7 D, Y* t, R- Z. y0 x& {+ N
  26. #include <linux/init.h>
    1 G2 e$ G5 B+ K' k! F( C8 `
  27. #include <linux/errno.h>2 s6 j" e3 E' X: Q% q
  28. #include <linux/types.h>
    ' T1 P. U+ P" ]: p5 I% W% m! ?3 X8 i6 h2 `
  29. #include <linux/interrupt.h>
    6 z4 \  `7 d' `5 [
  30. #include <asm/io.h>
    - i  Y$ }$ P# X0 e9 I5 f
  31. #include <linux/moduleparam.h>0 |* ^5 G$ L: q0 O) O0 N
  32. #include <linux/sysctl.h>8 x( x  N; f; \4 k( k
  33. #include <linux/mm.h>
    ! k6 t8 f! S% k+ H+ z+ h. d
  34. #include <linux/dma-mapping.h>
    1 n( n  S8 r6 _) f2 [+ [/ D" G

  35. 2 j+ w" r/ G( Z
  36. #include <mach/memory.h>
    & I& ^! j) o6 H2 ^, b6 `3 R
  37. #include <mach/hardware.h>
    ' n( F1 W! l8 t& N8 e9 K3 [0 ^
  38. #include <mach/irqs.h>3 c( v' e* T: D4 h( G' ?; [
  39. #include <asm/hardware/edma.h>4 c8 n# F: H' a! J/ `6 \/ h

  40. 9 S( V- V  y' X+ m. S
  41. #undef EDMA3_DEBUG% V6 P) y% \8 H6 b9 O1 @. n2 @
  42. /*#define EDMA3_DEBUG*/  z& {( `5 V# p1 l5 C

  43. 7 a8 F" N) `8 I0 P
  44. #ifdef EDMA3_DEBUG! n; G# t6 F2 N+ W; N( u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % \  J5 P) F# Y) Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* F* ^" I, h  ?+ I  \6 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 h8 G" V8 t  L; o# ~" L2 P( S, e2 i
  48. #else
    0 ?% X: S( Y9 P4 {5 @; V' ^6 A+ Q
  49. #define DMA_PRINTK( x... )
    1 y( W1 ^- Z5 A, T% c2 f  T. {
  50. #define DMA_FN_IN$ j; f5 E) C4 f6 {$ A/ Z/ D6 {2 H
  51. #define DMA_FN_OUT: V5 i1 S5 ^4 Q* C
  52. #endif
    ) i" Q( f9 `# ?/ P& Y0 e

  53. & z! h  W, t6 C+ C# r6 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # P: E% u% [5 V' e) b
  55. #define STATIC_SHIFT                3
    , S9 J0 d' M: @/ J* X
  56. #define TCINTEN_SHIFT               20
      s  J  ?) M2 C, J
  57. #define ITCINTEN_SHIFT              218 M! Z, }3 R" c% F
  58. #define TCCHEN_SHIFT                22
    5 ~1 d- v# ~3 D/ O0 s4 j8 `3 i
  59. #define ITCCHEN_SHIFT               23. l( z4 S. w( G& J+ k
  60.   O  c. c$ |' @' ?
  61. static volatile int irqraised1 = 0;
    7 r* k6 }( u* p6 f( k
  62. static volatile int irqraised2 = 0;( h6 \2 s8 ]( v! n* a. ~

  63. / _6 P' q5 \. t0 D" _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 V* N, p5 v7 }. T0 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ?: _1 B* z6 z7 Q) H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" G( |" J" t3 ~& W4 W+ {. v* R
  67.   R5 ?% n: y/ K0 n( @, \, g9 f( r/ l% O
  68. dma_addr_t dmaphyssrc1 = 0;  J0 Y; q1 i- L* {. ~2 K$ E6 T5 Z# _' f
  69. dma_addr_t dmaphyssrc2 = 0;
    , x. Y2 M- c3 q- E) H2 @: }
  70. dma_addr_t dmaphysdest1 = 0;" i1 X/ L& W/ ?
  71. dma_addr_t dmaphysdest2 = 0;
    - t' |" x" }( p# F
  72. 6 q8 T- v% S7 v8 K  B. T
  73. char *dmabufsrc1 = NULL;$ Q. ]/ s, {0 ^" P- a
  74. char *dmabufsrc2 = NULL;
    7 {+ H( }/ Y' \- n3 o
  75. char *dmabufdest1 = NULL;% g( S; h+ N9 @% }# d; z
  76. char *dmabufdest2 = NULL;
    ) ~' X/ F6 a* @4 t7 p' V# b
  77.   t' F2 ^' K. M% f9 N/ o: o
  78. static int acnt = 512;
    . Q) c. d8 \8 x) R
  79. static int bcnt = 8;
    " u1 x- f& \6 f0 f8 v, v4 k1 M
  80. static int ccnt = 8;4 e$ l9 I! }' q+ e0 {% x
  81. + Q8 l; C9 N. \
  82. module_param(acnt, int, S_IRUGO);& q; K0 @" E( ]( Z/ [' M' B
  83. module_param(bcnt, int, S_IRUGO);( n" ~! N. z* M1 j5 q0 a. I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% Q+ N! P6 p4 O5 h
2 [! ^% u/ @( L, T5 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& S7 l3 Y9 q& narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! n9 h& p) W9 D4 C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! O8 P; s! u" h: \
. ?! O* H, O9 O0 g; r0 a8 R$ S$ _9 a- M0 Y& O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 04:14 , Processed in 0.041286 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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