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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . c! G" J* R3 U" K& l
  1. [code]EDMA sample test application
    5 g6 e' k1 o6 c8 V
  2. /*
    " s( M, S0 E$ C6 H7 ~
  3. * edma_test.c
    , r4 t6 T0 G4 ?$ Q5 m6 K8 U0 R5 n1 G5 U
  4. *  w9 N2 }1 G: v8 \8 b
  5. * brief  EDMA3 Test Application
    ! w* b. Z/ c, a7 p% H: ?& j6 B1 ]# n
  6. *+ ?( Q* o4 I: M+ \! `: y
  7. *   This file contains EDMA3 Test code.
    - `5 J8 d& p6 l4 a' Y
  8. *  r6 M' o4 c) e9 Y5 I6 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. B! |" w4 U' C' A6 q- I5 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! ]3 w" k7 B: a3 j
  11. *         TO CHANGE.
    8 r$ Q! d. ^5 t* i2 w, t
  12. *
    - M  b; a' @0 q! n; K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - T+ k- z% @0 F
  14. *
    - Q) Z' H# u- x4 ]. F4 g& l
  15. * This program is free software; you can redistribute it and/or# T, x7 m1 z+ k( ?7 E
  16. * modify it under the terms of the GNU General Public License as9 B- H  R$ Q4 u' v" @) ], _7 b
  17. * published by the Free Software Foundation version 2.5 x5 q+ S+ w) q0 E' w* H2 L: z5 K
  18. *
    8 @' I6 h/ _( q1 l+ `7 S2 }6 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 o  X: n- H8 N" n( c1 f9 ?, X/ [
  20. * kind, whether express or implied; without even the implied warranty
    7 h  V( l) s$ a7 ^3 _' [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * d; f2 p  Y5 y8 m: M* s  S' f( A
  22. * GNU General Public License for more details.1 q" V; u+ T! @3 H. J4 X2 k% [
  23. */* T/ J' }  g8 Q

  24. % s$ W% A/ c( [# k0 a) u. J
  25. #include <linux/module.h># o0 b' p6 |! S) ^  s& w
  26. #include <linux/init.h>
    " u9 g$ @& q7 E0 ?: g$ I
  27. #include <linux/errno.h>
    ' I: o! o) z. ^% O; ~2 @% p- d
  28. #include <linux/types.h>* _' N" r1 m8 B  Q8 C7 E/ J
  29. #include <linux/interrupt.h>
    ; ~0 Y$ W2 o8 j+ T2 G) l
  30. #include <asm/io.h>1 i+ m. P# `3 `7 `5 p1 l
  31. #include <linux/moduleparam.h>
    " z; \" m- m) W, Z' H# H, g3 a
  32. #include <linux/sysctl.h>
    - Y, p7 y3 t7 {6 Y% H
  33. #include <linux/mm.h>1 {% F% n0 D3 M( G2 Z* o- u. R, O
  34. #include <linux/dma-mapping.h>
    # y. \5 B! r+ v- P+ i( n; _

  35. . P# Q/ b5 X6 j- B9 w: y& d1 k
  36. #include <mach/memory.h>" }8 i2 T' H/ `2 r* {2 w$ G
  37. #include <mach/hardware.h>
    1 e) q$ A" E0 r
  38. #include <mach/irqs.h>. q7 Z+ x+ V' j& l1 d
  39. #include <asm/hardware/edma.h>
    ! Q9 m5 m3 V/ R$ |3 ^3 N# q) l
  40. 6 @# W4 {4 |+ [0 m: _3 ?& y
  41. #undef EDMA3_DEBUG
    ; R, a- D* P% b. O2 T; Q
  42. /*#define EDMA3_DEBUG*/
    - W; M8 ~" N4 Y9 e. p+ [

  43. + V& R! s$ H" K7 Z4 ~
  44. #ifdef EDMA3_DEBUG( w; y% B3 F+ r- T. X( h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  L" I" E' ]" A( Z4 ?3 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      v; g/ S: \" @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% x! c# n$ @. [0 e) j* G
  48. #else! Q0 _( y6 h4 _  g0 s5 _
  49. #define DMA_PRINTK( x... ): x9 J9 `  r# Q. `$ i! C6 ^2 ?
  50. #define DMA_FN_IN+ W: Z6 H9 {1 o) W7 V6 S
  51. #define DMA_FN_OUT* S5 ?6 r" R/ P5 K' F
  52. #endif7 @9 g5 J& w5 X+ q

  53. 2 ?1 H8 H9 q( u8 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& F5 v1 q# N, @# ^
  55. #define STATIC_SHIFT                3
    8 a8 o: b6 J  h% I% v* t! D5 e
  56. #define TCINTEN_SHIFT               20' s+ \8 V4 l( a) ?8 V5 Y+ p
  57. #define ITCINTEN_SHIFT              21* ~0 ^+ ]/ y  Q
  58. #define TCCHEN_SHIFT                222 L$ m# x$ D: J. Z2 C* l. h
  59. #define ITCCHEN_SHIFT               238 P/ t* i' J" w( c
  60. 2 E* a0 R3 J+ U6 a  z+ ^
  61. static volatile int irqraised1 = 0;
    : A* ?0 F! I8 Q. {7 `, G/ E- d
  62. static volatile int irqraised2 = 0;5 @* _# D4 r) C+ D  D. p8 C% j7 C

  63. ( A$ I6 [/ D; b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 c9 a* G/ w+ v" k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ o0 `$ Q4 s& p" b( ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 c$ t, E& L9 C* K: ^

  67. * ?' E& F4 \. K; m" `1 L
  68. dma_addr_t dmaphyssrc1 = 0;
    , \, [+ P0 c# t4 C
  69. dma_addr_t dmaphyssrc2 = 0;
    6 m, h" J( O1 y( m; I4 J
  70. dma_addr_t dmaphysdest1 = 0;0 e: E2 K" c. e/ N3 L: u
  71. dma_addr_t dmaphysdest2 = 0;
    7 \7 X9 M; F; b. h7 g" p" ?
  72. 9 ]1 t" N2 m$ O# b, ~2 m
  73. char *dmabufsrc1 = NULL;5 \7 w" y1 D; i  Z3 N
  74. char *dmabufsrc2 = NULL;
    9 W0 D0 C% ~! c& Z+ _0 `+ W
  75. char *dmabufdest1 = NULL;
    . {0 p+ {2 J3 H% m9 y
  76. char *dmabufdest2 = NULL;
    : f) C  P2 h  y) w" W2 Z# w3 L8 w
  77. / |" z: m( B# K$ M2 b7 [
  78. static int acnt = 512;. a, \+ Y5 a8 [6 G6 G: H4 s9 H
  79. static int bcnt = 8;; Z4 @: e% ?7 A: F# J  B
  80. static int ccnt = 8;
    2 e6 _+ k& y5 @* L! X. K
  81. & d! e- b9 r: B/ C3 G+ o! y
  82. module_param(acnt, int, S_IRUGO);
    & k# s5 e- |$ p7 E
  83. module_param(bcnt, int, S_IRUGO);: n* ]7 A% I. H; B. g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 @/ i+ Z2 O+ L' n4 l1 _& q, q# X/ X5 V
8 M% ~9 W# N3 L/ k3 `$ {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; p- U) Y# D+ C! H* @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" a! `6 `- N  a) f7 e3 `8 ^2 P; H+ x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 q4 i; T7 L9 Z0 z! L
/ B  `! p. ?; o4 u: y

9 E& O- `6 N$ g  J' Y" ]( d" o6 `) N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 21:10 , Processed in 0.039760 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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