|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 f. [) ]) C0 Y7 K1 H. X: V
- [code]EDMA sample test application9 {! j- \6 Z6 v4 @4 K3 Y
- /*0 t" k4 W/ i! R5 G
- * edma_test.c0 q; ?! S* ?. s; m( C0 S
- *' a. L; @+ J8 k0 t
- * brief EDMA3 Test Application
9 q; R% _& F5 n7 V1 Z5 `9 a* P4 ]( R - *
4 ?) U1 y$ w& w% c# O8 W1 U+ } - * This file contains EDMA3 Test code.
; b9 n2 a$ E8 @9 D% C3 `4 i - ** O% p4 N% E( Z' F# a4 @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) B9 `0 g$ j3 R, v q$ |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# z) Y( T; o' @& }2 @
- * TO CHANGE.
) l/ {. I; F" G - *
. R4 s1 Y4 m7 s; `1 t3 n% i- e" q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) }" |( a& B7 h. e D - *
8 w; y* ?/ ?4 x1 K - * This program is free software; you can redistribute it and/or
9 }, J. g" `7 p) X L# u; T - * modify it under the terms of the GNU General Public License as
% {0 J& x' ?3 b3 J - * published by the Free Software Foundation version 2.
0 R( n0 s7 z& C6 S) M - *6 c) n- T1 z6 A. h* O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' v% x* P+ G9 p6 U: v/ g
- * kind, whether express or implied; without even the implied warranty
1 {9 p# j7 @% V; s9 V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! s5 P, j6 J6 V1 [9 A2 X - * GNU General Public License for more details.5 q- ~: f& _( k: p; i! o
- */, \1 j2 f; o& N: T
- ) A! c! D. d9 ]9 s1 R0 P" [
- #include <linux/module.h>; w2 t L+ u9 y( t0 Z
- #include <linux/init.h>1 z& I! u) c1 e# G: \) w- [
- #include <linux/errno.h>
# o9 t) O, F( {7 n* i/ D- N - #include <linux/types.h>, n9 H6 d9 H6 s$ g# x( p* X9 [
- #include <linux/interrupt.h>7 w" O0 J) o" O% X% G, o9 W4 Q
- #include <asm/io.h>( B& x% m, }2 t* I" c
- #include <linux/moduleparam.h>1 F6 _6 q& ]2 A. H$ {
- #include <linux/sysctl.h>0 v9 k' t0 S2 g( k1 U) p/ v
- #include <linux/mm.h>- O) f5 G8 q" M- p
- #include <linux/dma-mapping.h>
* r3 l! U% X0 {5 b! B - $ |1 ~4 w% Z3 ~2 q
- #include <mach/memory.h>
# Y3 I2 t" `, e2 j, X& A) n - #include <mach/hardware.h>
$ [' Z1 b. \" y# s, L1 g - #include <mach/irqs.h>4 y4 y! g7 K7 P7 R
- #include <asm/hardware/edma.h>% f' T8 o4 q- E* \! A' f+ ]
- 6 o4 y# a a* T5 Y6 P5 ~$ X
- #undef EDMA3_DEBUG
0 t3 j4 r5 ?" a+ X7 D g/ D4 J2 l - /*#define EDMA3_DEBUG*/
+ B* O+ C: k+ u6 a% Z - 5 @0 s ^+ P5 M* j2 c* d8 `
- #ifdef EDMA3_DEBUG
7 c* L' q) X1 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- X. V8 h# x) E' G/ x- { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 I2 R ?4 F+ k# B4 F2 q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# l+ }0 K, S. [$ w# `: ` - #else
7 t4 V# T: u' C - #define DMA_PRINTK( x... )) E6 A4 ?5 ]1 m4 p( m' q
- #define DMA_FN_IN, L6 A. x7 Q& W" M9 q
- #define DMA_FN_OUT
9 \( z! x4 X# P) z" `6 e+ h, b - #endif
# o3 e' n9 c% H. L2 v. X/ K, g
% u% D! [3 D% \6 c7 ~# t1 {8 J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, {. J( I8 M6 s2 i) S; j, y2 [ - #define STATIC_SHIFT 3' {9 y* V; V" Y @1 {6 }& }/ F2 S
- #define TCINTEN_SHIFT 20 D3 }2 r9 y' q& i9 j5 S
- #define ITCINTEN_SHIFT 21$ V" R2 r$ c; y0 ~9 d1 r
- #define TCCHEN_SHIFT 22
3 K7 |. _; ^3 f* B( J6 { - #define ITCCHEN_SHIFT 23
B5 h+ P! d, v
; t9 r3 M0 x7 @% U4 Y- static volatile int irqraised1 = 0;9 D. a! I/ k, ^4 P: o; Z' H" g, r
- static volatile int irqraised2 = 0;2 K5 G8 ~/ W% `! D
- G5 }. w4 s. t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 x4 V3 B+ R3 O% {: r/ l7 \. G( W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 t, S- ]7 A7 s( {6 S! H5 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; d. N' A3 R( @$ S: [2 U
H2 ]7 C3 n `. A. [0 ]- k. T9 T$ \- dma_addr_t dmaphyssrc1 = 0;
k2 [# O" `3 N# b9 C5 t - dma_addr_t dmaphyssrc2 = 0;
5 O) j3 q" q. Q, v" n3 c - dma_addr_t dmaphysdest1 = 0;
" j6 M0 C4 {) s& B2 L - dma_addr_t dmaphysdest2 = 0;: }# b; R" g8 c. o, w" P F0 C
- $ k/ M# |$ w7 S. M0 l2 w
- char *dmabufsrc1 = NULL;3 {4 h6 v4 p7 I5 x7 z% z
- char *dmabufsrc2 = NULL;1 K% |+ f& G0 u, o* ?
- char *dmabufdest1 = NULL;: Q" ?( o& B- o6 z! t0 N+ O( w5 r: W J
- char *dmabufdest2 = NULL;
: Q( {1 Z* `: S( |
" b- Z' W; s2 O9 x1 I- static int acnt = 512;- G" l. g- u) Y1 D, [+ ^
- static int bcnt = 8;% E+ O9 Z7 p1 Q1 z! {' o2 \
- static int ccnt = 8;
% j7 J8 H0 M9 r$ o - & {2 N$ H. U4 O) j% g1 E6 p- F* q6 B
- module_param(acnt, int, S_IRUGO);- n" {% R5 o: }- Q" _: P+ B
- module_param(bcnt, int, S_IRUGO);& _5 Z+ P( s$ T
- module_param(ccnt, int, S_IRUGO);
复制代码 ; b7 C) k7 u& r8 Z# V
% p% T) m b& V/ `: F" N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ }' K, `, t6 I" g, Y6 Q; v3 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, }7 T& l5 {' L3 F9 _4 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ N! f7 _8 U- U
' F5 o. ]' U: y( h( s2 u
5 { Y" K: H, b6 F$ d9 D2 \ |
|