|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Q2 N% ^! ?8 [0 [* b8 \. d: j- [code]EDMA sample test application
0 X8 k: ~ {* J( A; P# t4 w - /*
) }, @# Q4 Y% ^4 f. z3 `: U0 } - * edma_test.c' E; p2 z- n1 N" H# B
- *" @2 f: l5 A# z# k5 o
- * brief EDMA3 Test Application: X, ~' i! |+ Y% @
- *
% Y! Q) L' ^# |* I) w: ]( ]7 R - * This file contains EDMA3 Test code.
0 z# X$ |& N7 f4 ~8 u7 K - *
2 A& M( x" w/ b+ T A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: ^( \% _ S( e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; O9 k6 l! K5 m" |* m
- * TO CHANGE.9 Q8 d% `: B/ f
- *$ C* \6 a) c3 U5 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( t ]. i7 ~5 J# U( H& C. f
- *. v1 b4 j! W' R9 W: L, v
- * This program is free software; you can redistribute it and/or$ c) g; ? d* {$ M
- * modify it under the terms of the GNU General Public License as
. L2 V, w( O' f5 D. f' G0 v - * published by the Free Software Foundation version 2.
5 w. [& `% l: }& [) G3 V! x7 E: k - ** O8 o" s) `0 f) K5 B8 ^: j4 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ {7 N1 ]# Y) e: r. v! X
- * kind, whether express or implied; without even the implied warranty
/ ~8 Z$ E9 H% ^2 `$ ~' g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ~: c6 L U, y3 [2 A - * GNU General Public License for more details.
+ X4 ]7 [: h$ c1 ]$ b; ^3 ^# e - */) m$ L" m N0 \7 Y S2 S" p5 ~; r
- ; l4 p7 ^% V( y+ L' b" }
- #include <linux/module.h>5 l7 \& A2 b0 v
- #include <linux/init.h>
8 l& i1 b- `9 O7 W3 A$ g - #include <linux/errno.h>
% D- Y- ~" S% P( A - #include <linux/types.h>
+ M& K: p4 r& H- O - #include <linux/interrupt.h>9 X; s8 H k) }8 O! I' R1 B( `9 N
- #include <asm/io.h>4 J4 U" K3 o6 ~7 H- p. e a1 N
- #include <linux/moduleparam.h>9 J8 S! z2 ^7 h$ w& f
- #include <linux/sysctl.h>, F' ]" O, ]1 q0 B, I6 |
- #include <linux/mm.h>
2 C3 G2 ^6 _& ?$ B - #include <linux/dma-mapping.h>* Y( y; i Y$ O) m9 j* |9 R
, @* ^8 _( U [- #include <mach/memory.h>
& }5 M- x* l/ \% Z - #include <mach/hardware.h>% y+ Z; b; W! v! z/ E( P! t
- #include <mach/irqs.h>
' ~9 o1 U2 _8 V - #include <asm/hardware/edma.h>
$ q# d' L6 P7 O) O- W
h1 [$ h1 u6 |5 E* `# u5 u% e- #undef EDMA3_DEBUG( A4 }1 S: w+ P9 @
- /*#define EDMA3_DEBUG*/" }% I; r+ ~6 O7 z* b0 c8 w
2 F' i/ x, L0 ]+ @. y- #ifdef EDMA3_DEBUG$ {" Z6 f1 `1 @0 ]' Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 g$ O. v$ P& D- H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% c4 y- ?/ [( j4 ]& L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 ~. h" x4 j% z) \ - #else! e& e6 [; K2 J
- #define DMA_PRINTK( x... )( R1 M% ?; x d$ _% _" {: O
- #define DMA_FN_IN/ ~/ a1 ]/ i7 I' l
- #define DMA_FN_OUT4 y, ?% K D& a J, V0 g5 v7 X9 s1 j
- #endif) S9 O- B* C6 {8 n) s6 @
- , g7 J- s u% r# G* u3 Z& {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* P* q7 w) @- _+ m, V- L
- #define STATIC_SHIFT 3
( D- G* B( h4 a* w9 A5 n - #define TCINTEN_SHIFT 20
6 ]" I: H0 z5 p( s* J/ g - #define ITCINTEN_SHIFT 21
# n+ q+ j" Y% N2 [0 v5 \" F - #define TCCHEN_SHIFT 22' ^0 c) B6 |" C# {* m4 @
- #define ITCCHEN_SHIFT 238 f: D- }1 G1 Q0 K' V3 j: | y+ ?
' @6 R( p) _+ J, ^- R( ?- static volatile int irqraised1 = 0;/ F# B$ X" S( Y) M8 z' x
- static volatile int irqraised2 = 0;
9 h' Q" P; q; I7 C& D" ~
% X9 |- E4 p9 @, B7 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& { x/ x( w+ W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ ^9 \! N# t, p# W# j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 [* K2 `+ M6 I, r6 `
/ r4 c! d9 {# J6 z# } g6 x ?- dma_addr_t dmaphyssrc1 = 0;8 m- s- k! i6 P2 k) ^
- dma_addr_t dmaphyssrc2 = 0;) b/ e/ ^6 F2 }8 R2 p
- dma_addr_t dmaphysdest1 = 0;
5 z; f: h& q5 h! R - dma_addr_t dmaphysdest2 = 0;: A# a* Y6 v1 m6 Q! M* B \, o- c0 n
- : g) H2 t; D" M9 R# s+ u
- char *dmabufsrc1 = NULL;
; A! B* f$ Q7 u: [! Y1 W5 { - char *dmabufsrc2 = NULL;' g) T, z6 x; j& @# ?
- char *dmabufdest1 = NULL;6 \0 I5 z z3 \
- char *dmabufdest2 = NULL;
$ H! _4 j7 V# V# e/ [0 u/ R - " i* C7 p9 B0 O, }% X$ P4 p
- static int acnt = 512;
. O3 N2 z1 Z$ T2 ?: ~$ B" X - static int bcnt = 8;6 v5 i, }4 r; h; b: a: k& `) Q0 O/ g
- static int ccnt = 8;
) l% `1 A6 r5 p8 u0 U! d8 X( D* d' s
. D3 s7 p" `- r) }: R) Y- module_param(acnt, int, S_IRUGO);0 z8 g- Q$ Z0 @6 e# V+ B4 N' a
- module_param(bcnt, int, S_IRUGO);! A3 [, S! ~" j# i6 H& N
- module_param(ccnt, int, S_IRUGO);
复制代码
; V! |+ t* X- s4 `
" l/ E" Z( }3 X) r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 n- n, _; H# e) o$ Y& l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ^/ C# c2 g# [4 F O* J# w( S8 h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& ?1 D/ J* i2 v9 q* k4 |
$ p" k6 _# c! A' c! B5 q. _. T" F/ A* I. z
|
|