|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# `" y. [3 W" O3 }( W+ @, ]- [code]EDMA sample test application
6 o2 B! U7 Z4 B3 [ - /*6 Y& C3 r" I$ q8 ~! O* f% a/ f) ^! O
- * edma_test.c ~$ W; t* ~ F+ ^/ d' L4 W4 l
- *. t2 i1 x- I; i9 s
- * brief EDMA3 Test Application
% [" D G9 ^3 F; E3 \) P - *+ r) ~5 }: W0 {
- * This file contains EDMA3 Test code.
: O# z' F% i( z( q' I* g - *
7 I! ]9 ^* T9 m# ]4 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ J5 A! L! H. s( Z! [' Y" Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( M; N" U; T; C2 Y8 d
- * TO CHANGE.. x c9 d8 e. T# J. L
- *
# M- n6 u; I* I$ {$ t0 N3 g& D6 _* c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( [+ d3 v5 I! W& @
- *6 ^& H2 o( n6 j# d# I3 o2 t
- * This program is free software; you can redistribute it and/or
% d' A- D5 v1 f! l* Q+ R. N( N - * modify it under the terms of the GNU General Public License as. F% t1 z" a8 ]& j& Y. l6 f
- * published by the Free Software Foundation version 2.! D7 |% R3 e' ^
- *
8 Y c+ T- L$ V' b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 C6 J0 B6 M" T- g: s; e' X4 `
- * kind, whether express or implied; without even the implied warranty( a! x" R% R- u( D8 \& M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 T7 M( }' u0 x9 l) Q0 K& G" A" z - * GNU General Public License for more details.
8 O6 n0 m6 o+ X; U5 S9 E/ b - */
5 r+ F7 U/ \5 S. N% g$ g0 J - $ ^. k/ u2 s# m& B- j) |8 ~- L
- #include <linux/module.h>" U( U4 p3 e- X q" Z+ E
- #include <linux/init.h>( B6 o* @. y c
- #include <linux/errno.h>
* b2 P: v7 c3 I4 A. r; _, f! D - #include <linux/types.h>
7 }$ K" f! R, X8 F& a/ w9 R _! z - #include <linux/interrupt.h>
) V3 Z; Q6 D& F# s: f8 n - #include <asm/io.h>
7 d. b. H6 t- e7 ~" n* _% I5 v; E - #include <linux/moduleparam.h>( k1 ^; e; y+ Y3 C8 m; G! I5 Z$ e* z6 R
- #include <linux/sysctl.h>
J7 p, H/ y$ o+ w' n5 T - #include <linux/mm.h>- C+ ^7 k: x- q
- #include <linux/dma-mapping.h>
, y, @& q. ^) T) s8 {7 o6 W6 l - |; |1 m6 H) U
- #include <mach/memory.h>
. K; B+ ?# b! ~ - #include <mach/hardware.h>& P, j. T2 ?- z
- #include <mach/irqs.h>) R3 ?( K. l7 b% y
- #include <asm/hardware/edma.h>
) u/ ]$ ]. E. M& N* @3 A
% M+ ?/ F+ ^# \2 {* o2 h& F- #undef EDMA3_DEBUG) m( I; x7 f/ H
- /*#define EDMA3_DEBUG*/, [7 y# }/ Y7 |9 G$ q
- 6 P5 L4 j u3 I% Y3 u- M, @8 T' M
- #ifdef EDMA3_DEBUG. l5 L; M, h: ~: a7 e3 n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). V+ t: f2 v, g# M& p0 o0 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, z3 f* C) f6 I- l; j/ U/ u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& \7 F, F; W% o; \- |) Y - #else8 }$ x: G( B0 n% o5 c7 d0 t
- #define DMA_PRINTK( x... )! ^8 q# P& u& Z+ F
- #define DMA_FN_IN5 r) z1 z/ N8 L
- #define DMA_FN_OUT
/ L% h7 Z+ Y/ j1 H+ _1 } - #endif; X: G5 S3 R# V4 c# e1 Z7 k
+ q0 j' ~8 @! ^) Z, }1 |% ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 N$ A! _' m a- O+ L
- #define STATIC_SHIFT 3. y4 q; z( i5 T( r- n/ W" S5 T1 j
- #define TCINTEN_SHIFT 20
4 k, P4 x- M. h" j$ \ - #define ITCINTEN_SHIFT 21/ q+ D8 k4 R+ s; L% |$ A3 B
- #define TCCHEN_SHIFT 22
" j$ h+ H* d. P8 r - #define ITCCHEN_SHIFT 235 z# Z% I5 a7 n7 J& |
0 L) S/ U+ H* Z0 }: U- static volatile int irqraised1 = 0;$ ^6 W# |$ H, g
- static volatile int irqraised2 = 0;
* T+ m- r" M* W9 R
, f; A! |9 Z+ l$ l) G; b7 I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, {! Y% k$ C' ^ r. p/ m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 H( f2 B) a1 V9 h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ d0 J' G' w! U' Q4 R: C. w
- h+ a! X, n' N7 B
- dma_addr_t dmaphyssrc1 = 0;
4 X/ {! k% t# E; N$ w) c4 S# W - dma_addr_t dmaphyssrc2 = 0;
2 I/ t, g' i+ U8 j8 E5 G& Y - dma_addr_t dmaphysdest1 = 0;
% g* N ^4 U8 D, T/ S) C6 G - dma_addr_t dmaphysdest2 = 0;
# ?' I& b& |; N" Z- S
6 M6 L1 ^7 i) Y+ Y- char *dmabufsrc1 = NULL;: R( J6 P; X1 d( l1 u
- char *dmabufsrc2 = NULL;
0 f3 C. P% a [7 A& P4 `8 B - char *dmabufdest1 = NULL;
+ n# a- p; j9 N$ R- P4 r - char *dmabufdest2 = NULL; R( `8 }3 {6 j6 |5 i* q
- $ F# a/ s1 Q! @8 j: H- h! k
- static int acnt = 512;. b) g/ G) d. F% t# A& F
- static int bcnt = 8;
3 p8 g- a7 s. O: J - static int ccnt = 8;4 I) Z3 |& {& i0 V
9 |8 n' C0 V% [" L. S2 J- module_param(acnt, int, S_IRUGO);
- C- m7 H' B( }. l - module_param(bcnt, int, S_IRUGO);$ {! M2 q8 e( |
- module_param(ccnt, int, S_IRUGO);
复制代码
' P, J' Q* q' V2 M1 `; h6 r% \
8 j& @0 ~3 i* r- w! d( S n7 T+ y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 b2 } w# k0 _1 H' I- \/ u# carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ O% }5 E; K7 o" p1 N: c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 _; R4 j1 ^2 u
' \- q1 [2 g) w% I) F2 o
; z% z" u4 A9 R* a |
|