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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 u( k2 D# h( o; V8 k/ l
  1. [code]EDMA sample test application" j' q" s1 C" V+ j% d& Y! f
  2. /*5 O7 c4 G9 A( L; S0 {+ H* I5 \/ ]1 F& K
  3. * edma_test.c) s& B$ V/ k# w# m: ?. p( T
  4. *% X6 o* a, G7 m. t4 c
  5. * brief  EDMA3 Test Application
    5 I0 o8 K, L# H9 Q- p8 u9 C; o
  6. *  n% {6 e: A- |. F7 U
  7. *   This file contains EDMA3 Test code.
    ' w4 }" P, p: ?  h3 _+ `
  8. *: \) x- r9 ]+ Q( s. l- S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / D7 Q; n6 N- q8 N. ]% [, C) j( l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; r- @; r+ `4 M1 e
  11. *         TO CHANGE.+ X4 f( e; a# K# i: p' b' _5 o
  12. *& V# v7 n5 w+ c6 {; u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( ]* i% f  d0 u  x+ E# L
  14. *
    9 R! g' W/ j. H2 @/ ]$ W6 }
  15. * This program is free software; you can redistribute it and/or
    9 t5 F, T3 o* n, X
  16. * modify it under the terms of the GNU General Public License as6 S' d; h8 q6 e( A/ {" R
  17. * published by the Free Software Foundation version 2.) Z/ Y! W' Y( z6 _/ c  E* b
  18. *
    . b  E. B( F+ J6 Z& s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- ~9 F$ f) _; s- f" W; `7 |0 G
  20. * kind, whether express or implied; without even the implied warranty6 }7 H, h2 C% G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, m$ H" F5 I! |, f
  22. * GNU General Public License for more details.
    5 A" ~* h0 O2 w. L5 @
  23. */
    5 k: w# ~/ V9 `; Q1 A1 i0 n& G4 L

  24. / M& M9 \/ I) H; l7 }6 V
  25. #include <linux/module.h>- j. Z% a- A4 ~2 c% O
  26. #include <linux/init.h>' T. Q% {2 T( M
  27. #include <linux/errno.h>9 h* V8 z+ y% Z# P6 z% d
  28. #include <linux/types.h>. t" H* f) E( e9 A
  29. #include <linux/interrupt.h>6 X0 K2 ~) i5 Y0 z0 {
  30. #include <asm/io.h>
    * A+ m1 ^: g0 L% B$ X1 e7 j: L
  31. #include <linux/moduleparam.h># k2 m8 b4 L% }4 H. T0 o) W+ o( z, c
  32. #include <linux/sysctl.h>- D9 C6 Y8 r+ Z/ j. @: A
  33. #include <linux/mm.h>4 t6 j! y- D9 D5 I5 c
  34. #include <linux/dma-mapping.h>8 C& P% G2 g- q; }

  35. 4 _) k$ V7 E) j. I1 _8 `* L
  36. #include <mach/memory.h>
    3 U- m. @, W! b9 v( s
  37. #include <mach/hardware.h>
    + E3 Z; X/ R& x/ d
  38. #include <mach/irqs.h>' u% k9 m6 N9 u" \* |4 B* }
  39. #include <asm/hardware/edma.h>1 ^0 \% ^$ I# R, Y
  40. . X3 o0 C" B) I% m) D
  41. #undef EDMA3_DEBUG' N  y* e2 \- J7 m$ @
  42. /*#define EDMA3_DEBUG*/, A$ h: l& m! h! K: h, x

  43. : q+ Z& X, I2 q8 ^
  44. #ifdef EDMA3_DEBUG5 C% ]+ f$ h7 H7 |# a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 ]. n' U+ d8 t1 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& [) O% v9 s. _' z1 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): E" ~/ Y2 L/ h9 c
  48. #else" K- h! N3 X0 y9 y8 u; n
  49. #define DMA_PRINTK( x... ); ^: B/ `1 S; }, G, S% e- B
  50. #define DMA_FN_IN5 G3 [2 M' ^0 b& R& e
  51. #define DMA_FN_OUT
    ( r" G; j3 r! T$ x% `& X$ ^% |
  52. #endif
    : ~+ z/ |* E  s
  53. * E4 v* F0 W5 F; w5 ~7 Y  A# u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + A- v! Y, j% P4 |; T
  55. #define STATIC_SHIFT                3
    ! w) U  n/ O' k: y, f$ f, s
  56. #define TCINTEN_SHIFT               20+ ~) W/ [7 W" C2 c' L
  57. #define ITCINTEN_SHIFT              21
    # l2 H  X2 i' r* T$ A. T9 L
  58. #define TCCHEN_SHIFT                229 y: h- p) ]  ~+ e. {1 c. V" T
  59. #define ITCCHEN_SHIFT               234 @0 l: m# B  h
  60. 2 t3 K% ?7 A( R# l& q2 J
  61. static volatile int irqraised1 = 0;/ R: p/ L2 j7 _, q8 s
  62. static volatile int irqraised2 = 0;, l4 }( y; ^+ J4 e
  63. 3 m- w- m4 W; S2 j$ I# g# W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) D0 p! ^* b% X6 @3 F$ g8 A$ |! W9 ^4 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& I9 X3 n+ [5 H, P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 e* Q+ `* ?, |
  67. 8 `+ J. M2 j, |! I5 E  Q. ^
  68. dma_addr_t dmaphyssrc1 = 0;; m. a" W6 Z& K( p& d  b
  69. dma_addr_t dmaphyssrc2 = 0;  v1 s1 E3 ~3 e( P! D8 B' y% S" U: y$ P
  70. dma_addr_t dmaphysdest1 = 0;( X  a7 b5 x) T, ~& z, w
  71. dma_addr_t dmaphysdest2 = 0;
    8 G5 i0 u& w( h2 K: h
  72. % v9 f* C6 u: v1 k9 a
  73. char *dmabufsrc1 = NULL;
    + f7 Z/ S# G7 k/ p: w. b2 ]* ]
  74. char *dmabufsrc2 = NULL;
    6 C3 }/ t  L! [8 j1 o
  75. char *dmabufdest1 = NULL;& C& I6 n2 Y& x$ K
  76. char *dmabufdest2 = NULL;
    / m7 F$ E0 E4 e  C5 i6 ~

  77. / e* {  o: k0 D1 G
  78. static int acnt = 512;
    8 E0 l6 N. m7 M- d3 p( F
  79. static int bcnt = 8;/ V" _8 w. I6 G9 ~: E
  80. static int ccnt = 8;
    " \1 ?9 ~0 t/ |" {& J6 a

  81. , H1 g! D- k! T3 u
  82. module_param(acnt, int, S_IRUGO);
    3 ?9 B! ?4 b8 i) ]/ K* N  n
  83. module_param(bcnt, int, S_IRUGO);  x) i$ P* r9 N: b" B& ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 j$ }. \. y8 K( E/ G6 Q% _) W/ c0 }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* y2 V; p+ f5 [1 s5 d( i5 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* e( s7 t4 a+ r  a2 j  y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* N. y( S' @3 u' {3 ^1 e, `# G
/ p. m7 L% c- u7 D& L
+ ?$ e5 t3 g' @) M% f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 03:58 , Processed in 0.040908 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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