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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 R  ~% ?, D0 {) p
  1. [code]EDMA sample test application
    : d3 i8 m% u' n5 Q
  2. /*4 X; P6 B6 c( K; s0 k) r8 s
  3. * edma_test.c# t" ?# l- b6 m8 J$ a$ h& X+ W
  4. *  m, c& [" n6 T7 w( H% P# }
  5. * brief  EDMA3 Test Application
    0 q) p; e' _5 `+ J. @9 e
  6. *
    1 P. J0 m1 A( C1 \8 }
  7. *   This file contains EDMA3 Test code.
    , a) R4 [7 G5 a; B* S
  8. *. \7 B1 [& F0 u1 x- y1 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( s/ k; T+ A: e9 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : g7 c& s+ X& j4 r# Q) l
  11. *         TO CHANGE.: b! H( l4 u' Q+ G% A+ v& ^
  12. *" I! e. J6 x1 F! u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 A) B( ~/ _2 V1 `% Z2 y' [" N
  14. *+ z. H6 x* `0 @; r- b' m0 o# b
  15. * This program is free software; you can redistribute it and/or
    ! z3 l3 m1 v5 H. ?0 V7 `
  16. * modify it under the terms of the GNU General Public License as* R* _/ T, b7 x6 f3 I: f" N; ~+ z
  17. * published by the Free Software Foundation version 2.
    / v( N$ L' B" H6 ]4 {: O9 G
  18. *# R- d6 l! @" W4 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ x* V# E0 E" z" C! c: s
  20. * kind, whether express or implied; without even the implied warranty
    $ B" t4 o% y, G' p! b8 S5 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" n9 A0 H+ {6 y4 s( G  Y& T
  22. * GNU General Public License for more details.; s( Y! ~4 I' a8 s" z# w6 T
  23. */. b' k$ o6 k7 ]8 y( C$ K
  24. ' n+ E  g, S$ v0 G9 m3 T5 g
  25. #include <linux/module.h>
    2 B: ~; K  C$ Q0 A3 G# y5 l
  26. #include <linux/init.h>) S0 [" \! K1 v! a, D( Z
  27. #include <linux/errno.h>
    $ Y: ?! P  o& i# F) p- W9 M3 v5 Y
  28. #include <linux/types.h>  t- l, m% v5 i4 Z3 a0 T
  29. #include <linux/interrupt.h>% @2 R0 Z, {/ L  T
  30. #include <asm/io.h>
    4 B, B) A% ]4 ?) Z+ }, @. n  x
  31. #include <linux/moduleparam.h>3 C- l# c% M: F; ]' T8 F6 _' l
  32. #include <linux/sysctl.h>6 e  o! ^+ D8 Q' p8 G4 G- k( e  ?
  33. #include <linux/mm.h>
    * U: B! y" F- L  v" o' X1 s) @
  34. #include <linux/dma-mapping.h>- I# ?$ N6 A- G2 {. J
  35. , a" }: U8 f* B$ J* q
  36. #include <mach/memory.h>
    ' c6 o  J: X( Y
  37. #include <mach/hardware.h>
    # b/ J, R; Z: I$ g, U* {# y$ B: x
  38. #include <mach/irqs.h>2 v3 a4 V" q5 X, U9 s7 F1 Q
  39. #include <asm/hardware/edma.h>
    $ t/ b' K. D# |7 E

  40. ; x, \* l$ _3 q+ }& x* b
  41. #undef EDMA3_DEBUG
    8 j* ^/ q+ N$ x$ o. }  x
  42. /*#define EDMA3_DEBUG*/5 ~. ~/ _0 `3 L4 i- }. f" E
  43. 1 ~% ]. R. f% I( `2 F/ P% _
  44. #ifdef EDMA3_DEBUG" u7 Q5 Q+ _8 r0 C0 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . Q5 q/ L/ O# ^8 k& K* p/ C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 H# f" t! \1 g; ~+ S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 `# d; R8 c/ T2 \% B( h" q5 N
  48. #else
    5 d% ?0 Q4 d1 P
  49. #define DMA_PRINTK( x... )
    * p$ M, }. u) H3 B  a  ^. c. u
  50. #define DMA_FN_IN
    6 h! @. c- w1 A. S0 s6 C  q
  51. #define DMA_FN_OUT
    $ a# o5 h/ u. f1 R1 e" I
  52. #endif; i& g5 G0 z% V2 Y
  53. 7 ~# s$ T( x$ ~  B$ d% B3 K; `1 w7 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! l8 ?+ o# a9 ~0 A) W
  55. #define STATIC_SHIFT                3- g& w' v- k& C( \
  56. #define TCINTEN_SHIFT               207 A2 i  l' W9 b) B4 K5 z8 z
  57. #define ITCINTEN_SHIFT              21. c+ h  ?* Y, X
  58. #define TCCHEN_SHIFT                22, n* o0 x7 m3 O. V( F
  59. #define ITCCHEN_SHIFT               23" i* Y6 l$ N% n6 Q, N8 I
  60. ( J$ q9 p9 ^% y
  61. static volatile int irqraised1 = 0;/ Q4 A4 Y$ J2 k! B8 l% H
  62. static volatile int irqraised2 = 0;
    / J; d! {3 G. e3 _
  63. : v7 E" T* b, {  R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: o1 u2 L% [: T1 V! l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, F8 u+ _6 C' k: O3 i; X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, T7 S6 \8 a  e% ~' I

  67. / i" P% j4 @4 w- `5 x
  68. dma_addr_t dmaphyssrc1 = 0;
    7 ~, X# E, _, n% u! X: Q2 b( X
  69. dma_addr_t dmaphyssrc2 = 0;
    7 ~: C( T2 C. |2 e. z' o
  70. dma_addr_t dmaphysdest1 = 0;
    # s5 X0 e: p# d! Y
  71. dma_addr_t dmaphysdest2 = 0;
    . ~7 X) d2 C8 }
  72. 7 h. A0 N$ Z1 v$ ~2 n% P" G
  73. char *dmabufsrc1 = NULL;( d# j& k* l) a! V" m
  74. char *dmabufsrc2 = NULL;
    ! a/ b" V0 @5 X& c4 ]9 d6 E
  75. char *dmabufdest1 = NULL;
    ! c9 O1 M9 y8 y5 N! O
  76. char *dmabufdest2 = NULL;
    ) ?. u8 H2 l! S" u  g
  77. ( H" O7 R. ]: `
  78. static int acnt = 512;
    0 O2 d1 q: O6 L  J* ?3 q
  79. static int bcnt = 8;! t3 ]3 F% M0 W% U! q3 N, W
  80. static int ccnt = 8;5 E. V* J- b! ~5 v$ ?* z% K# K1 ~

  81. 5 D, z2 v* b9 L6 ^
  82. module_param(acnt, int, S_IRUGO);* o+ ?) e) f2 m" t
  83. module_param(bcnt, int, S_IRUGO);  a8 O/ f! w. W/ i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- `2 A" l+ U8 K
# D7 |3 c6 X: }6 u% J/ J, P) ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  h& K+ Q3 l- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- l( ^8 v& P" u9 G. P$ i- ^! w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. M6 ]4 E, w; t' @) H5 N

& y- J* v8 T4 @8 ]; c5 B# A$ s6 V3 |0 |" h- U& y. v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 12:28 , Processed in 0.040098 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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