|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ ?7 J4 A/ x' x* ~0 r" I0 I% i( v- [code]EDMA sample test application
& f9 E# l: Z) x - /*( j1 b3 J& ]9 _. m
- * edma_test.c
# E# s) z5 i b2 l5 ]3 _/ F4 } - *; h* i( D( t9 f( u! T& w
- * brief EDMA3 Test Application
1 Q0 \* s) O" p/ R8 ~# V - *
) g% y: [: P; T% g( D- L - * This file contains EDMA3 Test code.1 ~. A2 s/ m9 v9 Q% n+ _& W9 {; C5 x
- *
9 b7 U) K2 H2 I; [ ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, A( l( H1 n) ]* r1 y( c# ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 u$ n8 l& a0 i8 O
- * TO CHANGE.
' ?; y; [. X3 ^- _$ A - *
) Y" W' {! [4 m% j' v( Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ E6 Y' k/ F# R" ~) s
- *( M# ?# d# M% e# u
- * This program is free software; you can redistribute it and/or
! e6 \5 K3 A1 X1 N- n" O' T - * modify it under the terms of the GNU General Public License as
( p0 O& f: [- b# h: O( ^ - * published by the Free Software Foundation version 2.* x2 T7 }, m! w
- *1 k6 F0 Y( v% B+ b7 C0 g1 R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 m6 e: G) a' L$ d5 r) l8 d - * kind, whether express or implied; without even the implied warranty
0 {) d b! r! h- v; v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 Y4 y* c6 b6 D# ]* q) }2 G
- * GNU General Public License for more details.7 E. p( G7 G3 {- O4 `3 }
- */
+ U" ^. j' `3 \6 v - 7 K" Y& ?+ x: _4 f* H% @8 _1 u6 m
- #include <linux/module.h>
8 P2 a5 o1 ~8 B! o" h - #include <linux/init.h>; \7 _! A% \1 ^3 o9 Y7 {& y+ m
- #include <linux/errno.h>+ @% m/ H+ s6 T6 @% S6 |) `
- #include <linux/types.h>
6 R' Z/ a" I3 T' D( x, f0 C$ h% z - #include <linux/interrupt.h>
5 I1 u$ V7 \( \) ] - #include <asm/io.h>* I7 K+ H T8 i( y& V
- #include <linux/moduleparam.h>
7 [; F# p6 F& B1 [( S - #include <linux/sysctl.h>9 V7 U+ k/ P6 u& ?) {
- #include <linux/mm.h>
$ F( f* p l& ^5 M/ } - #include <linux/dma-mapping.h>
: k% l% b7 R$ `" i" O - 7 G5 Y" I3 O2 g% k
- #include <mach/memory.h># m, K8 j" Z% b5 }% Q9 Z2 z
- #include <mach/hardware.h>
- S$ }0 U" L2 _) j- u - #include <mach/irqs.h>
( Z8 p& s/ C0 S - #include <asm/hardware/edma.h>! L/ ]% R1 m4 h
0 o: Y, D% O4 V- #undef EDMA3_DEBUG
$ K0 X, W# \ ^9 z - /*#define EDMA3_DEBUG*/! |0 ~2 L3 R3 J6 v1 A- @
& o! b- z2 E F4 M" s' _- #ifdef EDMA3_DEBUG, \# {, d3 i( i! c2 j/ w% T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! Z* J6 }; F& E6 Q1 k$ Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! u8 k; y& \+ d2 o5 Q; \% d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 N* I3 p+ Y6 h; I - #else3 g6 T/ d2 {4 n! u) }
- #define DMA_PRINTK( x... )8 _4 E+ x l* o* R7 O& _
- #define DMA_FN_IN
7 V: Z8 |) c. F - #define DMA_FN_OUT1 Q f8 E7 X7 i
- #endif) `$ u0 I, A K: @) S
- . A$ D! ?3 s7 q! m+ Q+ u7 D, Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 S: y5 A+ n; N M5 r, Q; Q
- #define STATIC_SHIFT 3
O' S! ~; c8 V1 l8 B - #define TCINTEN_SHIFT 208 O. M1 X. x$ o( U( i% k
- #define ITCINTEN_SHIFT 219 ]- E- H% z* e' e3 ? }% Q: @
- #define TCCHEN_SHIFT 22) s( h8 M. i0 p8 b j
- #define ITCCHEN_SHIFT 23& h' C+ F# A+ f/ P2 b* [: i0 F
- $ r0 m. d% _, p" V) a- A
- static volatile int irqraised1 = 0;# B3 N1 C% a: Y0 c
- static volatile int irqraised2 = 0;
5 k7 W" H' Z F% K8 | - % ]9 T7 Y8 n. n$ L3 R; a4 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ \1 ?& ]: d% d$ ^4 n+ b. f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: k- D% t/ V4 S' p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 J" q' w% F! W3 [$ ^5 \% Z - % ^9 Y% F& Z4 U+ c6 n5 @
- dma_addr_t dmaphyssrc1 = 0;- o2 l5 X/ ~* Q# `3 j0 b" M0 F: }
- dma_addr_t dmaphyssrc2 = 0;# t( P( @9 r8 q
- dma_addr_t dmaphysdest1 = 0;
* k! }& O. P" b - dma_addr_t dmaphysdest2 = 0;/ v8 ?$ e# H, z5 x* f
- ) H# d( l$ L# [" w* [
- char *dmabufsrc1 = NULL;8 { n$ m( ?, ^- A8 b4 ]
- char *dmabufsrc2 = NULL;4 X( u% v+ k: L! {3 o
- char *dmabufdest1 = NULL;+ \& n4 ~; x+ p8 y
- char *dmabufdest2 = NULL;& Q! e2 J, S$ c. l$ [" E2 O' Y& s
- , ]' a, b( O1 ~- _; n% z* j; F
- static int acnt = 512;
1 ^& X8 Z) D. ^. X9 }3 N1 C - static int bcnt = 8;
' v: p5 i1 n3 @& p+ u# q - static int ccnt = 8;
, L4 M5 g7 G0 V/ d' c# u
( k! i" { [' R4 S! W' ?4 ?- module_param(acnt, int, S_IRUGO);
: m0 H1 ?% q8 R8 D9 \+ U) J+ e8 |. w - module_param(bcnt, int, S_IRUGO);8 e+ y9 `4 `/ Y$ K
- module_param(ccnt, int, S_IRUGO);
复制代码
. I' `/ B. D! |4 E! [3 x9 V; G4 }/ g1 c1 R' g/ @+ p2 j! H; o% O4 l) [/ F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ R/ ^- v5 g4 L- J0 W6 s4 p3 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( L/ K8 G4 T2 j c( z# }; i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& c& }9 L% k1 z+ S
# D3 h3 C% |/ X
0 ]- ?1 O4 Z( ]; |8 T* ?6 y |
|