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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ L0 m0 }7 e  \0 F
  1. [code]EDMA sample test application4 _; V- i' H' Y% p; a" Y& V' |
  2. /*
    4 x7 T9 m3 ]4 s6 m! K& E
  3. * edma_test.c
    1 J0 U4 ]+ {6 c8 v
  4. *
    9 C. t- l5 S+ Y: H
  5. * brief  EDMA3 Test Application
    * `7 y' R7 \/ F% k. K% z1 b
  6. *
    7 X8 S+ d* x4 d4 @
  7. *   This file contains EDMA3 Test code.
    3 h- z, X  Y2 y( @, W. x
  8. */ S( v  ^( f' b8 y+ T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% m, [$ B, [' U- R3 B2 E& m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 `3 T) I" `; x0 \+ x& s$ ~: o+ I( P
  11. *         TO CHANGE.
    + Q- y1 [+ x' _& V- x
  12. *3 n9 V! ^/ j  t% K" ~4 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 i1 l! I' x5 |) i% F  ~
  14. *
    ' E. Z( |  [+ r5 R1 B
  15. * This program is free software; you can redistribute it and/or
    1 z7 M( `$ q* X8 ]$ K0 l: j
  16. * modify it under the terms of the GNU General Public License as
    1 u4 k, x( r- g* _  g# k* C! ~
  17. * published by the Free Software Foundation version 2.$ y2 y& _0 _. p3 V+ D2 r
  18. *
    & b# K! h5 F' U9 _# b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; E: S: Q2 D* m* C
  20. * kind, whether express or implied; without even the implied warranty: h$ n3 u% I( g9 q! \+ J4 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 h8 m/ S! P9 d2 x. l0 I
  22. * GNU General Public License for more details.9 p" \  n( v0 J  f% b- F/ a
  23. */
    0 ]7 D$ F; E8 g) D/ I: X5 w* X
  24. ' V  w$ J- r7 I1 m4 n: b
  25. #include <linux/module.h>3 i6 Y. ]* X3 l/ d
  26. #include <linux/init.h>
    , b; Y/ L( T% e1 U6 {1 f
  27. #include <linux/errno.h>' W$ c$ a! W6 i
  28. #include <linux/types.h>, \9 v; n- P; x% V+ U
  29. #include <linux/interrupt.h>; i+ {" S0 P' v6 i* F% A
  30. #include <asm/io.h>" I# E: H6 e7 Q
  31. #include <linux/moduleparam.h>
    , O8 b6 n$ Y1 \- n$ B1 \
  32. #include <linux/sysctl.h>3 B( {' C, d6 f* I5 }+ H3 A2 m- ~
  33. #include <linux/mm.h>
    2 b' r, R0 x" S$ \. ^( K
  34. #include <linux/dma-mapping.h>
    7 n( n8 j1 o4 i# M  }
  35. 3 f& Y8 k7 @  y' W: M7 }9 W
  36. #include <mach/memory.h>/ I8 a. u1 ?- |/ _, y( V. N+ {
  37. #include <mach/hardware.h>
      j! U9 ~* V9 b0 [5 e5 V: c" p9 i
  38. #include <mach/irqs.h>5 x1 g  v/ N- X, x8 [, z
  39. #include <asm/hardware/edma.h>
    9 t) a+ N. e+ H9 M+ Z6 R3 B
  40. 8 i5 r& r9 s. ^/ l2 S) ^
  41. #undef EDMA3_DEBUG
    / n8 p! K9 }) {1 H& k$ I
  42. /*#define EDMA3_DEBUG*/, ~3 i4 d" w* M) C% w: V, q6 B
  43.   k8 C+ X/ P3 R/ o, ~3 |
  44. #ifdef EDMA3_DEBUG8 j4 y8 F6 F1 z* ]+ @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " \$ ]  n* u' C1 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ U* [0 {9 E0 b0 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + s' r, I( L+ n8 ]( u' K
  48. #else+ T* C/ A& v' b4 x
  49. #define DMA_PRINTK( x... )
    % }' V# @6 d8 j- y6 r" Q9 }) C
  50. #define DMA_FN_IN7 {- g* Q- o/ f
  51. #define DMA_FN_OUT
    6 R) P+ X6 v  @+ A  Q
  52. #endif  ?5 M# {, e! _. E& m

  53. ' W! Y. }( f# V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( u- ^; f+ t; {- p
  55. #define STATIC_SHIFT                3# t3 D/ G; k3 X3 d2 E) {4 v+ r
  56. #define TCINTEN_SHIFT               20) c$ e' a6 @' D" \1 B7 J) I
  57. #define ITCINTEN_SHIFT              21* g- ]/ B3 h+ a3 Z& x) ?4 e$ t
  58. #define TCCHEN_SHIFT                22
    % I+ a1 ]4 T$ @! p4 b
  59. #define ITCCHEN_SHIFT               23" {2 s. b! i. e  p4 d5 i/ M+ z
  60. # T- i; Y$ c; s  M+ N, v1 x
  61. static volatile int irqraised1 = 0;
    " r& k4 A$ F$ i' S, y0 l% _* T% p
  62. static volatile int irqraised2 = 0;
    5 F! c: O* H  \

  63. $ G# D5 s2 l0 X. I: v, t; r3 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / J2 H' H1 v7 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% R3 ]. h: b- j5 X) T) g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' G1 J3 ?1 y8 E" G
  67. : c8 a' ]2 O  E
  68. dma_addr_t dmaphyssrc1 = 0;( @- {4 J  C/ {* E
  69. dma_addr_t dmaphyssrc2 = 0;- z' H5 a5 |- t, i8 g7 a5 P
  70. dma_addr_t dmaphysdest1 = 0;( ?# @7 [- G/ _; T7 o4 _, y
  71. dma_addr_t dmaphysdest2 = 0;
    # R' ?/ y; H3 u
  72. 0 w2 A6 e$ @1 G# R
  73. char *dmabufsrc1 = NULL;
    ! ~- X. Y' t  H) m
  74. char *dmabufsrc2 = NULL;- ^4 ~$ F( A: ~. k' B
  75. char *dmabufdest1 = NULL;
    - I* y$ ]+ F, u% z# M
  76. char *dmabufdest2 = NULL;7 q  M* u- |7 B- v6 i

  77. ' Z1 _, w: V0 ?( y3 X" _8 b
  78. static int acnt = 512;
    : ^4 D0 c- r( m: x2 w, p! S* }
  79. static int bcnt = 8;
    & i% ]7 o7 A/ U
  80. static int ccnt = 8;
    # g, u  R9 j/ a. m$ C
  81. % T6 v9 ?2 \' r& \
  82. module_param(acnt, int, S_IRUGO);
    0 D( z7 `. ?/ \& S! S* N
  83. module_param(bcnt, int, S_IRUGO);
    7 m2 ]; m6 X1 y# N1 v: @/ [8 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, f0 P- W1 N/ y9 y$ s+ _) u( c: V9 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ a$ w  K* a+ C  p2 z6 i+ garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ j. m. `# {9 [% l+ D9 c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ V" Y) J3 `/ a7 z' E" M
) i8 Y. C7 S9 N- @. G4 s6 |( z- Y  M9 M
9 F$ U! a9 N+ p, y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 12:19 , Processed in 0.044533 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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