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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" M& r/ y- B5 e: _1 s% n0 @+ ^; L9 U
  1. [code]EDMA sample test application3 H  t0 H7 r6 y3 Q9 R2 j$ S
  2. /*
    8 R" _8 N4 v# q2 h
  3. * edma_test.c/ _# Y6 ^$ H  s! i' o
  4. *
    . @# H# N* \- [1 n6 {* O4 e
  5. * brief  EDMA3 Test Application& ^( b+ o! p# R7 v" h
  6. *
    2 p* ?4 o3 Q. M" E% k5 f
  7. *   This file contains EDMA3 Test code.# B! S; q7 ?9 Z& g3 U
  8. *
    ' n5 {' o6 ?" S4 |8 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ n" m" }; D- n; o2 h* \9 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( k0 T% ?, e, `) t2 Y% [0 U0 i# l
  11. *         TO CHANGE.
    . V1 J. {+ V8 \4 k+ Q9 X" o3 o7 v
  12. *
    ( u8 o7 E7 k5 U5 K! Q# E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 L# ]( E8 o; P$ O/ e; J
  14. *  Z6 u5 _! L9 x; ~
  15. * This program is free software; you can redistribute it and/or
    * z( F2 S( ~& j/ T
  16. * modify it under the terms of the GNU General Public License as9 D3 n8 o+ @* m/ f# l) x* |
  17. * published by the Free Software Foundation version 2.3 f3 l2 a! [0 [$ O* _
  18. *' u' V* U) x7 z. A  W) Z: k5 G+ |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  t% a6 a" e( W" M7 L6 [
  20. * kind, whether express or implied; without even the implied warranty
      ]. ]/ Z5 B/ v( L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # b: z' N3 h& z
  22. * GNU General Public License for more details.3 M5 O7 g1 M8 |  H4 ^
  23. */1 @8 J  r% }: d* `3 f  I

  24. % B% C8 F" z9 w: u; M0 C
  25. #include <linux/module.h>4 a( U3 ^: ]6 I' d" t( i
  26. #include <linux/init.h>
    ) R- [* N: M% m3 A5 m5 q
  27. #include <linux/errno.h>1 y' e% s. X2 g6 G# ?) y
  28. #include <linux/types.h>
    ) E( j  A- B, \% S2 P) }+ j
  29. #include <linux/interrupt.h>
    & I3 L; W6 h, J8 z! y
  30. #include <asm/io.h>
    , C" m. u0 I6 _1 t( I
  31. #include <linux/moduleparam.h>
    # {+ e" C" f8 F' D9 z: }2 _
  32. #include <linux/sysctl.h>& M( K  g* A  `- N
  33. #include <linux/mm.h>
    ; a  x. n" b- x* a, T2 w! F
  34. #include <linux/dma-mapping.h>
    4 \' \/ L6 D/ C  N0 J$ ~
  35. ( e& K5 d" Z2 E/ @
  36. #include <mach/memory.h>& P7 Q: ?5 \" |: [  d, {1 W5 Z
  37. #include <mach/hardware.h>
    " C) L( ?5 Y  M1 b) f# r/ L
  38. #include <mach/irqs.h>) R0 p6 ~5 Q1 Z0 T. r
  39. #include <asm/hardware/edma.h>
    . M0 S* O1 Y+ |$ Q; g

  40. + a" N4 ~0 g+ D& y6 C
  41. #undef EDMA3_DEBUG
    + O* P- p, q9 H2 z# z
  42. /*#define EDMA3_DEBUG*/: Y4 C4 `9 Z( |2 X* o
  43. 8 h8 H0 H- ^. h- V# l# h) B$ t: j
  44. #ifdef EDMA3_DEBUG
    ' c8 y, h3 }( G: G( w3 j; Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & O' s) T# h' I' d$ L* `& r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ S5 ~! O; v3 H8 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 u; e% \) X- N. c) t) S' J" ^2 d) w
  48. #else
    , ]3 m2 e3 Y# C0 F, O
  49. #define DMA_PRINTK( x... )7 S3 S# q$ L. M6 f
  50. #define DMA_FN_IN
    9 c/ c6 s5 x# F2 A2 Q
  51. #define DMA_FN_OUT
    9 L2 ?6 P( {; y+ X" r
  52. #endif
    8 G3 ]( r# @8 y) J! X
  53. 0 v! [$ s7 G1 D3 O9 q  ~3 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 [5 A2 E, u8 [6 F" _/ {
  55. #define STATIC_SHIFT                3
    $ V+ F' w. F+ M
  56. #define TCINTEN_SHIFT               20
    7 [% V6 t) I* P7 i, e( V
  57. #define ITCINTEN_SHIFT              214 S9 P8 j7 x5 \9 W9 \1 ~+ u
  58. #define TCCHEN_SHIFT                22  H5 K% c( a! w" A+ ^
  59. #define ITCCHEN_SHIFT               23; x% [6 i* X1 @& C% H6 c
  60. 8 _$ g7 ~0 C1 `/ o2 q! S8 v
  61. static volatile int irqraised1 = 0;
    ! l3 @: ~; i( k! L- P
  62. static volatile int irqraised2 = 0;! v! j$ `. {4 i1 a
  63. / L$ Z% ?4 R* f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Z% ^2 L% A  o1 [2 C; L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' B/ U0 L- ~. O2 z0 V6 U! Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 X: M% b/ p& W
  67. * J2 l& |5 K  ~2 l7 D8 z# ^' h2 I
  68. dma_addr_t dmaphyssrc1 = 0;
    7 J5 y; Q9 O# q: G5 @7 U
  69. dma_addr_t dmaphyssrc2 = 0;
    9 z0 w% B$ N0 m5 z# z
  70. dma_addr_t dmaphysdest1 = 0;
    3 `$ `3 A7 k- H% j" w, B) k: {4 n
  71. dma_addr_t dmaphysdest2 = 0;8 o" A, x( u  m, X  @; `/ ~

  72. 3 U) V/ K* c0 G, _
  73. char *dmabufsrc1 = NULL;
    ' m# M$ A; f- s
  74. char *dmabufsrc2 = NULL;' F, k' w9 f& V8 X; f9 w
  75. char *dmabufdest1 = NULL;# _# A; |2 }  o4 x9 f- l/ s! D1 A8 L8 H
  76. char *dmabufdest2 = NULL;
    1 n+ @) r% a5 J# T: ^

  77. : C7 m) O0 J7 e8 u% j
  78. static int acnt = 512;! g; p! s) Z  I) @% u
  79. static int bcnt = 8;$ V6 B" s: T+ E+ y( S; r: ~- [
  80. static int ccnt = 8;  p9 x& S$ H, f, \3 ^) K

  81. 0 ]# }+ @: J# T0 F: I- g; ?' b
  82. module_param(acnt, int, S_IRUGO);
    * j8 r, |5 O) i: R8 V
  83. module_param(bcnt, int, S_IRUGO);
    3 X  X/ K+ I3 M) D( a4 \& p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ `) V8 K  t2 c; ?; ]
( j% b! k; A  v2 v' s+ H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ P, G" c+ X! a% R) ^- R5 Y5 Tarm-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 Q; |& ]2 ~  T& m* Q+ f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' D- [$ [& T1 ~/ d+ W1 d

" \' e( k3 d, ~
: x4 r1 f" _- v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-16 01:03 , Processed in 0.048739 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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