|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' ^0 o; r# ^* i) }% @/ u- [code]EDMA sample test application
) W# e" B4 A, y% o x - /*
% U" g7 l% W/ Y) ]- @ - * edma_test.c
( r5 t3 ~& T$ Z; N - * g3 D' G2 H. }) O
- * brief EDMA3 Test Application
# [. ?) }) C* `3 S9 T' ` - *
6 o" N/ C1 n, C) V P - * This file contains EDMA3 Test code.- x7 b; J* p& J, |
- *
; |, T, g2 F4 C+ C( o( E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 W1 U- j+ _8 R& K: b/ [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( H8 D' f: f. ~/ S9 f. ~3 Q; _) v; b
- * TO CHANGE.
7 @4 j, F* E& q, T - *5 k7 W* D- ]/ |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 s! n1 J6 g9 s+ {) r
- *% H0 R- V! d2 C4 {1 W
- * This program is free software; you can redistribute it and/or1 n& r7 u" r; z
- * modify it under the terms of the GNU General Public License as9 i; `' C) J7 u* _! x" j
- * published by the Free Software Foundation version 2.
1 Y/ h) f: J7 ?$ h$ { - *
6 @* `0 c; T! s% T* t x' G* G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 D' n$ n( x5 y" H" P8 K) ~
- * kind, whether express or implied; without even the implied warranty
7 Q* Z: ^) q8 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) e; [6 l; A" S) M6 H9 a& r: `: L K6 A
- * GNU General Public License for more details.2 y5 \8 a6 `3 q1 V3 V5 }
- */$ \+ ^) h' R7 g3 B2 v) P
- & K3 z( z5 Q% b+ i" N5 o
- #include <linux/module.h>
9 K7 z" I# z/ w" Z - #include <linux/init.h>$ |7 M& l' g( q8 e
- #include <linux/errno.h>0 K: N! B0 Z# G* x7 t# H
- #include <linux/types.h>
9 j# f C: s1 N* ~" \ - #include <linux/interrupt.h>3 ^: s3 B# R& i, ~
- #include <asm/io.h>
3 B/ `# U2 q$ v! f2 @ - #include <linux/moduleparam.h>
& C& w, B4 M! G$ A' M3 ^% |5 D - #include <linux/sysctl.h>
3 P# z" {: `. W - #include <linux/mm.h>0 S' Y1 j! ?+ ]8 h
- #include <linux/dma-mapping.h>
6 a( \1 y6 _7 X; O
: p( J6 P2 G8 X- #include <mach/memory.h>
. @2 h% s6 s* @ - #include <mach/hardware.h>- E8 |6 J. N9 Y
- #include <mach/irqs.h>& X1 p/ n8 u9 J, I$ d0 f1 E9 o9 U7 c
- #include <asm/hardware/edma.h>+ A- a' s5 n. k, u/ j% L
+ s9 z! ^1 i3 U- #undef EDMA3_DEBUG& j& r# l2 q. [" j% y8 l3 c& q
- /*#define EDMA3_DEBUG*/
6 X1 ~- s1 U8 j
9 a. N, R' }8 {2 z' e% Q- #ifdef EDMA3_DEBUG6 x+ {. t* \0 [4 G) P u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 F# n9 [1 C- o$ E. c' i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ Y3 v. c1 e9 i8 J( n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 h6 G, Y* Q' u3 E8 U( w/ m+ t% w9 O1 R - #else
. _/ u, Q0 Y! I - #define DMA_PRINTK( x... ); ~' z# {8 }* N' C# F, F
- #define DMA_FN_IN. C$ K, J$ I- U1 }, P7 m h; {
- #define DMA_FN_OUT
4 _- `: Y, E, o3 X8 v1 z9 N - #endif
5 `" a9 G9 x* D) { - : q- p8 l* w V: A6 m% b9 A2 r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 x) |' y2 Z$ e' B" Y9 {
- #define STATIC_SHIFT 3
7 \1 u( Q1 _2 @* v2 a" F7 v& p - #define TCINTEN_SHIFT 20
, K" G F' h. V/ t& T8 G# U - #define ITCINTEN_SHIFT 21
4 N# R: C( L0 O" R& p5 N3 F% m5 i - #define TCCHEN_SHIFT 22
. O' v1 d$ z! q/ a- h1 D8 T - #define ITCCHEN_SHIFT 23; \( H: A% t3 k1 q& W) ]" M
- 5 I5 t, q4 N- C' l1 u' T
- static volatile int irqraised1 = 0;
: L7 p& E$ m9 n5 H0 T# R# G - static volatile int irqraised2 = 0;
4 P' G6 G* F* I7 ^* Q) b) W - ( E7 i& ~7 Y+ _+ a4 _" Z( x2 m/ v2 G3 {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 R9 a: G% ?6 P" u$ n/ e ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ |' j8 p4 Q W# G: o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ z2 w2 F N: \: l4 @7 S/ X' I. O0 G
7 h( U4 S: l7 e! l m- dma_addr_t dmaphyssrc1 = 0;
8 K' K; p+ l: v6 F/ T) D6 d - dma_addr_t dmaphyssrc2 = 0;
8 N% W! |% b+ k - dma_addr_t dmaphysdest1 = 0;$ s$ {& X; ?( B+ w
- dma_addr_t dmaphysdest2 = 0;
" v; f8 s; Z X
9 ~) c" r) {% i) e1 ]5 E; g- char *dmabufsrc1 = NULL;1 C. m* |( P) i0 i
- char *dmabufsrc2 = NULL;
5 [2 U: }% U1 C, X7 R+ Q$ G1 Y - char *dmabufdest1 = NULL;; @! S: s) i) q3 g5 Y% G
- char *dmabufdest2 = NULL;! b6 Z6 Q1 ^: z
9 L4 b% |! I, o$ Y# r: _5 C- static int acnt = 512;8 y* t- X9 Q7 g7 I% X
- static int bcnt = 8;: `4 x5 a% d- z0 Y9 D& c8 D, p8 R
- static int ccnt = 8;: f/ s0 P# U3 h- b, K3 v8 C
+ L/ W/ f+ C {- B- module_param(acnt, int, S_IRUGO);
. [) W! q0 @/ h5 ^& H2 G - module_param(bcnt, int, S_IRUGO);
; ], W. F& e. c; _; W$ @6 z- c* D! {2 q - module_param(ccnt, int, S_IRUGO);
复制代码 " t8 b/ Z4 k( w0 @# I0 X
1 ?3 C& v( C( R+ a8 Q1 K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- M) d! G. \* [) z' barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 B. l3 {# u$ K8 }. e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' x3 N# y1 ]/ v6 N6 [8 k, W2 t q" y! p' ^( T \* K9 \7 w
/ ?: O$ n5 j# c) v |
|