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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' x6 t1 H! U6 f) h( x. u1 r
  1. [code]EDMA sample test application  q) G7 p; U; {$ k8 _
  2. /*
    : x+ w8 h- v  y+ `9 n
  3. * edma_test.c2 C9 d+ Y' `: l
  4. *% p- e0 t- V1 |& n
  5. * brief  EDMA3 Test Application, s% N+ T) z' o+ I7 [+ |6 T4 V3 w+ n
  6. *
    8 |5 {7 x( t/ p" R9 b% e+ l
  7. *   This file contains EDMA3 Test code.
    : i) |3 q4 h4 `/ V. v# S# ^
  8. *# P6 a; n$ ^9 s) D% V) k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! n: A& |' ~+ N; x, t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  A# z2 y2 D0 T4 {
  11. *         TO CHANGE.
    * R, b, E8 Z' _* `2 X; @
  12. *
    & ?4 b( E8 }9 i1 @% `' o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" E* d& `& Q( {
  14. *& N; j8 }  e6 Z0 Z9 v
  15. * This program is free software; you can redistribute it and/or
    2 G* ~% T$ m& P
  16. * modify it under the terms of the GNU General Public License as
    ( Q. ~) m& t( A- s% E
  17. * published by the Free Software Foundation version 2.8 q& G$ f4 `  O" J
  18. *
    ; x9 F) h2 U  p* Z7 v, f) F' J3 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 r$ t% t8 O4 z4 ~- f; N2 \
  20. * kind, whether express or implied; without even the implied warranty7 i5 H$ e- _5 o) }, x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 E  m& j: e. q  ~7 G7 ]4 Q
  22. * GNU General Public License for more details.( ?' @+ U0 ^" T! r6 f  h2 m: s
  23. */. @) x3 f1 e7 n2 W% R0 B6 Y
  24. ; ]$ Q" ?3 h% b$ }0 h
  25. #include <linux/module.h>
    + w+ x  m( S8 |) p- W
  26. #include <linux/init.h>
    $ U) u3 b# ^$ E( G4 [9 r
  27. #include <linux/errno.h>
    * o+ F' ?$ S0 a5 s; N
  28. #include <linux/types.h>2 {2 ]9 k, I% I- V' z+ W
  29. #include <linux/interrupt.h>: X7 J- z& }& P& _/ }
  30. #include <asm/io.h>
    0 w5 Y( S8 D7 D$ [8 d8 G
  31. #include <linux/moduleparam.h>
    % D% ]! W( i, \
  32. #include <linux/sysctl.h>  S! d6 ?, l% A  m- o* T2 C
  33. #include <linux/mm.h>
    ; K5 X6 Q& u+ i9 j5 C( U, ^
  34. #include <linux/dma-mapping.h>
    / f% p' f5 z* m$ \+ I
  35. " A6 ^& z6 x* A" T. i
  36. #include <mach/memory.h>
    * R/ G# U0 C2 n2 C4 [1 D
  37. #include <mach/hardware.h>" ]0 ^. Y8 A/ I, {+ U
  38. #include <mach/irqs.h>
    * D# R4 b3 _7 F$ H* W: y+ O$ ?. A1 z
  39. #include <asm/hardware/edma.h>
    . @- u1 {/ d0 u

  40. " d, s& t/ I3 ^, [9 k& k. F
  41. #undef EDMA3_DEBUG0 G# l5 I$ L& D7 P# g/ u- K/ g
  42. /*#define EDMA3_DEBUG*/
    4 I9 l: v7 O# e( T

  43. ( M4 x+ R* `4 h& X
  44. #ifdef EDMA3_DEBUG
    ) o% h% Z) h% w. n( N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & T9 `6 Y$ |! K/ @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 d" M0 g& ?* ~; I7 z: H1 M/ P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) q" g1 G7 k% ?) W5 \, @$ w
  48. #else
    ' g7 U3 s/ R6 B& N1 {
  49. #define DMA_PRINTK( x... )
    ! `1 B& Q' O. N
  50. #define DMA_FN_IN
    9 h2 v) R2 {7 h! Q/ a3 W
  51. #define DMA_FN_OUT& Z2 ?- Q: S+ q
  52. #endif
    5 [: J# k% R( c) i7 z

  53. 7 ]% [+ |7 ?- _- @& L6 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      Y( i  `# g9 A: \6 V4 |, U
  55. #define STATIC_SHIFT                3
    * {$ u9 K) m5 {9 ~
  56. #define TCINTEN_SHIFT               20
    ! h% }. `& T/ \# v$ S
  57. #define ITCINTEN_SHIFT              217 {1 L0 E1 T0 o6 A2 g; z6 T
  58. #define TCCHEN_SHIFT                223 l2 U/ L7 c2 y: l$ \
  59. #define ITCCHEN_SHIFT               23
    3 v. |+ c' N  {% U; W' x6 v3 {! ?
  60. . W7 N2 J- \, [7 k/ k
  61. static volatile int irqraised1 = 0;
    $ w' n: D0 n7 P1 N' }9 b
  62. static volatile int irqraised2 = 0;- P- L% X& |6 x
  63. ! `* H5 K+ ~9 B+ ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 ~2 ]; T" O% N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ P8 ~2 \( s- g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 C  g0 h/ R2 `

  67. + d+ P7 `9 p+ C, w4 V. n! j% _' [
  68. dma_addr_t dmaphyssrc1 = 0;
    6 \/ |/ x, Z1 J3 W( o
  69. dma_addr_t dmaphyssrc2 = 0;! w: p$ r' ]& P; t, c$ S
  70. dma_addr_t dmaphysdest1 = 0;! T) ^( V# F0 ?) }8 k" a% d
  71. dma_addr_t dmaphysdest2 = 0;- A* ?7 y* A9 b% v$ A& O
  72. " y! _' k( T; G9 e' s; j: E
  73. char *dmabufsrc1 = NULL;
    . r5 p1 L! S. @4 G- h( v. G- s# e
  74. char *dmabufsrc2 = NULL;( Q& F. n, G3 F
  75. char *dmabufdest1 = NULL;; t2 J& \- V+ n  n  Z# Y
  76. char *dmabufdest2 = NULL;4 i& I( V7 W4 S8 {
  77. ' P7 ~& v8 V$ j# W  f6 p
  78. static int acnt = 512;
    7 {. v- B$ r# w3 z4 t
  79. static int bcnt = 8;+ W4 C: B& m) N
  80. static int ccnt = 8;, N/ J- J- z# _

  81. & {  t: c: R+ k9 Q1 a
  82. module_param(acnt, int, S_IRUGO);
    ) N+ e% R5 D- B7 c& q* m
  83. module_param(bcnt, int, S_IRUGO);7 ~2 A( `) C) p. [; Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 j( `  W4 ]! V
9 N3 [1 c# v. X# G. y" x9 {/ o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% D& E3 J( Q; D7 B: Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 v6 [- {! q8 D% }6 @  V9 ]( Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 V' s0 [8 Z# b- G. T/ N
5 F- q2 ]% @2 W: ]* H
. P. s# z9 ?" W8 G- L6 Q! m0 Q! Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 20:38 , Processed in 0.039926 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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