|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 Y2 D4 F* o, c# _/ s2 K- [code]EDMA sample test application
" j3 q7 q: Y- P6 ^$ \ - /*
/ Z. F' z+ U& b* u - * edma_test.c
, q9 B# s$ l% B/ t - *; h3 D; Z; q$ z6 f
- * brief EDMA3 Test Application
' c+ r9 c1 S- k) E$ c - *
- e: V- d6 W% b - * This file contains EDMA3 Test code.
4 K) |% _- _3 E- r5 F0 y7 m - *. T# }2 T" ~) j1 n/ u( f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! H5 p) r4 q% b4 R: d* a7 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 n) u8 d8 G* x. X* o - * TO CHANGE./ K( u P7 m# z5 k& N2 w+ c; e ~0 `- u
- *! _9 L# [# [% j8 p: C# H) t q) U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! R4 l0 c: p1 Q( b6 r8 q$ S3 b - *
) ]' i" l( V- o1 l+ j' M - * This program is free software; you can redistribute it and/or
% D9 g$ D4 {9 Q - * modify it under the terms of the GNU General Public License as. a5 a& `- Q" A# e4 ^; F0 h
- * published by the Free Software Foundation version 2.
1 L8 [) p0 n: \3 l0 q4 I) R - *
0 ?. F# i9 t9 O j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) o* e, V( G; j1 [: Z
- * kind, whether express or implied; without even the implied warranty$ A6 y- J& `/ Z& i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; Z. |% x9 y: s9 F2 U) U
- * GNU General Public License for more details.
( x1 K- J6 N7 U b. B - */, w! L* I& d& j1 z: l3 N) ]
1 w! X8 g3 G' j; u; p! ]- #include <linux/module.h>0 ?1 r# G+ _& m J4 w9 Z
- #include <linux/init.h>( j: b T9 }" j' x/ T: R
- #include <linux/errno.h>
* S! y+ [5 c! p/ { C6 R) ^4 @ - #include <linux/types.h>
/ x8 ~4 D% y! W2 \; E0 a8 W: Q - #include <linux/interrupt.h>
. _& t: B5 {9 U8 ~, S - #include <asm/io.h>! O, R8 B" n# V7 f' ]
- #include <linux/moduleparam.h>5 C) F4 x: |* Y( h7 [" ]. B
- #include <linux/sysctl.h>
2 u/ }5 c8 V. U. P* b9 C! [ - #include <linux/mm.h>! [' N4 l4 l" O" x" g6 a5 B
- #include <linux/dma-mapping.h>
: d" T( _* ?3 C: Z# {# t
8 }( A. m+ P, E4 D, x/ f- #include <mach/memory.h>6 \$ r+ G/ F8 u- `
- #include <mach/hardware.h>) [" m6 _" b0 U' @' c. v% r
- #include <mach/irqs.h>3 X, E& f4 F% ~
- #include <asm/hardware/edma.h>- u- a+ V: |/ t" |3 P: l
3 U% ?+ V7 w: L5 E- #undef EDMA3_DEBUG) O3 n' F8 [( l. L ]+ W* Y
- /*#define EDMA3_DEBUG*/
& B; L0 k4 D+ e) J }4 Q& A! l+ D
6 Z$ y" ~7 z& [$ W1 G- #ifdef EDMA3_DEBUG& f1 o. p: w+ ]# \$ b$ a0 l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! _6 x. D& F+ `$ L, Y: } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% e" b( u2 @8 B1 O- V0 k* c9 i, Y) u5 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 q" X) R* f6 D" `+ b# }$ _: n - #else' n d$ ~* E% f) A3 H& s
- #define DMA_PRINTK( x... )' d7 r+ ~ {' f! ^- n0 u" V
- #define DMA_FN_IN l9 I0 K. r# w" Y' P: Q
- #define DMA_FN_OUT
& x% x( L6 j% b) r - #endif
! U/ e; r" E' b0 f' ^, M' L
5 v6 X1 o) Y0 i" D* N* }1 u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( |0 r" z1 q ~/ Y - #define STATIC_SHIFT 3' ]2 f) S& s/ C8 w
- #define TCINTEN_SHIFT 20
" M6 o: e* Q/ w5 m; J8 U% Y8 c - #define ITCINTEN_SHIFT 21
\7 x/ L3 P, q8 W% Q2 \2 z - #define TCCHEN_SHIFT 22$ } R7 r4 G& f. r& |+ T: f
- #define ITCCHEN_SHIFT 23* k6 K X" D& @3 P" m/ _
- ' ~; G/ T: c7 H% @6 u: k7 b- h7 a5 o8 i
- static volatile int irqraised1 = 0; s7 _$ k! O) v
- static volatile int irqraised2 = 0;
- \* k* b" S/ B* p# A4 X8 J4 k
& G- W; E% @ f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 f' C6 ~3 X+ N9 B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 f) T0 D( [: E1 y; O5 o5 {6 m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l2 W, S" u5 d
' b, j$ q1 G, I0 R- dma_addr_t dmaphyssrc1 = 0;
0 t! K, N6 `/ }) V$ k7 M - dma_addr_t dmaphyssrc2 = 0;
) g3 i0 z- D2 {' t - dma_addr_t dmaphysdest1 = 0;
1 h& o) d# {' ]* j5 X - dma_addr_t dmaphysdest2 = 0;; j* L; a. C- B$ ~! B: O
; i9 g) M& q3 T+ k8 V- char *dmabufsrc1 = NULL;
4 b* @( I7 G4 m% m, O8 U$ f3 c* M7 c - char *dmabufsrc2 = NULL; k, s1 H! g# f3 |% D
- char *dmabufdest1 = NULL;- v1 ^- r. ?; l2 E
- char *dmabufdest2 = NULL;/ W+ [2 y) w5 A$ Z
- $ h0 m4 d9 M2 D0 [
- static int acnt = 512;; z9 C) b0 e. K# G U/ w) G/ }. o6 s
- static int bcnt = 8;* f5 p! t" x6 Y! h8 l
- static int ccnt = 8;
& l- K% A* o% m2 p8 w8 x. T+ r" q - & W; t4 E/ V% r# ]/ W
- module_param(acnt, int, S_IRUGO);- t4 P u$ K; p) o
- module_param(bcnt, int, S_IRUGO);
) w& E3 `) F; ? - module_param(ccnt, int, S_IRUGO);
复制代码
2 b- x, E4 p. N2 t" L; K1 D4 e7 I0 V1 y$ {9 L/ N7 G$ t; J+ O( x- J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 H; x8 f- X; m* o farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 [- o9 F) O) ?- [) C, ^" e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 d5 v+ ?" ~$ A+ E) E3 H
, ]4 }3 U& N, a
3 e+ K$ X5 r" P H/ A |
|