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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( s  v2 _6 L6 N  W# f3 q: O
  1. [code]EDMA sample test application
    0 Q4 s- @3 X: S, C$ q
  2. /*
    / `, |. S3 s% H  U
  3. * edma_test.c. I1 k8 L0 {, c2 p. v/ A1 e
  4. *3 g0 ~, C' ?0 T
  5. * brief  EDMA3 Test Application
    4 e+ E- w+ W' u4 Y( k# ~+ y
  6. *4 Q+ I# Z% G: A: v( R5 z
  7. *   This file contains EDMA3 Test code.
    , Z! R% k5 c6 r; F
  8. *- V7 O3 ?# l0 N* l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, m  v2 b+ j* k0 b* j( M) k. f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. E( ]4 i* m, a$ ^. I9 F! X
  11. *         TO CHANGE.
    ; p9 G1 c2 [1 l8 `% t/ N5 Y8 p" D
  12. *
    8 V3 O+ m5 w8 \' H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ t- w  e! z9 j7 {9 K: v# D
  14. *3 O) ^* K, l, |
  15. * This program is free software; you can redistribute it and/or  u; C8 o1 ^  h3 O. T
  16. * modify it under the terms of the GNU General Public License as5 t: ?( u! \$ x
  17. * published by the Free Software Foundation version 2.
    $ m: e2 }, `" @1 b: t. F( }+ K
  18. *' E* ?* b" s) f1 e4 L) Z4 ^7 f  L* u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 Y  w- E' d4 p/ o! e$ O
  20. * kind, whether express or implied; without even the implied warranty
    - n7 S4 W3 k' T& m! Q+ L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & p( a8 `* D1 m
  22. * GNU General Public License for more details.
    * a) S1 V8 X9 z8 p+ l. f8 z
  23. */
    2 F3 P: ~# i+ K/ ~

  24. . [# y- Q( `. V; ]6 t
  25. #include <linux/module.h>
    * n) x; A3 h- m
  26. #include <linux/init.h>
    + ?% [" K( O1 t$ R* @
  27. #include <linux/errno.h>
    + M$ a9 q* m* n8 F- d2 L. k2 T, ?
  28. #include <linux/types.h>' Z% i% K7 a1 @; q& D* I5 f# x
  29. #include <linux/interrupt.h>
    ' z/ z5 E# `# a4 A5 D
  30. #include <asm/io.h>
    / p1 y5 Z  E/ q' B7 s' J1 I' B
  31. #include <linux/moduleparam.h>
    ! o+ {1 w( m) i6 f9 b! ^
  32. #include <linux/sysctl.h>' X2 I. p7 ^% {" j( x
  33. #include <linux/mm.h>  C, _1 f7 b# t9 H; m2 L% F
  34. #include <linux/dma-mapping.h>
    - K4 i- g3 s, N

  35. . X3 u( ?4 o1 G) g% T6 f' ^
  36. #include <mach/memory.h>
    1 B3 ~+ Z1 _6 ]) J* r
  37. #include <mach/hardware.h>! {/ N, ]5 e% z$ p9 B9 @
  38. #include <mach/irqs.h>; F& B# u" G  ~+ x; f4 N
  39. #include <asm/hardware/edma.h>( E' q9 Q$ ?' \) B' q2 N

  40. ' y/ I& _+ }  i4 b) K4 N, L/ W- y
  41. #undef EDMA3_DEBUG: A; y- f: J1 M$ ]: y- A
  42. /*#define EDMA3_DEBUG*/4 P- }0 p+ G" G+ h( W* N) G5 U/ R4 v1 d
  43. 2 o2 E6 o/ S  J! o5 p: O+ P
  44. #ifdef EDMA3_DEBUG8 M1 h7 |- e' o& B% m2 ~; C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 `" l$ i8 ]; f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + A) ~& ]7 c+ r; M& o3 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Z4 ?9 q4 D+ K1 Y) P/ q
  48. #else
    8 x2 ?6 Y' V" L
  49. #define DMA_PRINTK( x... ), |# P% c% V. Y* K( w% C* |# ]
  50. #define DMA_FN_IN5 j7 w& K- Q+ e- h- z
  51. #define DMA_FN_OUT! Y# f$ W6 u- D( L' b: F
  52. #endif
    - s( I( b& Z6 K/ B
  53. $ _/ M5 u$ m+ }+ A- D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! Q/ T. Z/ Z9 u' @7 W
  55. #define STATIC_SHIFT                3
    * @. t6 A) D8 y0 S4 a( p; J" f& N! R
  56. #define TCINTEN_SHIFT               205 a( b* L0 d2 [+ e% [' h% M
  57. #define ITCINTEN_SHIFT              215 e+ ~, z/ j" l" j5 U/ @9 I) b
  58. #define TCCHEN_SHIFT                22
    ) R& O. D$ {0 K' F
  59. #define ITCCHEN_SHIFT               23
    / s0 Z/ v% g) ~* t; W, t! L

  60. / @; ~6 v6 ]( g1 P8 m9 [
  61. static volatile int irqraised1 = 0;: n* t9 a& S( s$ C# a* n4 S
  62. static volatile int irqraised2 = 0;# ^: q0 ^' d) }& V' b# R% k

  63. ( U* H# r! A+ S/ U# S% s7 R. j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A  Y' m7 F) j; e9 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % L/ y, e( U, H0 m( T: W/ P9 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r4 ^7 x8 {* u) K3 X# K
  67. # J  o: u1 e1 G9 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    + j, j( a2 d/ z9 u# K
  69. dma_addr_t dmaphyssrc2 = 0;
    % }$ A  \3 H) A( A3 j3 o2 ~
  70. dma_addr_t dmaphysdest1 = 0;
    8 u( m" X& G/ S0 I6 ]2 e; W
  71. dma_addr_t dmaphysdest2 = 0;$ l0 ]4 ?0 A! q3 l* e3 p* E+ o

  72. , q) R" r* s  n" d
  73. char *dmabufsrc1 = NULL;7 A' O$ r; @" K% I  L; `) Y3 b
  74. char *dmabufsrc2 = NULL;
    * y9 P8 {7 v+ k
  75. char *dmabufdest1 = NULL;
    8 P( c8 v/ k: t8 }
  76. char *dmabufdest2 = NULL;3 h8 G( z- x3 i! _1 Y8 W) h! V
  77. 2 L6 v5 Z8 [5 \7 X
  78. static int acnt = 512;
    3 H8 K) l- R7 G4 P" T
  79. static int bcnt = 8;
    5 @" x4 l1 w9 `& I
  80. static int ccnt = 8;
    / J" e0 f! O2 B3 U1 X& `
  81. 1 x& |* u5 @0 _) X" @0 S. G) ]
  82. module_param(acnt, int, S_IRUGO);. r" _2 J' s6 G% A/ Z
  83. module_param(bcnt, int, S_IRUGO);. z3 Q5 A- X3 P* U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 r1 S2 j+ J0 \$ k4 G; p% d2 W: ?' x& @$ ?* ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( c; j* P. v  j. Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: S$ s, k% P8 z) P; D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, v; K. t5 @& m" |' ?& K
, T; A5 c$ @/ c  |* ^! u+ ?

0 ]: E" V$ O6 y$ V+ N$ O" F9 S( T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 17:59 , Processed in 0.039112 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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