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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 k" U2 d9 W# a3 o* e# V
  1. [code]EDMA sample test application5 E: G$ k7 L' D3 Q
  2. /*
    ! |9 ?' L- v- i! j9 z
  3. * edma_test.c+ m% V1 y& B$ J) F6 b4 L5 O3 j
  4. *
    , A5 K. N3 q- @1 X
  5. * brief  EDMA3 Test Application& ]( v- f* k% I' h' y; g6 e7 P. J
  6. *
    7 r$ L" t6 F9 L
  7. *   This file contains EDMA3 Test code.( R0 B  v3 |! R2 N4 q: l
  8. *' c9 ]) s& {! R# r. \  c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 c5 U5 {; ~( P, v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 H; p/ v3 C4 }* X& E
  11. *         TO CHANGE.
    7 K& r! F. d% t- Q
  12. *  ]$ |" w" K9 d' E) _, R5 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 v6 T: |2 V6 U8 y8 T7 S2 C
  14. *
    6 k& W& [3 ^; X7 I
  15. * This program is free software; you can redistribute it and/or! p  z5 p6 R+ D* [0 ~
  16. * modify it under the terms of the GNU General Public License as
    - F, C5 {7 m  @% N
  17. * published by the Free Software Foundation version 2.
    * F3 X4 g; I6 d6 z1 d/ {$ J
  18. *; C9 n6 I. v' k7 h$ }) L# B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * B  ?3 F9 s$ b9 B
  20. * kind, whether express or implied; without even the implied warranty) f) [( j  P7 l+ n( [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 _/ h3 D! r% N. l& j: i$ b6 c
  22. * GNU General Public License for more details.$ @. g: {7 V9 V! S. u
  23. */
    2 b9 l. O( s% N/ X" C

  24. 7 K7 U' R$ s; @0 |- v- U# S
  25. #include <linux/module.h>  r" o, B0 s1 x) C# j1 B
  26. #include <linux/init.h>
    * [* ?; h+ }6 @4 o/ `' [0 T
  27. #include <linux/errno.h>
    # k* N  ?* G' V+ ]; }) L( M4 k* q# |
  28. #include <linux/types.h>
    ! l+ S, b+ R4 G4 R# f5 ?7 h
  29. #include <linux/interrupt.h>
    3 q8 e* m  e9 b& g; O& l* D- P1 N
  30. #include <asm/io.h>* d; H1 U8 N6 q9 Q' {
  31. #include <linux/moduleparam.h>
    : ]% F2 `% {5 P# M% \6 @
  32. #include <linux/sysctl.h>
    2 ]8 o" R5 l7 A% h& v. q
  33. #include <linux/mm.h>
    8 J0 l, M1 I( e4 P" J' F
  34. #include <linux/dma-mapping.h>
    ! m: e! f9 Q' I; Y5 ~; h- ~

  35. * I  B* j  y7 `: O# m6 k! s
  36. #include <mach/memory.h>
    " \; b( n& p* Y. {
  37. #include <mach/hardware.h>0 z* U6 g' e* H- S8 X- ?4 b# o
  38. #include <mach/irqs.h>
    0 Z0 F. E3 F. Z  h7 ]' s
  39. #include <asm/hardware/edma.h>" D4 }2 o1 i+ {  r2 J' s

  40. ( R/ `2 ^* \9 Q; I! e$ _
  41. #undef EDMA3_DEBUG" U5 Q: ?( \4 i
  42. /*#define EDMA3_DEBUG*/
    " x7 i5 r' i% m: o  |

  43. 4 P% D1 K- e- L  h6 R' h/ z
  44. #ifdef EDMA3_DEBUG9 p+ s* h7 U- X' Z; n/ C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! E5 M! G; ^# A, \' N1 F, V  J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 e( F# }) A6 T0 c6 o; k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( Q7 B' X1 q: a. Y3 K9 L
  48. #else0 m: C8 @% [& h" F5 R. S; U
  49. #define DMA_PRINTK( x... )6 m3 U. e& k- T; ?* Y
  50. #define DMA_FN_IN! ~; L- Z, S6 B8 D2 L5 z
  51. #define DMA_FN_OUT
    5 I5 d6 X0 \4 p* [' o8 X9 k' T4 A
  52. #endif
    : e9 B$ [, S+ z

  53.   h4 Q  r0 b- \' J- X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ O6 D% y% _( Y9 v5 }4 Q
  55. #define STATIC_SHIFT                3' i3 W; f' f$ F$ b/ ]
  56. #define TCINTEN_SHIFT               20
    # B+ f, D7 Z* r! ?/ `+ n
  57. #define ITCINTEN_SHIFT              21" i: r5 p; M( k1 z! r7 F
  58. #define TCCHEN_SHIFT                22
    , w6 K3 S5 ~) Z% @/ [
  59. #define ITCCHEN_SHIFT               23
    ; b7 a9 p" v. }7 O6 F
  60. & d/ T5 a* K# N
  61. static volatile int irqraised1 = 0;9 X8 M$ _9 ]% Z& m% }; d2 h$ e
  62. static volatile int irqraised2 = 0;
    3 C" v; O' _% l9 l8 l

  63. . b' `) A$ H) @) t+ |/ T5 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 k5 q+ ?" x# `( s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " e1 H+ b8 n' J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 Z+ q) M. d0 i! _& x

  67. ' Y3 ]& R, B0 N3 }/ T
  68. dma_addr_t dmaphyssrc1 = 0;7 Q3 `1 b; B! q0 J2 b
  69. dma_addr_t dmaphyssrc2 = 0;; B. E0 u: P& ]- m$ k5 Q* C: c
  70. dma_addr_t dmaphysdest1 = 0;
    / s+ j" H- f1 E5 y; c
  71. dma_addr_t dmaphysdest2 = 0;: }& R! _; l7 f7 d( M

  72. 3 ~& L5 r/ O6 b! J( m
  73. char *dmabufsrc1 = NULL;
    3 v8 H) K# A2 N( t2 L' _
  74. char *dmabufsrc2 = NULL;
    : [; X' g" ?3 C8 t1 R0 `8 V
  75. char *dmabufdest1 = NULL;) q5 j$ t! ^7 @4 ~- C2 {0 z" B
  76. char *dmabufdest2 = NULL;
    $ S( j* E; y1 D% z7 c/ D
  77. * c7 s% o& [! E0 @( y* U
  78. static int acnt = 512;
    / N. ?; `8 B1 k: G+ b8 C' v
  79. static int bcnt = 8;; w0 f8 f6 \4 A9 f* o
  80. static int ccnt = 8;% h9 {$ [( O# s6 y! {) Q( K9 {9 k

  81. % A  A* k7 `0 u3 u0 I
  82. module_param(acnt, int, S_IRUGO);
    1 p5 t1 W; O2 t# f( k. X/ ~
  83. module_param(bcnt, int, S_IRUGO);/ K  L$ ]% Q. Q2 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 `0 N. O# h2 |$ j$ t: a' n* r5 q! A  U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 ]; D3 ?- j+ {0 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ L1 \/ y1 H; w) F: I8 q; l+ c1 B5 B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 x2 R" i# |* }9 R! H/ z2 Z

# y& I/ e: f& C" Y$ Z. H. |( F( A% _5 |! y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-23 12:02 , Processed in 0.040168 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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