|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) i( }: P+ q, ]- ?- [code]EDMA sample test application# B1 t! ?1 t( m
- /*
1 w# ^% r0 p8 b0 u; t4 } - * edma_test.c: u- I! h% t' N* w9 h
- *5 v+ z+ g+ A, |( q* }. B
- * brief EDMA3 Test Application; P& ]! Y% p. O
- *
7 a7 R* e' C7 G% X5 [1 d. d - * This file contains EDMA3 Test code.& U! X! C S8 M4 z& {0 D7 f
- *. v- A3 s Q, b5 C' H; D( y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" A4 u+ O% A1 b2 i# P3 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) s; z: r) T/ s) y
- * TO CHANGE.! @* z" C: ~9 G$ U$ i j
- *9 Z+ v5 ~' Y0 I9 {6 K# F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, A1 G9 }$ `1 _9 s( r
- *: s6 f# ~3 e% M0 v9 S6 m
- * This program is free software; you can redistribute it and/or; i9 D* k) i& E& f& e7 u. K
- * modify it under the terms of the GNU General Public License as9 w/ n; m; E5 t9 a, a; {
- * published by the Free Software Foundation version 2.2 u5 |/ `* w6 I4 H2 h
- *
' c6 _8 P& h; y- a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 R3 f+ r. a- p4 y! v# ]- P
- * kind, whether express or implied; without even the implied warranty- y. M3 d/ K# \) z# i' [! l k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ e J Y% s1 t0 O, i: R, |! S/ {' O
- * GNU General Public License for more details.7 }9 {- A* N. ?! I n' ?
- */
7 [+ l0 E, o: e( x& O, \ - - p, z# p8 B3 r0 _3 m' z0 A% F
- #include <linux/module.h>. G1 H( p2 m; I- R3 m2 G" {
- #include <linux/init.h>9 l3 v* b& J- U5 w
- #include <linux/errno.h>
0 \3 y0 W' t( t8 A# {: G! t3 D' I - #include <linux/types.h>
+ `* _7 w d7 p | - #include <linux/interrupt.h>1 u" S8 V3 Y- k5 W% h$ X
- #include <asm/io.h>
5 N! D& H" }9 ~9 v& l" ~% r$ P - #include <linux/moduleparam.h>
" H' o. O; W9 B# J+ w/ `. @& k8 E - #include <linux/sysctl.h>
, Y' @" v7 Z" Q. @) o% S7 e - #include <linux/mm.h>. J: p& V2 O% Y8 H
- #include <linux/dma-mapping.h>6 K0 U' u; [% D. y: c5 S8 h
- & z; e' j4 `- p+ h: X4 z
- #include <mach/memory.h>
( P z- q& r* b' `8 `% B3 i0 s O3 } - #include <mach/hardware.h>7 A8 Y+ t' d; W
- #include <mach/irqs.h>
8 {$ Z$ L3 k8 [0 A. v - #include <asm/hardware/edma.h>
1 {* [* K2 _+ [8 I& K - ; v+ `- }" }2 h! ?, x
- #undef EDMA3_DEBUG0 Y, d- I2 L2 h1 i9 n- S- ~8 B
- /*#define EDMA3_DEBUG*/. A0 _. `$ Y+ \1 a: ]! y
1 s9 \' i: h! u, l! V/ g S4 p* k- #ifdef EDMA3_DEBUG _" z1 D* q( P/ D# o! Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 z$ k q' ~3 |1 ^& w0 P! j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; f T3 |! F0 d7 V" p0 B9 v! A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& \* Z/ L* J' w$ S% F0 ~
- #else) m0 n! `& S6 J7 b* x4 s
- #define DMA_PRINTK( x... )/ M2 u, P5 F% M) h! p a: J
- #define DMA_FN_IN
1 a- S7 R* o# c" _% j( |6 ^ - #define DMA_FN_OUT
. i& _8 M Q4 {2 Y" M. M' _. l) E - #endif+ m9 o/ D4 s* x% I/ z! x, _
- ; L; F/ i1 t2 _! O' E1 h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* _8 v: h+ B; b2 C- l0 T - #define STATIC_SHIFT 37 G5 W& m5 M, P( ?, E; @
- #define TCINTEN_SHIFT 20
4 H; Z/ l% N, v1 ^: f: m2 Q6 W - #define ITCINTEN_SHIFT 21
( @0 j1 p" e8 _5 X - #define TCCHEN_SHIFT 22: m# q: } Q6 R9 H
- #define ITCCHEN_SHIFT 23
+ C+ U3 r2 k- a: q s - 0 }- H, h: D q$ n# Z3 D4 f' i
- static volatile int irqraised1 = 0;
" @* v( r( _8 C2 Y0 a - static volatile int irqraised2 = 0;
' ~7 G7 T( i! R2 ~
% }1 m% L& V1 A5 M) Z9 M+ m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
M5 |, j) w0 t* b) _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ r4 G& ?, c6 V/ _+ I$ m" p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 S1 l9 v) L4 q U* y) R/ \
9 b% z1 Y1 n r% J' [4 o6 q3 C- dma_addr_t dmaphyssrc1 = 0;7 c3 i& g1 Z& G) k# K
- dma_addr_t dmaphyssrc2 = 0;- d/ S4 u9 i0 v
- dma_addr_t dmaphysdest1 = 0;
' _1 w+ N; {* o; z- m! b r - dma_addr_t dmaphysdest2 = 0;
/ F* ?( u+ o& P# h& y2 j - : M# f$ S2 k9 g" {+ [, \* ~
- char *dmabufsrc1 = NULL;
" r0 }" X: w5 s/ O( S - char *dmabufsrc2 = NULL;
0 J1 R$ Z+ `& ]! Y( f" c# ` - char *dmabufdest1 = NULL;! d- o3 p* @ B, n2 s
- char *dmabufdest2 = NULL;
5 w, A, k% U) D, p- l) O - ) H3 s, {. {7 X/ e0 m7 q( G3 ?6 o
- static int acnt = 512;% H& e; K; |/ _6 z
- static int bcnt = 8;
7 N X* F: `- P6 q# F2 b$ D4 f( n - static int ccnt = 8;
+ Q' I9 _+ e! G% ]( `/ P+ y9 b. j - , n2 J& G. Z$ U1 h8 ?0 Q+ ?
- module_param(acnt, int, S_IRUGO);/ k! ]' R( g3 b% g! d6 T: ^/ z
- module_param(bcnt, int, S_IRUGO); U! T7 S; X0 b" {# { v7 I) {8 `8 k
- module_param(ccnt, int, S_IRUGO);
复制代码
F2 O3 Q/ g7 R! b/ F
* u A- \+ y+ D' T' I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- R* j3 h' U% \/ ]. l+ y X1 b+ Q
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 s4 z8 v# o) N% _" V( n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 z( k9 V, j# J0 v+ a9 I1 x
, u' k" G" A% F8 s ?
# k# F" f9 T# z1 f. b
|
|