|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 c; @" ^4 ]) u8 T5 M E- [code]EDMA sample test application3 T$ J+ `! K# b& q$ z$ W
- /*8 \4 D) L6 G3 l6 m* O: R6 d
- * edma_test.c
4 @, a0 C. V2 q$ b J' Z" f# t - *
, s* M( N! J) ^ - * brief EDMA3 Test Application
3 C2 Y. a3 R% X Y# A - *
% q3 [( h3 S3 T$ K, M: t - * This file contains EDMA3 Test code.
1 Z/ t/ Y4 n6 W6 D' C& Y - *
/ F. w* r! D( E# j! A0 t+ c5 [5 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- x% ^; V0 R( F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
V/ H7 s$ O, d2 K/ t! C - * TO CHANGE.
v7 F& w G( k; O - *
+ E5 U9 x; ^9 t( t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. e( t0 i6 x, r' t - *. ^7 L1 y8 I4 Y. Y
- * This program is free software; you can redistribute it and/or: B9 \" y* s- ]+ e/ t. e
- * modify it under the terms of the GNU General Public License as1 L. u- Y4 F% f: g0 |% M _8 \
- * published by the Free Software Foundation version 2.
9 A" N, Y9 A& |7 ?8 s( k8 C0 V - *
7 F. e+ w! z$ [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ a1 o) p; p4 @* e$ N - * kind, whether express or implied; without even the implied warranty
5 ? P2 [" t& ]1 t0 L$ J1 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 W4 l. u% \; e1 Z9 B9 n0 F
- * GNU General Public License for more details.
% P8 M' k: F8 b2 V' n* c - */6 n1 U" L# l6 I; u
3 q! T* E& u4 h) w, q6 X. C7 |7 `- #include <linux/module.h>' m9 _ q9 a. `- e% U
- #include <linux/init.h>
2 S! L9 i; C7 Q# k& D+ p - #include <linux/errno.h>: n; \ U, C8 x. {. n
- #include <linux/types.h>9 j# S- Q6 W& m: @( F
- #include <linux/interrupt.h>! w+ C% w. f# w( K; w: o
- #include <asm/io.h># U" K y, \# c, O8 u+ [
- #include <linux/moduleparam.h> a2 {. y( m9 U( p# X$ x0 r& m
- #include <linux/sysctl.h>
/ g3 O) f- N6 K8 m( T - #include <linux/mm.h>7 Q( D( j! y# u
- #include <linux/dma-mapping.h>
; Y9 Z: ^" _& Z$ T& O - 8 ]% P: n2 s" Y/ y
- #include <mach/memory.h>
# M, X; y w4 f; z - #include <mach/hardware.h>& ?4 r/ N1 B8 V% I4 r
- #include <mach/irqs.h>
* U' v$ W% o' [1 r& a; @% L - #include <asm/hardware/edma.h>3 A6 O p! z* s. A4 O7 r: F
- 1 y! i' G$ M) v' u3 G! R2 Y
- #undef EDMA3_DEBUG
" z. @9 D* Q6 p- x' [ - /*#define EDMA3_DEBUG*/
q' q- w5 ^" r' }. [; }5 t1 N/ K: |
! |+ T3 f4 T( @6 R: ~: \# ^- #ifdef EDMA3_DEBUG6 K: y/ S3 [! {! f4 w, m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ m" \& J; p% ?" I# e: ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- V9 @9 ^4 X: V: X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" I. i- V3 D+ I& R - #else
7 B2 E$ N5 H% B* R6 i, u4 R - #define DMA_PRINTK( x... )2 j% S. q; M4 t5 A( g& p, k
- #define DMA_FN_IN+ r. D( b% _; \9 n8 f1 l* _
- #define DMA_FN_OUT
% K1 Z, ]& O* r0 D! Y4 j& w/ b5 t - #endif
) U0 @2 X$ {4 u7 l
& q8 v: I0 @6 I$ T: i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 }, n; `# D( ^7 Q
- #define STATIC_SHIFT 34 u" ] H( v% ?/ I4 `' l
- #define TCINTEN_SHIFT 20
) j" I- o! E9 U7 ~3 U" L - #define ITCINTEN_SHIFT 21
' o0 j- }, S' g3 Z% v7 \ - #define TCCHEN_SHIFT 22
4 b, i0 V8 t4 ^+ }! t - #define ITCCHEN_SHIFT 23
# R; C3 k) H Y m
; ]* N; x' e" f2 n- static volatile int irqraised1 = 0;7 [1 Y( j+ K, P# u& ]9 T
- static volatile int irqraised2 = 0;
9 n, ^8 V. D7 i& `/ l( d) r @ - 2 P: o2 S1 `, l" w S7 R1 I- Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* _+ A' r* g! M- ]; v( X6 Q' j% _" w5 d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 z8 _; W. i, O9 A5 t, l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% o6 D5 q) N8 i& y+ h2 M H
: [, n2 S% q9 ^( z* j0 U- dma_addr_t dmaphyssrc1 = 0;+ u' |+ Z- ]! i! a; T% u! u0 J3 X! y
- dma_addr_t dmaphyssrc2 = 0;7 w% v( n. R2 T+ h9 i; {4 ]: j
- dma_addr_t dmaphysdest1 = 0;0 a r: C. T" j/ c% O3 w- X4 R
- dma_addr_t dmaphysdest2 = 0;
8 o1 {5 a# t- Q - * D* j" k2 @. {3 z* P+ T
- char *dmabufsrc1 = NULL;
/ T% w) o' z6 }- N* v& W - char *dmabufsrc2 = NULL;
9 ~; k1 {) v2 s. J+ Y; ]9 A: \6 n - char *dmabufdest1 = NULL;3 |7 S, Z2 B- ], X
- char *dmabufdest2 = NULL;
0 U9 }! \* t: L2 H! U; Y
, d6 u% C; W8 @! u1 P- static int acnt = 512;* w3 R V* C# o% z3 z
- static int bcnt = 8;* h0 v6 h( d. M. i/ c: _9 q4 k
- static int ccnt = 8;+ e, Z2 j9 w8 k4 W
; a3 w$ Q' h# M% H" J* ?- module_param(acnt, int, S_IRUGO);
7 d7 o1 O: a! F - module_param(bcnt, int, S_IRUGO);. ^; a8 {7 P [+ @4 l9 d1 E
- module_param(ccnt, int, S_IRUGO);
复制代码
# o: E0 M0 @' K5 |( h1 i6 A' E7 [, \2 @; K- e' T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& x) {2 Y' ~% E5 d5 j2 ^ Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* w7 Z5 Q) S, J8 ^3 v/ W+ r3 E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' w7 O' h a" Z# T2 [3 i; J
: n8 W" ?2 u" o6 L @
; \, s0 f. i8 w |
|