OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( V: Z& w9 G! B% L/ ?3 D3 }6 |2 }
  1. [code]EDMA sample test application- p5 |( E* ^: v; a* \$ v( |* X3 E
  2. /*
    * P0 P; d% z& M( Q2 r
  3. * edma_test.c
    " s/ |$ @/ b  Y4 N8 X8 F  I0 F+ i
  4. *# ^) p7 K  D+ \
  5. * brief  EDMA3 Test Application+ p) P  g5 X# d. o5 V
  6. *& r! L* x% ^# o
  7. *   This file contains EDMA3 Test code.& ?. X) B% l+ ^9 Y  a9 d0 O7 k" j8 I
  8. *
    0 H1 K  @4 C0 U2 d( M& t* o% h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 t* n2 P7 Y; H3 y* I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * `1 [& _/ M. r. D# b& l6 |9 m; S
  11. *         TO CHANGE.- R9 ^# J* Q. Z; q( |' r
  12. *+ o' w/ a+ `( o' r2 R1 J9 P9 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 H$ ]+ |* h6 H# P0 ~8 q5 M+ n+ ~2 l
  14. *- u6 _5 T8 b& K+ }- Z+ H6 a! D) }9 g) \
  15. * This program is free software; you can redistribute it and/or! L# e& ]& s; i; w
  16. * modify it under the terms of the GNU General Public License as+ {3 n5 x4 u( |: k
  17. * published by the Free Software Foundation version 2.2 S/ a! Z4 c- y7 ^* S; j" p
  18. *
    6 b2 q1 H. C+ u; E$ P" s5 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ E5 `' J9 Q; z+ D
  20. * kind, whether express or implied; without even the implied warranty( f7 A; o/ T  E) V8 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, q: j, F2 p* Z. w
  22. * GNU General Public License for more details.
    $ ~6 v* h5 a' r" L9 P, O8 K
  23. */5 J) t, U/ H0 a, ~' @0 a1 w' T& c

  24. 7 s5 H0 p' a! N. o$ D0 v; h6 H
  25. #include <linux/module.h>5 |0 p: X/ I# K3 p  D! K7 i
  26. #include <linux/init.h>; ]. P. ]/ z) a( o
  27. #include <linux/errno.h>9 Q' ~1 D' Q2 H7 G& z
  28. #include <linux/types.h>
    $ {  w! g; ^& h" b) r
  29. #include <linux/interrupt.h>1 U6 k( y" X4 X) q7 @1 l$ h# e
  30. #include <asm/io.h>
    & f5 J+ a. v; |3 d
  31. #include <linux/moduleparam.h>
    & g" i- }7 ]) u1 o6 P
  32. #include <linux/sysctl.h>
    7 y& l, \6 s% e1 _
  33. #include <linux/mm.h>
    / V1 `9 [( {! U8 E3 e! J% v
  34. #include <linux/dma-mapping.h>
    : S9 N$ x2 m2 i( `4 N
  35. 2 `. Q4 V- T( K$ ^
  36. #include <mach/memory.h>: Y3 ^( z: [8 S; Z2 ]8 r+ B
  37. #include <mach/hardware.h>
    - H" F) Z4 Y& Y. U* X
  38. #include <mach/irqs.h>
    # B' R' i1 e! ?5 o( X
  39. #include <asm/hardware/edma.h>
    9 K# p& ~7 X8 ]) B
  40. * e$ x) \  M; N! N" L. m
  41. #undef EDMA3_DEBUG- y9 H% u# t4 w8 s1 p  T. l; W% r
  42. /*#define EDMA3_DEBUG*/
    2 ?( c+ R' k, E  t' v1 m/ j

  43. ! N9 |" V1 t8 p+ M% _8 ?# K
  44. #ifdef EDMA3_DEBUG, D7 h& Q5 Z) O4 N' s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): s: G  d9 t( B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- }) B( s1 ^$ t3 W6 a4 n( o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); S! @9 l; v9 w% a2 c9 y
  48. #else
    7 K, p; ^' y5 x: {$ O% R+ A  t
  49. #define DMA_PRINTK( x... )
    ( Y1 t& L# P! h( Q& ~. o1 N8 `
  50. #define DMA_FN_IN
    2 `" l6 a$ v' e
  51. #define DMA_FN_OUT( h- e9 _5 ]" @
  52. #endif; I# R% A: e8 p# F0 k6 w4 Z
  53. 1 ?6 s7 Z  E8 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 d! y* N" Q2 ~4 F/ C6 `) X8 E
  55. #define STATIC_SHIFT                3- o* |3 e, f( V$ K* [9 l) f' ~
  56. #define TCINTEN_SHIFT               209 H/ e! F. {3 G
  57. #define ITCINTEN_SHIFT              214 D/ w0 ]( t+ c8 j- J" W4 E! h. S) n
  58. #define TCCHEN_SHIFT                22
    0 L  y8 F, T1 k. B! J& p
  59. #define ITCCHEN_SHIFT               23! X3 I" Z6 }. ~1 E
  60. 8 U3 @9 Y$ `" u; g
  61. static volatile int irqraised1 = 0;
    ( v: a$ [/ [9 V
  62. static volatile int irqraised2 = 0;
    % L2 ~  ?4 a% x! o/ Q
  63. $ S* b3 c& F7 E9 x+ x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 y8 q7 g* e# S( a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : [" F" o$ G* X# b: j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' S) M+ m8 N/ ~) \+ P# l9 w! P" H

  67. " M2 ^& U  ^7 O1 ^  a; F' a
  68. dma_addr_t dmaphyssrc1 = 0;+ f! M5 @$ W& p5 B2 W0 T
  69. dma_addr_t dmaphyssrc2 = 0;
    # v6 r1 Z5 W; M* I  I
  70. dma_addr_t dmaphysdest1 = 0;
    & X4 o6 p  A) s- o8 J( X& R  f
  71. dma_addr_t dmaphysdest2 = 0;! D; A0 i  j1 I9 U: {# X  I

  72. 0 i4 Q! P2 k; S* c+ C
  73. char *dmabufsrc1 = NULL;
    $ y- Q1 v. Q* p7 V1 L) c1 D
  74. char *dmabufsrc2 = NULL;! M# z8 D9 V6 g1 O0 h5 O
  75. char *dmabufdest1 = NULL;
    5 ~; M. T: r* X8 d5 T1 `! S
  76. char *dmabufdest2 = NULL;
    ' D& b1 p6 z5 d8 c

  77. 7 n* ]- M. ~1 K( o6 ~
  78. static int acnt = 512;
    5 u" Q( D) c! m" |# T
  79. static int bcnt = 8;
    ! p1 u) C+ H8 _  r- J
  80. static int ccnt = 8;5 g, g$ y7 J& U) s9 N& q0 L

  81. 4 K6 Z" V: ?' \2 V6 \0 c. g- r5 u. x% ?
  82. module_param(acnt, int, S_IRUGO);
    . }! k( l7 y- {6 L
  83. module_param(bcnt, int, S_IRUGO);
    , G0 O3 @" p9 d. }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- y' B  s7 W, y) `6 [5 H
* m4 t. B2 |, s! z+ x+ Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 M$ `) e4 i, b- k2 D1 t+ |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ H# {& f) k8 {& v& M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: P" J8 k: u7 S% i3 l  J2 t$ N1 E2 e* Q

' }4 y% @. _( w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 03:06 , Processed in 0.037418 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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