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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. L; @- j6 d- N% Q1 ?' k7 T
  1. [code]EDMA sample test application
    4 Q  E/ q: ?5 j5 I, Z" ]) K
  2. /*
    ' c; |) t; l& H( L
  3. * edma_test.c8 v/ s# n- x9 v5 J( R  A; @0 c( R
  4. *6 p" S; w0 }/ \
  5. * brief  EDMA3 Test Application; ~6 O2 m: |. p' u$ a1 _
  6. *
    3 z# h. }1 a( x% t
  7. *   This file contains EDMA3 Test code.
    " F' c& V* Q3 L0 l, s( j) `( j
  8. *
    0 c+ L9 X* G. x& {; h, \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * K% I% {7 z8 t" W  i  W; F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & ?& [1 B& K6 s+ {9 [
  11. *         TO CHANGE.
    " S7 B6 v) K1 m8 v$ _- g8 E7 G
  12. *
    : q! z2 l) k) z( ~$ c  N4 a% b& k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ U+ w' ]' y9 j) R
  14. *
      Z$ |! L* V1 K! R8 @
  15. * This program is free software; you can redistribute it and/or1 a8 M0 h( r8 I
  16. * modify it under the terms of the GNU General Public License as
    , A" o' k) x2 ?1 U- @
  17. * published by the Free Software Foundation version 2.
    + P& c$ {# Y. k: k7 q3 N! I
  18. *
    ) t8 h! ?- X1 \1 [1 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 n$ i7 _) \5 D  C
  20. * kind, whether express or implied; without even the implied warranty
    % n% [* \! K; b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: ]5 Y3 Y# d. q
  22. * GNU General Public License for more details.3 x" ?' g2 H. I: }5 x
  23. */
    # t! u. g! O, E4 ^. N

  24. ( P! m% W$ e$ B( Q
  25. #include <linux/module.h>
    4 |# G. ?% Y# V  T/ G  L
  26. #include <linux/init.h>
    % s3 W: a# A% |( A+ _1 n
  27. #include <linux/errno.h>: n7 F6 J, y$ F. A
  28. #include <linux/types.h>
    4 N; R' r8 b1 R% V% l. J6 q
  29. #include <linux/interrupt.h>5 L! v6 X9 U) H2 @. \( v& m
  30. #include <asm/io.h>1 d1 G: S$ ?/ S& v! A/ T
  31. #include <linux/moduleparam.h>: D& D- {0 U! f# L! E9 h' l4 ~, |
  32. #include <linux/sysctl.h>2 d( v# M/ j3 q5 P- R% p
  33. #include <linux/mm.h>
    4 W3 q- S# t) U. W0 _
  34. #include <linux/dma-mapping.h>; H1 M* Y& V) f" k# j

  35. ) _$ E& ^9 r$ l' @( w# v
  36. #include <mach/memory.h>' p6 h& w' y2 N4 f4 z+ I' Y5 F5 V! _
  37. #include <mach/hardware.h>
    ) h! j+ d8 V1 |" w0 G8 ]
  38. #include <mach/irqs.h>
    , H0 @* |* w3 W, |* p! l+ m& g+ [
  39. #include <asm/hardware/edma.h>
    - m9 ~7 S" c8 K" [

  40. 2 x+ L! r: E; B% i& E0 E1 L1 ]
  41. #undef EDMA3_DEBUG
    " L% M1 a  y, L, }
  42. /*#define EDMA3_DEBUG*/
    % z9 D4 W0 [/ M* |0 T
  43. + J! G2 b3 A0 x; ?: ?5 N- L
  44. #ifdef EDMA3_DEBUG
    ! z' ^, W% ^/ q! [" u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! W  G4 e* r9 ]6 q$ }. P( l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 Q" Z+ @6 z  R4 c6 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# b0 ~& k( D3 \2 A
  48. #else3 {3 y9 U( o3 n7 q! r7 r
  49. #define DMA_PRINTK( x... )! X0 ^) V! ]' R' n1 f) C
  50. #define DMA_FN_IN3 ]7 j9 v! I) z% Q
  51. #define DMA_FN_OUT! K" H" x- |: B0 ~/ d* C6 M
  52. #endif9 n5 H4 k; G5 d0 R9 y
  53. # l- s( c7 j! o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 m" f8 z3 @. h3 \: y9 a
  55. #define STATIC_SHIFT                3
    - V2 Y) s2 W( Q, @9 \" X
  56. #define TCINTEN_SHIFT               20
    % z3 i2 g' j+ i8 T; C; o; J
  57. #define ITCINTEN_SHIFT              21
    ' c6 S$ w0 x4 Q
  58. #define TCCHEN_SHIFT                22# i3 H1 K! q4 a; ^
  59. #define ITCCHEN_SHIFT               23
    - a' a8 P" [  R  b! I* R" q

  60. 6 @, O7 {$ M1 M- A
  61. static volatile int irqraised1 = 0;0 N' s5 j" ]2 U
  62. static volatile int irqraised2 = 0;' @8 b! R& P; C0 Q" g8 O

  63. " q( n0 e- B' T  p) L# P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 N1 {' p5 K5 \0 p# O; t2 C6 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' c. Q8 Z3 v' M! C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : |  o; F: x" o6 _/ E6 R4 `9 S

  67. " y% {9 |) M; J4 l/ t# o- n
  68. dma_addr_t dmaphyssrc1 = 0;
    ) f9 [! `% `( J) r- W7 u) U) c. X
  69. dma_addr_t dmaphyssrc2 = 0;
    1 w% z+ ^4 D3 @3 P
  70. dma_addr_t dmaphysdest1 = 0;+ x* I- g3 q: d5 @' X
  71. dma_addr_t dmaphysdest2 = 0;% o" ~6 q; b$ ?! D
  72. * M5 r* f2 W/ @9 V6 K$ R+ P
  73. char *dmabufsrc1 = NULL;& ?- a2 R, Q; j$ t  x; C
  74. char *dmabufsrc2 = NULL;2 l/ O$ j! ^: `: Y
  75. char *dmabufdest1 = NULL;
      Y3 }" M$ _8 P2 R
  76. char *dmabufdest2 = NULL;
    + O: B# {" M( e7 z  j; l  c

  77. - d, w" C$ g" a6 I! h
  78. static int acnt = 512;6 Y$ a  E7 T2 m& l/ a& o" G* y0 a
  79. static int bcnt = 8;9 }2 R" p3 g- q/ u
  80. static int ccnt = 8;( _9 E3 a& A2 |

  81. 1 Y' {+ i6 A! q; u3 y3 g* C* M. N
  82. module_param(acnt, int, S_IRUGO);
    - N. a7 l4 K% u# }" G% x- Y
  83. module_param(bcnt, int, S_IRUGO);
    , V4 d6 m3 M. z! }- S% G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* _7 b% F$ z4 O3 z( Z0 k! I, S
# i( S6 `" ?; j# T0 D# I* I; w- ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' f7 b% ?. M2 g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' ~. i; N$ s4 J  X$ x, B4 h5 O, j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" q; @1 N2 e+ L' h/ |7 t, X9 j

) T! B' I* Z7 {/ |3 k) R
: p3 q' L& T) Y/ V6 C, t! W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 07:52 , Processed in 0.035922 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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