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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; D  T; e3 W5 o
  1. [code]EDMA sample test application
      Q# [# ~: c& X6 p, A+ ^
  2. /*( k5 W3 }& Y* I% @7 A8 i' s6 H
  3. * edma_test.c+ m) q$ B& a+ B# @* P
  4. *
    9 }: h; e* O" x
  5. * brief  EDMA3 Test Application) v' |! q8 a6 W1 `. ~9 I" e  _
  6. *
    + i3 a; T; b+ N& r# P
  7. *   This file contains EDMA3 Test code.! N5 \. l5 E: T3 ?4 ^5 x% K
  8. *
    2 ^- T4 t2 T0 }7 t) |3 v) {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & u% @* o/ \+ z: w/ `' F/ b# B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  F* `9 p% p/ e8 Y$ ]+ _7 v
  11. *         TO CHANGE.* X5 T% r2 n4 Q) p4 L
  12. *
    # B% f: E( q5 S/ a( r6 }+ A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- k3 r0 U, b7 \
  14. *- g" a. ]0 ?& J$ o2 e
  15. * This program is free software; you can redistribute it and/or
    7 J# Z& ]! ]7 q9 H
  16. * modify it under the terms of the GNU General Public License as
    - e' M1 q: K& `  e. s  t
  17. * published by the Free Software Foundation version 2.  A( L# ~+ H! Y/ `: F2 b% P
  18. *
    $ w" j+ {, o( M) d1 y: X8 M. O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ [0 }7 i2 \0 E: U& q
  20. * kind, whether express or implied; without even the implied warranty
    0 f5 G% s& S/ ]7 g4 O1 j, ]( O4 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. o; T& |- D, m* z: w
  22. * GNU General Public License for more details.
    / z2 l0 j% E+ I$ v, }5 f4 |
  23. */# F, ]! Z  {6 j

  24. 3 P. s! f1 `$ ^  z* `  o/ D
  25. #include <linux/module.h>7 b- [% c* b3 \: K8 f+ m. z
  26. #include <linux/init.h>
    . Y# m7 e/ _$ x$ n  h4 g$ V  r
  27. #include <linux/errno.h>
    & r8 x4 s: K, R. i8 C! }
  28. #include <linux/types.h>
    6 q% l7 X3 `" I. \" R& [% C& Z
  29. #include <linux/interrupt.h>
    : d0 D2 l. G% p0 a+ V, `
  30. #include <asm/io.h>- h( D; J1 Q: `
  31. #include <linux/moduleparam.h>
    / d' j9 ]" N% g" i
  32. #include <linux/sysctl.h>! B0 Q0 H, I" W; k! ?3 x
  33. #include <linux/mm.h># C7 `$ m2 c1 I. K" t. l. O( x
  34. #include <linux/dma-mapping.h>
    % q  e, X2 Y, t. o9 ~

  35. 2 y/ s' F+ O" H( X+ @
  36. #include <mach/memory.h>
    ' Q1 o  m+ n2 R# d- F) a
  37. #include <mach/hardware.h>$ n' l4 ~- {) O
  38. #include <mach/irqs.h>5 k) L0 O0 s# n5 J9 W  L
  39. #include <asm/hardware/edma.h>9 T2 U1 r1 G! Z, ^& S
  40. , ^& C* N) Z9 t! Z: D8 ~
  41. #undef EDMA3_DEBUG& i5 G/ M4 h! N3 A$ r- \
  42. /*#define EDMA3_DEBUG*/) h; V! X1 [/ J0 @/ [

  43. 5 ^2 f9 k9 h6 M* V. w6 j" v
  44. #ifdef EDMA3_DEBUG
    & U; ~" b! D  e/ x& P) u9 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 I+ S, L4 A% E0 h& E$ X- H+ Z" H; i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ w% ?+ x3 C0 t8 @& O4 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 _( _$ |8 _/ S2 l3 O
  48. #else
    & z1 v( I8 n- J6 H) q. u: e
  49. #define DMA_PRINTK( x... )
    + P, O" j9 Y3 b' ^+ c. W
  50. #define DMA_FN_IN8 t3 N: k( i% I2 @7 g$ D
  51. #define DMA_FN_OUT
    * J$ M5 A; I8 a0 b
  52. #endif/ y8 V/ Z( u6 h% a' L3 Q0 Y2 g
  53.   ~# _9 u- ^6 [0 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + n. a. {( d/ w
  55. #define STATIC_SHIFT                31 z' p* Z- ^$ [/ ?
  56. #define TCINTEN_SHIFT               20
    : M: f( f! ^1 q# \* ~+ o. Z
  57. #define ITCINTEN_SHIFT              21+ E! Q# E$ T% \* Q7 p+ D
  58. #define TCCHEN_SHIFT                223 W- v. W* T  s  H  W
  59. #define ITCCHEN_SHIFT               233 ]  ^" T+ x0 f' a0 V% a$ |8 f

  60. 3 D1 Z) F$ V' h
  61. static volatile int irqraised1 = 0;- o% w, G2 O7 W6 i/ M
  62. static volatile int irqraised2 = 0;
    / K' Z" v! k4 q1 R  m: u$ a
  63. 6 i, z* X) I/ |& X0 d1 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " {: E! Y/ d" b0 {  J, ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, J( Y* h/ d, }8 h5 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * s5 ?  B: _- m# R( p
  67. , D$ g9 l: n5 N2 o  r2 e6 w6 X
  68. dma_addr_t dmaphyssrc1 = 0;( G1 o/ f$ l: V* q6 ]& f" w4 r
  69. dma_addr_t dmaphyssrc2 = 0;! {4 t8 R/ @3 k% J; [
  70. dma_addr_t dmaphysdest1 = 0;
    8 |; I4 e$ Q1 g- Y# A/ ?1 N2 }
  71. dma_addr_t dmaphysdest2 = 0;
    - o# S+ ?- s9 H" D

  72. & J; w# q- p! R$ {
  73. char *dmabufsrc1 = NULL;
    7 x6 A/ y1 j# M1 X$ u; ^
  74. char *dmabufsrc2 = NULL;
    , j: }9 N' W% D3 N' o/ w$ y( X
  75. char *dmabufdest1 = NULL;
    # f# V) F6 D9 X0 a/ ~5 U
  76. char *dmabufdest2 = NULL;
    # z! [1 A2 X* K" d; R
  77. ( \6 i, l7 K' X! E2 _
  78. static int acnt = 512;, _; Z: _, q) ]0 Q- V
  79. static int bcnt = 8;) r) H, A" p8 g
  80. static int ccnt = 8;
    & o  t8 m0 N! f  S& K. }

  81. 9 j% G  N( C# B) w0 l1 q
  82. module_param(acnt, int, S_IRUGO);
    ; C( }2 S$ V! P1 t9 x; U* G' s* {
  83. module_param(bcnt, int, S_IRUGO);8 X( F7 B7 d9 Y* A- Z: a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ n- h" a. t# t7 @4 @  G
  z  s+ ?6 X4 U) E8 T  k/ _- ~: _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 x6 i6 |4 p* j4 k# a) d) l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 O3 Z: l. ^2 J" S& w" U$ t1 ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. T7 {- Q% U+ C; Y. U! N3 R! o! x) R2 _
+ D2 ^3 l0 Z5 u6 R4 P' N0 i( j+ Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 13:21 , Processed in 0.038356 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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