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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# V  D5 }# f. v, p& v# l. L$ O
  1. [code]EDMA sample test application1 k5 W( X* S( i$ u! f  z( W. R1 W
  2. /*/ Z. S. t' e9 w% B5 P% v( M9 \
  3. * edma_test.c
    % N/ ~/ s- Y9 v5 R* S
  4. *
    5 F; k- \8 S" T# B. E1 D+ L
  5. * brief  EDMA3 Test Application& ]! {" `5 i' C% R" {3 H. ?
  6. *3 `( P8 w3 y" k! V/ |, k
  7. *   This file contains EDMA3 Test code.
    " Q9 v4 w* J0 M3 @+ Q! n9 }- i( W
  8. *6 z. I  X% u& w1 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! F5 h3 h5 D0 e1 I9 u. N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% C9 f6 f4 |! i' \3 S
  11. *         TO CHANGE.( X# s6 G  E* U! a3 o; f" F# e
  12. *
    - q+ m7 i' O& z  U( n6 Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      j9 z0 \) a  m2 y8 M2 V: Y4 w
  14. *
    + Z  Z( O6 V- v' b+ a
  15. * This program is free software; you can redistribute it and/or& Y% f( n6 x% C- u: m0 l
  16. * modify it under the terms of the GNU General Public License as3 y$ r/ V; G. }3 ^0 i
  17. * published by the Free Software Foundation version 2.
    , F1 A# d) {8 \  b3 S
  18. *
    * K* u: z* K$ o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ^$ d4 T3 O& }+ a; e
  20. * kind, whether express or implied; without even the implied warranty
    ! O( _* k8 q( X# F( f' J- Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& i# [* J. F- i
  22. * GNU General Public License for more details.* f" Z, B1 N& g5 l+ N
  23. *// V2 ~" g0 R) ~* }# K1 m; `0 P

  24. 5 v2 q1 i# [" H# \& w, G, @: J6 }$ v
  25. #include <linux/module.h>. o* v# g2 t7 C, d
  26. #include <linux/init.h>( l& U% S& r$ g6 N; ?) E
  27. #include <linux/errno.h>0 J, o' t- K7 `& \7 J
  28. #include <linux/types.h>
    ; K- E) F' O2 s  T9 y$ o
  29. #include <linux/interrupt.h>' U1 {# d- s& D" L: w
  30. #include <asm/io.h>
    1 c- C; p- R" O: G- I5 B
  31. #include <linux/moduleparam.h>* a7 [: ]& C; l+ w
  32. #include <linux/sysctl.h>
    ! W- h  t% X: r' f3 _
  33. #include <linux/mm.h>
    % N; C' G% D% I, w9 {4 C
  34. #include <linux/dma-mapping.h>
    + i5 R$ U* u# J7 F
  35. 0 g2 }3 X2 i9 _! X( x! A
  36. #include <mach/memory.h>9 I4 o; p0 p0 q
  37. #include <mach/hardware.h>
    / n" V3 N1 U8 f' \! I
  38. #include <mach/irqs.h>2 c! G" T; M6 I1 [, r
  39. #include <asm/hardware/edma.h># y$ _9 k% Q6 U1 I0 r
  40. & i2 u% F  v1 E/ O) H
  41. #undef EDMA3_DEBUG8 ?; |+ K# J' X) T
  42. /*#define EDMA3_DEBUG*/4 \: f& b+ |+ h# P. C2 a2 [

  43. : d$ |! Z6 }8 L8 Z3 T) K" x) u
  44. #ifdef EDMA3_DEBUG
    & x' m+ M6 G: R% y( u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 o3 m! c9 H4 o$ x- l+ }/ t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 G$ Z4 j/ m* X5 N, l2 j* t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , z/ U: ?0 k# t! s0 ~8 R
  48. #else1 K; y5 j, }7 ~* O7 c, G1 ]! E) C
  49. #define DMA_PRINTK( x... )
    % G8 K( t- ?$ y1 o
  50. #define DMA_FN_IN. g/ h6 ^. j% u8 x5 A" p
  51. #define DMA_FN_OUT
    ; W3 S* d' t6 W: D8 l' @# `/ }: e4 f0 t
  52. #endif/ E* ^7 u/ \! ~
  53. . _. E! q$ s. Z, o% t* r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 l% M6 n$ N7 B' U$ B: b1 G2 p* r! K
  55. #define STATIC_SHIFT                3; P- f' U* O/ J
  56. #define TCINTEN_SHIFT               20
    * r0 o7 @9 I  _2 s$ j
  57. #define ITCINTEN_SHIFT              213 Z* d- G& _( H# H/ Y/ @5 j' U9 L( P
  58. #define TCCHEN_SHIFT                22  x' z. p: l& F+ x3 d6 x" Y$ T
  59. #define ITCCHEN_SHIFT               23
    - _9 A+ R, x, a, w
  60. ! c- j5 i& m, P& b' P
  61. static volatile int irqraised1 = 0;
    2 `. {+ V8 [& ?3 G
  62. static volatile int irqraised2 = 0;4 P8 J7 M, f. B. w
  63. - q. _- s6 ^$ S# `1 H0 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: e9 k  d% L. `0 n' n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " F; p+ X1 @1 S* j) b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( T# d; V: _5 r$ n7 x: M- p+ I+ F
  67. * E+ ^9 U  R- Z6 K0 t4 x9 A
  68. dma_addr_t dmaphyssrc1 = 0;
    , x4 t* n# ~! R& {- y8 q. Z
  69. dma_addr_t dmaphyssrc2 = 0;
    , q( h5 ?2 M, H( ~& R1 X# q- M
  70. dma_addr_t dmaphysdest1 = 0;
    , ]% [# c# u5 c3 A$ [( U/ J
  71. dma_addr_t dmaphysdest2 = 0;/ }; b& M% M: Q' L

  72. & L( A! k2 k& I, }+ D) M
  73. char *dmabufsrc1 = NULL;$ f5 P! Y0 s; E4 l6 k  ~
  74. char *dmabufsrc2 = NULL;9 f+ Z: }1 J$ l6 R0 t/ R+ u$ `" ^
  75. char *dmabufdest1 = NULL;
    # S/ ^+ v4 M) `5 j  u$ C! W. Z
  76. char *dmabufdest2 = NULL;( G7 |# n- ]/ M1 G0 j- n

  77. ) q/ t" |' s' B2 A
  78. static int acnt = 512;- B3 {+ U1 Z& a4 x& S
  79. static int bcnt = 8;. K0 P4 F/ w% T$ o
  80. static int ccnt = 8;5 M' I9 u: ?6 {+ n; n! M- W0 K$ M
  81. 1 F  [+ Z0 p( u8 a4 ~3 d8 R
  82. module_param(acnt, int, S_IRUGO);
    + T. G( D8 q1 N9 T0 O3 o" O( s  i
  83. module_param(bcnt, int, S_IRUGO);' d5 @2 T5 |* ?8 n# V; A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, `6 w8 e" ?' j4 v- j& Q" s  x
9 ]& i& ~3 h" b7 t- Z9 F' K( X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 L7 N7 c5 o$ s4 v8 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 G0 B0 q. x: c1 m5 m6 B* v) E0 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 ^  y+ o% @: [, X) ?& C# p4 k+ [/ L! ]9 P- L( O
% v  e) O; I% `' \/ K2 _- a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 14:13 , Processed in 0.058393 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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