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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # ^  N& M/ C. f( n9 [
  1. [code]EDMA sample test application0 h" k, k$ T' E2 L0 ?' U
  2. /*7 u6 r2 t. J; j0 U2 U, X8 F6 z' D
  3. * edma_test.c
    " m8 M  V  |9 X- f. ~
  4. *
    5 \4 Q6 t1 h9 Q" a
  5. * brief  EDMA3 Test Application& F) Q# k% K5 R1 E) q/ e+ g
  6. *
    ( e4 a: @' X3 n5 R
  7. *   This file contains EDMA3 Test code.  ^# |/ p: P+ r- A1 M
  8. *
    6 a& h3 R' m( N+ G  x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 I9 r/ p% H9 U' x% A& I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) d1 ~- l: x0 v
  11. *         TO CHANGE.
    # G8 @. C& d/ g  ]: j" i
  12. *
    & M$ p/ Q* H3 k/ `/ I) Y: F% `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 t$ H( I& @  i( i* U' G% Y/ H1 S
  14. *
      U" P0 e2 u2 d3 n4 p, A
  15. * This program is free software; you can redistribute it and/or
    7 g" t  }. x; e8 C5 ^$ s; n
  16. * modify it under the terms of the GNU General Public License as+ h, F4 K. D3 }' a/ e% m1 z
  17. * published by the Free Software Foundation version 2., V6 d0 `6 c$ _% H0 e) m
  18. *- x  E9 f/ n0 I8 g4 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 H+ M: B9 X: L( Z8 U* Y
  20. * kind, whether express or implied; without even the implied warranty
    & v/ z# N  C5 U; ]! B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 L/ b) {& x/ B8 Z( P# S
  22. * GNU General Public License for more details.3 K, f' R6 f0 t/ ?- Z. R" @
  23. */0 V. X0 L1 L& B5 s

  24. 3 E$ |  C# p7 o1 `& h" q7 a
  25. #include <linux/module.h>
    & M% j' v  F+ H7 j3 y
  26. #include <linux/init.h>7 |/ p* I) G9 b. G3 w3 @8 e/ a6 E: l
  27. #include <linux/errno.h>
    7 q5 ]5 d4 t+ R' V- @  B0 i
  28. #include <linux/types.h>
    3 U4 G' \5 }! c' G: w
  29. #include <linux/interrupt.h>
      f9 R) t3 `8 C3 O( K
  30. #include <asm/io.h>4 F: C! G4 G' X& l' ^) H9 L
  31. #include <linux/moduleparam.h>
    # `0 t' E7 ^& }2 P% p: H% F' J' m  |
  32. #include <linux/sysctl.h>; H+ B# @6 y$ ~* J
  33. #include <linux/mm.h>+ O6 F7 E3 X1 d
  34. #include <linux/dma-mapping.h>
      q0 C( P# L& ~; I, C: q( H2 [$ E% y

  35. 4 A& x7 \' |! v3 m$ b# g, D( a
  36. #include <mach/memory.h>
    * K; G# [3 W  i: l( K$ F) x' b
  37. #include <mach/hardware.h>
    / n5 j1 t& i, H& E: W/ \6 }4 \
  38. #include <mach/irqs.h>
    % W0 Z+ o# Z0 u9 {
  39. #include <asm/hardware/edma.h>
    ; y: L- g% W4 s1 m
  40. 5 p; r+ d  y5 k9 r
  41. #undef EDMA3_DEBUG
    - k6 A3 m7 c; p% H- b/ l
  42. /*#define EDMA3_DEBUG*/
    ) A, o; x& c7 b8 U, W
  43. ) p* \5 j( N: ?+ ^
  44. #ifdef EDMA3_DEBUG- p- ]: ]: N# i- q# o3 E; \. |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % Z# g+ ?2 V) \) m$ F$ m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 a; }9 g6 _+ Y# K. Q, V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% r( J0 ~& D" C' M
  48. #else/ a3 U+ l: @! R. _
  49. #define DMA_PRINTK( x... )" D0 q8 L9 {! J2 F0 `  [# v: T. k
  50. #define DMA_FN_IN' T6 ~! J7 O8 q9 l0 y7 z
  51. #define DMA_FN_OUT
    % _  J2 h: M) q, q
  52. #endif
    ) `9 U" ^0 H- G. D) c1 ]6 E

  53. : z/ t' D6 @, U; q! }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; T$ E( l5 \5 s9 B! J. q
  55. #define STATIC_SHIFT                3
    " e9 ]) e" a; l/ O) |
  56. #define TCINTEN_SHIFT               20
    ( t) N7 ~# h$ B& l* v; U
  57. #define ITCINTEN_SHIFT              21
    7 Z( m* h) J- k* G7 _
  58. #define TCCHEN_SHIFT                22
    " A$ _1 X- ~' r2 m+ w+ m4 K
  59. #define ITCCHEN_SHIFT               23' r4 }5 Y/ _* X$ y$ K+ V0 Y
  60. " i( O$ Q! ?7 ?2 b
  61. static volatile int irqraised1 = 0;1 U5 M3 S+ m, [- y) q5 S
  62. static volatile int irqraised2 = 0;5 g; `3 P% ]7 t; p; Y$ J  y# K' h

  63. 5 s/ y3 p* [- \/ z* n: u3 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- e* I! e! Z4 D/ D7 C/ U' d* F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * S/ H, I) g( D) v$ j; l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, d8 S- ~6 R7 T$ ]7 J  P

  67. 2 W- F, L* [0 n% V' }6 y
  68. dma_addr_t dmaphyssrc1 = 0;
    0 Q' @$ X- S: @4 p
  69. dma_addr_t dmaphyssrc2 = 0;
    * F  j: u) j5 }: s$ t) E2 m* m6 z
  70. dma_addr_t dmaphysdest1 = 0;" O: n3 i6 w" i' Z) c; |
  71. dma_addr_t dmaphysdest2 = 0;: P6 B5 i- a7 |4 o1 K' l: Q

  72. ' p; @7 ^5 O+ d4 S0 W
  73. char *dmabufsrc1 = NULL;
    ( s" J0 {) v  J7 \' e3 a/ i
  74. char *dmabufsrc2 = NULL;
    ; V- B! Z$ T4 K8 j# a: Q4 R& G8 f3 L
  75. char *dmabufdest1 = NULL;5 W7 l4 O! L, t/ \7 T8 ?  o  k
  76. char *dmabufdest2 = NULL;5 w- E& h* \4 B0 q; C7 r2 Q

  77. 1 w, d/ _( {8 l" V/ b: ?8 k
  78. static int acnt = 512;
    5 C6 }" M0 M. Z1 V, a, W
  79. static int bcnt = 8;* V+ e! M' ?' S! F% J
  80. static int ccnt = 8;9 B( d% h& r" P4 G
  81. * @+ ~) B$ I0 w2 v. I- n6 N
  82. module_param(acnt, int, S_IRUGO);
    # H( Y1 i3 g6 ~9 \  c
  83. module_param(bcnt, int, S_IRUGO);
    : p- Y" S- g3 p7 c. X6 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# f. E  a2 G* X5 P- n
' P' E1 Q7 A; l, E) ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  f. H: w, v3 H; {! Y9 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) S% d7 C4 J$ i/ F8 E3 ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; {; o1 ~  y7 c/ P5 t
6 {" l2 h  n& v- \; I2 ?/ F
: c' K# _5 c; a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 06:25 , Processed in 0.039978 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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