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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : r% ~. [8 {1 F9 o
  1. [code]EDMA sample test application
    ! j! x1 J$ ~( H  h5 y5 T
  2. /*
    " X! z. P" f: h$ J
  3. * edma_test.c1 v5 P5 Q! W7 M' v6 t! {  f$ G  d) F
  4. *& G4 U; l. d6 N5 r' e
  5. * brief  EDMA3 Test Application: ?9 h# v8 B( M5 R. I* K7 T1 C
  6. *' T3 M$ A* @# |7 r( s/ Q: z- {
  7. *   This file contains EDMA3 Test code.2 ~7 k6 z0 w% E: Q
  8. *7 X* n( D8 s6 T/ w4 F# v: A$ u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* X0 k) @, [9 l  F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 C, p% Y2 V4 f) S5 g$ Z  ^2 B
  11. *         TO CHANGE.
    ) L6 \; {7 z9 B6 c" d9 ~+ L+ U
  12. *
      Z. O0 q0 I  q! V1 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - M$ z$ \/ }% g
  14. *
    3 J( N( W/ }$ ^' h
  15. * This program is free software; you can redistribute it and/or: T; G0 j' a9 d( g
  16. * modify it under the terms of the GNU General Public License as
    & h) H4 T' y5 H, D' ^9 W9 N+ y
  17. * published by the Free Software Foundation version 2.% ?1 D. u" I& Z
  18. *3 Z! d0 W5 p# w7 e/ A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; r1 s! ?3 D9 x; f" V& Y) P' }
  20. * kind, whether express or implied; without even the implied warranty) a: l" N6 s+ `8 s8 I4 `4 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: [, e' d+ ?( o  \# W. |/ T; R
  22. * GNU General Public License for more details.
    ; c  J* u- S4 g% R
  23. */8 a3 Y" ?- C, |' p8 V
  24. 4 p/ Z3 X9 q  o
  25. #include <linux/module.h>
    & }: u% u2 G( g( o9 g  _1 C
  26. #include <linux/init.h>
    5 n5 H1 ?2 K, J3 C" [
  27. #include <linux/errno.h>
    * q- h/ e) C+ E
  28. #include <linux/types.h>. o! Q( E7 ?2 O
  29. #include <linux/interrupt.h>9 `* ]* l, t% x8 D2 X% n2 |$ I9 ~
  30. #include <asm/io.h>( I. n9 {# b  ]7 ]
  31. #include <linux/moduleparam.h>
    ; H2 a+ _. E0 y6 Z
  32. #include <linux/sysctl.h>
      R+ C  ]" T' U( Z. H
  33. #include <linux/mm.h>
    5 }. b1 Z' s3 [3 z7 N2 S
  34. #include <linux/dma-mapping.h>$ T5 {$ W* r/ s6 U: h

  35. / E5 P, ^4 o6 M( ~
  36. #include <mach/memory.h>6 d8 w+ h: `4 D% R3 H" o
  37. #include <mach/hardware.h>
    7 o' G7 ]( x: v$ H: N: O& b5 D$ }
  38. #include <mach/irqs.h>+ |% n  U: I' l9 J9 ]8 e
  39. #include <asm/hardware/edma.h>. e! T5 l+ K, `- ?. [7 o8 o

  40. ! n( v8 N5 a* _3 J  B4 J
  41. #undef EDMA3_DEBUG7 Z, x: t7 c; s% u9 ?
  42. /*#define EDMA3_DEBUG*/* ]  E9 ~* k# _0 O' C
  43. ! ]: i7 U6 ~% _1 D% [5 y. m2 R+ h
  44. #ifdef EDMA3_DEBUG6 R0 A) V) O- a7 Z" v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): M* `# ^5 q" U& ]" b9 D. ?7 j8 W" ]9 j% ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ V6 m4 |* G4 c$ A; e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) t- g! M& b. u% u" V3 \
  48. #else5 H/ P/ {$ c7 F  A; p
  49. #define DMA_PRINTK( x... )- u; `# g6 U1 D- O* q( b
  50. #define DMA_FN_IN
    7 v; x) l3 N; l( \' P& m9 |% L
  51. #define DMA_FN_OUT
    9 F+ z" e( p3 T+ y( _# h6 ^
  52. #endif
    9 |: K, O" @9 P" ?$ T5 b& M+ Y

  53. $ t) W' K. ?% F/ u4 s. q5 y, L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . o8 k! ~  ?: R( \9 M  r( \8 Z+ {/ D
  55. #define STATIC_SHIFT                35 I4 r/ a" B- k2 l" o% C5 M/ a, p
  56. #define TCINTEN_SHIFT               20# m! G5 x# a; a
  57. #define ITCINTEN_SHIFT              21
    & P3 O5 t. I9 @' o
  58. #define TCCHEN_SHIFT                22
    ) C% I7 C5 j6 I
  59. #define ITCCHEN_SHIFT               23
    * n) p- e  `8 Z# R

  60.   |2 _6 x! a1 ^; e
  61. static volatile int irqraised1 = 0;% J$ P0 o6 c3 W
  62. static volatile int irqraised2 = 0;
    ' L; w# ~, K  c6 ?. p6 D
  63.   r0 ]. ]2 J6 l* ~, V  h9 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 {6 |- `! ]- D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & D, U: t) A9 `$ j$ n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 o0 e" J+ ^6 k8 C/ e4 W

  67. 4 l# ~+ ^* @% ^# x: e
  68. dma_addr_t dmaphyssrc1 = 0;* o  x: D4 f( K8 h$ @
  69. dma_addr_t dmaphyssrc2 = 0;# t: V7 i4 V$ ^2 h" V
  70. dma_addr_t dmaphysdest1 = 0;
    2 M7 t1 \+ O+ r7 h, G% h: V% i
  71. dma_addr_t dmaphysdest2 = 0;
    5 h( }2 z( ~# c4 B: e0 ~/ L
  72. 6 m# s5 e* Y  Z0 j- b
  73. char *dmabufsrc1 = NULL;
    1 G+ k0 X- G2 ?1 M) K& D* z
  74. char *dmabufsrc2 = NULL;2 B9 [/ R( h  l. k
  75. char *dmabufdest1 = NULL;( q  j4 M8 F  c/ l( b
  76. char *dmabufdest2 = NULL;
    % a  O1 |3 H0 t9 v

  77. 6 t! m$ F0 `$ `9 ?. w. i9 t" n1 ?
  78. static int acnt = 512;
    5 o/ t  [& _* _* Z
  79. static int bcnt = 8;& ~" `4 D- G1 v  G9 z: j, i1 F
  80. static int ccnt = 8;
    9 ^0 Z" D) b4 s9 ]

  81. 0 r  c4 f' P  J' n7 k4 n* l/ u8 H
  82. module_param(acnt, int, S_IRUGO);
    5 E5 E6 ]" K( G# ~* \7 x, Z
  83. module_param(bcnt, int, S_IRUGO);8 H) K9 L% W9 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 @1 {5 J* v+ K% o  A1 ]( _
6 Z. }2 R$ B& M* U8 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( z) ^4 y2 G4 k5 Q# k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: J( m5 [, j# F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ J3 P5 l+ Y( }3 I/ d" T4 a( u0 X" O7 P

. v% q6 z# W8 u: Q1 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 23:50 , Processed in 0.041470 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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