|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 }7 n4 K7 X, D7 K4 S" G f5 r- M- [code]EDMA sample test application
/ }* D0 b7 M8 M1 W5 V' J* Q - /*
( B# i, @% w5 w0 s - * edma_test.c/ G1 s6 i& O; j7 k( Q3 H' ? |
- * y' h6 c% [) Y+ \
- * brief EDMA3 Test Application
- W; f9 O ^8 r, z/ h - *
& d ~( O. w- R+ C$ J- Z - * This file contains EDMA3 Test code.% N+ o6 N! P% f! ]: Q7 W& c; \
- *
7 {% ^$ v6 ?+ c" I3 m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 v, l. i" C; z1 ]( o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: X# G8 l6 Y+ O+ B" H
- * TO CHANGE.
2 `0 @* e: A! I) q( F2 a - *
5 V, [$ r7 \3 r% O! L1 e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 g2 ]- Z9 J" y- O" G& O
- *8 V, G0 \, X5 b9 O+ w) e J( p
- * This program is free software; you can redistribute it and/or
0 C; {0 }# c% B - * modify it under the terms of the GNU General Public License as2 y; F3 L7 B( T, ]
- * published by the Free Software Foundation version 2.$ g3 E# e2 W9 v, r$ k6 t
- *
: b4 k) a9 d+ Z1 H) d) U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- c! e, y1 g2 S. |2 d' }4 _* v B' } - * kind, whether express or implied; without even the implied warranty
2 e0 C" g$ l( j4 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: p* P" o, `/ J$ s9 R% y
- * GNU General Public License for more details.+ e3 T _/ T; C" { ^
- */) G4 s, u' s7 {$ E, e
U$ d5 h$ s$ [! k- #include <linux/module.h>3 |. Z) C& g3 m0 h0 l' o6 D6 R
- #include <linux/init.h>& f( e! P! m: c/ n2 T
- #include <linux/errno.h>
2 |! n; S# _% y+ k* D - #include <linux/types.h>
/ g" g7 M8 H, H9 q1 Y - #include <linux/interrupt.h>. }! B' S( I' R. x* a" B
- #include <asm/io.h>
, M7 R- f' A" e/ Q - #include <linux/moduleparam.h>5 m2 }, w9 O' ?" O% ~, ?' y! w, q
- #include <linux/sysctl.h>
0 ~' b" U$ H; b3 c. u( z4 _8 A: W9 I - #include <linux/mm.h>
4 H2 I1 D/ k6 \' C- O - #include <linux/dma-mapping.h>' ]$ P5 ]: E6 g+ H5 O/ e; e. S
- 8 V$ H! b, G* r% d4 G
- #include <mach/memory.h>& i: T+ B5 s M9 E0 T, s
- #include <mach/hardware.h>
2 ~! E8 k2 \& U7 _5 a. v( W - #include <mach/irqs.h>
; Z6 a' c0 j" o8 K - #include <asm/hardware/edma.h>
+ ?' e) s, w" e, H& G, h! c - 4 u% Q6 `; w S9 a1 t
- #undef EDMA3_DEBUG! Z3 m5 u* ~* ?6 y/ r5 d D
- /*#define EDMA3_DEBUG*/
7 L4 I ]2 `' A( G% o" X
/ r8 _6 B7 m5 h% w+ t5 _- #ifdef EDMA3_DEBUG, V7 P! I" r& s6 E# H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 C V% A: K$ v& L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* S" Z. P( l6 X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ T" b; ?* u0 o2 c& B7 H& U - #else9 k/ e( _- i# ]# V6 b/ `
- #define DMA_PRINTK( x... )# D* w$ L( z U1 T3 k7 ?% n
- #define DMA_FN_IN
- o3 L- ` ~0 m4 C - #define DMA_FN_OUT
5 T, w0 X# l& \ - #endif% v* @) S4 i: O2 L! g& P
- - t1 w7 W9 j" c0 @' }* y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" c6 j7 p% r) A - #define STATIC_SHIFT 3
% o/ o7 E# ?( z1 \7 Y0 P - #define TCINTEN_SHIFT 20' [3 }* X9 o w& F
- #define ITCINTEN_SHIFT 219 H q/ {6 @' f( o$ g4 s* ^
- #define TCCHEN_SHIFT 222 e' r: q0 D9 h& Q
- #define ITCCHEN_SHIFT 23( e9 j9 R8 B9 T7 [! E5 U
2 u: \' Z6 @: p0 k0 g' b# n1 e- static volatile int irqraised1 = 0;7 y: S5 }1 D ^: U& n
- static volatile int irqraised2 = 0;
" X) d: p; J, u" r+ E, @ - & ?3 C+ \7 T7 K+ y7 T5 G$ `* l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Z% t* l* y) ]+ w! j# X: ]: R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 F( b3 N2 A0 J+ r+ {; ]5 V0 A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" L# Z h( H3 |5 G6 [ - 9 Y, |1 u8 ^ C" y6 {: m! [! s
- dma_addr_t dmaphyssrc1 = 0;( V( T' c o- C/ r- r2 {! ^; B
- dma_addr_t dmaphyssrc2 = 0;: G7 r0 V7 ]/ b, d6 J8 \; i/ O
- dma_addr_t dmaphysdest1 = 0;
0 x/ {" b; Z2 |- o$ Y- t5 r8 O/ N - dma_addr_t dmaphysdest2 = 0;7 S6 G$ y2 G" I6 q6 u9 W' o0 Z+ J
# v' f' {5 ?. R0 C7 X- char *dmabufsrc1 = NULL;
$ |3 L/ m. \7 S) T: a" V8 | - char *dmabufsrc2 = NULL;
/ r" T u7 @& }8 J; S5 |1 ~ - char *dmabufdest1 = NULL;
! x8 ~2 Z8 i+ |5 P* Y. u - char *dmabufdest2 = NULL;
/ X, V: C2 u; d, R - 9 c+ J9 A' i. D' e& P
- static int acnt = 512;
5 r* V1 l% I$ D - static int bcnt = 8;- \% F0 J; N/ x/ y c$ V
- static int ccnt = 8;
$ c! ^# K; ^( ^4 o' K" G% k: l/ f - ( `. ?8 L: W! F% O1 B9 [' P b
- module_param(acnt, int, S_IRUGO);- Q6 b2 A0 N3 u/ R6 s- K% r+ g
- module_param(bcnt, int, S_IRUGO);
; w' }. W, l- d, D8 z' P - module_param(ccnt, int, S_IRUGO);
复制代码
' m9 c: H3 g: |2 J, V( t
$ w2 F9 \. _2 F& `9 H T9 H# g2 c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. o( F; x& w9 Q% M6 Z4 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 N# @- q; s* P" ^2 R, d+ W2 n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* i! u9 t4 t% c. V% P
1 b' |' i0 l* D6 F8 `- k+ W
* L7 O' Z! r! Z3 r( z( H |
|