|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! b1 E9 a- ^" q3 d3 {' s- [code]EDMA sample test application
, j6 e( G* t) B) W Z! m" o, O' w' _ - /*
, d! q/ F1 G. V, H - * edma_test.c' r/ _* g/ r* s& m' W* E0 S5 s
- *
1 y5 w3 G- X, T6 O8 J+ D& j) x7 @1 n. w# y - * brief EDMA3 Test Application
! P* z* e( S7 a# g( s" _! E0 Y) t - *
E7 Q+ E9 {( l2 E: I - * This file contains EDMA3 Test code.
' a) [2 {% u9 Y - *7 e+ u* }' k2 t9 }0 P" ]3 W2 Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ K" Z5 r9 {4 O/ d% Z1 x( f6 K. u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& @% P3 G$ z7 a; m) K- y) v
- * TO CHANGE.
1 C$ g6 B5 u( a- }0 ]8 Y6 q: F( K - *5 A- y- m6 ^- t" s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' }2 s8 E: C+ L
- *
& y1 V4 ~# e8 Q( C - * This program is free software; you can redistribute it and/or
5 q, J; `8 q" V7 a. Y - * modify it under the terms of the GNU General Public License as
! ^% E! C4 L2 {4 e) J' K% g: ^- X - * published by the Free Software Foundation version 2.
+ I2 b% t/ t1 X: F- o9 X) r - *, V: l0 ~+ K7 q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 d! h* _7 v2 Q, l) V, |+ @
- * kind, whether express or implied; without even the implied warranty6 s" Y8 U& T7 ^: k" O; ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) e; }9 j' q- _1 e4 q- A - * GNU General Public License for more details.
% L6 b* O0 K5 k7 f - */9 \5 w3 d% }( y! e0 T; e% A# z+ U/ L6 u
, u% ]$ u; O5 V5 {9 I9 n9 ?2 u- #include <linux/module.h>, K1 w; [7 S) E. O0 D& l
- #include <linux/init.h> l2 L4 U! ^9 v* l
- #include <linux/errno.h>
- F% P4 ?2 Y/ {. { - #include <linux/types.h>
0 S7 y2 ~& Q! t, j' | - #include <linux/interrupt.h>
" Z3 L& j5 x2 U- e - #include <asm/io.h>- i4 |0 Y8 V w* q3 f! L* r$ X
- #include <linux/moduleparam.h>- r# M( j C- I9 s: A& W& T
- #include <linux/sysctl.h>
& w+ c7 Z( [, |4 j - #include <linux/mm.h>
G7 ]# R$ r" U3 `" u - #include <linux/dma-mapping.h>; r! u; v5 ]" w+ a9 s3 u
- - N7 e2 j! O b1 r
- #include <mach/memory.h>6 x1 a1 }2 w9 E: _0 {, o0 S
- #include <mach/hardware.h>
# l. {6 u* I; r& K/ _% z - #include <mach/irqs.h>
0 M G7 x* c* S* E0 J$ n+ E - #include <asm/hardware/edma.h>! }7 O& u9 F- Y( `: n
: t$ o% J) T& H- #undef EDMA3_DEBUG
2 z) f9 S }/ X: v4 p: O) _ - /*#define EDMA3_DEBUG*/: F# m8 {5 i9 a
0 S8 D" x4 O/ |- #ifdef EDMA3_DEBUG
" W' P, @1 G% ?& h5 Q; N+ G* m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) u8 s! L+ [% \# e) x! v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 L) C4 G2 w2 a, m {0 W0 w2 q( g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); f: c0 l+ \: ` I- o% n/ l0 x
- #else# N' b, _' Q8 i, G
- #define DMA_PRINTK( x... ) P# {6 [/ }$ e
- #define DMA_FN_IN
+ o, A/ F$ {9 Q& b2 Y( j+ R) k - #define DMA_FN_OUT% V& H( s# k- e z4 E2 ?
- #endif
+ k+ @" J t, d: P Y8 J2 \
- y! W% d/ s5 ]+ c% o* b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! P { X& S" x0 z9 H2 W3 ]* `
- #define STATIC_SHIFT 31 c& ]% n8 s0 D" ^6 F. m B* h
- #define TCINTEN_SHIFT 20; d e4 I- }+ l8 N! f9 H/ F- Z0 f" l
- #define ITCINTEN_SHIFT 21( R: W0 a0 n5 H$ N3 D
- #define TCCHEN_SHIFT 22
' O% A8 m( x } - #define ITCCHEN_SHIFT 23/ U: [! T* A2 g. g& K: i6 W1 n
" t, }4 K( E6 J* m- static volatile int irqraised1 = 0;
& t* R+ R! V# W! z, M; ]: ] - static volatile int irqraised2 = 0; M, o: d1 c/ `7 V, V
& @8 ~; e0 Y" r) h8 Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* W" d2 l+ ]" f3 ?- S6 q2 E6 n2 C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 s- W* L3 k3 ^6 C) {# k6 @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ^7 G d" R9 j r3 Z- Q: m - + L0 Q; v- b3 C
- dma_addr_t dmaphyssrc1 = 0;
# E& w- k# W: Z9 H* Q- e - dma_addr_t dmaphyssrc2 = 0;' p: s% v+ h! y7 Z: X
- dma_addr_t dmaphysdest1 = 0;
2 u& R4 V% ]; d0 B/ Y2 k1 S - dma_addr_t dmaphysdest2 = 0;
: }- [$ ~2 F% k+ \
( ~/ ?& j5 P* O' Z6 F+ R0 k- char *dmabufsrc1 = NULL;' T9 l6 I" f4 l6 z$ @
- char *dmabufsrc2 = NULL;
% p& S+ D: g l% v+ K - char *dmabufdest1 = NULL;. S7 \7 K4 ?* M* u' Q, e
- char *dmabufdest2 = NULL;( Y! A. p5 w' c% I) m: Z" Y' w
- * C) a! D9 e$ y9 g
- static int acnt = 512;. C- d9 e! k3 T
- static int bcnt = 8;, H8 e* U! ?0 K0 y
- static int ccnt = 8;
5 q h7 p2 z6 G: J& {
5 O% [# f# c5 M, W0 Q, ?, g- module_param(acnt, int, S_IRUGO);9 q5 q9 P, \" D8 p
- module_param(bcnt, int, S_IRUGO);' c+ C- i: M) C* s' R f; L: S
- module_param(ccnt, int, S_IRUGO);
复制代码 ) K8 y% P# q- q; n& V" W1 t" Q
% f1 [7 {$ P, ] O9 W' Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- y/ y# @) k* k/ _6 D, f# Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 r$ h) r! Y& J) g2 ]. [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 v8 ~. O) o& f; ^
6 x# ]2 a; Q# w* H. F8 K/ L! \+ [& ]* L7 { L+ Z* o' w" C, I
|
|