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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 b  d8 A: x0 i% B5 f. F7 X. V
  1. [code]EDMA sample test application
    ; w& ~4 A- b/ ]  r# e# N
  2. /*6 R7 N/ I7 ]$ b# F5 u0 K, O# J, `7 T
  3. * edma_test.c
    $ L; y" d0 j$ Z; O& K# S& ]( X
  4. *" _6 ~4 V, P& F4 B1 E& `; G( P/ \
  5. * brief  EDMA3 Test Application
    . }& D( u% _0 B- I9 `5 t4 _
  6. *+ Z, V1 p, @+ F0 y0 ?% {( [. H9 _
  7. *   This file contains EDMA3 Test code.
    1 A; [! v: R2 y8 Z+ y  a. b: g3 t
  8. *
    3 O' n+ v- n: `8 O" a$ u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 v- z. {4 |, n  k- o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" k/ X4 V6 Z9 C9 i
  11. *         TO CHANGE.
    ( E% L9 [6 @, c& [$ [
  12. *( N+ M; Z" k  |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 E8 n7 r0 v2 V+ f
  14. *
    % |; Z) i) Y) V; n
  15. * This program is free software; you can redistribute it and/or
    / B) {' l9 ^" J
  16. * modify it under the terms of the GNU General Public License as+ {* M3 i) g5 g+ I2 X: B: h3 b
  17. * published by the Free Software Foundation version 2.; T5 R# K5 {( U1 ?$ H+ \/ `( S
  18. *
    , L2 T! m4 D+ N. H) L  u4 D$ t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 u0 x1 a$ `: Z0 C) S2 @8 P; N  Y
  20. * kind, whether express or implied; without even the implied warranty/ I& |$ z0 \2 y) c# N; F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 V! p+ O. y* x$ R$ ?/ _0 X4 ?  |5 Y
  22. * GNU General Public License for more details.2 N& t; R: T; _: u; z$ t5 M! N
  23. */
    ) J* p+ g  N$ ^8 j

  24. " R4 H" p/ H3 n+ p1 S
  25. #include <linux/module.h>2 o2 D) ?/ M+ x, l+ u6 ^
  26. #include <linux/init.h>
    7 K7 }$ Y+ N% N& e
  27. #include <linux/errno.h>
    - v6 g. |# o* Y+ k
  28. #include <linux/types.h>8 ^1 H2 ~% A+ {; {7 Q* }
  29. #include <linux/interrupt.h>
    * f' Q( b. v) s% Q
  30. #include <asm/io.h>
    9 K4 o" d7 y% M, m4 _
  31. #include <linux/moduleparam.h>
      Z+ k* w) T9 `  g+ z/ ~
  32. #include <linux/sysctl.h>
    & y& |+ R' u$ E5 \7 G7 X/ ]
  33. #include <linux/mm.h>0 P8 x6 m1 ~$ j; `% H! w
  34. #include <linux/dma-mapping.h>, T) x+ M. y6 E" N$ s
  35. $ `1 w+ }8 q4 J
  36. #include <mach/memory.h>
    # D& c+ b( B$ r- R2 I
  37. #include <mach/hardware.h>
      Q3 ^& V# G$ R& j, D* k- w
  38. #include <mach/irqs.h>" ]  c0 q4 |' m: H6 t0 j% q, o
  39. #include <asm/hardware/edma.h>9 n* X& ]3 F; P7 D/ Q
  40. 4 \* `0 N# E1 y
  41. #undef EDMA3_DEBUG3 z( t: ~$ K: g+ O* b2 `4 H0 M
  42. /*#define EDMA3_DEBUG*/& X. G/ k+ s1 w: x
  43. ) \- ?1 M2 C) N; f) K
  44. #ifdef EDMA3_DEBUG$ F1 M/ L: r+ D2 m$ M3 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ c/ D  I& D7 c1 E- ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) J8 x- j) Z% V0 _) \$ F- u' J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 k% [3 y# h4 O; ]1 y4 ?
  48. #else' T3 E3 ~/ W/ X( W% h
  49. #define DMA_PRINTK( x... )
    . I& W9 ~# \; m0 p5 V
  50. #define DMA_FN_IN
    * V" F. P5 {4 x  R* {
  51. #define DMA_FN_OUT
    : S# u! J6 Z/ I+ d% n) g+ }# t
  52. #endif
    5 ?; S/ d  z/ h
  53. % ~8 K7 d7 A% H  b+ }$ t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 Z9 X$ M; Q) C+ ~
  55. #define STATIC_SHIFT                3
    ) m' l7 g4 X/ X  E. c; l: Y" ~
  56. #define TCINTEN_SHIFT               20) y" ^. A1 X4 {) f3 F
  57. #define ITCINTEN_SHIFT              21
    * P: T5 l  h7 c6 F& h
  58. #define TCCHEN_SHIFT                228 h$ z3 M0 k7 H$ e& x
  59. #define ITCCHEN_SHIFT               23& b& }+ A) Z) j
  60. & d: ]  ]. J3 M/ n
  61. static volatile int irqraised1 = 0;4 I/ o9 [: o; e( n
  62. static volatile int irqraised2 = 0;
    & J% v6 l: V4 E/ L9 A
  63. / a+ ?. F4 t/ ~' r4 x  W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" G+ f2 v% J+ F5 [" Z; p& i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 M9 |8 _: L: Y4 l# a: v- \, z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 {, g, ^$ }5 \) G8 w9 i3 V) @
  67. 7 [+ V, F4 b* h! ^0 }! E- i0 c7 w+ ^
  68. dma_addr_t dmaphyssrc1 = 0;6 \8 L  n% d# e+ n2 ?% a
  69. dma_addr_t dmaphyssrc2 = 0;. ~! a4 t# Y, n- a8 R7 ]( \6 d2 @' u
  70. dma_addr_t dmaphysdest1 = 0;. V5 b1 ?0 D# z1 H4 Z
  71. dma_addr_t dmaphysdest2 = 0;
    1 f9 E6 o' a* `* f% M

  72. 9 m1 i8 f+ N) q9 C9 w( A$ h" j
  73. char *dmabufsrc1 = NULL;6 w* C' y0 d6 w4 p1 o( h) |4 }
  74. char *dmabufsrc2 = NULL;
    ! w# ?$ K9 H7 V( `4 ?
  75. char *dmabufdest1 = NULL;
    ; v- U3 @2 c: j6 }# N1 F6 n
  76. char *dmabufdest2 = NULL;
    * ^* u' T1 h, R) z1 ]8 d3 O2 b* H

  77. # r: C+ i" M0 b/ Y9 O3 B  m4 w
  78. static int acnt = 512;7 {: c9 c, U$ w
  79. static int bcnt = 8;1 \% u1 W: F4 k2 q- b5 V- p
  80. static int ccnt = 8;
    . x$ K4 p- Z4 o/ h6 l/ R  y8 h
  81. 2 Z# o3 b4 M* l1 f: s% d
  82. module_param(acnt, int, S_IRUGO);- G* U$ l- x* S0 E% E% G  y0 g
  83. module_param(bcnt, int, S_IRUGO);
    ) {# o* b/ W1 v6 I; F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* F9 {) U5 C8 B+ r+ z
3 L( [+ }: \  L# t) Z* u+ @3 `, q1 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) r" c3 f. m" C3 }! \3 u7 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 Z& p, v! K0 }2 m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: ?7 V8 s$ B2 {
" H5 Y* n) A; O9 H$ _' ^2 z
' d0 C/ _( g$ a! T/ q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-26 23:35 , Processed in 0.038650 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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