|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 H5 e$ i. ]5 H- Z1 S* {' Q
- [code]EDMA sample test application
- I3 U2 C4 Z9 X. g$ v% z - /*
" }' l1 z, @4 G q- a' s7 K - * edma_test.c
2 u3 i+ ]' V8 Y) D - *
' c) D' a' {5 ]- o* A - * brief EDMA3 Test Application
* H8 ]. |0 h6 I - *
: S( r9 @9 l, w: y# S0 C2 R0 G/ } - * This file contains EDMA3 Test code.7 t; d( ^5 H6 _# ]! r& V4 ~" U
- *
7 m2 u- x' F3 | J8 e6 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& Q7 [- o8 i; t% t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 \& _7 c j% F2 M
- * TO CHANGE.
+ r7 l& ^. L" C; d/ C3 U9 y# z - *
4 @; G$ h( E5 A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 F7 a( @% ^* ]( w2 i( k9 ~- j, n; v
- *) ~$ D3 J) _8 o+ D' {
- * This program is free software; you can redistribute it and/or
2 _- P6 c c* @! p% N- u - * modify it under the terms of the GNU General Public License as7 k. a1 m9 o4 F3 G) Y) d! Q
- * published by the Free Software Foundation version 2.
( q* p9 h6 s C$ n - *$ |3 P" \" v7 Q+ i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 w/ y; A( x/ V6 R9 l3 [3 Z A) m
- * kind, whether express or implied; without even the implied warranty
5 S6 [7 ^" v0 f: h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& h9 ]& F& ^/ G1 y6 q% _ - * GNU General Public License for more details.# V8 s5 @# R: o) d2 T
- */' n# h$ T+ w' [0 q1 e; n
- * M! ]* O# t/ R, a% x7 w, g
- #include <linux/module.h>8 x5 i. @ q2 T2 w" Z
- #include <linux/init.h># d1 a% q) J- G/ K7 d
- #include <linux/errno.h> G0 q7 M7 Y O5 S" p
- #include <linux/types.h>1 T9 C+ ^, M4 b0 v
- #include <linux/interrupt.h>
, k- e+ v: H2 l6 s7 c* A - #include <asm/io.h>$ a0 J, p3 B4 b8 g
- #include <linux/moduleparam.h>
1 j6 L' K0 A9 B" ?. f1 U - #include <linux/sysctl.h>
# t$ v( |! J- J* b( u1 v% O1 f. n - #include <linux/mm.h>
$ n1 |- D/ ]! E3 o3 Q! x- Z - #include <linux/dma-mapping.h>0 n+ X: t, X" a& s4 ] u2 r
0 o) @% r$ V$ U @/ C- #include <mach/memory.h>1 h8 ~: ~) Z# t4 U0 [; b
- #include <mach/hardware.h>
5 A" f- Z a! |. J$ m) z - #include <mach/irqs.h>" v% W: B6 ^$ z7 \
- #include <asm/hardware/edma.h>- a+ ]( A6 d3 x6 E7 `. j
- ; M r0 x9 e) N) }
- #undef EDMA3_DEBUG! R$ n/ | \7 f$ L% Y
- /*#define EDMA3_DEBUG*/! B0 P1 }9 a% x5 F* f- x- J X
0 J* p0 e6 t# u6 y$ u" g- #ifdef EDMA3_DEBUG" Y. i1 u2 i0 }8 h* ~ T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' W q( D6 p* j. r- q6 r! z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( N; `, P# c- G0 ?$ U% A$ V. t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 o% ~$ {" ]; I4 \ - #else
+ b% x: Y) ]" l# s s; t; l - #define DMA_PRINTK( x... )
8 I2 H+ x/ b0 H - #define DMA_FN_IN
4 I* N# C7 I' `" o. D - #define DMA_FN_OUT+ |/ `4 R, b7 u0 U/ _
- #endif8 I0 A4 N- }0 M6 k4 R$ S. m
9 U# p F @! h9 O: C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 H7 F* G% T- y, P- Z
- #define STATIC_SHIFT 38 o0 f3 ?9 s" A0 x
- #define TCINTEN_SHIFT 20
' W J+ `4 r# S( ]0 ^ - #define ITCINTEN_SHIFT 21) a6 r# N; S* P$ O8 o& [+ d2 Y3 Y
- #define TCCHEN_SHIFT 22
9 {4 H8 y. b, S( l6 H0 C; Z( R - #define ITCCHEN_SHIFT 23
q8 i, r, n. B2 X. v7 D - : I% d# o7 F) M n# J0 _7 `" o
- static volatile int irqraised1 = 0;( |" O! |1 T* l' D) h
- static volatile int irqraised2 = 0;. }+ J& }. _5 E8 {
7 S d; b- F+ h( v# t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 C3 e4 K+ l1 c( H6 |5 S( D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, J4 ^+ G5 H x7 X7 P; \! w" i, h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' s3 f+ r" i( l0 M% T
6 y ^ b4 K B! k) H- dma_addr_t dmaphyssrc1 = 0;5 q1 e. }- v" w5 M5 R
- dma_addr_t dmaphyssrc2 = 0;
+ O2 L8 H0 y+ L: {5 p$ Q - dma_addr_t dmaphysdest1 = 0;# {2 l2 G7 O% N: Y, Y
- dma_addr_t dmaphysdest2 = 0;
Q- j& K- Z( I- C8 N - : n9 T: y7 L7 e: W* ]& \# W, G: X
- char *dmabufsrc1 = NULL;. R' Z$ U) p* S
- char *dmabufsrc2 = NULL;- T+ m. W, u$ j( S# [
- char *dmabufdest1 = NULL;
* h( }4 k) m% q2 z: b. V; L3 U - char *dmabufdest2 = NULL;
" t$ D3 }, n8 d" v. E - 9 e3 r7 D# ~. z8 @6 K/ @
- static int acnt = 512;
% q: _ S* U1 r1 R+ q4 v2 g - static int bcnt = 8;" k" T) B+ o# c: @# f9 F+ t" F4 b {
- static int ccnt = 8;" n4 b8 S. k8 I( |$ k' Q
- 7 A0 [. q7 [3 F2 n- l& g Z2 [
- module_param(acnt, int, S_IRUGO);
7 E$ I- q( O; M - module_param(bcnt, int, S_IRUGO);3 \3 H; U9 Y# c5 u% u
- module_param(ccnt, int, S_IRUGO);
复制代码
F) K y4 l8 z' |6 ^
5 a, K- |/ ~, a: `: s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 u. u/ Y! R/ z Y# o& n$ ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; c* E! T ?8 g' P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; G4 d" B% D$ {( M0 Q6 C4 t
7 q$ |0 ^& P& s
* p* h m: f- @$ v5 Q" e/ j
|
|