|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 T. W3 ?! w' ?0 w0 w6 L
- [code]EDMA sample test application3 b' F) \& j) M- K- z3 u# V
- /*
* R& D2 K) m1 R* |. l5 w) E - * edma_test.c
8 Z$ |; g. F7 m& \5 j - *5 o; u3 b! t e3 O2 {) K
- * brief EDMA3 Test Application
! V f4 U0 w# M, W9 p/ {2 w+ r - *# J; g; S5 L# }% d6 X1 E7 S
- * This file contains EDMA3 Test code.
0 m3 k; O N, q0 B g' g. w - *" c7 j. E4 K9 [( D1 ^+ w0 ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: m8 T$ u' M9 e+ d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 y; m# C! J2 N5 w" n& R# X - * TO CHANGE.2 F2 @6 \ s1 g6 C3 r
- *0 x2 j' \" J$ k& {, D# o' h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 ~( w$ O% x0 q0 z/ b/ r/ K
- *% u' H2 Y8 |0 m+ _9 K- c1 r' ~
- * This program is free software; you can redistribute it and/or0 d& x2 N9 U, z' J
- * modify it under the terms of the GNU General Public License as
4 L# q9 n2 {( s* A, q* { - * published by the Free Software Foundation version 2.
! g, V5 S$ Y/ s8 S) ~ - *
$ W/ B1 N' h2 e5 f0 {+ D' i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" o$ C$ `' k6 L+ k( {/ [+ R
- * kind, whether express or implied; without even the implied warranty
3 ]1 \7 J! y' e& J# G, I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! [% S! A1 A, K: K9 v4 c$ N. l
- * GNU General Public License for more details.
0 J( P. k, Z, O$ T+ i - */' w4 p0 L: q4 k* E) D" W: z
- f" h- ?/ Y& q. X5 a2 `
- #include <linux/module.h>
) O/ s$ F- |) a g c% a - #include <linux/init.h>) p$ x( z, |( Q( P+ k7 V7 }
- #include <linux/errno.h>5 I5 F& [" F! J+ O; f1 S# {7 p
- #include <linux/types.h>( ]# k+ i2 P; ?9 a9 Y( ?
- #include <linux/interrupt.h>9 V" q% x/ s+ w
- #include <asm/io.h>, P: `0 q" I5 c. y
- #include <linux/moduleparam.h>1 T7 z4 Y8 X+ V) X) A6 g7 W
- #include <linux/sysctl.h>
' z, l, x+ x# D - #include <linux/mm.h>
8 M1 Z, K: _* u! b( t: n. y - #include <linux/dma-mapping.h>3 k4 ?: \9 [2 [" ^! }* q; o" K/ g
- * V$ [2 K, O0 r
- #include <mach/memory.h>
% u* ?! D0 d+ ]; a- M! a - #include <mach/hardware.h># J6 ^5 M( i1 a2 ]
- #include <mach/irqs.h>8 U3 L9 a* |8 B; V- e
- #include <asm/hardware/edma.h>
, j, f0 C$ ?7 r9 u
, N5 N" e) L! ^4 j- #undef EDMA3_DEBUG
- ]4 X9 D6 n3 P$ E# d: f - /*#define EDMA3_DEBUG*/
" I5 o: v% n0 Y7 j3 D! w/ a: G - ( G( M& [0 M4 y7 ?) b. H9 n8 R3 h; v
- #ifdef EDMA3_DEBUG2 v0 a& P) I) E' x3 U% q2 s# v# Q9 v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( J. ?$ |3 c- F# c4 Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ \$ Q( p1 l6 m. ]( J# o7 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ h* g ]2 ~5 l$ m" y2 F: j% b
- #else- E l" N. O1 |# E7 ?& e9 q
- #define DMA_PRINTK( x... )* S+ ^! c% H5 Z( b1 |$ _
- #define DMA_FN_IN7 c3 p3 R, i( i s7 u
- #define DMA_FN_OUT0 G6 p8 B h; T+ R2 I" Z P' Y) S3 P
- #endif
8 c- z# w9 O4 I - & A% j% |4 E$ y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* Z: T+ B: y3 c6 K7 z, R - #define STATIC_SHIFT 32 @: w9 B7 K; ^
- #define TCINTEN_SHIFT 204 @# |' K4 i( A! ~9 z
- #define ITCINTEN_SHIFT 218 b! k3 g, v7 Q1 |
- #define TCCHEN_SHIFT 22) ?: `9 P8 V3 E, o" G% v
- #define ITCCHEN_SHIFT 23
+ P, ^4 r% \7 S$ y& `+ z s - 8 i$ j4 v+ L$ |" M, |
- static volatile int irqraised1 = 0;; h4 F0 j1 }( |! {, n( U; x
- static volatile int irqraised2 = 0;$ B4 [; u: N- |2 k
- ; v, o. c4 G, G$ V6 w2 q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: I( o8 {4 c' d: g2 i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 l/ M# B' s, M3 p1 p( _4 Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ V+ o1 m4 I9 C: g0 B
5 R# u" V$ U1 {1 }. m* g- dma_addr_t dmaphyssrc1 = 0;) U! b" b# d+ ?4 f9 X* r
- dma_addr_t dmaphyssrc2 = 0;
' N* x1 {: g) c, ` - dma_addr_t dmaphysdest1 = 0;
! s/ j* S, |; Q - dma_addr_t dmaphysdest2 = 0;% Z! \8 @1 Q6 `+ [" _9 F d }
- 4 T2 a! h' {7 V# {
- char *dmabufsrc1 = NULL;
6 \- Y) X3 E) z! C - char *dmabufsrc2 = NULL;
' U1 N$ C8 r( _& A/ d( T - char *dmabufdest1 = NULL;9 |# |8 Y$ j6 O' I" H
- char *dmabufdest2 = NULL;
: h1 d7 o* L& D( b - : Z, r+ _4 ^3 G& f, |
- static int acnt = 512;
0 p- K0 D" I% y - static int bcnt = 8;
) n8 F% f0 Q$ a; k( s! \ - static int ccnt = 8;
; D4 z4 C& N* P: k4 J8 ~: u3 F3 v6 D3 }
# q# Y% N, |0 u8 T- G# h1 \# ]- module_param(acnt, int, S_IRUGO);
3 n; y& o) P- a6 D, f - module_param(bcnt, int, S_IRUGO);
" |7 ]! Y* a. `! L5 f - module_param(ccnt, int, S_IRUGO);
复制代码
& r& E# W6 S& k8 k: o6 `: L7 q/ P$ P! [6 n1 E5 B7 I! N9 S7 |9 R7 _& y! ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 H" T: [, |. D4 a3 N; \2 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; d3 ?5 @7 Q! t3 s. m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 O9 G2 r, N& C/ d
+ U0 C4 h+ g7 l, r# Q4 Z
& o) Q. K f3 n, e# @ \! V+ O+ @ |
|