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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) T( E! Z8 F( ]+ h% X" C# n0 {
  1. [code]EDMA sample test application
    8 C$ C% z: k. Q! \% U7 R; ^& U
  2. /*8 c% A) h7 W( A. L  A
  3. * edma_test.c
    4 _. t  b& d( n" m8 h4 _
  4. *
    4 r0 U4 q3 c4 t3 x. H1 M
  5. * brief  EDMA3 Test Application" U9 c) d2 M* W9 M: U
  6. *
      Z0 M) q5 K  y; j4 G# D/ d
  7. *   This file contains EDMA3 Test code.9 a5 ^5 W8 I" @. z- ^2 x: B' E3 k  B8 K
  8. *
    $ ?& o( h0 h. e/ Z3 O4 C' q9 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( y! t# K9 F5 W- H. }/ t8 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 Q- E4 E6 O# ]
  11. *         TO CHANGE.9 o0 ]1 \5 |3 i( g1 s
  12. *' G) j1 f' x* U, A( w" p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # M% P: a5 N, j( D2 O: Y9 c) e
  14. *
    4 \9 L8 U7 |4 T" L/ |" V
  15. * This program is free software; you can redistribute it and/or
    , \. x3 q# ^2 T3 h6 C
  16. * modify it under the terms of the GNU General Public License as
      i3 {% f( Z) P2 E; |( e
  17. * published by the Free Software Foundation version 2.2 n0 s0 l) ]# ^" e/ G9 j2 |1 w
  18. *6 e$ h2 H" v" {( |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! o% O* L" s: d/ L: }1 Y
  20. * kind, whether express or implied; without even the implied warranty" F- w  O) v4 k8 z' S' C2 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      S" X$ w9 k% T
  22. * GNU General Public License for more details.
    * E) i+ R2 `& R/ O+ E* H% H/ w
  23. */
    6 J) U  Y3 A$ x  I

  24. * Q% t0 @; z3 _/ ~) |
  25. #include <linux/module.h>. V& D) r! o) E
  26. #include <linux/init.h>
    $ G, q/ E" \$ O; o& R
  27. #include <linux/errno.h>; B& X/ s# Z3 }0 t
  28. #include <linux/types.h>7 r# v8 O3 m0 P& ?, B' h
  29. #include <linux/interrupt.h>4 |- f# z9 |/ ^$ l8 I+ w1 \
  30. #include <asm/io.h>
    ! S+ H# k5 O2 f2 S  K3 e
  31. #include <linux/moduleparam.h>: b1 {8 i* d8 Z6 X7 E
  32. #include <linux/sysctl.h>( I0 ~" o! X6 o1 P$ @* D2 W$ f
  33. #include <linux/mm.h>7 \2 W4 t2 A: O8 X6 G" s$ X1 e
  34. #include <linux/dma-mapping.h>  W7 Z" m# C% i$ a7 G0 Q6 n8 E
  35. , x6 S& I$ w, o" d7 p& |
  36. #include <mach/memory.h>
    + v, h1 {/ Y9 Z# A% o
  37. #include <mach/hardware.h>
    - ?. a6 D1 ~1 V- x  ~: K+ v/ @
  38. #include <mach/irqs.h>  z% {6 R& g3 k5 ?* `1 ]' y  O
  39. #include <asm/hardware/edma.h>$ b& M" b. e2 y" z
  40. 7 q6 B/ U7 h% o9 w: y& [
  41. #undef EDMA3_DEBUG
    : w5 Z, h) m  y
  42. /*#define EDMA3_DEBUG*/
    ! V7 {  c0 b  v) ?; v7 R

  43. 7 v2 K* q' Q- E9 u7 ]
  44. #ifdef EDMA3_DEBUG
    ! G0 C: a# k7 R( |7 d- G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( E+ M% P, t5 o; K" ?3 s  D$ L2 t. F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! I- W" c& ]8 X) O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 `& l+ w% c; r  |& {: o) \! k3 ^
  48. #else# s% {! V) _& E
  49. #define DMA_PRINTK( x... )2 l; [) `" v. F( l# ~8 \$ m
  50. #define DMA_FN_IN9 I0 ~% b1 t, v' f) h) T* m/ x
  51. #define DMA_FN_OUT
    / K# B$ x; V3 c& b  y8 j. q  A% T
  52. #endif
    2 O- c6 z1 c4 \# x$ F7 I4 ?, f

  53. 6 ^2 B; U+ Y2 l( o; K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " i% ]" p' v; Z0 X. ^5 n3 j7 }6 c
  55. #define STATIC_SHIFT                3
    * `) L1 D1 _6 o
  56. #define TCINTEN_SHIFT               20: g/ W4 }9 g- }0 B) u# J' V7 J
  57. #define ITCINTEN_SHIFT              21
    ) r# K7 ^, K4 E' o9 l9 l+ M
  58. #define TCCHEN_SHIFT                22
      ~+ x- v  x9 p2 t$ A7 ~
  59. #define ITCCHEN_SHIFT               23+ u8 z: p. c& ~6 Z1 q$ a7 w& e
  60. ; P  x* i+ J" C8 b1 Q
  61. static volatile int irqraised1 = 0;
      g. c# D- {( \3 D8 J' Y
  62. static volatile int irqraised2 = 0;4 c( t+ w& M5 u- _( Q( B
  63. - E0 P; ]* k  d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) m) h) m3 k' O6 C( [9 g2 v: O* f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G8 O% Z# C) J. M& F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }! r# U$ A) G% u
  67. ( b. d1 O7 h7 M0 v! s3 e( l7 U$ |
  68. dma_addr_t dmaphyssrc1 = 0;
    $ v+ _) Y' R8 _4 J+ l/ ]0 G
  69. dma_addr_t dmaphyssrc2 = 0;/ e6 m$ s/ k; r! y: g1 T$ n, C( L, D
  70. dma_addr_t dmaphysdest1 = 0;
    * m3 w; w" M+ O4 X1 |
  71. dma_addr_t dmaphysdest2 = 0;
    2 E/ q/ N* N" t+ m) F1 T

  72. $ W% K8 ~; S  T' Z
  73. char *dmabufsrc1 = NULL;4 f+ Y. y& W" {! \
  74. char *dmabufsrc2 = NULL;
    9 M( V" t9 n6 a% Z
  75. char *dmabufdest1 = NULL;  g$ z. q# t! X8 k: S# G. Z
  76. char *dmabufdest2 = NULL;+ p2 P9 G( U/ h2 d; i# h
  77. ) _- P3 J: o+ H0 ~' {/ L" ^; S
  78. static int acnt = 512;
    7 g) _! ^$ F( Q6 j& G
  79. static int bcnt = 8;
    ! H% x- u  m" E+ @
  80. static int ccnt = 8;) t( P6 g5 l% ]8 [
  81. ! J3 E6 P8 [- H
  82. module_param(acnt, int, S_IRUGO);
    & D0 q* i* s& M7 w
  83. module_param(bcnt, int, S_IRUGO);
    ; s& N7 s* a1 r* a0 J" |% Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 J/ W5 F; F% V/ P; t0 t% b* C$ l
- Z4 |4 j' }& w( s1 k# m$ o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 M6 \% t$ _% C; h  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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 W0 J2 ^( I" ]) P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. B) w. q8 z% x- I7 d+ ?/ n9 z, N, N/ M; R
0 I4 ^: M- f6 ]$ F, [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 22:28 , Processed in 0.045149 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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