|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 D; }' k% x0 y- [code]EDMA sample test application w* v' m- y: w3 u6 \
- /*( i9 H J/ t: P. L- j- \ L
- * edma_test.c
' q; J" w! p9 R" Y' I4 y7 W' K - *
& h5 x* j% v; w9 z - * brief EDMA3 Test Application
. o1 l, O9 F' F+ T1 N3 h2 X - *
. J4 j j3 @, V* K - * This file contains EDMA3 Test code.% t$ x5 d7 J; V2 J# p G% F, |6 H
- *& ?$ `8 l4 x/ t* g1 d4 w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 T$ i% H/ w1 c" h9 V0 g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, U5 ]8 z% \; n* `6 H7 M' m3 I5 @
- * TO CHANGE.
( C+ v0 o! M" N - */ A- o6 i9 h- h8 Y3 M1 @2 a: }$ K6 M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& F1 j2 p( `2 j+ {$ P m0 r5 u
- *
. `0 G$ }8 }( ~ - * This program is free software; you can redistribute it and/or$ G% x e2 I$ a* s5 G
- * modify it under the terms of the GNU General Public License as _& \' ~# l! X* n& l+ U, w+ f( B
- * published by the Free Software Foundation version 2.
" C& ?9 `, m8 W1 ~ - *1 D) _& B" w# U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* L! p/ s7 @3 |2 O
- * kind, whether express or implied; without even the implied warranty
/ b0 {8 I7 i* N5 ?; _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 I+ c7 K2 R4 F1 T8 z$ h4 z) b* ` - * GNU General Public License for more details.
/ |( K2 u: D* x* W - */
% j0 x8 u' y' @( ?
$ q- X" {; i$ \5 i$ @+ k- #include <linux/module.h>' T: I' o Y* V/ H3 m2 Y
- #include <linux/init.h>
" j2 O. o8 Q8 {' u/ c, t - #include <linux/errno.h>
# |' j* f3 m& ~ - #include <linux/types.h>4 k$ _; U+ |1 l( q. X# o3 t2 I* F
- #include <linux/interrupt.h>
7 o- d2 H+ n3 g) A - #include <asm/io.h>
7 X p6 v/ y6 g9 R' W8 k2 A - #include <linux/moduleparam.h>
( W2 u- K: ~$ {4 [! r0 { - #include <linux/sysctl.h>$ d7 ~' o) o) g. k/ X
- #include <linux/mm.h>
8 h+ ~5 w6 ~& g" L+ m7 J - #include <linux/dma-mapping.h>
2 O$ E- U* H4 I" u' o7 ]4 _ - ! z3 h6 b4 ~$ Y3 O
- #include <mach/memory.h>2 [9 x8 u2 U4 q6 t) ~. I+ @8 f; b
- #include <mach/hardware.h>0 U! C4 \" P8 U
- #include <mach/irqs.h>
) D; O. A- d0 N3 ? - #include <asm/hardware/edma.h>! Z, n: x( n9 C: H: u+ R: [+ s
) }( K) D( b+ [7 q5 z4 k! I- #undef EDMA3_DEBUG# d/ K* X: m( m2 }
- /*#define EDMA3_DEBUG*/4 W) z* z, l( a! b& r7 G
- 2 k* R: ~& X0 ~2 `, T( p; k
- #ifdef EDMA3_DEBUG) n* T, A9 k$ m- z$ ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). G2 E1 w& a: |# V9 h$ W9 _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% q" F2 n3 }! z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) d: U. \$ s0 ^! f7 d& q3 Q
- #else# m6 Q( K2 R( I$ b( @) I5 E0 {
- #define DMA_PRINTK( x... )3 |" c- ~+ o4 L; e$ J
- #define DMA_FN_IN
3 r+ Z. p6 k( j- {8 V - #define DMA_FN_OUT
( g! d' d6 E$ P( w5 w( ^ - #endif
! E0 F4 R7 } y8 E* Z
+ i3 u0 ?! Z, A n, R! @- #define MAX_DMA_TRANSFER_IN_BYTES (32768): @4 B7 R. D6 e( \5 R o
- #define STATIC_SHIFT 30 K# j& h2 ^3 O, _# B
- #define TCINTEN_SHIFT 20
* `& b$ z/ w; T& S! A' e4 J - #define ITCINTEN_SHIFT 21
' \) J' \5 a1 K% o - #define TCCHEN_SHIFT 22
2 J/ t1 W" } L% I - #define ITCCHEN_SHIFT 23
1 M9 a$ K0 E" x3 m
1 d5 U5 P" a3 |! x- static volatile int irqraised1 = 0;
; X+ ^! ~4 k: W; h: ]/ \ - static volatile int irqraised2 = 0;
, D, g+ ~* G. N/ f/ i9 V/ z! b; {
* e% U" _% u# i* A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. t: b: O9 m4 a: g' v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
]% c4 e1 v. u) ^& y3 o. F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Z( }1 O5 P l4 n$ M% q0 s
4 e% y) m8 s1 ^( w) R9 p- dma_addr_t dmaphyssrc1 = 0;
$ K8 q* u$ b2 j; A: L' _ - dma_addr_t dmaphyssrc2 = 0;+ x8 I( l$ q! @$ n0 g
- dma_addr_t dmaphysdest1 = 0;
c( ]: Y% U9 Y9 U; m - dma_addr_t dmaphysdest2 = 0;' F! x% D! \' U0 F$ y
+ ]: l, m& a* u- char *dmabufsrc1 = NULL;
8 h4 R& L T5 e# W - char *dmabufsrc2 = NULL;& [ E/ i \( z
- char *dmabufdest1 = NULL;5 ^6 d ^4 f# e6 g) {/ t7 H
- char *dmabufdest2 = NULL;0 k0 [6 V, ]0 }- H) M
4 M$ G% J" _1 X5 L- static int acnt = 512;
; S, F. F( ~9 ^ - static int bcnt = 8;
7 j$ I# q% f' h) R - static int ccnt = 8;
+ A0 z& M) A: x" N0 ]( `5 m1 @5 T0 ~& j - ( r% m- {+ ]& m% h0 ^
- module_param(acnt, int, S_IRUGO);8 }, p* U1 q/ [; x4 i
- module_param(bcnt, int, S_IRUGO);
" Y# F% z: ?) X" M: [0 z - module_param(ccnt, int, S_IRUGO);
复制代码
$ U2 e; M3 o' A) \1 T# S0 Q- f, A: M, K1 A' Q. n$ Z! W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( j+ g5 A* m# u
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 s* _# W7 n' i: \7 ]0 @) B% X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 X ]5 R; X! I) i& B Y$ X) D$ B& f: z# ^2 T. [9 M
- p$ Z& n5 @/ y' }) y$ g |
|