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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 q2 M9 @% o) G( K  X
  1. [code]EDMA sample test application
    9 i% O8 p# p/ t2 C. e# x
  2. /*
    % i& I: l: O+ b: k# {3 |
  3. * edma_test.c
    ) C' l0 Y8 x0 c' W7 s
  4. *
    ' |: r' Q; v+ Y+ L' k2 P% v
  5. * brief  EDMA3 Test Application+ Z; P. U/ O4 L" R
  6. *
    ; i0 v5 X4 Y" s  I! c. Q  D
  7. *   This file contains EDMA3 Test code.
    + s8 S% K6 b1 ?( H7 }
  8. *4 G- j  g1 Z6 d% u% _5 {$ B' |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & O. C8 Y5 q% s1 d4 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; [  }6 |* l2 m' A4 I# R! {4 p: I
  11. *         TO CHANGE.$ k7 S; |2 L  ~) g9 M8 G
  12. *- b* [0 d* P* U8 M: ]8 F$ y! l2 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 E8 E2 _7 y" W6 Z: e: r7 H
  14. *
    9 [9 {+ m3 K  z" S$ d
  15. * This program is free software; you can redistribute it and/or
    9 U* a, I7 O( {2 R- v* q
  16. * modify it under the terms of the GNU General Public License as  w' D- _% K4 w7 Y
  17. * published by the Free Software Foundation version 2.
    : s0 \: b' J5 S
  18. *
    6 J5 e& W& K- ]$ z0 u  U2 U6 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      T% N9 U9 M& K* S: i+ \$ R
  20. * kind, whether express or implied; without even the implied warranty
    6 [7 j" e; q4 q1 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  _! r2 m% t9 d
  22. * GNU General Public License for more details.
    % K2 ?' V$ B$ w/ u6 o! c
  23. */
    / y' H& X, m* l# K' [

  24. " X; h4 X0 ?9 Z7 N- u  o, J  ^
  25. #include <linux/module.h>- O( f! C0 T9 a4 W
  26. #include <linux/init.h>
    . a! I* L0 }6 ~- E# j( B! {
  27. #include <linux/errno.h>) w# m- M4 i; c9 K
  28. #include <linux/types.h>1 E1 [+ b, ^# b% W" |4 K$ j
  29. #include <linux/interrupt.h>5 A$ F7 |2 k- p  J: S4 M: @
  30. #include <asm/io.h>
    6 f( s6 u' n( V0 X$ w7 w( {
  31. #include <linux/moduleparam.h>" \9 c' {3 x4 U1 V. r& J% I
  32. #include <linux/sysctl.h>
    3 c; h3 g( r3 G8 n' B3 r
  33. #include <linux/mm.h>
      ^9 `. }6 l! [: k; m% ]5 e7 ~$ Q
  34. #include <linux/dma-mapping.h>
    " O5 ]" t5 [& m6 d
  35. & R& |, x2 Y0 f( o  P
  36. #include <mach/memory.h>
    % }8 J2 f6 F& I# e' R
  37. #include <mach/hardware.h>
    : c* q5 }8 O/ F; I0 g  g
  38. #include <mach/irqs.h>* c8 o* z# {- e. E
  39. #include <asm/hardware/edma.h>* S6 k8 C' e3 Y  k9 E8 W8 K" c; ]

  40. $ u7 d% Y* w' C2 _; u1 z
  41. #undef EDMA3_DEBUG
    + Y( x: m8 g% J. w9 X* l
  42. /*#define EDMA3_DEBUG*/
    * R1 d. @6 a. N0 q' I, J1 h+ v! b
  43. ; r! F& V. b: R; I; W( |
  44. #ifdef EDMA3_DEBUG
    1 D: `" \; x. u- }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ y7 c0 n0 Z; p: j2 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 @; t6 u% o6 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! o* Q  {0 g0 o: R' o' U( l' Z
  48. #else+ u1 v5 W2 r( A$ }
  49. #define DMA_PRINTK( x... )
    , Z1 u9 a# D1 o2 K' q4 ?' i
  50. #define DMA_FN_IN
    8 l* ?, p7 A* x- M" F- T/ L: ?2 O
  51. #define DMA_FN_OUT1 R$ ^( W+ f( R  b7 I9 @
  52. #endif$ d' u; c: G5 a  n
  53. , B, e( J) S4 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 G. M4 N7 n/ g! E* N
  55. #define STATIC_SHIFT                3' Y+ [5 B( f& p. W' a8 V6 i  q
  56. #define TCINTEN_SHIFT               20
    0 o2 f( ~$ M. ?" C+ g
  57. #define ITCINTEN_SHIFT              21
    ( z8 ]! B  X7 q+ s. H: [1 t3 i
  58. #define TCCHEN_SHIFT                22
    + S% E3 }3 H& W) W6 j' [
  59. #define ITCCHEN_SHIFT               232 u  t, T$ D8 Z5 {5 G7 |  N

  60. 4 p4 U9 R4 g& K1 Y
  61. static volatile int irqraised1 = 0;
    + ~$ [. U, h$ n0 B9 W9 D
  62. static volatile int irqraised2 = 0;9 U. _/ O; b6 ^0 W, z8 k, G

  63. 7 |$ e& Q0 R* F" p+ N0 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % @3 I# B+ H$ \  R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 `2 T; U+ h, D) p2 |: U1 }) P" `2 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% _$ x4 q( f) F% m7 d

  67. ) t* P2 c0 K- N* Y! k
  68. dma_addr_t dmaphyssrc1 = 0;; i) t0 \+ ?) X) U: I
  69. dma_addr_t dmaphyssrc2 = 0;
    " V5 O7 {' L1 a' O7 J+ j
  70. dma_addr_t dmaphysdest1 = 0;
    ( E' `; ^3 ^0 Z1 N) W5 L" |
  71. dma_addr_t dmaphysdest2 = 0;1 a6 ^. |1 L6 ~- r2 Z/ K2 ]

  72. ; U* m+ ]5 a6 ~2 P+ y
  73. char *dmabufsrc1 = NULL;2 M6 U+ [+ H  v+ u5 x  B9 \* A. t
  74. char *dmabufsrc2 = NULL;, a. `3 w/ Z: S, E; O
  75. char *dmabufdest1 = NULL;
    & K# H) F6 Z4 L
  76. char *dmabufdest2 = NULL;4 B) N4 N) Q) `. L3 R3 ~% b4 B

  77. 3 ]- Z7 i, y9 u2 ^0 [5 t1 E4 L7 \
  78. static int acnt = 512;
    6 a3 s6 Y4 q- K7 Z) t) }
  79. static int bcnt = 8;: S/ G0 O1 ]( U# u! f. ~6 b
  80. static int ccnt = 8;
    " w4 @% m4 T7 i$ _6 Q- ~

  81. 7 s% f1 E# g0 ^' }
  82. module_param(acnt, int, S_IRUGO);
    ' I! j2 z. w- `0 Y7 S
  83. module_param(bcnt, int, S_IRUGO);
    8 G+ C; }2 A# l) Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. s( F1 ?3 [, S8 d  n7 N, y/ C* i" T
  n* _  X9 O9 N( \1 Q# P) D' H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" r0 T) e+ M+ ?7 m$ yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; E$ S# x2 s6 l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* v$ X1 p9 l, L. y9 u: a! f7 X: Y! @7 `3 S7 h6 Q7 Z" D
, @/ l; ?" r! d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-15 22:40 , Processed in 0.045589 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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