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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) q3 F9 o% [. D/ u
  1. [code]EDMA sample test application
    " C8 c+ [0 v1 D7 O
  2. /*
    ! l* r) O+ M- y% e# S, Q( Z  i8 u( p
  3. * edma_test.c
    : E& v3 o$ C. X% O/ c% C% _! i
  4. ** v8 S- F' U+ P# P- @7 y
  5. * brief  EDMA3 Test Application% _2 k( z3 K- J
  6. *& W5 w* g: Z: X+ l
  7. *   This file contains EDMA3 Test code.$ V6 }7 e: q$ O
  8. *
    & J  {0 h9 L+ P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; Z: l* Q  H5 o+ _" v* c( D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( Z; b" W1 ~# z! U7 g: Q) W
  11. *         TO CHANGE.  \/ y# b/ G, t7 Y- t  x' J( R
  12. *
    2 i" Y9 W2 E6 B. y. B+ Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , J7 |4 ?7 O$ `+ T7 U
  14. *# S; T4 O/ f0 \5 P% u! z
  15. * This program is free software; you can redistribute it and/or$ v9 k- e2 u' O/ j4 C( i
  16. * modify it under the terms of the GNU General Public License as- V6 T1 k. X4 q) G  p2 b& d7 G% }
  17. * published by the Free Software Foundation version 2.7 b) i5 ?+ X9 Z0 }
  18. *
    # Y+ z7 O8 k9 j5 o1 [+ d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! V7 S9 Q7 z) h1 z. @* k4 D  _
  20. * kind, whether express or implied; without even the implied warranty
    " ~1 U+ F4 q" r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& {! e7 y9 n1 t. U1 L
  22. * GNU General Public License for more details./ p% C6 @) s9 w- i4 _0 d2 R5 s
  23. */
    ( L" H4 q* r$ T! g" A

  24. 6 T* L" n( Q4 K. h$ v3 U7 a
  25. #include <linux/module.h>% K7 i% ~3 z  Y$ H: E
  26. #include <linux/init.h>
      Z4 r4 ]5 [9 y6 ^' [
  27. #include <linux/errno.h>
    + s! ?" N. T2 e5 _7 `# j, [
  28. #include <linux/types.h>
      a  z$ C: i! p+ f' H
  29. #include <linux/interrupt.h>
    % F2 U  A4 L* p3 S1 t7 T7 {2 Q
  30. #include <asm/io.h>
    + T% z7 c6 W% b% k3 {
  31. #include <linux/moduleparam.h>9 L. v4 s; Q( o( A3 O/ U
  32. #include <linux/sysctl.h>/ M! c8 P  W7 C' z! Q1 o& N
  33. #include <linux/mm.h>
    $ w3 V$ Z& S( Q- [
  34. #include <linux/dma-mapping.h>
    / B& }5 P) y) ~) q! M2 G& Y  ]
  35. 4 i: K) J: z) y# v9 P; e
  36. #include <mach/memory.h>$ b/ X4 O0 `- r* F
  37. #include <mach/hardware.h>- }  @/ r3 z! {+ ?  B
  38. #include <mach/irqs.h>; B8 ~7 l& c2 N( u
  39. #include <asm/hardware/edma.h>) p/ c: |$ x9 C$ G. o; s9 `* b

  40. 4 c; S" M. ~: b( M. o6 @
  41. #undef EDMA3_DEBUG
    . a9 {8 A& c0 G2 c$ R0 |# g
  42. /*#define EDMA3_DEBUG*/0 _1 D8 v* m4 m3 _. J, Q
  43. , K, N  O+ _* ~6 W/ [6 C
  44. #ifdef EDMA3_DEBUG4 E6 B% f' v0 J  F- a, D6 u! ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! j9 f) p6 s: _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % Y8 `" O% V9 |" _( e( g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 ], W  |, w8 f0 Q
  48. #else% |  c, |* f+ d7 {9 f
  49. #define DMA_PRINTK( x... )
    " ^- g1 r. n' E1 X
  50. #define DMA_FN_IN
    : ~7 s, P/ f% U4 b1 t& G
  51. #define DMA_FN_OUT
    * J& N& O. Q, H" B: t8 X
  52. #endif
    3 T/ E2 p+ |4 F5 A5 ~& z) @

  53. $ i$ V% C# C* U( W% ?+ ^9 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 n% D) `+ t' s! Z3 I! x( c
  55. #define STATIC_SHIFT                3
    , [; a. I3 j/ v) o
  56. #define TCINTEN_SHIFT               209 x4 m! W( {" O$ N
  57. #define ITCINTEN_SHIFT              21
    9 k9 z7 Q5 y, Z  f; p- y6 B
  58. #define TCCHEN_SHIFT                22
    4 Y: P- a1 k  T8 z
  59. #define ITCCHEN_SHIFT               23" T3 ?# O' _4 K) N  |8 F) l

  60. ( j. n0 s; f1 {: e3 ]; ~
  61. static volatile int irqraised1 = 0;7 P" x/ v. G( \5 T& l) B4 {& n
  62. static volatile int irqraised2 = 0;
      P& x9 V7 i9 Q8 L
  63. & C; C' i# o1 R& @9 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 L# ?2 ^5 k( w' }9 L4 w4 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! C2 Z2 E: h- ~0 A  E4 K: B- u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, s: K: g% b. X7 U- u' w3 t
  67. 9 `* @- U0 Y) L9 \7 p8 G; s; h: j
  68. dma_addr_t dmaphyssrc1 = 0;- i6 p3 ~% Z$ T
  69. dma_addr_t dmaphyssrc2 = 0;
    3 t% i9 D- j4 R$ Q/ _
  70. dma_addr_t dmaphysdest1 = 0;7 D7 z! k8 f# X: K8 ~
  71. dma_addr_t dmaphysdest2 = 0;
    ! j) h6 I+ K/ l0 Q

  72. : d: t6 c) r* F- l+ d
  73. char *dmabufsrc1 = NULL;# Q- q" P) I% [/ V4 e/ \3 C
  74. char *dmabufsrc2 = NULL;
    % N& w4 W0 S5 T0 G3 d5 i
  75. char *dmabufdest1 = NULL;# \: `; |( p) u) J" N, B% P
  76. char *dmabufdest2 = NULL;
    , M/ E: r0 K9 q$ W2 Y6 Q
  77. 7 i. Q. r/ w9 X7 T/ t# Z1 g# J# C: Y
  78. static int acnt = 512;
    5 f! [0 w# X: }: c" \8 C- F( b
  79. static int bcnt = 8;* s- I: P- ?- r+ V- O; ^" J
  80. static int ccnt = 8;
    ! b: v5 z7 U% [/ z2 d. Q9 Z7 r

  81.   `  U* p% G; \# C8 H
  82. module_param(acnt, int, S_IRUGO);) x5 ~: U. @( K9 |8 }& A
  83. module_param(bcnt, int, S_IRUGO);
    8 A( O! _* ]6 u5 h) c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' t/ w) p% [2 h
; A+ o4 c* k5 O2 ?) N: B, L' P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  K0 h. f: X4 a; z  h4 g2 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; o, `- n7 f! {( p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& B2 p- j$ Z- q# b, Z: X1 p1 B$ h9 ~2 D, T/ \1 X( F, n  J

$ }5 |) W( o/ E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 15:57 , Processed in 0.040830 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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