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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * [& M, d; E$ R" ^% L' g. k' k% @- v
  1. [code]EDMA sample test application0 |& K/ |0 h) `9 J* r! r2 N
  2. /*4 A, g. c( P' m7 r( v8 h
  3. * edma_test.c) K2 Q9 ]% L( d( z& d4 d* R
  4. *
    ( ^9 m: C- c3 k5 U9 s
  5. * brief  EDMA3 Test Application  S1 \; O/ u8 A( G3 Q; R# b; }5 b
  6. *$ d7 x! Z5 I1 a# U& h8 @
  7. *   This file contains EDMA3 Test code.% \/ j( K4 Z, q8 v" x" y( m& U$ ~
  8. *
    1 u" e9 R! m* k' S. h( G# B  D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 \+ n' D& @5 i7 D/ y% ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ H" _) {8 Z& |
  11. *         TO CHANGE.) i+ _5 @" M# L
  12. *
    + N$ [; o$ R' S& k& l% G" E* {6 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) @% F5 K. u/ A  y- ?9 \
  14. *
    . P7 M$ b, _+ }4 P) I, p
  15. * This program is free software; you can redistribute it and/or
    ' p! w0 G9 p3 y. p6 q9 ]9 o5 |
  16. * modify it under the terms of the GNU General Public License as  G) _; R3 W1 \1 t. ^# J
  17. * published by the Free Software Foundation version 2.) X6 O0 H! k  P) Q! [9 W
  18. *& U4 g4 `$ t- |6 ^7 N8 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 O5 o$ V/ y  p4 P& n% }% d3 p0 @
  20. * kind, whether express or implied; without even the implied warranty
    ; e* L4 j( y* |, [1 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ N, S. ~* H5 c
  22. * GNU General Public License for more details.
    . i5 T" K/ b1 }; P* _0 g
  23. */+ Q" s5 t* ]3 T% M% O  F
  24. 2 b6 v! ]2 H5 Z. _( ~
  25. #include <linux/module.h>
    $ D7 u. _) J3 ^$ m% b+ S
  26. #include <linux/init.h>
    # w0 H: ~1 `7 ~; C9 {) m4 U* R4 \
  27. #include <linux/errno.h>: K( R; p0 c5 R
  28. #include <linux/types.h>
    8 g6 b* U0 I5 z; `$ J
  29. #include <linux/interrupt.h>
    - o2 Q; h( V& N0 H- c1 D- T
  30. #include <asm/io.h>; Q" F0 j3 A3 }  l7 `7 L  n
  31. #include <linux/moduleparam.h>* ]% }  D7 q. r$ M
  32. #include <linux/sysctl.h>
    ! j( N' w" N  q  @" F) s1 h
  33. #include <linux/mm.h>
    - L  A% o+ `5 t; _  o% X
  34. #include <linux/dma-mapping.h>
    & u4 z* M$ q" N# M  n) f7 U7 J4 E0 v. d

  35. + T$ j% A- k8 A  f& ]: s
  36. #include <mach/memory.h>! U. b/ e. z+ ~# n+ e- e* e- @
  37. #include <mach/hardware.h>
    9 @( ?, ^0 a" _# B5 ~7 k
  38. #include <mach/irqs.h>; @, Z; M" s) m2 A4 E
  39. #include <asm/hardware/edma.h>
    ) r- l' M% X/ i/ f3 u

  40. + l  F! f7 I% p; i8 l) m$ Y
  41. #undef EDMA3_DEBUG/ I% [9 o  z. `4 R- K* B
  42. /*#define EDMA3_DEBUG*/
    5 j5 @- h$ U, |2 q
  43. 1 h" ?7 p: ~4 W% z6 O* H. d
  44. #ifdef EDMA3_DEBUG
    % F$ g& _% p; G! J9 i" c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - {7 V+ j# V8 I0 v" t  ?# _" K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& ^9 [: ]3 {- _- Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ {" ~0 [7 y/ H6 ?9 ^5 r
  48. #else' s. [  l, R! J3 D9 S
  49. #define DMA_PRINTK( x... )
    : W. Q8 n, B" W- i9 t) ~
  50. #define DMA_FN_IN
    & p3 j8 D2 q+ y3 Z
  51. #define DMA_FN_OUT) \1 w, @" s" n
  52. #endif5 B% b2 l7 ]8 s: g3 q! `. V' q

  53. : u3 l+ c( l7 l0 X) a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . C" M! W/ J# t, |
  55. #define STATIC_SHIFT                3
    6 T& ]( _- f9 k+ q! H2 ?' y
  56. #define TCINTEN_SHIFT               205 l% O9 V, J- T6 L9 G8 Q6 z
  57. #define ITCINTEN_SHIFT              21
    8 h. s1 `7 m$ O+ k4 ]( v4 Z
  58. #define TCCHEN_SHIFT                22
    * S: \) U( V/ R/ C2 B+ O
  59. #define ITCCHEN_SHIFT               23
    / y/ {5 }4 c3 ?' Y0 H' ^0 W7 A

  60. / F8 e! R  v. {, L
  61. static volatile int irqraised1 = 0;
    & P$ h' n# b+ `. z* ?& r
  62. static volatile int irqraised2 = 0;
    ! k6 D% c8 F- X- l: G3 |5 m
  63. 7 [0 x, I8 M9 J- {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 P3 Z. ~* V5 ]" y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : O3 P2 X' P2 K3 ]9 q5 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; M+ N/ U+ V6 c% f4 E5 [
  67. / G* o! L9 A7 _' w6 i
  68. dma_addr_t dmaphyssrc1 = 0;
    ( n5 [0 ?7 p8 }6 N7 J7 \+ l9 n
  69. dma_addr_t dmaphyssrc2 = 0;
    5 ?* ~7 v0 k* t+ n5 E0 e
  70. dma_addr_t dmaphysdest1 = 0;
    ' _/ T& S& _$ {+ }  h* E; f
  71. dma_addr_t dmaphysdest2 = 0;% U! e: ^' J5 V% A4 V; H6 ~+ f5 Z

  72. $ h, S0 \  n( D* Z' _4 D, \
  73. char *dmabufsrc1 = NULL;
    0 `0 ~) A+ `' ]. D2 Y
  74. char *dmabufsrc2 = NULL;7 b9 Z1 j- W" O3 @7 X6 q
  75. char *dmabufdest1 = NULL;
    ) `8 H0 e0 w& S) J7 `4 w1 c- j# K
  76. char *dmabufdest2 = NULL;
    ; _- O' W/ J5 ~

  77. 6 {, Z* ^9 h7 `+ X- B- n
  78. static int acnt = 512;
    1 E2 Z% ~1 Z9 L
  79. static int bcnt = 8;
    7 Y, H5 i9 l: h1 d% K0 E- N
  80. static int ccnt = 8;) a# K( u( e0 x9 d/ G- Y! h
  81. ; t7 x' v! _7 M. {; ]0 e0 V
  82. module_param(acnt, int, S_IRUGO);
    9 J: e+ X+ P& O+ @9 P: x9 U
  83. module_param(bcnt, int, S_IRUGO);# R. s9 V- n2 _# U- V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; c' o' T0 z% P' M1 \0 u4 f  r# W
+ J) }, Q% u4 u( g1 C1 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 {" j0 X% i$ {* R2 O, a1 a7 c9 H( R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 N  {- q% z, F5 c( ~9 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" X- |' p) j, }) }- z( Q% Z4 n
7 i) V4 z8 b8 k. o/ Q
" J. W0 p& n5 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 10:53 , Processed in 0.039503 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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