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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" s4 l0 I+ V7 Z5 j* a4 I) B
  1. [code]EDMA sample test application
    7 Y; p, t! R. l( c. c
  2. /*" E$ |1 R2 ?/ `2 ?; J+ N2 x
  3. * edma_test.c
    % B& C1 G% O/ Y; L" u
  4. *
    ; n6 L/ @  q% ~/ W7 Z1 s' |$ Z
  5. * brief  EDMA3 Test Application
    ; n/ C& C% r# u& V3 q
  6. *( R8 M- U9 w7 w1 t: o
  7. *   This file contains EDMA3 Test code.+ e% r( @; q6 i3 g
  8. *
    8 y0 \9 `1 u; M& x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 f; a& s4 ~! j* ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ @+ w6 }$ \) z( Z: Y
  11. *         TO CHANGE.$ t5 ]) J! ?0 A$ e3 N3 j. v
  12. *
    - a  X- K$ f, [4 G( V" t* U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// o# x6 K. Z, a+ P
  14. *
    0 l+ q' C6 N0 P* z4 F  B
  15. * This program is free software; you can redistribute it and/or$ V  h- e$ K2 x' \
  16. * modify it under the terms of the GNU General Public License as
    1 b. [& s6 c+ J
  17. * published by the Free Software Foundation version 2.
    ; D$ V' z1 W% w
  18. *$ c  r3 A/ z: A! v( b2 ?8 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 {" B9 U' p4 M# i
  20. * kind, whether express or implied; without even the implied warranty
    8 H3 {+ K/ b* F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 q" ]# t! e- O  i7 B* A4 Q
  22. * GNU General Public License for more details." X9 \0 O. ^* H% i, U# b
  23. */
      a: e- h5 F* n) @4 t+ m
  24.   e( `' y& \! \. L' B9 T0 D/ u
  25. #include <linux/module.h>
    ( [, G3 ?" r& S6 e  l
  26. #include <linux/init.h>: R% L) }+ Q- S7 r; h
  27. #include <linux/errno.h>$ A& S" k, v( J9 i' Z$ e7 b/ u
  28. #include <linux/types.h>
    ( P7 b& X9 f2 b' j* \
  29. #include <linux/interrupt.h>3 j, }( N% G) ~9 n) t& y/ @4 ]8 ]
  30. #include <asm/io.h>
    . T% v- |: H8 E" `$ B3 z% B+ _
  31. #include <linux/moduleparam.h>9 T) _+ b8 \# S' I2 K% C. J
  32. #include <linux/sysctl.h>
    - L8 Y8 }2 V" i6 i$ k9 A, j- S
  33. #include <linux/mm.h>
    ' u3 W5 D6 U- \2 |7 K. N% h9 j
  34. #include <linux/dma-mapping.h>; o6 `2 B  v7 O3 B+ |* S5 I

  35.   @: q8 E' H0 j! @7 U+ Y+ g
  36. #include <mach/memory.h>* U4 T* J- a8 C3 Q6 _7 [, L
  37. #include <mach/hardware.h>2 J3 j5 ]0 N) T* C9 H
  38. #include <mach/irqs.h>
      }7 y, B8 d$ \
  39. #include <asm/hardware/edma.h>/ C4 U6 R/ G. b% _$ B8 _

  40. + ]9 v6 Y+ n3 v& ~2 J; p" J7 u  x
  41. #undef EDMA3_DEBUG& E, |! S, ?+ o% j: _9 p
  42. /*#define EDMA3_DEBUG*/
    ; _8 r; ~/ a6 Y# J0 S
  43. 2 n% X& m7 _) t* h& q0 x0 l) H
  44. #ifdef EDMA3_DEBUG' h' w9 }- q: m9 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) I2 x! p3 [, p0 ^2 f$ a  _) f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # W% u9 H' M: ~6 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / f+ K7 ~3 i) [7 V( q
  48. #else8 e  T; E. s6 ?! M6 O9 f3 Q, k* {
  49. #define DMA_PRINTK( x... )+ w: C! z3 d: \
  50. #define DMA_FN_IN4 i! I" ^8 W$ z) R6 o6 W1 Z% o
  51. #define DMA_FN_OUT# F  M5 d7 d7 e9 e
  52. #endif+ b$ r3 ?9 i. g8 z5 b
  53. # O' d& [3 U2 n# p+ D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , X  Y5 y. ]& n9 J1 B
  55. #define STATIC_SHIFT                3
    & {2 J' J% q* j( Z
  56. #define TCINTEN_SHIFT               20# j* @/ ~5 @2 i
  57. #define ITCINTEN_SHIFT              21
    * T$ A0 A# x; @. x- o% g( D% {
  58. #define TCCHEN_SHIFT                22
    $ w, M3 x- v  z
  59. #define ITCCHEN_SHIFT               23
    ! H/ L4 a- v+ `
  60. . e, z6 X  S: a9 M8 J
  61. static volatile int irqraised1 = 0;
    2 F/ [4 A& U: X; R+ H7 E
  62. static volatile int irqraised2 = 0;
    : `$ w" }6 m2 |9 m2 \+ `" z

  63. , G% w+ n, p1 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 X- P1 a9 _, D; [) _; s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 w% ?. d! Q. f3 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S% U/ e( W6 ?

  67. ' }$ K9 O; L% g
  68. dma_addr_t dmaphyssrc1 = 0;! x4 V  f, F1 v9 ?- @1 m% x2 f
  69. dma_addr_t dmaphyssrc2 = 0;! D6 I) j, r4 x# U
  70. dma_addr_t dmaphysdest1 = 0;5 Y" K7 B% w6 _7 c" H' U
  71. dma_addr_t dmaphysdest2 = 0;2 a. E( D# s7 V
  72. * H" }0 ^$ m( G$ P4 o) z+ O
  73. char *dmabufsrc1 = NULL;" E! c5 {  j3 P9 _& ?- ^. A
  74. char *dmabufsrc2 = NULL;
    " u. \* p& f. n7 Q# R7 J2 w' i
  75. char *dmabufdest1 = NULL;# F& ~( e( G# t/ l
  76. char *dmabufdest2 = NULL;# `5 Q+ F/ A3 U* h3 m( M/ K! }

  77. / p3 _  M: N% B5 j
  78. static int acnt = 512;- M: y% U1 L2 y; d. {
  79. static int bcnt = 8;8 _% a% \3 E* `9 S
  80. static int ccnt = 8;
    ; J$ p' B) B' h5 M
  81. # a, b9 u. j* [
  82. module_param(acnt, int, S_IRUGO);
    / k8 t" E1 U+ N+ |2 ^# o
  83. module_param(bcnt, int, S_IRUGO);4 O# \8 Q5 A9 n* h, O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ Y; C. A* u( K; W& p; O- ^

, k8 z- ^3 u7 D6 R! h) o7 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 G1 R, a; `% X9 O+ q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# R' A9 [0 u, k% u) p- d% i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 ^) {4 z/ L5 |1 N3 `' j% k* c' @3 Y1 e% o; T& l: p& z
' f; N3 _" ]8 |5 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-13 13:24 , Processed in 0.038647 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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