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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( O: I/ q7 U$ P3 [. b' H$ _1 Q" Q
  1. [code]EDMA sample test application7 r3 ~; V  ~8 ]
  2. /*; h$ D3 @2 x; m; [  Y+ n
  3. * edma_test.c/ `- I; @1 v  V& Q  N
  4. *8 G( {2 x# `! ?: i+ g
  5. * brief  EDMA3 Test Application% s: R) m9 `, L5 c; h9 A8 R2 E
  6. *' t/ _6 t' p2 S: {4 `
  7. *   This file contains EDMA3 Test code.  @# w! Z& J1 P, t% Z7 d: j
  8. *
    ( {1 Y. p; w* e. h) t$ @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 F+ E! w% |7 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) J$ x3 y2 n4 y0 H; [2 N+ l
  11. *         TO CHANGE.
    0 A, b" s) H: C, a
  12. *
    7 D5 Z: ^( O5 ?' H5 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 v8 F. a" I! a6 N8 Y" [& q" ]
  14. *
    ! [& `5 d# C6 Y2 I
  15. * This program is free software; you can redistribute it and/or1 h8 A- a5 I* L% R! ~
  16. * modify it under the terms of the GNU General Public License as$ t. s, h8 q- U3 N! A3 t" f
  17. * published by the Free Software Foundation version 2.
    * ~$ H/ U/ t* F+ @9 |/ F
  18. *
    ! p* k; L0 q$ a  G" k* B& R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 @0 B. C) M4 \$ H* D5 z9 u, a
  20. * kind, whether express or implied; without even the implied warranty
    3 p6 }% I. f2 N6 L  T2 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 c& v9 K, b  _7 W
  22. * GNU General Public License for more details.: j* O$ o3 m/ _
  23. */
    / k! R) p6 f: @9 M

  24. ! U# G7 d0 B- @: Q8 F, a% I
  25. #include <linux/module.h># \" k- v% u" |" k
  26. #include <linux/init.h>. n( @, U. o; s; I9 Z3 P
  27. #include <linux/errno.h>
    7 H$ z+ h8 Y5 \6 I
  28. #include <linux/types.h>
    # d/ ^" l- y  S3 n- Q8 c! @
  29. #include <linux/interrupt.h>
    ( ?" u( C$ ~( }: D% H/ o  \
  30. #include <asm/io.h>: S+ C' E# r9 h3 @
  31. #include <linux/moduleparam.h>; x+ u( m6 u% e, S( \% k
  32. #include <linux/sysctl.h>
    * v; D- |% y3 d0 J2 o4 Q( Z
  33. #include <linux/mm.h>" M7 y" ~$ a- t8 u: o
  34. #include <linux/dma-mapping.h>5 D; x" K! a3 y
  35. 5 _: o' a$ x6 M* T) O+ H9 P; W/ C
  36. #include <mach/memory.h>& v8 _1 H4 ]2 l5 Q) ~4 f
  37. #include <mach/hardware.h>
    2 x6 I: Y* v! Z9 T- ]) [2 J
  38. #include <mach/irqs.h>
    ' @+ `6 B% q- N0 H
  39. #include <asm/hardware/edma.h>
    4 Q2 x+ P1 N+ ~. N7 |
  40. 9 F: t7 Y7 C  V) F! X' \
  41. #undef EDMA3_DEBUG
    ( c/ F* }7 b% A) u/ C# C
  42. /*#define EDMA3_DEBUG*/
    : R4 A& D2 S) x% |/ |3 N) {

  43.   T: W' K9 L( g0 o' X) ?
  44. #ifdef EDMA3_DEBUG
    0 K  ^8 j2 L7 H% x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 F8 ]! X& R, k% y3 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . M. F" B1 I" p1 {( I5 B6 }2 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ X7 J3 K+ \( T+ a
  48. #else, H* C3 Y4 ~3 C  T& q1 {
  49. #define DMA_PRINTK( x... )
    8 B0 [, |5 g& w# _2 s. {. S( V
  50. #define DMA_FN_IN6 `# r! e& P3 `. ]
  51. #define DMA_FN_OUT
    0 D# I) ?# @( _% j% a; t
  52. #endif
    6 ~5 M/ S6 y, l. h

  53. 8 g5 Q0 J5 P  r) O( H( z6 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # W4 v. V& Y( m4 D1 b3 y. m" }& f) Q
  55. #define STATIC_SHIFT                3; c' L4 r; G" o) U1 y
  56. #define TCINTEN_SHIFT               20
    & ^/ z% W# i' u& D/ d6 V
  57. #define ITCINTEN_SHIFT              21- c  G) z+ M' c
  58. #define TCCHEN_SHIFT                22) T7 u" w; u6 \
  59. #define ITCCHEN_SHIFT               23( M: m5 H- a! C0 }) c: n
  60. 7 E' d( B" ?/ m8 ^2 g
  61. static volatile int irqraised1 = 0;- Z  b) K1 ~8 z" L/ i
  62. static volatile int irqraised2 = 0;
    $ p8 b+ s* g0 k9 e
  63. " G6 e/ T1 v: e+ e4 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( j/ T1 k. E- x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ^9 D3 \2 R$ D0 |  J2 L( P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: X* T. g% Y$ U) J

  67. & m( t/ z: s9 R* }3 W" O
  68. dma_addr_t dmaphyssrc1 = 0;5 |( X! I  d2 N9 b# M6 m0 s
  69. dma_addr_t dmaphyssrc2 = 0;& ~* k7 ^) A7 @$ E* x# X
  70. dma_addr_t dmaphysdest1 = 0;9 k) W; l: v9 D7 H0 @' _5 G1 w' o
  71. dma_addr_t dmaphysdest2 = 0;
    , \+ H4 ~4 m6 }

  72. ' w( T3 n2 j+ ]1 {/ O
  73. char *dmabufsrc1 = NULL;' K* g$ B& `# G& q
  74. char *dmabufsrc2 = NULL;
    + N7 [) J9 l: s7 ?2 j& Q! z- [
  75. char *dmabufdest1 = NULL;
    8 \) _0 Q$ R7 ^
  76. char *dmabufdest2 = NULL;1 h9 ^5 g0 D) D) }
  77. , m4 _4 ?3 X9 N5 }# @- x# m& a
  78. static int acnt = 512;
    " l) y' q- C. P* u1 o
  79. static int bcnt = 8;
    * W- F/ m* i* Q+ L, _0 S/ F8 i8 @
  80. static int ccnt = 8;/ [) g  U; Z3 W6 v( i: J! u* z

  81. 7 r5 w  k; m* f1 w- D* K3 O7 q
  82. module_param(acnt, int, S_IRUGO);
    / m& J5 `/ N1 G
  83. module_param(bcnt, int, S_IRUGO);$ H6 m. k$ v% Y  W) l0 Y# d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* j' k0 G+ ~# E3 ?# }
$ X- g- w3 G. q+ G+ R# q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 o& R: s3 Q' d1 I7 C! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- N5 R" G9 a$ O* L" O) x3 W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 g1 Z, ~( A! c" D+ m- f4 B7 J
! l1 A1 z( x4 n3 A, [3 [, q

; ^+ O! ^* |7 l1 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 05:19 , Processed in 0.037089 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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