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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# p# Q( l1 S( c9 l
  1. [code]EDMA sample test application
      _3 A! \) N) {! J3 I4 W
  2. /*
    3 s4 g, ^; O7 u$ p
  3. * edma_test.c
    4 A( L( W" S" r( s
  4. *
    $ L( e  T" z, R$ @& }
  5. * brief  EDMA3 Test Application5 i& R+ k% V. V$ G  H
  6. *# o  b) R# p4 i8 @% }
  7. *   This file contains EDMA3 Test code.
    4 ~4 R; B. i6 J0 S% Y& z
  8. *
    " X& l. i5 ]  d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 b) r4 `/ l) N9 F8 |$ _& J4 J9 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 X  S, u* R( F+ N7 y/ Y: |" m
  11. *         TO CHANGE.( C, ~- ~; H. k. U" o  I
  12. *
    " [$ R9 O9 K* S& [  K& D+ g9 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : x$ N; i; v. |8 K, r
  14. *. j# w0 K6 b* Q; R
  15. * This program is free software; you can redistribute it and/or0 T) E; F, ?5 A% j: G
  16. * modify it under the terms of the GNU General Public License as& f) }# g) M6 u8 p% E
  17. * published by the Free Software Foundation version 2.1 V+ X7 O" R+ _' E: c: H
  18. *! u6 [: n7 |( b/ `: `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " u( D2 x4 h3 j1 `" I2 I
  20. * kind, whether express or implied; without even the implied warranty
    , C+ I0 L" I4 |) S5 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , N: N- e9 C; G0 `
  22. * GNU General Public License for more details.. O9 \9 c* }+ h' L8 |
  23. */
    7 s5 i  v( s7 r6 L/ ?
  24. * ~; f0 ~! z4 s  Q+ ^. _: c+ a
  25. #include <linux/module.h>
    6 Q% @9 k; L9 |; U' x9 }
  26. #include <linux/init.h>( D# H0 }, {! r& W
  27. #include <linux/errno.h>
    ' b) ?: c, W& u2 D1 `
  28. #include <linux/types.h>
    ( s  `1 c: E% ]$ N& c( K- x
  29. #include <linux/interrupt.h>
    6 r  @2 V# Q8 g5 ]0 }
  30. #include <asm/io.h>) O% @9 ^! ~; r# ?4 G
  31. #include <linux/moduleparam.h>
    0 y# T! p2 S7 q
  32. #include <linux/sysctl.h>
    . M7 o' t6 w1 j2 ^) @& N
  33. #include <linux/mm.h>$ o, F( D4 z# [/ i% e3 E
  34. #include <linux/dma-mapping.h>/ q4 A5 ^. i1 g) j8 w  Y9 ]+ V( P
  35. 5 y9 `# k( N2 e; ^) j
  36. #include <mach/memory.h>* {+ I, {8 E( J4 Y6 x
  37. #include <mach/hardware.h>5 M1 N$ ^, Z: h: N
  38. #include <mach/irqs.h>
    8 v! O) Q/ }/ {
  39. #include <asm/hardware/edma.h>
    ; T. x$ j& J% ]" A# _7 ]% e8 o
  40. / J1 h% v2 x+ W" {
  41. #undef EDMA3_DEBUG
    * \% m8 f3 {5 K, S$ b
  42. /*#define EDMA3_DEBUG*/
    7 ^. w3 j0 A0 `4 F! z

  43. 5 Q* l" W, _. N2 t, V8 ^" ?5 I- n
  44. #ifdef EDMA3_DEBUG4 O+ L: D6 N  `* f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . n1 K) O5 \  {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' V3 s! Z3 ?. o) b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* v$ I0 L$ E9 ^9 y2 D% H. L
  48. #else
    " E8 T0 s3 n! J' o# S4 O2 [
  49. #define DMA_PRINTK( x... )
    4 |# X7 O5 y$ q. _" v
  50. #define DMA_FN_IN
    ) Y; F) B1 o( ^! p8 K  m1 E
  51. #define DMA_FN_OUT
    ' X4 e1 l- k; ^
  52. #endif, ~& Y& G. [* ?% @, M" h

  53. 9 @7 h  I' o0 B, v3 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( V7 C! L) g0 E2 D6 U+ o
  55. #define STATIC_SHIFT                3. J" W: z  V3 j5 r% }' h* O- W
  56. #define TCINTEN_SHIFT               20
    & X9 \: _" s# Y: p
  57. #define ITCINTEN_SHIFT              21
    ! z+ [* _# m# {' L3 s' W9 }) C8 A, y3 c, l
  58. #define TCCHEN_SHIFT                221 K' r0 C0 W. v: l4 g. R
  59. #define ITCCHEN_SHIFT               23
    4 H  V0 p$ Z! C+ D9 s
  60. + P- n, E7 G) C, m  j* i8 `
  61. static volatile int irqraised1 = 0;
    % Z: g8 ^# k3 a6 B% r9 k
  62. static volatile int irqraised2 = 0;
    % w& B/ Z2 Q0 f* z1 O' V) E
  63. 6 w4 Q3 R- f3 P) e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ G( {1 |/ w: a+ x  ?6 S# L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ?. L# V) ~" E+ K+ F+ m8 x8 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " P" @1 e5 k0 [. e& Y; U8 B) G" C! s/ C
  67. , B$ w$ `2 a3 c' T3 I* ?
  68. dma_addr_t dmaphyssrc1 = 0;" S4 s/ L2 E3 v' B2 w- m
  69. dma_addr_t dmaphyssrc2 = 0;
    : {! P* C- d' H
  70. dma_addr_t dmaphysdest1 = 0;, R* G3 T! a. G3 N' z. T" R
  71. dma_addr_t dmaphysdest2 = 0;0 r0 d+ K0 {, M  j, U1 w! u
  72. 8 g( Q3 p- u! t2 ?& p1 f% M
  73. char *dmabufsrc1 = NULL;
    9 |4 a  h1 d! D# X" `& B: O' I! O9 _
  74. char *dmabufsrc2 = NULL;+ Q6 ^' ?, {/ E- ?
  75. char *dmabufdest1 = NULL;
    * L$ ~9 k) `9 y* }9 t& Z; D
  76. char *dmabufdest2 = NULL;
    : M+ f6 |: Q- J# R( g! h( s# J: C
  77. 9 R4 W% D! n1 C
  78. static int acnt = 512;
    2 ^# B5 A! J+ K7 A, w3 A6 I# j
  79. static int bcnt = 8;. G+ V6 x- |- K( y, _  n
  80. static int ccnt = 8;
    , m) z8 B: \! O, Y" V8 w0 q

  81. 8 s, ~% x- w+ E- p! x
  82. module_param(acnt, int, S_IRUGO);
    * a/ J2 E3 z- n' a. A
  83. module_param(bcnt, int, S_IRUGO);
    , M; u& Q; s0 }) ^) X5 n0 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 X1 E& {$ Q# ?* Q
5 j( Q" S0 |2 B. i5 `( x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( j1 i" m0 e2 x3 ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& L; U7 m  A* v6 y) {9 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  E3 X) N8 _4 Z/ h1 \8 o6 A+ R$ ~3 q7 ~& l. k1 c+ V- f8 s

* X4 I1 T' Z% w. u+ D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 02:40 , Processed in 0.039055 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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