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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: A+ O5 }" s) e" H
  1. [code]EDMA sample test application: Z8 z$ Z: l  A+ J- P# B
  2. /*1 i9 N6 ]( ]3 l, d/ e2 o6 c
  3. * edma_test.c' v7 x3 l0 G& z4 ^- e' Q4 m0 E, C
  4. *2 D9 A. i/ [# E
  5. * brief  EDMA3 Test Application
    + q* r3 J" i: `2 Y% m
  6. *
    . u" H$ T$ j+ ]2 O# M8 Z" G, H
  7. *   This file contains EDMA3 Test code.
    0 j9 O7 \* a& R+ ~/ X6 k: }1 w
  8. *
    1 G; g1 [* I/ W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 a4 ~# r( T3 K  e. |' V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 I4 H, G# }. N& e& f
  11. *         TO CHANGE.+ w& q& n- z9 B: j
  12. *
    . ?; R7 w, H. M$ N& W+ K+ k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 K. N7 E# s9 _/ Z, x2 j. Q4 C
  14. *
    6 E% ]1 a1 n1 R, T0 q
  15. * This program is free software; you can redistribute it and/or1 F) R2 u: B% N/ {& L: g2 a2 x
  16. * modify it under the terms of the GNU General Public License as
    / Q! ~" v% P7 y9 g, F* c. t
  17. * published by the Free Software Foundation version 2.
    ( }% a; N/ }) N  c+ m3 W
  18. */ r, l- V* Q# G6 ]- V0 ]& a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. ~% Z# U& c: O1 R, L
  20. * kind, whether express or implied; without even the implied warranty
    * g5 n" {( B* G, w6 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 F5 h  q2 T* b- F
  22. * GNU General Public License for more details.2 F# Y- ?3 k' _" J) C6 r" \" H! m6 _
  23. */# A0 v3 Z9 x) K3 q' E

  24. 2 K8 y+ o& R$ t" R& J$ R
  25. #include <linux/module.h>
    / z/ o. N4 p4 S! h5 g
  26. #include <linux/init.h>7 Y  K5 v/ p. ^5 M: Z) ~
  27. #include <linux/errno.h>
    2 B7 S5 Q; L, ]- q# F6 [, }
  28. #include <linux/types.h>6 O0 e& j' l1 c# f+ D
  29. #include <linux/interrupt.h>
    . ~: s+ i: B( ]/ T4 Q6 {* q8 G
  30. #include <asm/io.h>
    3 h& V4 k, A- t$ s* w; u
  31. #include <linux/moduleparam.h>
    ! u; A2 G0 I* |5 }3 {
  32. #include <linux/sysctl.h>
    $ s+ V8 X  G6 U5 _
  33. #include <linux/mm.h>
    ) {/ P* O' F$ t7 P
  34. #include <linux/dma-mapping.h>' F" L5 _! b9 D8 c% k6 r( z/ Y7 u
  35. * \2 u" l5 b, T7 ~
  36. #include <mach/memory.h>
    1 l1 ?7 c, J$ \& c+ O
  37. #include <mach/hardware.h>) p9 g4 }) M' m. E( g4 q
  38. #include <mach/irqs.h>
    ' U: }8 ]2 x' L, h
  39. #include <asm/hardware/edma.h>  w) d& q, ]6 b0 J8 U* L( K

  40. ! B7 ^* R0 z8 d
  41. #undef EDMA3_DEBUG
    ! G- @" {" E- d. [. y
  42. /*#define EDMA3_DEBUG*/4 q$ Q/ x2 ]% }7 ^! }* G; p5 v; o& c

  43. 0 i8 D7 u1 B; {& p, k7 r, C+ B- T
  44. #ifdef EDMA3_DEBUG
    1 V  F+ N# ~" Z7 `& Q( k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 z. X- F8 T+ k7 l# b2 r/ s  E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 @4 H) l: k' b5 Z) M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); M3 T2 j: s) Q6 ^" }! G
  48. #else
    9 r: N9 _+ P( G4 [* V0 O
  49. #define DMA_PRINTK( x... )2 S6 g4 K) i5 D" Q/ g" e7 S
  50. #define DMA_FN_IN& J1 u, W/ N1 h( a; Q) r; w& S7 u
  51. #define DMA_FN_OUT
    2 Y& i% u- w* @
  52. #endif
    1 H( m" `& F/ G- B0 @

  53. & ^+ R- B7 J, [- \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 A5 \3 i2 }+ m# l2 f
  55. #define STATIC_SHIFT                3/ a/ s; o3 M/ g# s& W
  56. #define TCINTEN_SHIFT               206 t$ C* P" h* M* U
  57. #define ITCINTEN_SHIFT              21
    4 ]. ]4 N6 Z; Z& e' y& b/ P; \; S
  58. #define TCCHEN_SHIFT                22$ y, X$ \$ ?0 q1 j' o' Y& {
  59. #define ITCCHEN_SHIFT               23
    ( p; K2 u3 P' V4 y6 M
  60. 5 v3 S! o0 d: V; I9 ^7 I8 b4 b
  61. static volatile int irqraised1 = 0;$ R% K/ b0 G; A+ ?2 J5 u
  62. static volatile int irqraised2 = 0;
    ' k3 e, x1 Q/ ]* b

  63. ) ]8 s! H' }6 e1 ~/ y4 }( Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 N& Q3 `7 g, ^% ?0 S; N0 n4 O* y1 ^2 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% |/ y4 k& s' i  w1 [, Q# m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " [9 W+ U0 N7 _9 |1 e  E

  67. ; S6 D* R' U: [/ `+ J& N
  68. dma_addr_t dmaphyssrc1 = 0;
    2 L# _- x' P' |5 T
  69. dma_addr_t dmaphyssrc2 = 0;
    : W4 w; \/ A5 X0 C3 D( x
  70. dma_addr_t dmaphysdest1 = 0;
    " X# l/ r- f7 h
  71. dma_addr_t dmaphysdest2 = 0;
    ! g# y* t2 y/ x9 b; w
  72. , c" c  B2 \, x& ]
  73. char *dmabufsrc1 = NULL;
    / J  J; l; Q  }, y& C$ j% P
  74. char *dmabufsrc2 = NULL;
    3 x0 F, B5 y+ T1 D4 L4 k% @% O9 G
  75. char *dmabufdest1 = NULL;
    * `" \6 _* f2 f# I
  76. char *dmabufdest2 = NULL;% v8 }1 z7 ]: E' m7 @9 I! c8 {0 H6 M2 h
  77. $ D6 w! s- ]. Z' p) N, W& l
  78. static int acnt = 512;, ]0 L" j  x9 I$ H6 y
  79. static int bcnt = 8;
    / l  G. I+ H/ Z7 [
  80. static int ccnt = 8;
    & n3 x( f2 z' K* W3 {
  81. ; C+ p) p4 X: g. m0 I2 E
  82. module_param(acnt, int, S_IRUGO);
    ) }) `3 }1 W) o  ^
  83. module_param(bcnt, int, S_IRUGO);
    * K# m- x% ~6 w, y, c$ R, t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 M4 x5 G) d# r' _- W2 C1 d
4 B; y4 B( u( O5 b& v, K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! g& Y5 e: `/ c8 R- e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 x3 v6 R. r" |$ e9 [, p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 y, ]" Q2 x3 ?7 I$ J

8 N' N% Z1 J( Z2 l( V7 X3 w; @5 v  Z6 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 21:13 , Processed in 0.037033 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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