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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   K1 `) Z8 l% Z/ d4 T- H; v
  1. [code]EDMA sample test application$ P" J( \# i" r! U9 o
  2. /*
    0 _/ L. x9 Y* ^( X. W5 }
  3. * edma_test.c, `( ]$ Z* n: V5 X% \
  4. *
    / y9 ]# B& |- Q& D
  5. * brief  EDMA3 Test Application
    % m5 D. I' u* U) c2 H6 p5 A
  6. *
    6 M$ x- [7 ^- q. {  [
  7. *   This file contains EDMA3 Test code.
    $ f1 Z1 b9 b! k% D3 s
  8. *) O. v3 k- z8 e/ X, M, ~. T( p6 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 U( v+ I' E9 t) T* [- I  a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( g! B9 Q2 F3 ~0 d
  11. *         TO CHANGE.5 d5 l/ J; N* e
  12. *+ A) g7 I/ C, j& m9 d2 a, t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& q) O$ g8 d0 U: j6 k" [" J: c
  14. *1 q( A6 V! T( k$ `) T( l4 o
  15. * This program is free software; you can redistribute it and/or- q, N6 {0 N( S' p: [& }( G: Y
  16. * modify it under the terms of the GNU General Public License as
    # z: ]4 s7 A# E0 A6 G
  17. * published by the Free Software Foundation version 2.
    ( p* n% \) a' g3 a8 I5 y
  18. *
    . w2 @( A" f* a+ h4 _5 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ G" i2 A+ I$ z4 I1 _; P
  20. * kind, whether express or implied; without even the implied warranty
    , u' u9 q+ o8 W" X, P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * |- \7 g+ m7 N7 Y- Z
  22. * GNU General Public License for more details.8 i- T' n0 T" W$ I3 M; o
  23. */* D, m4 e) Z2 I* |3 y- S
  24. % t0 g$ g0 }( @- I+ v+ [
  25. #include <linux/module.h>
    " r5 T1 b; R1 y4 l: A1 P# U& h! s7 Q
  26. #include <linux/init.h>
    ! V, N! O  Q! D" d
  27. #include <linux/errno.h>) w5 j/ o' p- R; b) u: M
  28. #include <linux/types.h>6 D& G& }0 b3 d% X9 o( Y
  29. #include <linux/interrupt.h>" _0 x$ Y2 [+ B5 i$ P& r& @
  30. #include <asm/io.h>% I4 G1 n8 r6 ]7 {2 ]' K
  31. #include <linux/moduleparam.h>
    ! _( h& ^: A! H: N+ _
  32. #include <linux/sysctl.h>
    7 m3 W2 B3 P2 K0 \+ b' g
  33. #include <linux/mm.h>- O) x0 l5 K2 [, S( T
  34. #include <linux/dma-mapping.h>/ V  i5 N7 W/ J4 _8 @
  35. & V, ^+ @. N( {" v, r8 `. e5 @
  36. #include <mach/memory.h>2 }- c% W  b8 {, A# V$ Z1 {) m( d
  37. #include <mach/hardware.h>9 q9 ^0 ]% n  ^/ ?4 b7 ]" Z7 l
  38. #include <mach/irqs.h>& U( n/ M: J9 a' @( |% m, ?
  39. #include <asm/hardware/edma.h>+ F% h7 @# y5 ]0 G' t
  40. ' J, D' {$ v# E5 E
  41. #undef EDMA3_DEBUG
      S1 b) v7 `& V$ g* o- _
  42. /*#define EDMA3_DEBUG*/
    , o, Q: D8 d$ J, c2 e

  43. * Q# P0 I1 U8 n$ h6 u, p8 g+ K* r
  44. #ifdef EDMA3_DEBUG( c6 I/ H0 i, ^5 v! Z' g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ q7 _0 O4 ]2 L# R! _3 d; |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 q* `& C, V/ e, ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 y! o7 P) m/ K1 t" p5 v3 ?
  48. #else
    * c6 t. Y+ r, s' b" Q( @
  49. #define DMA_PRINTK( x... )
    7 L3 r1 ^; }6 z6 t1 d; a, |: ^
  50. #define DMA_FN_IN; Z4 L2 f: V- \3 }# A8 ^5 O
  51. #define DMA_FN_OUT
    7 D0 z6 B4 y$ H/ h$ |
  52. #endif
    6 S6 C. H# H6 k) C! e+ D0 {7 ~

  53. ( X6 g. j$ {9 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 T) {) D) H4 N0 _/ ?2 y
  55. #define STATIC_SHIFT                3
    5 Z7 D( K: V' X0 K' t+ o
  56. #define TCINTEN_SHIFT               20
    9 m4 n! ^1 \. y7 I, p
  57. #define ITCINTEN_SHIFT              215 ]; n, N$ h8 j2 i6 s5 c: |
  58. #define TCCHEN_SHIFT                22
    * X4 a2 m: x3 V9 @3 U& B  t& _
  59. #define ITCCHEN_SHIFT               23
      P8 C* B! {1 S' }8 \7 t' w
  60. * l% I; A+ X6 r6 J/ R
  61. static volatile int irqraised1 = 0;' @0 c9 e) Y' }) ?/ _- Z% a4 Q8 b; j
  62. static volatile int irqraised2 = 0;
    0 s, k! }$ {6 _, ^( E4 J3 q- p

  63. $ @- Z; {5 u- g  q( x% p- R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ], Z+ x, U; W! ?8 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 R) m' f( W0 K- E2 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . u3 A, i0 e" m0 L* R. }
  67. # F7 Y1 S. f' T. R: }
  68. dma_addr_t dmaphyssrc1 = 0;
    1 ]) j1 K5 ?; R6 |. l
  69. dma_addr_t dmaphyssrc2 = 0;
    - X+ O1 f$ \/ w% R6 O6 H9 K' {
  70. dma_addr_t dmaphysdest1 = 0;
    2 Z0 D0 h8 Q3 z
  71. dma_addr_t dmaphysdest2 = 0;
    7 u+ d3 s. c7 ~" r( O; V4 O! T. L8 e, ?

  72. 9 [) }; y1 g4 k4 M. I' O0 R
  73. char *dmabufsrc1 = NULL;4 H/ X; Z" r; B$ K
  74. char *dmabufsrc2 = NULL;$ H! k/ B( A' f9 S' j
  75. char *dmabufdest1 = NULL;
    / D  h) R$ F9 D; P: ]
  76. char *dmabufdest2 = NULL;
    ) u5 L7 }0 E9 n8 J0 ]% \" }, s( ?+ c% ^

  77. ) z$ T0 g/ ^+ p- ^  t+ c
  78. static int acnt = 512;
    % M8 ~1 P0 f3 [
  79. static int bcnt = 8;
    ( R, Y# v3 f; g& t. O- u
  80. static int ccnt = 8;
    ; i0 B7 e0 n0 o: V

  81. . A  e9 S+ R2 w0 n9 b0 A) d( T
  82. module_param(acnt, int, S_IRUGO);& j8 R5 `5 e3 b2 X/ M+ H
  83. module_param(bcnt, int, S_IRUGO);6 }0 g  {2 L& s9 p$ {, U% T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 W) A( t! Q- ]5 A" ^5 e6 q8 O+ Z( J
: Z+ q& ^0 t: q2 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 _' l: X, I: i6 w/ m0 \. d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; C0 _  z# f# J" K8 l7 n: x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 l! O% O* K+ h# W8 C3 \% h0 z+ H% |5 n# l( x; l) n9 a# {

. h7 _, K1 Q9 H, A4 G9 T' M3 o6 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 17:45 , Processed in 0.037416 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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