|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' y! ~' W B* ~ R! U! r- [code]EDMA sample test application
$ Z d8 K x+ _. t9 C - /*: i% F3 h; w. G2 A+ q' q
- * edma_test.c
; m3 G. g& R4 C/ ?' y; H/ a - *
" {& K4 _% J9 U5 U$ O5 Z1 e& L V/ T - * brief EDMA3 Test Application
- H& ?% r) e. t0 i" Z, U0 A4 S - *
- r+ ?8 w- Z' y, ]& {6 s: i - * This file contains EDMA3 Test code.
+ n; y' R8 e% `) R - *: r$ k, k7 C3 Z1 M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ A4 P% c" {- |) y; f/ e, H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" U2 r8 E C% M1 W/ V - * TO CHANGE.% m3 J$ V% k6 z- Y. Q; E! D% p
- *1 O Q l4 {; L& d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 X/ ?$ Z/ O3 }$ E- G - *
5 M: C0 [0 T I7 J - * This program is free software; you can redistribute it and/or( b4 B, g+ c( ]# ~! T( d
- * modify it under the terms of the GNU General Public License as' r8 K& i' L) A' e/ _/ [: g
- * published by the Free Software Foundation version 2.0 `# H0 E" u' R* Y8 y
- *
6 L" e- E5 d% h) v( m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 S. t% m3 R) x2 q& N - * kind, whether express or implied; without even the implied warranty
1 u" q2 @5 d* K# s+ f% ]* C Q: Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. x+ x3 b/ A" F9 l7 i5 _- Z" | - * GNU General Public License for more details.
, j$ ]. }/ ]- h - */
, u2 {5 u$ K6 U- p& b$ p0 h% O - + k, s' F+ S; ]' W( G9 b/ Q
- #include <linux/module.h>' R- s- V# A& E
- #include <linux/init.h>8 g# P) R" k8 a% q% j
- #include <linux/errno.h>3 |7 f) W7 x% K9 u$ y0 f5 Y
- #include <linux/types.h>
6 p4 R `* R2 _9 W& y- z3 H - #include <linux/interrupt.h>
: e& M! h5 X% y- t/ L - #include <asm/io.h>$ _. s w) l) X
- #include <linux/moduleparam.h>
; g$ {" }8 q+ ?5 b$ U - #include <linux/sysctl.h>
; F7 z& B& p/ q2 M - #include <linux/mm.h>
* l, h& E- C; I. H5 F' n - #include <linux/dma-mapping.h>/ D9 d" x* d$ x+ U9 f2 [
& M7 T3 f) ]2 c3 w0 t1 i9 ]- #include <mach/memory.h># X! |" R& N: y) q% L* o6 q
- #include <mach/hardware.h>
$ e- w% r: P) [ - #include <mach/irqs.h>
8 O: P. g0 @6 O. P - #include <asm/hardware/edma.h>
( ]9 V8 K& k4 c3 ]
{/ f* U' W8 B- #undef EDMA3_DEBUG' x, D1 O/ \$ R1 H3 E# {0 T( ^
- /*#define EDMA3_DEBUG*/
5 m$ W- y @( p) d( { - $ z) `4 I; Z" u/ a( t, ^! ]
- #ifdef EDMA3_DEBUG
4 j' d# r/ a" v& c8 S: T: ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 _7 B; p/ M/ i# x/ ^' \# q% q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 f. H V" e1 @5 x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ u* q# j7 e; X- B j
- #else
$ V6 B; `) i- h- j: m) [ - #define DMA_PRINTK( x... ). ^# k( B- O, i) G o) X
- #define DMA_FN_IN
$ C3 d% f% z# T+ y3 Y" u0 J - #define DMA_FN_OUT
6 x0 C d/ v% O% }/ U/ \# t7 g - #endif
6 `( `7 U0 [) H7 ]
$ L& X2 i; N1 P3 Z: f7 C2 y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 r& ]" y0 I. O# d# J! T - #define STATIC_SHIFT 3# }8 P; X+ t( `% |/ T
- #define TCINTEN_SHIFT 20
! B4 S; \# E( N) z' U- a3 t - #define ITCINTEN_SHIFT 21
4 `( ]: j# \3 |( ~! a - #define TCCHEN_SHIFT 22( b( w, U/ B0 u/ `
- #define ITCCHEN_SHIFT 23
- y7 H) O% j3 W( t. w' k" \ - ) K# U0 D# k9 n+ J1 C- d. j9 p
- static volatile int irqraised1 = 0;% w4 B. Z- T8 P4 r5 u4 |( Y
- static volatile int irqraised2 = 0;
1 B& J7 F- q9 ]& l1 U: e - % T7 u4 x7 Z4 x" M2 X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) {( _2 L1 |+ y2 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! \0 G" k: q, E* H4 d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 y7 J u% K$ Z) Y5 k
! V0 e: Z6 D/ ?( t0 l( Q- dma_addr_t dmaphyssrc1 = 0;6 y% {) @# s M& d' Y* {
- dma_addr_t dmaphyssrc2 = 0;+ u* F N) H+ }9 z$ v$ S
- dma_addr_t dmaphysdest1 = 0;& D! Z6 b8 ]! [+ f7 S/ T7 X* I
- dma_addr_t dmaphysdest2 = 0;
9 p# m* Y. b0 e+ h9 b! Q
; w" s% I/ D0 E- B: v) V- char *dmabufsrc1 = NULL;
+ q; B9 h; Q/ @ C4 V# S4 H - char *dmabufsrc2 = NULL;. i- I7 b+ W9 m0 j$ j
- char *dmabufdest1 = NULL;% f' R/ v; @- M$ e0 B
- char *dmabufdest2 = NULL;1 I' R. W% R# p- O% a8 s
- : ]2 n0 x" \" u
- static int acnt = 512;* R# t% G% g* k- n7 D6 \
- static int bcnt = 8;
& o. D, U; D7 Z2 i; j' y. H5 l - static int ccnt = 8;
, n$ v2 `6 j# G* s* y
: l N" U- i- f/ r ]8 Z; ^* ~- module_param(acnt, int, S_IRUGO);
$ M: }* y; a: ~! ^ - module_param(bcnt, int, S_IRUGO);
& e2 y+ n' u: k - module_param(ccnt, int, S_IRUGO);
复制代码 3 e: j' d& P9 M
- y" ?/ N7 S+ ]1 X, Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 Q3 `7 ]6 ~; o3 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
B2 r8 d. R9 J. h6 y5 I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 v' I- D1 i! a3 W
1 R" x5 S2 N0 n; a
7 p4 t, a" X* [% \9 u* E |
|