|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 F9 g5 ^4 a& Y8 u- [code]EDMA sample test application
9 M. q( D( Q% t* ?, }) k/ V3 K - /*. P! Z* U& N! w0 Y& j2 T& r
- * edma_test.c1 j! ?0 q; D7 Z& h* V0 y( d
- *
. _9 z" d* `, F" m - * brief EDMA3 Test Application& k% N9 {0 A! W) Y b
- *- Y1 k# l/ ~6 @" ?" B$ l$ f+ h: p
- * This file contains EDMA3 Test code.1 P/ _( i+ G6 j$ x2 j1 p
- *' C) E/ k }0 ~- j Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 y) }/ W/ O4 s- u3 k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( B5 X9 I! [3 u7 Y/ `3 `" ^% o
- * TO CHANGE.: q2 v" _4 T; N/ B' C
- *% ^/ s5 r: E9 ?7 a$ a3 ]) y/ {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& P0 I, M& y2 W# h+ s9 {; k8 a
- *
7 f/ y0 |3 K4 f; U - * This program is free software; you can redistribute it and/or6 D1 m; i4 G0 j. M$ y6 Y! f
- * modify it under the terms of the GNU General Public License as
$ k8 ]! Q$ n# ^1 x# L" y6 k - * published by the Free Software Foundation version 2.
6 Z# D) w' g9 Z, P3 Y/ H4 m - *% \' ^% j. u# P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 v/ A8 h. o+ t- A# s5 h - * kind, whether express or implied; without even the implied warranty
, ?+ W6 g% N: f: U1 E8 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 ~* Q e& E6 Q9 m- W$ f3 r - * GNU General Public License for more details.
6 l6 J7 Z9 C( V6 {7 g8 v5 e" s - */ m7 `: _% J1 {
! L+ u1 x, L! Q* a6 d: [0 D) s$ p- #include <linux/module.h>7 T" z. D1 |% d7 i3 s
- #include <linux/init.h>
$ p* f, C) z+ q0 G! f - #include <linux/errno.h>
3 D- n: K+ Q/ ?2 ~1 R) X% n - #include <linux/types.h>
/ J) ^$ e6 q5 L$ E9 p- I - #include <linux/interrupt.h>
; n. D* Z5 e# n, l! ` - #include <asm/io.h>7 `: F6 @; r, E! U2 K! m2 O% {
- #include <linux/moduleparam.h>7 o! ~& s6 G5 Y& N
- #include <linux/sysctl.h>4 [/ a5 o0 B6 o1 }9 ?
- #include <linux/mm.h>3 W" B8 k0 p/ M9 a a( K! }& V, y
- #include <linux/dma-mapping.h>$ h) j$ \6 V+ v; ~
1 ~- r4 m8 v0 v. e( k- #include <mach/memory.h>0 A4 j/ B- F: L4 _& h. [
- #include <mach/hardware.h>
; A) C4 `1 h: U }1 X% @ - #include <mach/irqs.h>
/ l% g% x/ J0 ? - #include <asm/hardware/edma.h>
* T& H8 o% H: I" Y c$ A) L
9 O" ^) L9 ]5 j. s/ @5 s- #undef EDMA3_DEBUG
* v( @. ]/ `+ Q" K. E - /*#define EDMA3_DEBUG*/ y6 Q X! j; e- \% E
- " G0 p Z( D0 ?5 ]* A$ I f
- #ifdef EDMA3_DEBUG7 b: r& o/ O" q) B4 t* ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! h1 ^% E7 q; i0 ], s$ q* @9 T% k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# i$ i$ e7 i# s7 A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' B3 f! N9 J; U% g1 x# z
- #else
2 R; a/ G3 r( A3 \ - #define DMA_PRINTK( x... )
5 r$ }7 W% {/ ~: ? - #define DMA_FN_IN6 {, Q$ H8 f+ R7 T" t2 ~
- #define DMA_FN_OUT
; K: M$ j- w/ ]' T3 |+ [: {0 W - #endif
8 w" X/ a7 C D5 J
; W- x6 t* L" v3 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% A t1 z S; j4 y- ?9 l - #define STATIC_SHIFT 37 K4 ?. d6 T; o. E2 E' P
- #define TCINTEN_SHIFT 20
* e) D6 p8 P/ g5 y5 ~2 O5 Q - #define ITCINTEN_SHIFT 21
: B. o( K7 n/ C0 Z$ R# x2 t - #define TCCHEN_SHIFT 22* ]" b1 ^1 O- c( J* O: P: x
- #define ITCCHEN_SHIFT 23
" I, X: o$ M9 C. ~( s+ _- y+ Q5 U9 f
+ _" E y* y9 u, r3 d$ h5 U6 j$ z- static volatile int irqraised1 = 0;7 K$ ~: g; k( t5 `) M+ f c
- static volatile int irqraised2 = 0;
; F" z0 s3 K/ E( B2 b9 j3 f3 d
! i3 g& e" G) y6 v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ `) i6 S3 c8 p( S4 w1 R: S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" G: U; N: {1 ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, { c# u& _; \! y8 R/ d( [( v( e- a - 0 Y) O* `0 X+ c2 _
- dma_addr_t dmaphyssrc1 = 0;
' a* d. J) U; I5 Y - dma_addr_t dmaphyssrc2 = 0;
, v: j- J# P1 P5 D - dma_addr_t dmaphysdest1 = 0;; Q/ k6 f- K: C! N0 ?( w4 f) P: p9 `
- dma_addr_t dmaphysdest2 = 0;! S/ K! n2 V) q: v. E
- ) p9 H% j0 V" N
- char *dmabufsrc1 = NULL;8 T& W# ^, |3 i+ ]
- char *dmabufsrc2 = NULL;
4 B* u9 H6 S; N9 R: N/ F# v - char *dmabufdest1 = NULL;; n b- n. U& b
- char *dmabufdest2 = NULL;
2 G/ ?8 e3 G+ p8 B3 H6 _3 Y - 8 t4 B; p; t3 l6 S0 Y
- static int acnt = 512;
! Q% }& x Z9 v8 y; [9 c3 O - static int bcnt = 8;
2 E- E" c a& S. x/ x% G0 b - static int ccnt = 8;$ w: w _8 Z+ y$ E% R y, k
- 1 X1 ?0 H* \9 F, i+ n& s
- module_param(acnt, int, S_IRUGO);
$ r" { g, d7 U& b - module_param(bcnt, int, S_IRUGO);
& m b1 Q) U7 N( I+ n- q - module_param(ccnt, int, S_IRUGO);
复制代码 , M' _) o; L8 c( X4 e8 b% q7 d
p4 A6 W3 b% v3 S8 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 o' T6 r! s) W/ d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" U' o# S2 ]" M; W1 x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ L3 s. U2 M u, O- d& e. l- [0 |5 `: ~
7 U: Z7 I4 o. s ] |
|