|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! L) z1 u7 `: I2 V, [. u& y
- [code]EDMA sample test application
0 {3 O+ T) y" [( d - /*; E- G4 Z2 b# x* c# x4 x
- * edma_test.c
4 n/ q7 } o, [, t1 l+ S4 f - *, w4 Z1 @: ?9 `6 O+ r
- * brief EDMA3 Test Application
* ~, f! p( T2 B8 n" j, e3 C - *- ^+ V2 I/ k" t7 ^1 W' i' [' b
- * This file contains EDMA3 Test code.
0 e' o+ \4 o8 K% X5 s% U - *
3 a [0 C/ z/ j+ e& m- N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* r9 r+ g+ i( e- T0 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- m4 r4 s- v9 b, @% c2 ~! w
- * TO CHANGE.
* V: I1 `) M, Y9 N4 q - *" [, a- y; S, ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ V* z* `/ O* T* t: M
- *
6 S5 j: Q) f z0 z- a# w) \ - * This program is free software; you can redistribute it and/or
7 W2 f! z a$ t/ \3 a - * modify it under the terms of the GNU General Public License as
/ W/ m9 [0 E( L! z - * published by the Free Software Foundation version 2.+ v. \9 h# n: ?& a4 u% g- U
- *
2 w% z" k' r) [/ T! C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ q2 E7 @- ^8 T/ _* M
- * kind, whether express or implied; without even the implied warranty7 `2 M$ w3 m2 k v# a1 c4 w! x& S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, ~" g( N2 c" m5 ~* r
- * GNU General Public License for more details.- u8 ^# p; J3 b R
- */
8 S# i! Q- }8 \& T9 `
2 R+ |+ T+ \4 L6 Y+ c ?- G) J- #include <linux/module.h>' D& x+ Q! X2 Y' }5 R$ o& K
- #include <linux/init.h>
! s0 ~9 @; x; B6 u1 D8 }2 M) [+ [ - #include <linux/errno.h>3 P b8 M6 d, I, o! K/ N: l. T. c
- #include <linux/types.h># P4 z- _; S3 L# Z$ g- z
- #include <linux/interrupt.h>: F4 x6 {3 n! ~( J# l! _
- #include <asm/io.h>- s3 [9 L. _! ~: ]6 O' w
- #include <linux/moduleparam.h>6 P7 t$ s8 E& H8 A4 k4 g7 N
- #include <linux/sysctl.h>
* Q9 A- j4 \7 q) m - #include <linux/mm.h>( W2 g1 a( M6 h; o% M& f
- #include <linux/dma-mapping.h>: Q1 a$ N, @& D1 [' W; p
- / b( D/ g+ ~. \* P0 T7 n
- #include <mach/memory.h>5 v9 a. m6 |/ J
- #include <mach/hardware.h>- y( E& o7 Y$ N3 v
- #include <mach/irqs.h>$ G4 g# _3 I5 A, O, l
- #include <asm/hardware/edma.h>
% ~( v: \# \' q' d6 v
" F Z% Z% D- _" z3 ~- #undef EDMA3_DEBUG
3 P9 H; J; E5 Q) Y5 e. \" D& l - /*#define EDMA3_DEBUG*/
a, W8 X9 p6 L9 t& |. K- o T* N
! f$ e" {5 m* M- #ifdef EDMA3_DEBUG( X0 y! Q' l, t0 @1 r* A- s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 w! S6 s$ \8 A: T* ~1 h7 n# b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 b, I8 I V+ E2 Q/ w7 X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; ]( Y$ P) }3 W7 b" |8 ^; H u ]4 a - #else
, C9 P, [; _4 X - #define DMA_PRINTK( x... )2 Y3 o0 N2 Y1 C% E8 ], f# g
- #define DMA_FN_IN
" k( s/ ^" M, }5 x3 m+ b - #define DMA_FN_OUT
. O( u2 s) { B ^8 z - #endif7 H: N! x- k+ G3 _, o) L, }* ~
4 r% C' ~6 f# S( \; J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 T. C4 G" a0 H% A! K' H
- #define STATIC_SHIFT 3
0 k z& ~; n- c% k5 b( \( r' D - #define TCINTEN_SHIFT 20
( K* Q k1 n- }' }) I- Q - #define ITCINTEN_SHIFT 21
. j& l; y) h( [& u) L4 Z - #define TCCHEN_SHIFT 22
1 {; R( J' u. }* y& u5 M3 t - #define ITCCHEN_SHIFT 238 e! b8 K; t% N! k1 U
- 0 D1 Y9 \* \/ ?0 L
- static volatile int irqraised1 = 0;8 A" V4 a' j' X( L% B' p
- static volatile int irqraised2 = 0;
2 {8 I7 u; n3 X/ M$ ?; H' U0 X - 9 S4 q0 u) e" q8 h, B2 ^/ K" w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ?5 c2 K7 m1 H/ D$ D: @7 d5 N: | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 v+ k3 V4 z& P7 P* p4 N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 g* T1 m7 Q' k% x! N- s. Y" t& p9 T - 6 ]# X, Q, p1 t/ m/ R
- dma_addr_t dmaphyssrc1 = 0;
/ K5 N3 r1 N4 n4 M' C - dma_addr_t dmaphyssrc2 = 0;
; T' \8 b* d$ j - dma_addr_t dmaphysdest1 = 0;3 {$ H w7 s. `. `. G1 q/ f: b
- dma_addr_t dmaphysdest2 = 0;
$ ]+ D2 `; S6 w2 A; d& g0 m# q
+ Y3 Z1 c K5 a# k! \- char *dmabufsrc1 = NULL;
+ R, L2 l; ^& ~- p% O& @+ b* e - char *dmabufsrc2 = NULL;
6 ]8 x$ R3 E" w2 ~& _) U% ~. R4 h - char *dmabufdest1 = NULL;
1 \1 P* z1 v: C: T2 |: l5 A) _7 r - char *dmabufdest2 = NULL;: z' d/ C2 [+ P! ~- j
7 @) t2 B- p' p; G6 m3 G5 D* b- static int acnt = 512;$ u- |) T6 y* q9 `6 i/ M
- static int bcnt = 8;$ k$ x* h9 I! K( g8 E/ @' b( w
- static int ccnt = 8;0 ?4 I( I/ _. S5 `5 C$ b% f
$ R8 g5 b$ j2 D7 G- module_param(acnt, int, S_IRUGO);
) k5 t6 {! A3 y" h2 W: T - module_param(bcnt, int, S_IRUGO);
, t: _" g+ R. g- i1 t - module_param(ccnt, int, S_IRUGO);
复制代码 ( S/ s! c$ w( q, r# V7 k" A# I
9 X. i9 U( Q ^% w( K5 z% G0 N* c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 I" X9 I, [- t8 G4 }
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 K9 h! v( n- ~! H2 ]8 ?9 m* r9 d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
~7 g3 x! y. n6 O X! _* G% S# d
9 p, K5 q9 l9 i# J4 P/ u" `8 J7 ` _* Z& Y$ l& ^* C6 Q
|
|