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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' C  c" u; Z9 ]7 y
  1. [code]EDMA sample test application5 j) k  J5 d  r9 L
  2. /*
    5 U9 V. o1 Y# r( [# M
  3. * edma_test.c
    ; W. w2 J+ b/ n# ]5 r
  4. *( m  y6 ]5 i5 p' l+ T, p; {
  5. * brief  EDMA3 Test Application: x( e5 i  b3 S. r3 E8 g
  6. *
    # V5 D, ~: ~) B2 [9 ^# o- K/ b
  7. *   This file contains EDMA3 Test code./ F, I/ B2 D4 w$ X1 N
  8. *; d; i4 @7 u  q6 Q3 O& K1 L. S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " R/ `/ f+ T0 e' J8 p6 ~9 z& i/ w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! z0 ?+ {: g$ a2 g& O9 B$ M
  11. *         TO CHANGE., w) {% M% Q0 ~: ]0 P, l6 H
  12. *
    & L: _+ Z( n! g" L# G& d3 v; f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * Z$ I8 W9 c4 r0 O% A1 L1 o
  14. *% q3 v- p( V  A- ?& h
  15. * This program is free software; you can redistribute it and/or' j: F  Y- l- Y
  16. * modify it under the terms of the GNU General Public License as
    : S# A' L" c2 Q2 o0 S) ]: W
  17. * published by the Free Software Foundation version 2., t3 T5 P1 ?- @$ T% S2 u& j
  18. *
    & S  ]. _! G4 U: u! Q* [  E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      |, M# t! D; n) C# s) I( Q, w' o3 h
  20. * kind, whether express or implied; without even the implied warranty
    9 J+ a0 F5 @+ L( w" Q2 [# g& g6 Z4 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) x0 _: P; k2 a3 Y5 ]5 W
  22. * GNU General Public License for more details.) K, G) `4 ^1 e& _7 C* o
  23. */$ C* p7 b' ]1 }# t* q) ?% r7 C2 F
  24. 4 k! p+ q4 s: A$ x4 M. ?: t2 N
  25. #include <linux/module.h>
    # d* E1 k" ^( }" S7 S2 h
  26. #include <linux/init.h>' a$ X& ?: e% U  j5 }" s; u- R
  27. #include <linux/errno.h>& ^9 u" J  E3 l3 i/ _
  28. #include <linux/types.h>9 q+ `! ~7 I. m/ d' k& `$ L
  29. #include <linux/interrupt.h># R8 F/ i6 h; o: q: i
  30. #include <asm/io.h>. N5 r& E8 y, A$ B1 ~
  31. #include <linux/moduleparam.h>
    5 G' S( u8 c1 z5 q' ^9 Z: X9 q
  32. #include <linux/sysctl.h>7 {- N! L# x) |, ~. S4 A; G
  33. #include <linux/mm.h>
    1 A" [( a" d' c: G# b  `4 J' e) i
  34. #include <linux/dma-mapping.h>
    , j4 M9 ^  y; C- J' B9 X
  35. . o/ Q) B. R; j1 v* n# w
  36. #include <mach/memory.h>0 ?6 A# r+ u; V1 d
  37. #include <mach/hardware.h>
    6 _/ z, I# [% e" Z
  38. #include <mach/irqs.h>
    ( c) x8 ~. z, N0 d7 H
  39. #include <asm/hardware/edma.h>5 G  l  ?) K# M4 n
  40. / h, y6 u5 }6 q
  41. #undef EDMA3_DEBUG# _2 s4 [: w& I  T+ N% x
  42. /*#define EDMA3_DEBUG*/$ E! f8 O3 k# e" O, ~3 ]$ i' ~8 ?0 o

  43. . ~; f# A/ V$ q$ Z
  44. #ifdef EDMA3_DEBUG: d8 n2 u4 n  f9 A, ?- v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). j2 W% p( W7 S5 J, Z) o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( A; g2 Q3 p; D' j+ q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* q1 R5 [$ H8 N. s% b8 r! y
  48. #else5 j4 N. }% L  A$ j+ c) U2 P% i
  49. #define DMA_PRINTK( x... )
    ( W" L5 \* K" {: K' f
  50. #define DMA_FN_IN/ g; X% H: M  d- n# I
  51. #define DMA_FN_OUT
    1 i$ x8 A3 h& {1 `
  52. #endif* L3 m2 ]* W. B% R+ c. ?

  53. ' ^" j6 b8 U0 O1 ]& d5 h$ s) w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 |& ^5 P$ `! H6 {9 @
  55. #define STATIC_SHIFT                3/ V# N3 R9 V* Z
  56. #define TCINTEN_SHIFT               20
    ' P# V2 e* C! Y3 n
  57. #define ITCINTEN_SHIFT              21# c& |" S- M" t$ h' F7 K1 G' G
  58. #define TCCHEN_SHIFT                22
    # r2 u+ i* F0 Y
  59. #define ITCCHEN_SHIFT               236 d; N/ G/ }+ M
  60. 3 Q1 z- l+ s- C" Q5 Y6 ]
  61. static volatile int irqraised1 = 0;9 j4 K& S& Q5 ~) q# [! o3 M
  62. static volatile int irqraised2 = 0;
    1 N7 L/ K6 ~3 s. g' I

  63. + D  K; z4 Y. t. t6 a8 c7 u( a) H- u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 @" u. g- q9 c9 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * A$ K( i! M$ l1 L7 n( J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 A) C/ B* U! m4 A
  67. * C' m6 G$ V) h" N
  68. dma_addr_t dmaphyssrc1 = 0;) a* h$ C& u1 c' I% M0 S7 S+ z. P
  69. dma_addr_t dmaphyssrc2 = 0;# C7 j' j# D( ?1 }5 K+ b
  70. dma_addr_t dmaphysdest1 = 0;# e% ?# e* w5 v! p* m9 x( f0 @
  71. dma_addr_t dmaphysdest2 = 0;' g& F, y+ h. a8 v% ~
  72. 2 p2 D1 Q/ p$ J* k9 L/ H. J
  73. char *dmabufsrc1 = NULL;
    ; i- Q5 o; E+ w: s( H
  74. char *dmabufsrc2 = NULL;
    # g6 A- C5 D$ }7 O
  75. char *dmabufdest1 = NULL;
    $ y7 y. C( _  H
  76. char *dmabufdest2 = NULL;
    8 [( q: x  Y0 b9 ]2 `+ H
  77. ( M4 S2 @( v) P9 B7 I/ r
  78. static int acnt = 512;
    5 D3 [  {* M+ @) p8 D; }
  79. static int bcnt = 8;& J  y% Y7 L0 K  {+ c5 k! k: y) D
  80. static int ccnt = 8;2 e! ~4 ~* G/ p" h8 h0 d+ k) z
  81. ! `# k# Z8 u5 _$ X+ e# e/ t
  82. module_param(acnt, int, S_IRUGO);  ~0 t1 U/ c9 j6 I/ l: o2 n
  83. module_param(bcnt, int, S_IRUGO);' t3 S9 Q% o1 Y7 ]$ \4 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( K$ h7 ~" d& D  M5 H3 v7 D
3 i# v7 S/ z( b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  n# G  u- q8 m4 q$ d+ marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; C* k, @( ~! W& u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" g; p- E8 b! {  k( T: ^$ S4 s0 i0 D8 [

* o; f# @) _  Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 01:19 , Processed in 0.040897 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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