OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# z9 n* Z3 m0 ]- L9 V% z/ j
  1. [code]EDMA sample test application
    ( R) Z9 b! C& A
  2. /*
    7 u  i' |4 ^; W0 k) ?
  3. * edma_test.c' j5 d! ]5 ~3 m. U' C  U7 U
  4. *
    ) {% F& h( e/ X; o
  5. * brief  EDMA3 Test Application
    4 u5 I3 b6 _% B0 C( t( |
  6. *
    ( Q9 ~! A2 t* @" B( J; m
  7. *   This file contains EDMA3 Test code.9 C1 _7 O6 e6 V$ |. b8 @( w
  8. *
    8 K, H3 u! z' r5 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) o# m& F8 F& ^+ e4 X. }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % p% `$ K7 }' y  F/ _5 f/ @! Y4 c6 g+ \
  11. *         TO CHANGE.
    # h- Q& b5 A( j, }/ h. l; l0 |
  12. *
    , Z& C3 K+ |. j2 F% [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& D6 N* v/ m& J9 M  m+ ?6 T6 t! f
  14. *
    1 e# D' o0 G$ B: {! e
  15. * This program is free software; you can redistribute it and/or+ o0 U/ \5 f6 c, K+ V, |
  16. * modify it under the terms of the GNU General Public License as, r  R5 c+ X, P( R8 u4 [4 W
  17. * published by the Free Software Foundation version 2.
    " a9 K0 Z& h" Z
  18. *
    - D. |8 F7 w* K; F) [2 ?, c  P4 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 ^# @! _5 P& o6 L& j7 Z7 t% n$ C
  20. * kind, whether express or implied; without even the implied warranty, J3 J. W" k  v. S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ {% A5 E& Y3 e  A5 |
  22. * GNU General Public License for more details.
    6 b% F; `6 S: Y0 E( c
  23. */6 K' Y5 H% J  q6 \+ |* R* ]

  24. ' w- h- B" i0 `2 e
  25. #include <linux/module.h>9 \# y2 _& u* z' \5 B- x2 ]% v* O' p
  26. #include <linux/init.h>5 D( s! {. X6 j
  27. #include <linux/errno.h>
    1 f  ]5 f9 I; L
  28. #include <linux/types.h>
    + V- U* e7 e% X
  29. #include <linux/interrupt.h>
    3 }9 e, G: F; J- N( m+ m4 f
  30. #include <asm/io.h>
    ' M1 g9 a4 \% D( H
  31. #include <linux/moduleparam.h>
    8 U' A9 G! }/ k
  32. #include <linux/sysctl.h>7 }( Z& @+ I5 g) L. b( J
  33. #include <linux/mm.h>
    ' g$ A2 `& ~. c  G5 W- u2 x
  34. #include <linux/dma-mapping.h>2 P% A5 K: F2 q

  35. $ @, Q! V. a: U9 F9 a- `8 F9 F
  36. #include <mach/memory.h>. X$ {+ n4 l2 L! F1 F2 t) o
  37. #include <mach/hardware.h>
    # a$ t( A0 N3 }4 G6 b/ ?
  38. #include <mach/irqs.h>, W3 I* B3 A9 S2 z$ K& l1 B
  39. #include <asm/hardware/edma.h>
    ( M. w/ H+ S( K. ?
  40. . g6 B  Y: o: l/ j8 a
  41. #undef EDMA3_DEBUG
    & K4 ?( ?& l+ v5 L' n
  42. /*#define EDMA3_DEBUG*/* W, H- O6 o$ q. S, v( T' i3 Y$ {
  43. 6 r% C! d5 p, i; t
  44. #ifdef EDMA3_DEBUG6 G5 @! r" Y# R' j" H1 ~" p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % E! f( i2 A  d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 S  _: x( o8 x/ {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): r. s( o1 w  y: A+ ]
  48. #else  a+ M& c6 H9 S! @+ O6 h) f
  49. #define DMA_PRINTK( x... )0 p5 x& n- ~3 z# ]- t
  50. #define DMA_FN_IN
    , {! t9 l! w$ ?
  51. #define DMA_FN_OUT9 S' y$ Q' }% r$ j
  52. #endif
    ' O* |7 ^* _1 \. g
  53. 8 i+ S0 f+ l, X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 e: ~) B5 X# K2 D2 Q
  55. #define STATIC_SHIFT                3$ j6 l6 h3 K* f' n# s
  56. #define TCINTEN_SHIFT               20: w, V5 s9 n( n0 j* P( |  ], i
  57. #define ITCINTEN_SHIFT              21
    / s5 K1 q: {5 {9 O7 W/ V( ~
  58. #define TCCHEN_SHIFT                222 Y0 }$ b% P' o+ J5 ^* d0 I/ N5 J
  59. #define ITCCHEN_SHIFT               23: B# r2 k, \5 ^" I( K' I5 A
  60. : z( R) B* ]4 ~: f; ?
  61. static volatile int irqraised1 = 0;5 k6 C" U$ l* p( O" ^# ~; v
  62. static volatile int irqraised2 = 0;# V9 S; a; h+ }+ c& F7 m* E
  63. % Z7 \5 t$ D! _0 ]0 X$ M( [0 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 l6 r  ]4 e; X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # x; z5 c! F9 d  R& v8 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" l1 [; V% ~& q' u9 e  [2 F

  67. ' q4 ~% r) N. u& x1 b
  68. dma_addr_t dmaphyssrc1 = 0;" t. F! E. f: x2 P- f, T
  69. dma_addr_t dmaphyssrc2 = 0;* A# g+ g" ^, v
  70. dma_addr_t dmaphysdest1 = 0;
    7 G* p  D9 l  S  s. _! f1 U& Z
  71. dma_addr_t dmaphysdest2 = 0;
    # i3 P- k3 {" _" ?
  72. " }5 k# Z+ F7 C, C$ ~/ w0 M/ Z
  73. char *dmabufsrc1 = NULL;
    + @  A$ S7 V. V
  74. char *dmabufsrc2 = NULL;' B7 v: S2 B9 \% y
  75. char *dmabufdest1 = NULL;! ~5 W7 S6 z4 Y, Y" w' P
  76. char *dmabufdest2 = NULL;, e9 _' l8 d( L; z7 B& S2 y3 T

  77. ) y5 |8 {- d7 E5 ~
  78. static int acnt = 512;0 g* `. `7 f4 ~) [  {
  79. static int bcnt = 8;5 w9 y+ o2 B6 s4 Z6 t# [0 q
  80. static int ccnt = 8;
      P5 J1 G, d1 u  D/ m! y

  81. 9 l9 W- _& g8 E# ^2 U+ ]2 I
  82. module_param(acnt, int, S_IRUGO);
      z& X( p, i' Q; e: B
  83. module_param(bcnt, int, S_IRUGO);0 X6 V' x9 o4 C: ~% f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- _/ P  r. H7 m& ^7 Q
) ?0 q% N& {+ j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 A, l+ A! [; E+ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 e& u0 @  r! J0 Z# }: U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ W  t% r8 W# ]8 t+ D1 |

; C# V  H+ ?; e9 p- y9 R, |3 U, j" Y7 |9 [, B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-9 21:13 , Processed in 0.040427 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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