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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: e2 D! ]% c7 F, \4 x9 r. R
  1. [code]EDMA sample test application! y% p1 l0 ]% j3 y% z* }/ P
  2. /*+ K" V. c& t% }. c6 l# {# e6 G2 i
  3. * edma_test.c/ g2 r! s2 K  z. I3 u
  4. *
    : a- k9 _) t/ o* O, S; a. e1 `
  5. * brief  EDMA3 Test Application
    : @7 d3 G7 n2 T8 ~+ a& b
  6. *
    / \: x1 u! j6 C. Z/ R* D' k
  7. *   This file contains EDMA3 Test code.
    . s/ W6 E* [$ h/ c8 h+ C4 A4 V
  8. *
    % x& H: e7 h, }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 D2 j2 r% G/ X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 ^* f. a% \& l* ]; K1 Z$ J
  11. *         TO CHANGE.! X2 k9 g' h; |- w* i% q( p
  12. *; d( i' Y3 [& i! _' W( }+ G8 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + }  B9 J; s" t7 \
  14. *
    2 t% T+ J9 R5 w  _# P7 \5 N
  15. * This program is free software; you can redistribute it and/or6 j5 Y9 ^9 a, _* L) ?9 z
  16. * modify it under the terms of the GNU General Public License as
    5 J, r1 u* W1 G  u) p& B/ G
  17. * published by the Free Software Foundation version 2.
    8 J( y* }# |: ]% C& j- L
  18. *
    ; M) F. v; [% M; S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' f5 V1 u& a& J. _% x: P
  20. * kind, whether express or implied; without even the implied warranty
    6 ^$ Z8 r/ B7 J7 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # ~6 |- d9 L. {" Z6 h& V' c
  22. * GNU General Public License for more details.8 F) X) V- S" z; ~: L0 T2 Z: i: U
  23. */
    - [: a2 R$ g' _' D
  24. * I% n* u4 [4 @; r8 ]( f2 d
  25. #include <linux/module.h>
    " }; }" x6 a4 t2 N4 _
  26. #include <linux/init.h>0 ]/ s; R7 A& r# G8 `. Y2 `: g
  27. #include <linux/errno.h>+ w3 n0 Y# R% a$ w
  28. #include <linux/types.h>
    ) o4 E8 Z' {8 f2 y$ t9 v
  29. #include <linux/interrupt.h>
    + a# I# d0 t2 P2 w* F: a
  30. #include <asm/io.h>
    ) H- [0 R# z0 p$ z: X' g  ?
  31. #include <linux/moduleparam.h>
    ! x0 x2 `0 [9 J  A, D! K( F
  32. #include <linux/sysctl.h>! U: E9 h, A  R; v/ k+ m' a
  33. #include <linux/mm.h>
    ) D7 G& K1 J! |& L8 J: b  C6 ^
  34. #include <linux/dma-mapping.h>
    0 f" y% k( ~) |$ N$ u% b$ B$ a1 Z
  35. ) f6 k  n/ \' v& L' K! R6 y: f* X
  36. #include <mach/memory.h>0 d! y- t4 v' c7 [8 K
  37. #include <mach/hardware.h>
    / b/ b: L2 t. A4 t. E2 ?& n
  38. #include <mach/irqs.h>
    4 ~/ J2 ]( Q# J" Y3 J* n6 s
  39. #include <asm/hardware/edma.h>/ I$ Z* B6 x& U/ ~8 v  I

  40. ; [( V. N1 j  t6 \: \
  41. #undef EDMA3_DEBUG7 ?8 P  T1 Y. H. Q& e* [' K
  42. /*#define EDMA3_DEBUG*/
    % ~  I5 w# L7 W& d! E

  43. - y/ C: I+ p, A- k' R; h
  44. #ifdef EDMA3_DEBUG% G; e4 F" g2 i$ v9 D# _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# ]4 S8 U( k; M2 B$ @% }, \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ y9 M+ U$ P: V8 A" v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' L* C, t3 [0 a4 v9 E
  48. #else7 p! q# w0 y0 c, P/ e0 @8 f
  49. #define DMA_PRINTK( x... )
    ; u, Z/ k2 P) x! x4 k
  50. #define DMA_FN_IN% r+ a3 a" H& V. a4 s4 @
  51. #define DMA_FN_OUT
    0 J2 `/ e8 R9 r  F; ^% M" c; |
  52. #endif+ W# a1 P6 U& b% i4 Y
  53. 4 R/ y2 q! `* n* n- a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ J  e/ O; s! {6 x4 t2 l" ^1 n
  55. #define STATIC_SHIFT                3) j9 ]3 o+ ~/ z. X8 _( P
  56. #define TCINTEN_SHIFT               20- n/ [9 A) f, }* u1 s9 T
  57. #define ITCINTEN_SHIFT              21: f# V3 ]' D* [  G; q/ ?
  58. #define TCCHEN_SHIFT                22
    4 t/ j) F/ W$ D( P3 g; f0 ]+ a
  59. #define ITCCHEN_SHIFT               23: P  Q: L( g5 n7 }8 M* I
  60.   @( N* P% M/ l  y4 |% ]
  61. static volatile int irqraised1 = 0;
    6 m' G% J+ A8 h# z
  62. static volatile int irqraised2 = 0;! k* f7 {4 W  Y, J8 u1 K

  63. . u  e$ d+ }$ t1 D& H8 l* w, d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) d! D) n' ~7 L4 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & }1 }! [1 R7 ]* g. `4 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 p7 l2 n% X+ ~  U) g" _8 B# p' m1 `

  67. ' s% L( ~9 K  J; L# B
  68. dma_addr_t dmaphyssrc1 = 0;0 a: K' R- X+ B: m5 P
  69. dma_addr_t dmaphyssrc2 = 0;+ @6 s* t9 p8 _+ B- j6 w6 i
  70. dma_addr_t dmaphysdest1 = 0;7 V& H6 c- l( C; g
  71. dma_addr_t dmaphysdest2 = 0;- k5 {! O% E7 G. O7 g7 Y7 }1 \
  72. 3 o8 Z; E. `, @- W0 t
  73. char *dmabufsrc1 = NULL;. J. v% _3 i. Z1 [
  74. char *dmabufsrc2 = NULL;5 ^! Y' D' x1 I) Y" c& X+ W7 {
  75. char *dmabufdest1 = NULL;
    ) f+ h; t3 Y$ z" Y3 k. B
  76. char *dmabufdest2 = NULL;6 O& P& i- L) P# E# T6 u/ H. h% g

  77. 4 `+ l  j2 H' E3 _% E
  78. static int acnt = 512;
    9 J# U2 `$ H2 K9 H4 x& N. ]
  79. static int bcnt = 8;6 x: y4 D/ K9 i3 u* ?+ G
  80. static int ccnt = 8;
    2 S% |  h! v/ Q" X4 e
  81. ' V3 m* p/ B$ a3 [; ?5 h4 e% F% g* q; r
  82. module_param(acnt, int, S_IRUGO);
    ! p0 S) C, _5 b) U! h2 d
  83. module_param(bcnt, int, S_IRUGO);( Z& N+ X2 l- R  d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ i) `% Z( ]6 ~) E' p* t

1 V9 ]: y! x3 u, m5 i% {6 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. t) Y' S$ c: m# x; Z9 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 S% m6 B/ U. a* ?' f8 D6 r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 y* {, {8 i1 _- M& |: h4 O
( e. q1 w# x( z1 Q3 s: M3 o0 S# i2 i0 w* C, I: M: \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 16:18 , Processed in 0.038941 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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