|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 q9 G4 a5 r% A) Y# e- C
- [code]EDMA sample test application
5 k+ b8 C; z2 c8 l - /*
' G1 q0 o$ p6 @ - * edma_test.c" c" ^+ p8 p7 I! w
- *
% f2 V, c9 d4 P( U - * brief EDMA3 Test Application2 ?9 l j* a: f; k/ K8 W# U
- *
8 _- F& ^4 X" E+ O% I - * This file contains EDMA3 Test code.
) n3 U7 B; U/ N" X - *" u2 o+ r+ `' n; Y5 r8 s; K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 Z* t/ B3 Z8 a, e- l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, k5 F C" ?3 A5 }' B, n, s* K - * TO CHANGE.$ }! k# T; h. _
- *
7 M2 l7 a# Y1 K9 r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 J1 W1 y, C5 Y a, { - *$ L' n8 h. S& a) [
- * This program is free software; you can redistribute it and/or
! X( t. c% C" K+ d& U6 j - * modify it under the terms of the GNU General Public License as4 ?6 p" x2 d* Z( @+ X% f7 d2 z
- * published by the Free Software Foundation version 2.( W) q/ w7 O' i* Z; m3 a
- *1 p! O' N- `( l, a l6 s# R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* s0 M* e) I& ^+ @( n6 N! l - * kind, whether express or implied; without even the implied warranty: p: {% A. O) m w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 L7 P0 r; W( r, S# e& P
- * GNU General Public License for more details.
! Y, C {+ B4 m( J6 L5 J8 {) w9 L - */
1 `' V% `0 k7 i3 K- {* e, I9 \ - ! a: n0 ]1 H4 n" ^
- #include <linux/module.h>
! w; ~( Q5 a7 `+ a0 V/ ` - #include <linux/init.h>0 p! i Z& Z; V; J9 x
- #include <linux/errno.h>8 r( S+ u1 ?$ S2 Q/ t" m
- #include <linux/types.h>: u4 h, x# i$ |$ L; L# N" V3 g o
- #include <linux/interrupt.h>
) E1 U: B( p/ o+ Z9 e, D# p - #include <asm/io.h>3 i* c! o$ u# ]3 q
- #include <linux/moduleparam.h>
' w( T4 P2 V% @+ | - #include <linux/sysctl.h>
8 \8 ^- _. ~# @: @, ` - #include <linux/mm.h>3 r% b. n0 z9 D7 o' c; _7 ]$ @
- #include <linux/dma-mapping.h>; M3 V3 J* O$ B: s* V: ^
7 Q( [4 g" {& p1 E. Z! m- }* }- #include <mach/memory.h>5 y; v- }1 |- T: u
- #include <mach/hardware.h>5 H! C; Z2 c- @9 ~
- #include <mach/irqs.h>
! l) i( w+ m) Z9 |6 V* N m - #include <asm/hardware/edma.h>
+ [& t1 d# H7 j# Q1 t G - - n; ^" ]/ z# C. U' m% b/ u
- #undef EDMA3_DEBUG
3 V( R& U0 K% k2 ?& c4 l - /*#define EDMA3_DEBUG*/! s0 G' Q# x' E8 ?" j* W$ Y
- ) a- {5 X( t( J! R: j2 F5 J
- #ifdef EDMA3_DEBUG2 |6 `6 c% S( } G+ ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 e: Q: Y, f! F! d. F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 y0 f* X& B. T w4 X6 ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* h* z, p, D4 K, a, D X2 u# r - #else
6 T1 ^6 _* W' B' e+ ?6 M - #define DMA_PRINTK( x... )+ k0 n k: d8 g# `3 j1 E [3 Q7 s
- #define DMA_FN_IN
* v m" l: W# @" v- ?* \/ O7 f - #define DMA_FN_OUT
- R$ Z* l) r6 j( [- i1 A - #endif2 ]" z& N. J9 D9 }$ A: x
- 0 a0 B: u' S P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 o. ]' {3 t5 m% U( S5 ^5 R) r8 d
- #define STATIC_SHIFT 3
6 R+ f" ~( h( ]2 @ - #define TCINTEN_SHIFT 20
s K3 q! `, ?1 D m% Y5 I - #define ITCINTEN_SHIFT 21 Q; O) ], b$ B) E$ }, Z
- #define TCCHEN_SHIFT 22
( P/ L& I$ |* E; t7 J- ~4 D - #define ITCCHEN_SHIFT 23
. T) ?1 ?# L/ O1 M7 j; L - 5 l! {8 Q1 h5 y7 C6 `% O
- static volatile int irqraised1 = 0;
& U) Z' z" P# i% |' U6 n: I - static volatile int irqraised2 = 0;
: {0 [, z! E* @2 e: r5 }9 W0 I1 M6 H( x - ) E5 O) {; k N' H8 J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ G- ]# X5 j% H( t; i9 h5 I+ k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 N& p1 ?. O3 m6 s K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 F2 w5 e" t: s4 x
- * `0 N4 T, |1 {" W
- dma_addr_t dmaphyssrc1 = 0;
$ P5 j: B: I1 G9 l; m - dma_addr_t dmaphyssrc2 = 0;3 B/ i- M8 B7 A; X7 F
- dma_addr_t dmaphysdest1 = 0;
! A! I. _8 X7 c; J5 Z p - dma_addr_t dmaphysdest2 = 0;
( R, O( J/ M7 w
- b$ t+ ?& g2 K& z& j' O8 L3 F- char *dmabufsrc1 = NULL;
& D7 r" a& p9 C: L - char *dmabufsrc2 = NULL;" T- ~8 g- q5 \
- char *dmabufdest1 = NULL;
& Z2 `& q& x3 `: s - char *dmabufdest2 = NULL;
0 H$ A! e9 u+ }- P5 k2 N
5 M* J' v. {& A' @/ S; \7 h6 L- static int acnt = 512;9 Q2 p" T u3 g' V. x, ?
- static int bcnt = 8;
8 E9 L+ L8 U7 ]& |: C. I - static int ccnt = 8;
: l3 \( r7 X T5 O7 S( b+ N: f
1 b3 S3 c' L- n) e2 |% a- module_param(acnt, int, S_IRUGO);/ y* J# h% \/ A9 f. ]9 e8 W# X' [
- module_param(bcnt, int, S_IRUGO);
& |4 f3 S0 w/ |7 {! ] - module_param(ccnt, int, S_IRUGO);
复制代码
4 }+ M2 r; h6 P$ O( P* n+ [: \, k
) \# r9 n" T1 y! v, C1 S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ R( Z6 n7 |8 I1 `1 `! [) D. B) T$ q5 S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' x3 z9 j* V3 |" Q8 w/ R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) M& h6 y3 i1 E3 R$ E; D9 G, i" x' k- n% w
) M$ ^ i! F* z4 ~ |
|