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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 q* n% I/ q' D
  1. [code]EDMA sample test application* k  l$ Y/ j) w! A; Z
  2. /*
    . g( f8 E& U: `! a
  3. * edma_test.c
    . c! r: o! U7 R! `
  4. *8 N$ Z1 N) w" }* r+ F0 @
  5. * brief  EDMA3 Test Application4 k- b- b# p  w! ~  n. f
  6. *# N  k5 `2 P$ F/ e
  7. *   This file contains EDMA3 Test code.
    / b0 t# i! u6 o! I7 J7 k
  8. *' K4 k4 z0 T7 f2 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 d3 c& _8 ?" ]7 M# G9 r% S' A7 d8 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! B% a5 ], _4 E- y' O: E1 f' ~
  11. *         TO CHANGE.
    6 D; M5 r) B* J( b
  12. *+ ]. d3 c* p4 G* n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 S4 n& t( T) d. a) m
  14. *. ]0 c$ Q+ b3 f( S; Y& t& U
  15. * This program is free software; you can redistribute it and/or7 K5 L- s# n8 Z/ V) t
  16. * modify it under the terms of the GNU General Public License as/ P/ B- H4 U3 [5 J- b% R- K
  17. * published by the Free Software Foundation version 2.7 |& U# S% _/ ]$ @. |8 P
  18. *! u+ x, r* Y8 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ P6 ^. c& a+ ]+ w  p4 ]
  20. * kind, whether express or implied; without even the implied warranty# }' @( c3 I! s8 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - T+ j9 H2 C: D4 m: ~2 x
  22. * GNU General Public License for more details.7 ~3 ?  R; C  ~
  23. */
    ' u; g! {# {7 u
  24. ' a) ^1 }, h) l9 s8 {) n/ l
  25. #include <linux/module.h>
    , y# J( s" W! [+ t' P
  26. #include <linux/init.h>
    * G0 F( ^  s$ f2 ]
  27. #include <linux/errno.h>/ E4 b$ Q* r& _' r$ \1 L
  28. #include <linux/types.h>, b. d* _) T' E0 @; l0 e8 G8 z
  29. #include <linux/interrupt.h>9 L' ^9 y! m- u) X2 z
  30. #include <asm/io.h>; E" J% q$ {; s
  31. #include <linux/moduleparam.h>2 `. F7 O% h$ f
  32. #include <linux/sysctl.h>
    : @* j& E% d3 i! W9 y
  33. #include <linux/mm.h>2 d. U% \3 L& X& m$ q
  34. #include <linux/dma-mapping.h>+ W2 l9 G( C1 }( N" T

  35. * z& F0 F" B# b' R* M7 y, X: ^
  36. #include <mach/memory.h>1 D6 }) J- a9 }1 w
  37. #include <mach/hardware.h>
    3 G1 ~. a- @: R
  38. #include <mach/irqs.h>% K1 [: X7 Z* ^
  39. #include <asm/hardware/edma.h>
    : q: o( g3 X$ ]2 l# N: `; _/ h
  40. 5 W* y  K% r% p  M; r" W8 H6 v$ V
  41. #undef EDMA3_DEBUG
    + d2 q, l% I: V4 Q6 D- p
  42. /*#define EDMA3_DEBUG*/, d# n1 B3 b6 G. f/ b3 K- J9 \, N3 A0 [

  43. 6 F$ z9 ^. r# }# ?2 v3 y0 \. O
  44. #ifdef EDMA3_DEBUG
    , Z4 K! M3 B2 }, M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 u5 Y3 Q0 C: S: ]/ F; {- W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 i$ d9 W  h' C4 R! }6 q3 B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 V: x% |# I# p* m$ _/ X7 b; b7 T- ^
  48. #else
      U" f5 E4 |6 ^7 C/ R: M  L
  49. #define DMA_PRINTK( x... )
    / `7 o. t1 g6 @; ?- B& M0 p0 B9 j/ ]
  50. #define DMA_FN_IN6 ?9 \& t1 A0 Y6 v" \% R- q: h
  51. #define DMA_FN_OUT, b" r) b) Z2 u* x  V" X
  52. #endif0 }" V8 [! R8 Y$ ~+ y# ^
  53. % n: g& b5 h2 F& x; T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 H: o" _  K! @( N' ^( a7 b
  55. #define STATIC_SHIFT                3
    & w6 l. G, a0 E4 u/ m1 N
  56. #define TCINTEN_SHIFT               20; T. m* f2 n6 V$ m& {8 Q" r: {
  57. #define ITCINTEN_SHIFT              21
    ; [7 L! q  M) w
  58. #define TCCHEN_SHIFT                22- X3 A% ?: S/ `& w2 r
  59. #define ITCCHEN_SHIFT               23
    * j7 V% O2 T5 c$ z; [: E  o' F

  60. 2 B0 W# e& j! y2 ?& f. W
  61. static volatile int irqraised1 = 0;$ T* }0 Y2 V9 W' M: z3 e9 M5 _
  62. static volatile int irqraised2 = 0;
    & O4 n; B3 B0 ~1 n0 n
  63. ; P* r: y# f; H5 q* d9 S9 f& A2 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . J' a4 N; F# y/ g) B6 E+ N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- I* ~8 p- E% c  u1 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" E  X( Y% F) A& y0 B( y
  67. # n: q0 c8 g+ T+ x
  68. dma_addr_t dmaphyssrc1 = 0;
    ' T+ _( J  ~- o9 [
  69. dma_addr_t dmaphyssrc2 = 0;% [5 r% H$ L: A
  70. dma_addr_t dmaphysdest1 = 0;
    , f( N/ \0 l' }$ [& e& g
  71. dma_addr_t dmaphysdest2 = 0;$ d' d2 X" n* Z' K
  72. & U: u* p4 w- P+ o9 t3 Y; N% l  \
  73. char *dmabufsrc1 = NULL;
    ; _) ~$ _. F# Z; E
  74. char *dmabufsrc2 = NULL;
    & X6 [, T! F7 a/ t& W& j
  75. char *dmabufdest1 = NULL;+ v8 w3 ?( _) X& V
  76. char *dmabufdest2 = NULL;& a# U2 L) Z9 Y+ d% e3 F
  77. 9 f  {  e' P! z
  78. static int acnt = 512;
    ; j( Y- y8 U. K8 {) z3 i
  79. static int bcnt = 8;
    ( R6 r6 T) p( _1 \  l2 r, X
  80. static int ccnt = 8;
    5 d2 ~5 k2 V' g/ f
  81. , [( `  o# n9 Q, v3 `# J( y
  82. module_param(acnt, int, S_IRUGO);
    . o0 i) b3 b5 h' Z; j; n5 Q
  83. module_param(bcnt, int, S_IRUGO);
    * y1 i7 }$ M1 N9 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ L  p" j: G: f  J& Z( x6 b$ ?* W7 M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& D9 S' F7 C! W& z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' _( J0 h3 j9 K3 R" {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' c  @3 Z2 Q" ~; |2 _" R
$ T0 _* A$ D8 s# V/ V

8 g. z5 K5 r* Q* A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-18 21:08 , Processed in 0.042897 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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