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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 C5 a! M* [5 X- @: h. f( i9 G
  1. [code]EDMA sample test application2 F0 s6 T9 L; I
  2. /*
    $ F+ S0 Z7 C8 ^8 r4 @: V/ S
  3. * edma_test.c
    ; U' C# H/ {: O0 u4 V! P
  4. *
    - @: }& |5 u. }( N- j# M  k0 \  _3 D
  5. * brief  EDMA3 Test Application
    ; E% c) h9 r) ^' \
  6. *
    0 n8 o8 {; w7 H3 a% [+ ^5 i# U0 a4 O4 c
  7. *   This file contains EDMA3 Test code." Y/ w/ ], v1 b6 R2 H* M' e  p
  8. *1 B( Y% i& c. n) O2 D* t# r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ G. d0 h: h% }/ ]2 C/ J0 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . |4 X2 S1 q6 R' E3 D3 U+ f
  11. *         TO CHANGE.+ j* I5 L% y, ]3 c
  12. *0 V6 S/ F" U9 K9 P7 f3 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, _& M0 ?: C1 _0 D$ Q1 n% Q! M! u' s( T* x
  14. *  T) X- g/ u3 A9 }! c
  15. * This program is free software; you can redistribute it and/or0 z  Q/ T6 }0 i/ B* i# {
  16. * modify it under the terms of the GNU General Public License as
    ( |- W% }2 r& ?$ T
  17. * published by the Free Software Foundation version 2./ m; j6 ~1 f/ ]" Q3 `0 }6 F- c
  18. ** M9 b8 Y; H6 O( B4 X- w) u0 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 z: K( v1 z# H7 E$ g2 y) O4 f
  20. * kind, whether express or implied; without even the implied warranty
    + [  h  {0 ^3 |5 Q8 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 V9 P6 N; ]; T  h
  22. * GNU General Public License for more details.
    0 {+ Y$ }- C4 K. |* q, B
  23. */! ?4 I& R5 X) D8 z6 J' S
  24.   t! |( [/ T" R8 ]& x- J, ^
  25. #include <linux/module.h>+ k% M& R  W, s$ ~
  26. #include <linux/init.h>. Y9 F( \- Q1 N( N. u
  27. #include <linux/errno.h>
    $ \/ g- W- V* P
  28. #include <linux/types.h>9 ?8 e/ D, L9 w1 Z( m
  29. #include <linux/interrupt.h>
    ; y1 O  \+ @+ Y7 P
  30. #include <asm/io.h>& N' b: I8 `6 ?4 B
  31. #include <linux/moduleparam.h>
    - {/ W9 d2 {* N$ }
  32. #include <linux/sysctl.h>
    + q: b% U# k+ i! ^
  33. #include <linux/mm.h>& s& [) O4 x6 {% a# l3 j2 ?  h
  34. #include <linux/dma-mapping.h>+ j/ |$ y+ @7 V2 P) t0 M9 g
  35. . k/ `0 w; w1 h7 ]1 P  `5 D! _: \) P# Y
  36. #include <mach/memory.h>& `1 O6 B/ J+ Q! e' a2 q
  37. #include <mach/hardware.h>
    ' V2 Z/ I7 C1 H1 L' T
  38. #include <mach/irqs.h>' |7 x: B! V' G- q) W
  39. #include <asm/hardware/edma.h>
    . W# [% c0 b0 f( }! o% @
  40. 2 J9 o! V# ^; Z, E
  41. #undef EDMA3_DEBUG& N2 S. E2 H. Y6 {' S/ q% M
  42. /*#define EDMA3_DEBUG*/
    2 B# \, T2 Y( j9 {, k9 f$ u

  43. : M! {$ P1 K& J
  44. #ifdef EDMA3_DEBUG' h8 c6 o! {4 F: j% y% T; z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" {1 P# G4 G* y7 f1 P5 W, M# X3 Q- E- A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 i2 R6 R1 _& O6 _* b) }9 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 q4 P/ m# V- o+ W! R
  48. #else
    6 G9 D5 D5 N1 Q$ V( _
  49. #define DMA_PRINTK( x... )* d: @) B. M  M$ I/ |, H( x
  50. #define DMA_FN_IN
    5 \$ l) d/ x+ ~
  51. #define DMA_FN_OUT- y% E  a& m" C* O3 T
  52. #endif
    ) n2 s& O" E! I$ a  a
  53. / j/ W" G7 {" @9 I* Q# T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# {. P* Z# f: P8 v4 n
  55. #define STATIC_SHIFT                3
    9 A, R3 [2 m" E- ?* V) p' ]. g0 ~
  56. #define TCINTEN_SHIFT               20
    : o& d. B/ h! @0 R" e% n
  57. #define ITCINTEN_SHIFT              213 X$ _( e" f! d/ Y; Q
  58. #define TCCHEN_SHIFT                22/ Y. H- ^  y2 ^" h
  59. #define ITCCHEN_SHIFT               236 G( V( k; L3 r# n% ]& b1 R

  60. ; k4 ]( e0 @, S) B
  61. static volatile int irqraised1 = 0;  y4 {  Y4 y( T7 c1 z9 @
  62. static volatile int irqraised2 = 0;
    ) Q& M, E/ \8 h2 y, R" Y$ U0 [

  63. - f: k  |: U9 x: X* R* M+ ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. [: E. ]1 p  V" R. F! T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' G$ K: h6 O, c  H* P5 u8 h( U* p7 T; x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. E( H( z' ?6 |  g- l

  67. 1 S5 |1 d$ R7 A2 a& N* H4 y
  68. dma_addr_t dmaphyssrc1 = 0;: f8 Z, O" h; F: \
  69. dma_addr_t dmaphyssrc2 = 0;
    0 I5 e( `; p9 U) k
  70. dma_addr_t dmaphysdest1 = 0;
    5 q/ @; k. x9 u- \$ E2 `
  71. dma_addr_t dmaphysdest2 = 0;' ^! H1 U$ `; K# z, P

  72. 9 m+ |; E7 O& M' i! R7 T  k3 I
  73. char *dmabufsrc1 = NULL;& _8 b8 V7 A" w* o- Q) Y' k
  74. char *dmabufsrc2 = NULL;* F$ p/ B8 D2 a( v" A
  75. char *dmabufdest1 = NULL;
    2 F  r' N. A, V8 u+ W
  76. char *dmabufdest2 = NULL;
    : z* U! K$ x; C
  77. 9 X- K3 _2 o' K' [) u( h% J5 H
  78. static int acnt = 512;' ]) r+ E" ^+ i9 ?8 @
  79. static int bcnt = 8;
    ( F' z3 y, d3 d+ [* a
  80. static int ccnt = 8;, H4 O) Z+ w# t' _

  81. * Y; x0 |8 |+ t
  82. module_param(acnt, int, S_IRUGO);+ E5 V: q9 C) M( h
  83. module_param(bcnt, int, S_IRUGO);& p! t* S# R/ M% K, X: s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( c2 _$ {$ P/ d$ H- Q3 \; S7 p! X4 d3 K3 i$ ^' ?7 q1 Q. j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& Y, T5 Y; W4 q) H, G6 X6 I+ O; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 T4 O) j6 N8 A# e- K# D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ g7 |: p% Q2 @/ f  w/ s6 V" R8 h: F5 p- Z: ^! }4 u

3 N# w/ J0 j3 ]: ?7 k$ j* |& K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-5 23:38 , Processed in 0.039510 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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