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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 F6 f- w: u* A
  1. [code]EDMA sample test application8 n6 `: Y4 C( a! P% X1 U8 o
  2. /*: F& Z$ ~4 ~1 @" Q
  3. * edma_test.c3 d* j  {, d3 ~' A- X8 L
  4. *
    & [( V0 A; O" Y3 @5 O' k% j
  5. * brief  EDMA3 Test Application
      _% t4 f& ]+ f) @/ |# w, R
  6. *- g9 [! k" l5 P: L  |
  7. *   This file contains EDMA3 Test code.& Q* y7 |8 X& R6 A3 R# {
  8. *0 _7 N  T6 ?( E) w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ q8 R% h7 {& Q5 j7 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' Z! y6 d5 |8 A& v( w
  11. *         TO CHANGE." P1 L0 Q) Z* q3 Q; a4 U
  12. *$ n) u" |9 l3 C" a( r0 Z" r3 M/ v6 H) _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & @, l8 y4 |2 k) H& A- v
  14. *  h" r( |: r7 L) ~
  15. * This program is free software; you can redistribute it and/or
    6 T% E) O5 I& \& S
  16. * modify it under the terms of the GNU General Public License as( }! q+ |  ?! X& e$ Z6 Z$ S
  17. * published by the Free Software Foundation version 2.0 |+ V8 |. V5 Y: h/ y# l8 n5 O
  18. *% D  N6 I0 Y& {1 y1 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , X* k$ F- W7 X$ L: n. Y
  20. * kind, whether express or implied; without even the implied warranty$ ?+ ?# T! V% Z) g( `+ U- c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- Y6 Z6 j8 Y5 o$ @! @+ @3 [8 c
  22. * GNU General Public License for more details.- p1 ^, [/ }+ |" u
  23. */
    3 N" Q8 b8 J# N9 d/ Z$ ~
  24. . H6 k9 b/ w% X2 ?# o3 S, x
  25. #include <linux/module.h>1 o4 A. P* {: T' v
  26. #include <linux/init.h>8 V. |, a5 l1 Z& f) B: p
  27. #include <linux/errno.h>
    : j" @- O8 K5 J1 t: Q: {' E
  28. #include <linux/types.h>
    ) U8 z5 F( [, n- Q. A2 n' L
  29. #include <linux/interrupt.h>1 f5 c1 x; Y( s  `
  30. #include <asm/io.h>4 T. }+ n! L% f1 p/ H
  31. #include <linux/moduleparam.h># K* u. B% O* V" H' p( i6 b/ U6 q
  32. #include <linux/sysctl.h>$ q" S8 O4 @- K( s5 M" K
  33. #include <linux/mm.h>' D) G5 R" X0 T1 F5 r
  34. #include <linux/dma-mapping.h>
    3 W+ H+ X0 B. T) {6 y0 S& z

  35. 8 R' T& S4 x" g& T9 z/ w1 j8 l+ D
  36. #include <mach/memory.h>
    5 l9 v9 O0 x$ O% M$ p* r
  37. #include <mach/hardware.h>5 {, Y+ {9 L* m2 v
  38. #include <mach/irqs.h>
    ( H0 b& T" n- t1 i' d8 [! E
  39. #include <asm/hardware/edma.h>5 b* o; d1 W9 \' V

  40.   @/ c: M2 \) i
  41. #undef EDMA3_DEBUG
    : h: U/ |/ ^7 O8 O
  42. /*#define EDMA3_DEBUG*/
    , M' B5 q5 i2 A: K) J. y& [( n
  43. * o& ]" m" U6 y: ]% J6 {- R5 o
  44. #ifdef EDMA3_DEBUG; E( Y' K. `- e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 V3 H0 [# p$ e" ^2 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . ]8 c( r/ f$ w$ f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 W5 C) j6 n/ ^$ v2 f
  48. #else, c, T4 u) W3 f# W& s7 d4 d. F# k
  49. #define DMA_PRINTK( x... )
    2 s7 @0 l8 I  ?4 h
  50. #define DMA_FN_IN# `% T" ]: h6 O% a5 l
  51. #define DMA_FN_OUT' V3 m! g, c* @
  52. #endif# ?: `8 s8 D8 j
  53. 4 W0 ]  p/ g: N6 f' D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( ]4 ]& s, d" R! v+ `$ b- _2 @4 X9 |. D
  55. #define STATIC_SHIFT                3' n- Q# @1 \9 T1 e6 k; v
  56. #define TCINTEN_SHIFT               20/ {& E# ^- ~/ z8 I0 \! L4 Y
  57. #define ITCINTEN_SHIFT              217 |  H, c+ Z0 k8 ~$ l: q
  58. #define TCCHEN_SHIFT                22
    # `$ [/ C7 m8 A
  59. #define ITCCHEN_SHIFT               23
    9 s) J$ z/ z$ s5 y
  60. 8 q* y. j' f3 d; ~8 u# }
  61. static volatile int irqraised1 = 0;- a* a: \* o1 Q6 i" {
  62. static volatile int irqraised2 = 0;
    ) E7 ^( M% ]3 o. K  S" t& Q

  63.   |0 Q( R& ^/ ?0 d" b+ J' B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ }# n% k$ w0 C' @/ G$ b& J6 g5 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * ^3 @# B: l1 C$ t2 F2 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . v) w9 `1 O$ y7 I

  67. ' J4 |0 V0 B- j5 f9 ~, e5 G
  68. dma_addr_t dmaphyssrc1 = 0;$ O/ S# {) o7 f+ k7 ^8 q  E$ v
  69. dma_addr_t dmaphyssrc2 = 0;# n' V2 l8 O6 Z
  70. dma_addr_t dmaphysdest1 = 0;
    : \, T1 d! A5 O. Y# u) F6 }* S
  71. dma_addr_t dmaphysdest2 = 0;3 Y  B& J! m+ k, n; c

  72. 2 G: B: Y: Q* |' |3 r4 I5 I
  73. char *dmabufsrc1 = NULL;% u: D, E% R* W" z+ r! A( d' q
  74. char *dmabufsrc2 = NULL;
    + i% ^: n! F3 _' E1 Y* ^1 n# Z# V+ S
  75. char *dmabufdest1 = NULL;( T0 L4 Q" j( n
  76. char *dmabufdest2 = NULL;; D4 e" q* h! L% R' m+ |

  77. , R5 p  |8 W0 V0 l: |1 s
  78. static int acnt = 512;7 u. y) M5 ~  N  }/ H& U* g6 b- a
  79. static int bcnt = 8;
    1 F5 r' n- q. |, ~9 l& F
  80. static int ccnt = 8;5 F7 J/ R" V- r+ x

  81. # o( p! C; C8 s  d" o
  82. module_param(acnt, int, S_IRUGO);
    $ D2 A: R* ~% R
  83. module_param(bcnt, int, S_IRUGO);
    . N) p% I2 ]  c9 l6 |0 B6 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- r1 B* I) T7 t3 P) m: ^0 [5 ]

, R& Q6 P( T: |( ~0 B1 k( t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; y3 ~8 n$ y. V* E9 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( u/ d/ q8 @5 N2 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 H2 p! N' J* S/ A( j; K9 J
" F; F$ x. F8 X) N5 i1 w

6 y, U8 b: b8 |: N: H" O& P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-8 07:58 , Processed in 0.036729 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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