|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & B4 h# y o0 o0 N/ s
- [code]EDMA sample test application3 L" s! k! l" C4 J( y
- /*9 Q2 }% }, l4 D5 W; D* B1 \0 R8 h
- * edma_test.c
6 g' |5 z) Z: U% |; y: N - *
* P8 d+ s$ b% k - * brief EDMA3 Test Application0 p7 F8 g7 z% e
- *
% J% w- d( ]3 u; i - * This file contains EDMA3 Test code.
+ c( M& p1 k8 r) ~ - *
3 U( C8 ^" q* [. X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ L; C9 G0 Z8 G" F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 s& e8 o" ^% r8 S5 O( g. D+ T3 ?
- * TO CHANGE.7 V2 L% M- A5 }7 ]
- *
- i4 G# Q! b- k$ m6 y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" x* B: W! k2 J9 G3 B T
- *
% \5 L ~" P5 } - * This program is free software; you can redistribute it and/or; \$ y' e/ f3 _
- * modify it under the terms of the GNU General Public License as
/ H& d" w+ P3 E$ n3 \ - * published by the Free Software Foundation version 2.$ e1 x' r3 b: E+ y7 p
- *
$ I( x+ I- w( i' e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ O5 \& y# D$ b+ p/ g" n - * kind, whether express or implied; without even the implied warranty
$ @# {. q' V. ` }% O; ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' k( }' u4 D( V5 O, L, t6 U
- * GNU General Public License for more details.7 K* ]# B& Y5 b6 L9 L0 O
- */$ Z/ p8 M% O7 ]1 W
- 9 ?- _/ K! d! u
- #include <linux/module.h>
2 L! {. D5 Y9 O: C: ?& U - #include <linux/init.h>: y$ L3 O6 o! M. g8 R' Z4 N/ F$ t* J
- #include <linux/errno.h>: }; ?& z* z) u4 X% _1 e* g% E
- #include <linux/types.h>6 c9 E9 a, A, g3 G# p, F+ V5 {/ ?
- #include <linux/interrupt.h>
; O3 _8 X a5 w2 c* m/ w/ K - #include <asm/io.h>
. Z( u* C" |( J2 `/ {1 [5 V4 ] - #include <linux/moduleparam.h>
# j7 w! p* H( e8 F2 ?+ A - #include <linux/sysctl.h>
' m& N- o/ v, b/ p$ \ - #include <linux/mm.h>8 w: s1 Q: [ L7 w& s% N
- #include <linux/dma-mapping.h>* c- U; D3 Y# `6 `
( S4 F0 s6 B5 v! R- #include <mach/memory.h>
* J4 b3 T& X3 D! P7 x$ n; L% s4 ~. q - #include <mach/hardware.h>
1 ]# n0 n& v% e$ ]# k0 J- z) F - #include <mach/irqs.h>' q% Y; Z0 U k& _3 H& {$ C
- #include <asm/hardware/edma.h>& T4 m. H/ ?9 m0 _
- * Y& } V4 O% Q) ?' X. F8 w
- #undef EDMA3_DEBUG# P" D2 ]. F# S( g5 ^% w7 O
- /*#define EDMA3_DEBUG*/! Z" d, ~, j6 K. l/ N. `
8 c8 p; I2 E# a% I l$ R- #ifdef EDMA3_DEBUG
3 V& Q+ U2 m2 R1 e+ l2 M" O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) {# a; x S* \: e& E' `7 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 S0 Y3 ?, C7 L- `6 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ ]; r# `3 A7 E* O - #else
; m6 m# [. w! x4 ]+ L. W - #define DMA_PRINTK( x... )- t2 e, k3 W# ^1 ^' J# Y
- #define DMA_FN_IN! q; o# U) C) s0 N; p
- #define DMA_FN_OUT
8 W* |+ |5 e& @/ n0 S - #endif
, a2 L- n" p3 q+ V( u
# `) e- M- u: Q) l9 x' V/ @7 E5 o3 @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ y! k% J8 f' T4 c, \/ l3 S - #define STATIC_SHIFT 3* N9 l5 k( O: K) Y' B' h
- #define TCINTEN_SHIFT 20
9 q, h. W1 ?. z( d! J2 d - #define ITCINTEN_SHIFT 21
8 V2 C. q3 ?. j- m: T1 ` - #define TCCHEN_SHIFT 22) C G& P. p+ e/ t$ s
- #define ITCCHEN_SHIFT 23
" W5 ]2 Z; a! c% E# d
7 o; g! R4 M& O8 A6 n- static volatile int irqraised1 = 0;
8 I0 ?. x; l/ ^2 }% R0 ~1 L - static volatile int irqraised2 = 0;
2 d9 B: h; ^ ?+ X9 T - & {: }. ^$ b9 E1 E- _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& _: x8 f( ~0 [ Z3 L: m" w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 {, Y: @1 p" }8 e b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 K. Z- ~) B- B. S1 k - % N" c" o$ \( u
- dma_addr_t dmaphyssrc1 = 0;
8 x% s1 G1 t) {+ {# q9 w - dma_addr_t dmaphyssrc2 = 0;2 D+ o" ]* v. F( D
- dma_addr_t dmaphysdest1 = 0;+ D, d! M7 t8 }+ R
- dma_addr_t dmaphysdest2 = 0;
9 R: A$ W! w# {; o2 f
. R8 U2 o) W% I% j; D1 \. `+ p" X/ h) \% m- char *dmabufsrc1 = NULL;0 s9 i- ~- ~! W G0 w
- char *dmabufsrc2 = NULL;, N* F. l" b6 |
- char *dmabufdest1 = NULL;
- r. {5 q( Q0 I7 a) I5 F9 q - char *dmabufdest2 = NULL;, m0 ]+ g6 v4 Y
( p* `! k9 t: v& _; o- static int acnt = 512;
' |( T1 D9 k5 F x0 b9 D3 `: M - static int bcnt = 8;
: ^4 m: t, i& g' `+ D& X" X5 Z - static int ccnt = 8;
& N( k) b4 `& r5 v) x" k! G# X - / ]7 q# V5 i1 v; D: g4 V
- module_param(acnt, int, S_IRUGO);2 h) J9 [+ t! |/ ]
- module_param(bcnt, int, S_IRUGO);% y' {0 u0 ^8 d
- module_param(ccnt, int, S_IRUGO);
复制代码
6 ]2 v/ M$ V( b5 Z( j/ U, b, r' g3 M1 p# v7 e( e2 `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" y) ^5 F1 E$ R5 w: e+ d, |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 R, n6 @3 g) } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) W, ~7 z4 q0 z9 b5 w
0 a2 `0 L! N7 `+ p* ~" H8 |! R% z+ X9 o, G
" P( r/ a+ B7 K3 w; `
|
|