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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * u7 J! U% W& G; Z, R2 z+ ^' T
  1. [code]EDMA sample test application. e. ]+ H6 f1 I% \, J; u
  2. /*" A& |/ G% ~: W7 e/ V
  3. * edma_test.c
    4 M# ?# V6 v4 v8 A% [, h& q5 J
  4. *
    % H% W8 n/ P7 r4 e- ~8 T8 }
  5. * brief  EDMA3 Test Application
    # s1 y  o5 M/ {3 ^2 ]
  6. *2 c+ y. x+ x7 l0 \, O3 z
  7. *   This file contains EDMA3 Test code.$ _7 A; `: K% U8 Y6 z
  8. *
    ' L. T% ~; {* r3 ?# }; H; ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( c2 U& t& x% X; `  n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; x% U4 j1 [6 k) ~! c1 N  J* O
  11. *         TO CHANGE.
    ; {. \- ^# a1 u. m$ R  g, M# S% |
  12. *
    0 C  r7 I2 a. S$ B. M8 I. q2 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # X9 F! i% T3 h& ^
  14. *1 C7 U' z: K7 V
  15. * This program is free software; you can redistribute it and/or1 K8 Y8 I7 J* S6 E
  16. * modify it under the terms of the GNU General Public License as: l1 f$ ?4 M1 ^" _. Y+ e" i$ `
  17. * published by the Free Software Foundation version 2.
    8 M# m& ?4 {  s6 r  A
  18. *8 N3 N$ L2 g5 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 \9 y. N* Q# B, B% |# L# v, r
  20. * kind, whether express or implied; without even the implied warranty
    : o! W5 v# T' E; g( Y$ L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ E- f1 \1 T* A$ R7 _
  22. * GNU General Public License for more details.5 K9 O* `2 }& q! n7 `6 R4 D
  23. */
    ( r0 E+ |; u4 q/ u* w- Z
  24. % Z2 h( H; k! K& V$ y6 E
  25. #include <linux/module.h>
    # c/ l# w& r- g& Y
  26. #include <linux/init.h>( E4 D2 a; j4 d' f
  27. #include <linux/errno.h>/ V# X9 Q! X+ l
  28. #include <linux/types.h>3 i8 S4 P5 ^% c+ ]; k+ J
  29. #include <linux/interrupt.h>) [2 u  \! ^5 s9 ^) \2 N2 ?/ Y8 W
  30. #include <asm/io.h>/ o; i  I9 S9 a: F( o
  31. #include <linux/moduleparam.h>- {: [  o; a% Y5 D6 e
  32. #include <linux/sysctl.h>( s( h) |% ]% s1 L1 l
  33. #include <linux/mm.h>) O( H0 s* k: B- n% W, u
  34. #include <linux/dma-mapping.h>( r0 W+ k" P. x6 @  G

  35. / b. F8 N8 o* h& |
  36. #include <mach/memory.h># m- C$ j4 ^) E
  37. #include <mach/hardware.h>
    , c8 H' h* h  B) ^7 n
  38. #include <mach/irqs.h>& n5 r. e9 I! q
  39. #include <asm/hardware/edma.h>) T) N* G6 I" S% ^0 }! ^9 }
  40. 1 m* m; u# ]! a, v; }
  41. #undef EDMA3_DEBUG0 O3 y0 g0 \9 Y3 N6 G' C
  42. /*#define EDMA3_DEBUG*/0 }! R4 y5 Z9 [: w7 X; k6 {

  43. - G7 S$ H! _$ m
  44. #ifdef EDMA3_DEBUG+ Z+ B$ n. x  S- j: D- q& J2 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' g4 z; D, c, [4 ~1 {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 _( j: L7 v& c1 `7 b1 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' |6 r7 [* E6 q% c  Q9 l
  48. #else
    " }! I% y  o& ?: N
  49. #define DMA_PRINTK( x... )
    1 ?: q, g1 G; ]8 ^( Q. ]( e
  50. #define DMA_FN_IN- T- J( P0 `: o0 T& F1 n
  51. #define DMA_FN_OUT
    & N3 n: p) G. A' h$ f
  52. #endif: ]/ r6 W3 u  T. B3 \; ~! q

  53. ) e( F- F7 A0 L2 A/ _8 ]* g2 R) m) m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); f3 S. L# V# U0 k& P
  55. #define STATIC_SHIFT                3
    & i/ F4 e+ s2 u6 r8 ?) @- L! \% r5 d
  56. #define TCINTEN_SHIFT               20
    7 r% |) r7 R7 u' r. {3 q
  57. #define ITCINTEN_SHIFT              21* ]( ~3 x5 B, n& L! e
  58. #define TCCHEN_SHIFT                226 E! e- u" p/ G) H2 h
  59. #define ITCCHEN_SHIFT               23, u/ b/ z! i- u. g: S4 g

  60.   i7 g: h" A+ v" j6 d  D
  61. static volatile int irqraised1 = 0;3 t/ B& a' A3 f9 H- g8 t/ C: r8 e
  62. static volatile int irqraised2 = 0;8 `& D& F2 y, v9 z  [) P
  63. ) w( Q: m: z* o( D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 d* v- H2 Q5 ~  k* i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ t4 u  f  J/ u# r9 M% n  A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 }. G- M9 L- ?+ u) M4 v
  67. ) i3 [; E! {- z! p4 P
  68. dma_addr_t dmaphyssrc1 = 0;
    3 U9 |  W5 g* U/ R3 E3 h/ h5 P
  69. dma_addr_t dmaphyssrc2 = 0;/ Q# \+ w$ w6 l4 z8 u$ I& |
  70. dma_addr_t dmaphysdest1 = 0;! K; c7 w8 Z2 i5 Q# L2 B* k
  71. dma_addr_t dmaphysdest2 = 0;$ _, Y& g6 z) g- \
  72. # s' j0 f! P: ^1 T
  73. char *dmabufsrc1 = NULL;
    9 X. t" w8 V  E
  74. char *dmabufsrc2 = NULL;
    4 A9 R4 Z5 e) \  o
  75. char *dmabufdest1 = NULL;
    ' _2 [, Q+ H; V9 U  X* v
  76. char *dmabufdest2 = NULL;
    6 A- a, g5 q! {2 u3 A
  77. 7 Q: T3 U9 t% Y- o0 {: b
  78. static int acnt = 512;5 o) ?3 S* m: g- A9 i, J+ o4 Z
  79. static int bcnt = 8;
    1 V5 W5 O0 h* J' b8 R
  80. static int ccnt = 8;
    : |- d6 L" N- d' w% @- G
  81. 3 p* E; p' W6 u
  82. module_param(acnt, int, S_IRUGO);4 U) H2 v: e! o) @
  83. module_param(bcnt, int, S_IRUGO);- f% s; S$ u; S1 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' _: o- @; d! S8 R: J' T' p

" Q: r9 f6 l' j, F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: O( Y' S4 \5 c; n: e
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) Y( s& Z, b( w* E3 ]2 E9 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ W) @' r4 s0 R5 `+ v4 U, O4 r

: E3 B7 {& m! l! j/ G/ a5 U4 u3 }$ @$ R3 ^4 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 21:47 , Processed in 0.041141 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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