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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 z$ A' f/ e6 i1 R2 Z8 X
  1. [code]EDMA sample test application& I  b- i( j8 X) C  p
  2. /*  K5 O8 ^% Q1 c6 ~) U/ p: l) P: n
  3. * edma_test.c
    4 v0 d6 r2 X. v: E; Q+ P
  4. *
    1 j3 ?% U/ ~" f+ `# M" {+ E* @4 V
  5. * brief  EDMA3 Test Application. q- r- M4 r9 a( R$ Z% Q0 N3 j
  6. *0 M; h+ T% d5 X% m5 s, @9 X# K
  7. *   This file contains EDMA3 Test code.6 a2 I1 C. P/ \1 \% V
  8. *
    ; _  y+ c4 u: w/ {$ Z6 e# v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ f6 Y& L' ~$ k; g7 d( n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + Q) m6 u  ^6 }  X- u6 W8 f7 t- l7 t3 K
  11. *         TO CHANGE.. b  N# M. Z1 A7 v2 O
  12. *
    - ^: E4 @( Z% j# }( T. x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 _" t: x6 M1 D9 m0 O3 O' c7 a0 N
  14. *
    : ~2 g; h. v  f+ b
  15. * This program is free software; you can redistribute it and/or! I4 k& z* x# x3 @1 H; H
  16. * modify it under the terms of the GNU General Public License as& q) Z0 r9 G6 @
  17. * published by the Free Software Foundation version 2." g) n, {, [" L1 m3 c' u, p
  18. *. ^) U1 S1 M" I4 i7 [+ {) a% Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# e' [* i. z* e6 W1 v' r8 A
  20. * kind, whether express or implied; without even the implied warranty
    8 P7 ~) h7 Y/ _4 d/ F/ A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' i! Y# Z" S" j# C7 t
  22. * GNU General Public License for more details.
    ' R+ @4 k! |9 t$ F$ G3 q
  23. */# A0 `1 v$ x; q
  24. 7 h$ U8 X: a6 @5 @- e+ L6 e+ V" F, A" X
  25. #include <linux/module.h>
    # Q8 H0 v8 \( y# H9 |3 y8 i
  26. #include <linux/init.h>) f$ B! D1 R) L. n
  27. #include <linux/errno.h>& j7 |- x+ `& {1 ^+ }; ~  ]
  28. #include <linux/types.h>+ I6 ^$ F( d8 A$ H  c: _! }
  29. #include <linux/interrupt.h>
    $ Q' ^) i3 h7 X$ i$ ^
  30. #include <asm/io.h>, P! A& A  A5 M$ c0 s# H
  31. #include <linux/moduleparam.h>
    5 O/ y' N, w+ ^2 b) X4 l
  32. #include <linux/sysctl.h>
    / H- y/ L2 ^$ J+ B, F
  33. #include <linux/mm.h>
    : R0 A0 A; d" }, K& ?
  34. #include <linux/dma-mapping.h>
    0 s5 b7 {2 Q+ \2 O2 o# Y9 U

  35. . N( ^" R4 V/ U& O# n% f, o0 H0 v
  36. #include <mach/memory.h>* j; q. ]6 C1 i0 A: i/ }4 g* q/ O$ ?7 U) q0 \
  37. #include <mach/hardware.h>
    " B* e) J% \9 }; p8 p5 ^0 W
  38. #include <mach/irqs.h># ^# i! ^  r$ p
  39. #include <asm/hardware/edma.h>
    7 F5 Z( Q, u" h. q, H+ W
  40. 0 J1 y- U& Z! V7 f8 e! n3 s
  41. #undef EDMA3_DEBUG7 F+ M! L( H9 I3 w( f8 D9 E
  42. /*#define EDMA3_DEBUG*/  |  v0 r8 Y2 _& b7 z
  43. 3 S/ W$ |" @/ V9 F4 W0 T! _
  44. #ifdef EDMA3_DEBUG
    & v  U5 l. d; i8 W/ |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & b3 H4 F. C2 J2 ~) S: X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 C. N. i) s0 q( J9 |" U' c2 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * x* V  x+ B3 A1 i# ~. ~! b
  48. #else3 G- X& n2 f1 b; M: N; @
  49. #define DMA_PRINTK( x... )' r' w7 C  r$ w- p# U
  50. #define DMA_FN_IN
    . E' e/ n1 @- J. A2 u
  51. #define DMA_FN_OUT
    3 y% i$ {1 S( E' o/ `8 q- ]0 m
  52. #endif% x5 o( @: J% W! W0 z+ P' x( W
  53. % G/ q' |! g2 o9 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ Y& r& ^$ ?) e6 H
  55. #define STATIC_SHIFT                3
    - C* m6 i: }* [* d& _( ?& _! H
  56. #define TCINTEN_SHIFT               20  b3 h% T' k" ~
  57. #define ITCINTEN_SHIFT              21
    # K/ S% J7 ]0 H, {0 d# i: e" y2 V0 B
  58. #define TCCHEN_SHIFT                22+ F: f$ u- b3 x) o
  59. #define ITCCHEN_SHIFT               23) a' G2 q4 c5 F& ~' g9 @5 k$ q2 R! H

  60. " `7 k3 e0 L+ q3 T8 Z2 Y
  61. static volatile int irqraised1 = 0;! s! R  L5 U' F/ u4 g! F
  62. static volatile int irqraised2 = 0;5 k2 r2 j6 R, ~3 `% z" W) l+ v2 `

  63. ( X* Z/ v0 N+ }0 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  c" y) ?* ]/ c3 z2 O) x5 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # x% o: V' m7 c" T6 Z  X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - G) N! \7 \/ C$ ?
  67. / l& j& p6 G- W% p" Q* e8 t
  68. dma_addr_t dmaphyssrc1 = 0;( F9 L0 d! s# D  Y8 ^6 h
  69. dma_addr_t dmaphyssrc2 = 0;; A6 Y" }' L! M/ q* G$ G0 `
  70. dma_addr_t dmaphysdest1 = 0;
    3 H9 I! p" Z2 W& ~  w! |
  71. dma_addr_t dmaphysdest2 = 0;
    % V" d0 M4 Z* L' ?6 A& b& G8 F# N

  72. " c: D# D& o% o
  73. char *dmabufsrc1 = NULL;
    5 t2 S& h" l1 r2 D+ H+ ~2 F3 Z
  74. char *dmabufsrc2 = NULL;, r5 p8 {3 J) R% Z1 ?% g
  75. char *dmabufdest1 = NULL;
    # `* M4 C0 A" r/ s1 r
  76. char *dmabufdest2 = NULL;
    ' E' v* G5 \, \. N$ N  s

  77. * U/ H0 q+ X; J$ _; n+ n, B- q
  78. static int acnt = 512;
    1 V2 a/ F) D' q" x
  79. static int bcnt = 8;$ N) S! H. b2 _7 H8 L
  80. static int ccnt = 8;3 n( b  \; y' K" _7 X

  81.   y* r; K% J" r% V' a) h/ F
  82. module_param(acnt, int, S_IRUGO);; u1 H4 G" R' `: S# {6 O( V
  83. module_param(bcnt, int, S_IRUGO);$ h5 L# Z/ u6 }% _$ p0 o: ^9 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 }/ I' T6 L, x. Y$ e; e
& n6 ^$ s. u! |4 b) `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& i. D) v2 V3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ g2 f0 |' N6 {: R2 W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) @5 \9 N" g  X) G2 f( v

$ @7 R' P4 C* u8 D5 y9 U+ ~" p  x: m4 f2 K0 b9 G, |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 01:07 , Processed in 0.039171 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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