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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ]* q$ ~2 H9 ^% a* Q+ e# z7 `8 s' Y
  1. [code]EDMA sample test application
    & @2 e) c& e6 y2 U. C7 g% N
  2. /*
    ( s* o' t; d$ M# h0 W  F( V2 E
  3. * edma_test.c1 `7 v: i$ [3 O. C% y  u
  4. *
    & }+ p4 i2 k. R, d* k. W
  5. * brief  EDMA3 Test Application( d6 y8 N( r2 D5 F; [. C
  6. *
    , m: m9 u$ L# p# r
  7. *   This file contains EDMA3 Test code.
    $ o; G0 S8 R5 N. z5 J/ ^
  8. *; ^. ]2 I+ Y& V- A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; \# l1 g  T4 d7 u& Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# X4 v- u% Y) n: U2 r  F
  11. *         TO CHANGE.2 w5 X5 f0 n+ P: m% _
  12. *
    . |% S% Y  e' Q; r. o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : f* J  q+ f( S* C
  14. *
    , o0 l$ q( i( j6 d( u
  15. * This program is free software; you can redistribute it and/or! F8 |  d! R7 V! q+ F
  16. * modify it under the terms of the GNU General Public License as
    % P. @& f, W+ o4 r* v+ ^- D" e+ C
  17. * published by the Free Software Foundation version 2.
    + k& A9 O9 F# P% t# X/ o
  18. *
    + D" O) `4 S3 W/ u# Z4 b/ j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! L) F% x4 |7 v# w
  20. * kind, whether express or implied; without even the implied warranty( t9 P3 S$ Q$ Z' \* q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ K6 X0 `& R+ }! O
  22. * GNU General Public License for more details.  _/ |; y" `3 B+ Y
  23. */
    7 r2 S- v! R) f& O
  24. 1 v: X- @$ V+ @3 G. x2 g! |4 Y+ g% e
  25. #include <linux/module.h>
    2 `; W! V7 _& L1 O! A
  26. #include <linux/init.h>- W. _9 N$ y5 o* M- f6 J
  27. #include <linux/errno.h>3 ~$ x5 N6 J7 y( M
  28. #include <linux/types.h>
    2 ]( n# C) i' ^' S( Z' E
  29. #include <linux/interrupt.h>
    : p% G- A0 Z1 D0 m5 C+ F
  30. #include <asm/io.h>
    4 U( Y# B. H: r6 @9 c
  31. #include <linux/moduleparam.h>
    3 y% V- L/ w2 `) y+ @' r6 G
  32. #include <linux/sysctl.h>; O: k3 x, }4 s; K
  33. #include <linux/mm.h>/ b3 @; R6 V& w0 k+ i8 R. H
  34. #include <linux/dma-mapping.h>
    , [% b5 P9 c; d  \

  35. / N! s8 ]! m' |
  36. #include <mach/memory.h>
    ( J* q  ]$ H% K" V
  37. #include <mach/hardware.h>, b7 @: G3 o. A& P% e* o
  38. #include <mach/irqs.h>. P1 C$ l- [, A& G7 w" t% [  X
  39. #include <asm/hardware/edma.h>1 K5 f6 ]  I  e* q8 E: R

  40. 6 e  ?  o, B8 u
  41. #undef EDMA3_DEBUG
    - l- O' D: A7 A2 r4 W' J+ u% f
  42. /*#define EDMA3_DEBUG*/
    2 E! [7 R% [% r" V7 u  y
  43. * }) J% K" m$ V+ g8 @( ^2 T1 u
  44. #ifdef EDMA3_DEBUG5 Z7 X  ]) R) u- Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 Y; E! ^! s, H( M/ k- {: w6 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  U; i3 G0 I) c7 ^) J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % ]6 c4 M; i7 e  [4 F
  48. #else" n' o" |9 m* z- w) f/ M* `
  49. #define DMA_PRINTK( x... )% C* P8 m0 M/ K0 ]6 C: O
  50. #define DMA_FN_IN2 F1 }/ W8 v# i. a  B# B) _' J
  51. #define DMA_FN_OUT$ J6 g7 f$ v1 N) J
  52. #endif5 U8 d1 a$ B: n/ s4 t
  53. 9 D9 d) {, {& l5 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & x& _* V0 U6 R) m# I' w
  55. #define STATIC_SHIFT                39 H. H* e' D' [8 R: ?
  56. #define TCINTEN_SHIFT               20  D, f' V) X7 o- `9 i: [' Y
  57. #define ITCINTEN_SHIFT              21
    . K) S% M- w- i) ~. [
  58. #define TCCHEN_SHIFT                22
      _! A, i# d; B* s1 ]! }1 G
  59. #define ITCCHEN_SHIFT               23
    9 K  f  x& ?- J/ @5 G% L

  60. * B* p& b" |. ]" [( N* _
  61. static volatile int irqraised1 = 0;
    4 S4 f- d% i4 F# z2 Y5 J
  62. static volatile int irqraised2 = 0;
    & M/ i0 _9 R% p& ~4 t

  63. % n: E$ r( _( X% Z8 G5 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : @  W0 y* ?4 }) i: o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ v( t0 T9 I, G2 X/ U' ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( L$ }8 w% u* _# V4 W3 D
  67. 3 i! G- Y9 F3 J4 f2 B, ~
  68. dma_addr_t dmaphyssrc1 = 0;
    : @  M! v) T0 F0 t* W2 o  B
  69. dma_addr_t dmaphyssrc2 = 0;
    5 C* C- C) r" ^% O- C7 |
  70. dma_addr_t dmaphysdest1 = 0;
    9 q% A; y) {9 P* J' Q6 H& t
  71. dma_addr_t dmaphysdest2 = 0;! p* z4 a  L: t8 Y, b( t% l, \
  72. : k% v3 {  h# Y8 x% n
  73. char *dmabufsrc1 = NULL;  n. O6 P  ]  L! z
  74. char *dmabufsrc2 = NULL;# R# d' g2 A3 [- m
  75. char *dmabufdest1 = NULL;
    4 l& _2 }. X$ B$ d, O
  76. char *dmabufdest2 = NULL;6 o  _( X; S+ @0 W" b

  77. 8 H) b7 t6 J1 f: h+ L
  78. static int acnt = 512;
    & g: B( {# H4 k
  79. static int bcnt = 8;
      Z- J' K/ ~2 O$ \! w2 f" ~8 s: @) H
  80. static int ccnt = 8;3 a4 P+ I, s# ?+ j3 b% w" y
  81. : \) Z* @6 o9 i9 {& L# H: l
  82. module_param(acnt, int, S_IRUGO);4 e# M  C$ W. S: h! o7 J9 w
  83. module_param(bcnt, int, S_IRUGO);
    ; g$ a. p4 d; O% D3 g  \0 K9 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 i! N0 ?' q3 Z0 p. ^0 l4 G$ N) D1 G7 O0 d$ ?' a$ Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ `9 w$ m" ?2 X+ Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! i1 u7 @% p5 ~. Q2 Q. F8 x- R) B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 y* m, z( }1 h* F+ K$ n$ |

4 {" \/ X% H% H  l5 M
/ W4 n* Y; a4 [; A( w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 23:36 , Processed in 0.040940 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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