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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , m8 y; m1 K, P6 G$ ?0 v' K
  1. [code]EDMA sample test application! P, {- ?! U, E/ Q9 D
  2. /*
    & f" }' U1 B# a! U
  3. * edma_test.c
    ( A2 L  x( K! F( r
  4. *
    * ~* {5 G: N9 J  ^2 K7 P8 z5 @
  5. * brief  EDMA3 Test Application
    * M3 O5 D6 ]3 H; ~
  6. *
    * ]1 f3 I/ m) m7 v& m7 Z* _
  7. *   This file contains EDMA3 Test code.
    3 _* |/ ~* w' b4 m
  8. *
    0 X: w! d* w2 B8 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 o- l. k3 d6 D9 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 a! s/ ?9 K, e7 O6 f- B
  11. *         TO CHANGE.) O- Y9 P$ R; S  X% f. ^: R( k
  12. *: G% o7 `* F4 ~0 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 |2 _1 C3 a8 k" y
  14. *3 S3 D+ D% E3 M2 y/ @
  15. * This program is free software; you can redistribute it and/or; B7 C% k" ?( {: k' N- i7 f
  16. * modify it under the terms of the GNU General Public License as3 g. @% L& h' x$ w
  17. * published by the Free Software Foundation version 2.
    " g# l: A" N3 T
  18. *
    ' g% g: r* A9 h& T2 S. ]+ I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * ]+ c7 t( x% ~
  20. * kind, whether express or implied; without even the implied warranty
    5 C# ?% u& Y4 h7 I- s6 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 x2 n+ B& s* E( [
  22. * GNU General Public License for more details.# D/ V% @2 p0 ^
  23. */
    " ^; r. Q4 Z8 m& r! `: `
  24. : ]7 Z1 n& h& [) h
  25. #include <linux/module.h>9 K4 a9 y- q% P4 N  ?  ^
  26. #include <linux/init.h>
    ! D' N- j2 a: Q+ Q: ]/ X' s
  27. #include <linux/errno.h>' Z2 Y7 S" m8 f4 H- j/ {" G1 B6 L
  28. #include <linux/types.h>. N: }- m5 @2 K* u& F+ h
  29. #include <linux/interrupt.h>7 _$ X) I' o2 t& V7 E0 U* u+ B  e. j
  30. #include <asm/io.h>
    , \$ W) q& ]# j& u- L# t
  31. #include <linux/moduleparam.h>
    9 }) a! I% T  Z( R6 u! z5 h" F* l
  32. #include <linux/sysctl.h>/ s3 T7 D6 V5 u" R( K: F
  33. #include <linux/mm.h>$ b) k. r0 s8 Q$ L. `
  34. #include <linux/dma-mapping.h>
    4 K! O$ @# s- r- R0 s! M# r" K. ?

  35. " P! G) o& h8 _
  36. #include <mach/memory.h>
    : d9 M& I; e& x# Q
  37. #include <mach/hardware.h>
    * ~( ?! @3 \: F
  38. #include <mach/irqs.h>) ~6 {; ~' M) B: C9 |- X
  39. #include <asm/hardware/edma.h>
      A+ A- D6 c) ?  x7 ~& G! d

  40. % R0 G6 f9 t7 _4 E" o: L4 g$ p
  41. #undef EDMA3_DEBUG; U6 y9 ^: }4 ?; h0 @9 I
  42. /*#define EDMA3_DEBUG*/, q' d+ y0 ?0 }. p4 _

  43. $ j3 a3 c  m7 D
  44. #ifdef EDMA3_DEBUG& S! m1 J  V/ B" s6 G5 ^2 P5 Y! Z( s1 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 L/ C: h3 n5 a6 g* f$ }+ |) C% D- y, k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; L0 j% Z) R8 ^# B: X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" B2 @+ v- k' w
  48. #else2 c! i( }: j& m: ]3 ]  _5 @$ P
  49. #define DMA_PRINTK( x... ), `, O! K) ~; L9 X0 c
  50. #define DMA_FN_IN6 r0 h7 y3 @8 E* e. _8 K( M2 w, W
  51. #define DMA_FN_OUT
    6 ~% {1 {% |8 X6 _+ k5 D  ^
  52. #endif
    , m+ J) S0 \! r6 u5 H

  53. / Q/ W; D/ R4 K! Y. ~9 B; l  a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 A1 y3 V+ r. @/ }* ~5 [7 p" C
  55. #define STATIC_SHIFT                3
    5 [8 r- V7 N$ V4 u% K+ p
  56. #define TCINTEN_SHIFT               20
    6 H4 L- z+ B3 s  J5 t9 B
  57. #define ITCINTEN_SHIFT              21
    * ^3 t0 c5 X2 L9 G4 X4 T2 d9 u
  58. #define TCCHEN_SHIFT                228 I% d. w9 c0 Q; {% M; K: e& ]6 B+ a  U
  59. #define ITCCHEN_SHIFT               237 `/ e  M6 X8 c9 Z6 P
  60. 1 Y2 f+ A3 V2 `5 u! [+ J# Y  O
  61. static volatile int irqraised1 = 0;
    ) n# q# V  g& @1 r& x8 e
  62. static volatile int irqraised2 = 0;: g0 ~' h7 e+ y& _* j: G8 G3 _  m
  63. 3 g6 {. z& g. V: ]) T7 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 D+ _. A0 D5 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 }' V/ f4 k4 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 N% s+ X: F' T2 H, I

  67. 7 m- N! W1 ]# M) e5 |+ o
  68. dma_addr_t dmaphyssrc1 = 0;
    4 g: F, d' Y) @' J. b
  69. dma_addr_t dmaphyssrc2 = 0;0 ?  C: W; t5 W! z. r
  70. dma_addr_t dmaphysdest1 = 0;! Y* r$ u: O2 ]2 l! @+ S+ j: u
  71. dma_addr_t dmaphysdest2 = 0;) F8 [" L, S2 p% ~3 ~. g* y
  72. ( e1 V1 v; H$ R2 X" g6 O- M" K
  73. char *dmabufsrc1 = NULL;# f+ M' ?$ c; f1 p/ {* o
  74. char *dmabufsrc2 = NULL;
    6 b, v: L6 z$ \! i; ]7 T2 m% W
  75. char *dmabufdest1 = NULL;2 @* v: a1 P5 o6 I, x5 H* |
  76. char *dmabufdest2 = NULL;' n' j7 H% t4 J1 H: f

  77. * M& T4 Q& q$ n* o, S
  78. static int acnt = 512;
    ; A% Z9 @# G/ S# `2 i& Z! {" j
  79. static int bcnt = 8;
    4 q; e; \( o' Y0 d2 D* X: g
  80. static int ccnt = 8;
    : W' _! }5 ^; Q# A/ X9 M
  81. : T5 A8 P6 m# b( I0 O1 J7 W
  82. module_param(acnt, int, S_IRUGO);, H1 ^+ }% [/ i$ f5 H. q
  83. module_param(bcnt, int, S_IRUGO);: q/ H# j5 v' M) k7 E4 F( d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' I# b# M, X! |' ~0 v
3 x* y" X( E* V" ]5 {* L2 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& c/ i9 d7 ]# e) Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ [% \/ y0 O; |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" s4 l- h8 U" p$ P' b8 P  q* a, z- R$ @# t5 h5 e

5 \# j: k" `4 L$ T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 06:01 , Processed in 0.040611 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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