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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , Z# \; X9 z8 ?% `/ g4 T
  1. [code]EDMA sample test application
    ) P( F9 n% g" E/ @$ X( U- ~+ f
  2. /*
    ! k" ^  e* ]- h3 p; K# j0 u
  3. * edma_test.c
    ; @: n- u5 e9 T
  4. *
    $ {- `" L5 H& {# B$ L8 T
  5. * brief  EDMA3 Test Application
    " i" m  }& U. ^  ^: m
  6. *2 O& h( B7 X1 \$ O4 U7 g
  7. *   This file contains EDMA3 Test code.
      I- a  I2 l; A7 A# ~
  8. *. T+ t3 Z( J6 W: x' o6 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . f- Z& I( \1 N& \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 W2 L0 o% H4 ^, V0 a2 ~6 L9 }: |* q
  11. *         TO CHANGE.
    6 F2 L7 C! \- w  \6 e) b
  12. *
    % ~4 x' P; M* I: ?' L# h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' a' P8 W2 P  c. r$ h) M. |) x1 f8 [
  14. *$ I: j6 I  N9 |0 _: `* ~) q
  15. * This program is free software; you can redistribute it and/or
    0 o; e$ V" m3 ^6 u: X3 d6 W
  16. * modify it under the terms of the GNU General Public License as" x/ e  e/ V7 q% y3 ~9 E
  17. * published by the Free Software Foundation version 2.
    ; Y; P6 J6 o! W; c% j- H8 {
  18. *
    9 C! H2 x+ ^! o1 `& X" W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 N6 t9 `7 W6 Q) I: g* C
  20. * kind, whether express or implied; without even the implied warranty
    0 s+ K& L( N8 p& U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 ^3 N# ^* M& X
  22. * GNU General Public License for more details.$ F, d. t5 q. U' R  L
  23. */
    4 a! g# {/ D: c/ V; O

  24. ; [5 m) C$ S; \, G
  25. #include <linux/module.h>: m# Z7 \" u4 S6 G: }9 i& o
  26. #include <linux/init.h>2 Q7 m$ j) h3 p1 F. o6 S7 N3 l3 ~
  27. #include <linux/errno.h>
    + B1 _6 |$ Y8 e  u1 a9 k
  28. #include <linux/types.h>) Q, y! K) Q; N& F7 I0 C* Q
  29. #include <linux/interrupt.h>
    8 a1 j5 N  d# n) \5 F8 G' Y0 v
  30. #include <asm/io.h>: S! }' v* M6 E- [; Z
  31. #include <linux/moduleparam.h>
    % G' q& K9 x  h; q
  32. #include <linux/sysctl.h>) G# i0 C- [. k0 U
  33. #include <linux/mm.h>6 f* R: I& j. |
  34. #include <linux/dma-mapping.h>& S5 n+ q. o- T# J( c1 J8 r

  35. ) P/ E8 h8 l5 U. [3 Q
  36. #include <mach/memory.h>
    , W& {5 l) X1 a
  37. #include <mach/hardware.h>
    ' G5 x& O: _; u7 A0 a: w0 J
  38. #include <mach/irqs.h>7 p9 f! Z( x* p% l* {- @3 ^
  39. #include <asm/hardware/edma.h>
    : i/ V* M& l; X  M
  40. 6 S( E6 V! J/ c$ ^3 g: s
  41. #undef EDMA3_DEBUG0 d2 V- v: }) d0 |
  42. /*#define EDMA3_DEBUG*/
    # W& t. f! M3 @$ D9 T* d

  43. 0 {. q  C" b- k& Y7 n
  44. #ifdef EDMA3_DEBUG
    6 z7 l( S: @. G/ _4 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . v+ S6 w- |6 y, I0 M" d8 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# N" C* X' V5 _$ Z- F( H1 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 d$ O4 y5 G; e2 w. Z0 o
  48. #else
    / W/ W, S: D. ]0 y5 H6 U9 Y: D3 ]
  49. #define DMA_PRINTK( x... )
    ; c% [5 M6 |7 {6 o
  50. #define DMA_FN_IN; T9 v4 d- u- d+ ^1 [! v9 {. w3 V! l
  51. #define DMA_FN_OUT
    1 |3 r# s/ ?: k' [* K" o
  52. #endif
    ; u) A6 y1 T8 \+ R+ |- Q0 T
  53. " Y$ l& L0 _1 b1 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # r* ]. t+ H: b: R! ]' }  }
  55. #define STATIC_SHIFT                3
    # ~( R+ l+ F5 l: W6 k4 x# d& ]9 Z
  56. #define TCINTEN_SHIFT               20
    . J, c8 s! ?- t3 ^
  57. #define ITCINTEN_SHIFT              21. D' Q; `  m6 [4 h% c
  58. #define TCCHEN_SHIFT                22; [. X! M4 O, A3 I4 ]
  59. #define ITCCHEN_SHIFT               23
    + T; F# A7 w4 S7 W( G5 d
  60. ! d2 n7 S. [8 h. W. X1 q
  61. static volatile int irqraised1 = 0;" S$ A" P1 A( B3 r9 s8 x$ S
  62. static volatile int irqraised2 = 0;
    + W; v: G6 Z2 i) l* O
  63. " Z5 H9 e3 t! h. T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " Z( F7 z2 R: u) k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 }  ?. e5 z4 ]7 K. `0 y7 _/ I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" G4 }/ Q6 R; E/ K

  67. - f0 r/ R& x& J! {) b8 e6 x) h
  68. dma_addr_t dmaphyssrc1 = 0;
    $ \! J8 a0 B) V& Z& O$ j  A
  69. dma_addr_t dmaphyssrc2 = 0;
    ' k4 O5 I/ J7 Y6 Q( N
  70. dma_addr_t dmaphysdest1 = 0;
    , E# b0 ]) G! K7 l; N
  71. dma_addr_t dmaphysdest2 = 0;0 d) a/ Z( ^1 A6 w. `/ Y

  72. 0 M* g6 ?' n; w0 q4 J, I/ F
  73. char *dmabufsrc1 = NULL;) G4 H, H7 @9 Z. ]  A7 P
  74. char *dmabufsrc2 = NULL;
    . [/ P4 l8 D. v8 ?( G! U" W9 x
  75. char *dmabufdest1 = NULL;4 p* w' q0 F, z( D& n- V. W) @
  76. char *dmabufdest2 = NULL;, ?  D$ a; M( Y9 S

  77. 7 A. {9 p3 ]) o* i" N
  78. static int acnt = 512;
    , R& K/ |) Y# [% x5 W
  79. static int bcnt = 8;
    * V9 t; {' w/ a5 f
  80. static int ccnt = 8;
    : X6 n, J, L* c" A) q  N1 m

  81. + \# s* t7 Y' {  t. X2 x: W
  82. module_param(acnt, int, S_IRUGO);# l: {7 w. M, p9 p0 L
  83. module_param(bcnt, int, S_IRUGO);
    6 M: }7 e2 Y2 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' f& b( M8 O( F6 y6 c: O5 B. A" M
" @. i- ~9 o+ a8 J3 @' ~) E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# O) T8 k. E9 o4 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' U* i7 Y- I" t2 Q' H  ^0 G* v- `, A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ ~) O) X6 B2 W3 g. x: o( f% V6 c7 r
( n5 T3 g4 \9 l3 _( v

3 s. ^( B" X0 p6 ^. H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-9 06:26 , Processed in 0.039220 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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