|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 `1 a% }! u/ U+ }$ x, A
- [code]EDMA sample test application# E) f) D# i/ f7 u q* H
- /*
7 v% m% ^, d7 p% P" Y - * edma_test.c: y+ ^0 s% W! P; }
- *
" ^# V/ p# a3 K! C& |, E - * brief EDMA3 Test Application! F& m# }' w) z& H
- *
, z/ W0 Q, [) i% i5 |2 y3 u - * This file contains EDMA3 Test code.
/ a- }4 B( ]9 Q* V, d5 P - *
9 h9 h" M/ j# l/ a" C- X1 i0 T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 d9 X/ [; @+ P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# i4 Q3 I# ^5 P' N
- * TO CHANGE.5 y- `' z7 i5 v+ e
- *
& Q0 ?5 K! Y9 p; A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" \0 T6 i4 y+ _/ i+ g( d9 _; |
- *' [+ \2 D: e2 X n
- * This program is free software; you can redistribute it and/or
5 [. x: o' n3 t% @4 e - * modify it under the terms of the GNU General Public License as" i- _7 _4 ` B V% M, }
- * published by the Free Software Foundation version 2.9 T" i. e% \0 N: [) N) T7 w' Z
- *( d) W6 t& M- \9 n0 L$ M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 g; s. B7 _+ R/ A, R
- * kind, whether express or implied; without even the implied warranty! K5 p& |1 D* ?8 n7 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! ?$ s3 P! y- L( L" x - * GNU General Public License for more details./ N8 Y$ s& ~7 C2 W: W5 d1 ?7 [
- */
* K( @4 e" m. F- X
2 K& c/ Y/ {# Y- J- #include <linux/module.h>
$ H5 A, B+ J4 D& T% o+ h - #include <linux/init.h>
# Q2 h& a, e7 S - #include <linux/errno.h>
$ d; i1 B! h" B/ Y% R; ~# J" i: K - #include <linux/types.h>
6 a, q! c3 L0 g% J1 s - #include <linux/interrupt.h>
H4 {. Z3 t$ \ q+ j* ]* c1 w* ? - #include <asm/io.h>; x% @/ N" S' R0 Y
- #include <linux/moduleparam.h># _6 k( T3 W: Z2 L: w3 ^
- #include <linux/sysctl.h>
2 [4 B) z& i3 s7 W" } - #include <linux/mm.h>) J5 u6 V2 p2 G7 n, ~0 s/ e
- #include <linux/dma-mapping.h>
, G& j! B6 R R - . n* r+ J5 m$ E9 \; z7 ^5 [
- #include <mach/memory.h>
1 r& O+ z$ u% X. B! q2 b - #include <mach/hardware.h>9 K" \. ]3 I/ `9 E; P
- #include <mach/irqs.h>
( v9 D. Y% k. B1 N Y - #include <asm/hardware/edma.h>
' D( j- C7 e n- ~ - % d2 ]- c2 L5 W" j/ {
- #undef EDMA3_DEBUG- |4 i- X* p2 k, E: u3 j; l5 h3 r" Z
- /*#define EDMA3_DEBUG*/
- F V3 D' m' R - 6 D( s. W( @9 L) F0 u
- #ifdef EDMA3_DEBUG7 k% \. f6 R6 ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 X& k# Y" |, S) W0 M0 {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 R1 J3 ~7 t' v; Z4 n' f7 H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! s( j' _& T, [- S! f `2 ] - #else
; B ~% [9 D) f& M- Z) [: j- i0 Z. C - #define DMA_PRINTK( x... )
$ G- s0 O: x" F7 C! @' l- K - #define DMA_FN_IN) I, W% t4 M9 ]& J% m" g. V. T8 O
- #define DMA_FN_OUT
, B$ a7 [2 O" s& N - #endif
# R2 ^- q6 U+ \' X
8 b! q- A+ C& a5 m; [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; ?/ u% K$ h2 C& k9 N2 N - #define STATIC_SHIFT 3
- k: g* U @4 z4 w7 @/ [ - #define TCINTEN_SHIFT 20
5 Z% k* I4 e) k2 x - #define ITCINTEN_SHIFT 21$ g5 f' b) t+ L
- #define TCCHEN_SHIFT 22
4 Z( T8 R! C9 ~/ n - #define ITCCHEN_SHIFT 238 j9 H% C2 d! F# U! b S# Q
4 d( U" L0 g2 h. N/ N- static volatile int irqraised1 = 0;- z$ e- D3 c6 a+ @' d
- static volatile int irqraised2 = 0;0 c3 @' J7 W& @5 S) g8 E
j- f$ z; Z& c4 }/ f8 b5 \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" R9 y- h' i Y7 A, C9 Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" A1 L& ]3 v$ e' L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); f2 q" x; H8 {# G+ T
- }5 ^( H: ^5 k8 x( [- dma_addr_t dmaphyssrc1 = 0;
; ]2 i3 p! Z, D( O7 Z+ U* W - dma_addr_t dmaphyssrc2 = 0;
i& j v# @% E - dma_addr_t dmaphysdest1 = 0;! e8 ^7 `" R) ~' }( s
- dma_addr_t dmaphysdest2 = 0;$ M) u4 m% i- S4 ~/ a
% B# |% A G- u$ y% J2 E& M- char *dmabufsrc1 = NULL;0 i6 H3 c$ I" i c. v, a# Z
- char *dmabufsrc2 = NULL;! p/ j2 \; ^2 ?, [4 B. h( n5 d
- char *dmabufdest1 = NULL;
1 U. |, b$ I" `: l! _ - char *dmabufdest2 = NULL;, }# o& e$ Z5 l' D! h! ]
- + T* V* I. S: h/ Z$ c) d
- static int acnt = 512;$ x( w6 [) c+ T& O6 n0 b5 ~- }1 J
- static int bcnt = 8;
: L# W- A$ L: W, t% c - static int ccnt = 8;
& \+ w3 A+ A1 | V
! m/ K5 d2 ^7 W W3 x3 S" B% t5 N- module_param(acnt, int, S_IRUGO);7 f T: v, p: C7 j6 {) p9 t
- module_param(bcnt, int, S_IRUGO);
+ [5 g+ `0 K1 V$ H - module_param(ccnt, int, S_IRUGO);
复制代码 ( J5 {& u& U3 u. I+ y u1 `
" b1 m0 x# r$ e) k) W- j3 J( J, W- W: a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 @ N4 {' f& x1 z8 {7 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( T, a" B7 L' H& K/ L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' h8 r6 v8 b, Y0 ]& k5 a0 y
' L) i) }" [4 s2 P: J+ @2 [5 ]$ E2 d) W4 i x
|
|