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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 G2 S( M; a; c' `! P5 v
  1. [code]EDMA sample test application
    * y8 ^0 L* j. ~5 }2 c* {7 l
  2. /*
    $ P7 O; B" N& O7 N' X
  3. * edma_test.c
    - {  v! ^8 c# c
  4. *) R) X% Z( @6 F( `- @
  5. * brief  EDMA3 Test Application
    , A) n% ]5 l1 S9 h4 H) k9 ]6 x" [
  6. *
    ) g  y3 N, S4 y1 `
  7. *   This file contains EDMA3 Test code.
    " v/ H7 d* G+ `: _! N; u, t
  8. *. Z- [% X: d0 k' k3 `3 q; E0 B; i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 k, e, ~+ _* @+ K3 j/ V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ b8 o1 ?' J: l$ e: g
  11. *         TO CHANGE.
    5 p7 [: B, l* M" M$ ~/ `8 E4 z! C
  12. *! I+ @- _# V% S2 }5 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  g' O" y! K% T8 a$ v, M( b
  14. *" C1 Y* g1 d3 B# D' \; |; r
  15. * This program is free software; you can redistribute it and/or
    . s5 ]6 g9 E6 R4 \7 u$ l# H# ]
  16. * modify it under the terms of the GNU General Public License as+ k. W. I$ b' O" y' t! ^* f
  17. * published by the Free Software Foundation version 2.- a# Y4 e0 ^" i  |4 e# g
  18. *
    * H3 k# w2 C" H( k# H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- A4 _$ \& ~8 l+ [
  20. * kind, whether express or implied; without even the implied warranty
    / Q) k  p+ v& m) R8 ~* q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # l/ \; r- H4 s1 J3 {- K9 H
  22. * GNU General Public License for more details.
    4 C6 o( t% n: h# |4 P: H7 \
  23. */; p$ O/ y! E4 O  B  {6 j

  24. 9 C. o- m0 k# V. _! K
  25. #include <linux/module.h>) k3 q" V  L* L7 U9 H
  26. #include <linux/init.h>
    4 V( V& H+ @# h% c! v6 v" q8 Q
  27. #include <linux/errno.h>
    7 Y( H+ z: E- r$ q3 I
  28. #include <linux/types.h>
    : {" t* J0 Q3 d. ?6 G
  29. #include <linux/interrupt.h>
    8 f) r" }& X* q4 O7 S/ }) f' O) K
  30. #include <asm/io.h>" S: C2 ]/ z; |) I6 W3 W; i4 N
  31. #include <linux/moduleparam.h>  M7 |4 R% Y1 o6 Q
  32. #include <linux/sysctl.h>
    % q4 V8 p( R/ `7 H" |
  33. #include <linux/mm.h>; P6 \. [+ J, E+ \. K
  34. #include <linux/dma-mapping.h>& \1 k, e9 u/ ^3 `! y" n+ k
  35. ' O: t. k: G! v6 l5 W
  36. #include <mach/memory.h>$ |% r& u1 N) Z
  37. #include <mach/hardware.h>
    + k: P* M0 ?. o7 Q4 Y) o& \
  38. #include <mach/irqs.h>
    ! n% D0 m2 b2 _3 V9 G
  39. #include <asm/hardware/edma.h># |1 G, [9 T/ k0 m& R& F" x
  40. & ]. [; m9 a, Y- p
  41. #undef EDMA3_DEBUG1 H$ d, _0 H7 ]6 t
  42. /*#define EDMA3_DEBUG*/+ y& u; X( g7 F: l; l" S5 Z$ Q1 w

  43. 2 {/ q) h, _# D3 M: u5 P( I6 U
  44. #ifdef EDMA3_DEBUG' {# b7 G& V3 N' n6 a  Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" J; `8 F$ y0 T6 v! \0 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % j; r6 l* a8 O% q0 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 ?9 [  m" U. T5 E# c6 k
  48. #else2 q; [+ {- _4 j. _: j
  49. #define DMA_PRINTK( x... )
    + x# f3 k( L0 z# X
  50. #define DMA_FN_IN
    3 d8 K" V: D/ C8 U
  51. #define DMA_FN_OUT. }) C7 E9 [( d' }# R
  52. #endif
      D4 ]& a1 U* F4 t; \+ t! v" M- B

  53. ( o7 l8 r: Q* x3 L, A) Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- f& _1 ]' }9 p- ~" W" z
  55. #define STATIC_SHIFT                3
    4 ~( ]" _% t9 R; w$ F
  56. #define TCINTEN_SHIFT               20
    - Y# Z5 z( k1 X& o  Y
  57. #define ITCINTEN_SHIFT              21% l+ q1 H/ H. Q/ s% ~: c
  58. #define TCCHEN_SHIFT                22
    ; v' y) B0 w7 L" J1 |0 w% ]
  59. #define ITCCHEN_SHIFT               238 K2 M" }& Z+ h2 O5 t  L- j

  60. : K# J* ]- N$ k/ Y0 z' w
  61. static volatile int irqraised1 = 0;- c+ A) A7 c2 v, @; \6 I) m
  62. static volatile int irqraised2 = 0;  a" Z. \2 U6 A7 Z  ^* d

  63. % I. S; l. t' b9 \2 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; U/ J3 C, Y( w* X- b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      @- V9 v/ \2 V+ v: H( N3 I/ c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ |1 k: g$ C, {; T0 o+ U& o
  67. , c5 e" _0 W1 e4 I, x  u) H. W$ \
  68. dma_addr_t dmaphyssrc1 = 0;
    ! u0 i' B. P( X
  69. dma_addr_t dmaphyssrc2 = 0;
    # z5 d$ M5 Z' O5 T
  70. dma_addr_t dmaphysdest1 = 0;. I, P/ R7 L0 \% |3 t4 ?5 L
  71. dma_addr_t dmaphysdest2 = 0;2 a- L' H/ w9 {4 N) H! a
  72. $ Z0 w3 v% _7 L1 A3 q3 y
  73. char *dmabufsrc1 = NULL;
    + v7 U! i, g8 N( Q+ w
  74. char *dmabufsrc2 = NULL;
    1 l! s& R" t3 y
  75. char *dmabufdest1 = NULL;
    " w, F+ G3 q, @1 l
  76. char *dmabufdest2 = NULL;9 ~9 T5 o  U2 L$ L( Y
  77. % I( v6 j* `: ^! g, N& l
  78. static int acnt = 512;; R7 q, `( J, x7 t+ ~) b6 q
  79. static int bcnt = 8;9 m' B( U6 v0 n. [/ f6 ^
  80. static int ccnt = 8;
    4 |' F" x4 ~$ |1 r$ z* W  i
  81. 3 Z* t0 u% ]/ N
  82. module_param(acnt, int, S_IRUGO);
    5 Q5 A  P: B& c
  83. module_param(bcnt, int, S_IRUGO);. p/ M1 i( e9 `/ V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 P* m) e) u3 }; w7 p0 _$ R8 R0 D! k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' ~3 G6 u6 k1 ~' c/ i8 Y, ~6 sarm-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: c7 Q* n8 K, r4 }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 w, z6 j" S1 I$ |3 ]: M

, `. Z3 i5 \2 ?/ F- ~1 r5 d, E5 c- h7 o- M7 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 23:07 , Processed in 0.068638 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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