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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% U: M% J7 W  s+ ]* t
  1. [code]EDMA sample test application: L! F8 J* m: {4 y
  2. /*. k* {( `, b) @) b
  3. * edma_test.c
    8 B. u8 Q. n* ?  z( u  @! Q
  4. *
    + w5 k8 `$ h" c/ F3 d8 Q! P; u
  5. * brief  EDMA3 Test Application" K; P: [% V3 K+ N1 E5 l
  6. *
    : t; b" ]( H& |( o* j7 ~" G
  7. *   This file contains EDMA3 Test code./ l! Y: x: ^4 [1 D, Q( o
  8. *8 `$ }8 X8 |( c5 d3 j6 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( [* ~4 x) Z" B8 N; W& k. J! `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) A3 l$ p) R+ a- I* f% F  Z
  11. *         TO CHANGE.
    , E! ~- b: r' F/ M0 A
  12. *
    " n# Z5 i, F: a' H' b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % K' V( n4 f: y! e' M5 x5 n
  14. *3 _1 U( y& t$ z
  15. * This program is free software; you can redistribute it and/or
    ; w1 C8 d7 ?5 L+ T" n6 C9 d; `7 V4 f
  16. * modify it under the terms of the GNU General Public License as! _- y8 ]: p8 }1 y) ~* x: s
  17. * published by the Free Software Foundation version 2.* r$ N+ u& \1 t8 U0 I  O$ Q. z7 d
  18. *
    ) ?+ e9 r, R/ D1 U, N/ B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / G6 }# u1 W% q- S, w
  20. * kind, whether express or implied; without even the implied warranty
    3 e5 K' t/ C$ X4 x' n: ?+ k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 V" B8 H+ G+ G! {' v4 e
  22. * GNU General Public License for more details.
    ! e8 a% {) M8 {$ s5 Q) Z* Y
  23. */- x6 Y' I5 N9 O0 }, \' ]

  24. ) u1 P& h" H7 }) a  m+ Y8 R7 L7 H% y* D
  25. #include <linux/module.h>
    . U2 D, b- \3 d" X' d$ f4 }
  26. #include <linux/init.h>
    & ?5 x7 P. \7 Z' B* m) p3 o8 {5 a
  27. #include <linux/errno.h>9 j6 G8 L1 n1 Z- _
  28. #include <linux/types.h>7 j$ a$ _- T0 G, {
  29. #include <linux/interrupt.h>/ k. c- M" j& j3 L9 Y
  30. #include <asm/io.h>0 R6 \: J, Q) I8 M
  31. #include <linux/moduleparam.h>
    ) s* P- C& V+ C
  32. #include <linux/sysctl.h>
    % Y% Q  s+ s/ J% ^$ S, l: w: o% F
  33. #include <linux/mm.h>5 f% ]3 B  T9 ^+ p+ D' b
  34. #include <linux/dma-mapping.h>2 t: E& Z6 p7 @+ i& Y( n
  35. & O8 f, v1 _0 P7 r7 o. M; L3 P- x( d/ z
  36. #include <mach/memory.h>
    2 r9 B4 L. g' ]7 ^: U3 A, L$ h9 E" i
  37. #include <mach/hardware.h>0 t7 {$ q) m' g: V
  38. #include <mach/irqs.h>3 R( a. Q+ h0 @- R/ \* o. R
  39. #include <asm/hardware/edma.h>
    , p* @. R# Z! @' b
  40. 2 ^8 s, `5 j6 R2 p& r
  41. #undef EDMA3_DEBUG: i. @: R1 }' q: b; J) ^/ @6 c
  42. /*#define EDMA3_DEBUG*/+ R6 P" I; Q$ ^6 ?6 S% h7 L
  43. : l9 a6 R) R0 [( b& A% v
  44. #ifdef EDMA3_DEBUG
    ( [7 o; _. k# x& ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( @0 m; V% _. Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# _- W5 _) s$ m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # F5 M$ t! i& k3 ?/ Q  S7 {
  48. #else6 x3 ]* ^$ P9 D4 c+ o
  49. #define DMA_PRINTK( x... )
    $ ]3 q0 a6 {2 p, \3 h5 |
  50. #define DMA_FN_IN
    9 `/ e* O( U) c4 M8 D& ^
  51. #define DMA_FN_OUT7 |, {' z) i9 C8 E  ]
  52. #endif) D' K( R9 Y* e0 e) Y

  53. 9 V2 O1 \* M! p2 k- ^6 J# r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  A  u+ S) H; K- G4 Z% Z9 W- x
  55. #define STATIC_SHIFT                33 V7 W+ a+ W9 T$ l2 r) F
  56. #define TCINTEN_SHIFT               205 E5 }6 i3 S- N3 i6 J# Z
  57. #define ITCINTEN_SHIFT              21( X# l) z0 o( o) [8 e- v6 J
  58. #define TCCHEN_SHIFT                226 I5 f5 P2 [+ b* c! V( W* L: H
  59. #define ITCCHEN_SHIFT               231 a3 L4 S) H( r' a3 Q( v
  60. 0 V- t/ G' @0 l! o( t) q
  61. static volatile int irqraised1 = 0;
    ( h, E: H3 M) @6 |
  62. static volatile int irqraised2 = 0;3 y; w! L7 Y& N* {4 x

  63. 8 H( ^# @) u4 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ?1 }+ J$ `7 h% U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : P$ w5 D1 `2 C" T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Y) [% Y: Q' O

  67. # M; @& o: i: _
  68. dma_addr_t dmaphyssrc1 = 0;
    2 H; C* q5 e7 f: ^
  69. dma_addr_t dmaphyssrc2 = 0;# ?" V  K, j3 X. \6 X
  70. dma_addr_t dmaphysdest1 = 0;
    , N6 G' e8 Y3 }$ U; N# f' R
  71. dma_addr_t dmaphysdest2 = 0;$ {& J8 Q. O& y7 v

  72. " _' f6 C/ \* q. w$ h7 f, r( v
  73. char *dmabufsrc1 = NULL;
    6 j; R3 }# j5 T
  74. char *dmabufsrc2 = NULL;- M; f/ }% q$ p0 t7 r5 d. n  v" Y
  75. char *dmabufdest1 = NULL;0 v; l6 }& m$ z: T( Z/ w
  76. char *dmabufdest2 = NULL;
    " i$ E$ z' x* y: r6 Y& i

  77. 8 I  N2 C+ n  n( _; T
  78. static int acnt = 512;' R; [: {- b# r. c& y
  79. static int bcnt = 8;
    7 ~2 c) H' h2 y/ y5 O* p/ z% m* [' D
  80. static int ccnt = 8;
    $ @) ^4 d. i* m# ^! c

  81. ( R4 l6 a$ P' n1 [
  82. module_param(acnt, int, S_IRUGO);
    " @& a- ~' o/ h
  83. module_param(bcnt, int, S_IRUGO);/ a+ D3 U( i( T/ a1 V3 c& C% |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 M* F6 _7 h! Q: }. a

" O% \) {( O+ t% d' ?& i6 b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# R8 w2 `, A% v2 Q  H8 Z1 O0 G: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 L' t! v* @2 ^) r2 ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 l1 C$ H% s5 H  o* S/ y; O5 ~$ p1 W1 }( s4 g

' ]/ B6 ?4 T7 P* m% V! i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-31 22:22 , Processed in 0.048727 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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