|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 O. h/ c2 f3 K1 x0 X
- [code]EDMA sample test application. L/ v3 F, M1 n% F
- /*& }1 e9 t: g! _% H
- * edma_test.c
1 b7 t# B( e/ Z" x: { - *
[2 L {) n7 ` - * brief EDMA3 Test Application+ o( U2 \6 o- @6 E
- *
3 ]& G" K; i; h, G - * This file contains EDMA3 Test code.
: a+ Y7 F$ [" @$ ^/ Y - *2 P$ U0 A' m2 r# I( j2 L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, W& ? f: i$ i* y/ k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: |; U3 }: `/ A; ]
- * TO CHANGE.* F+ `+ E8 ] w* ~
- *" y! }! @) ?7 l' o; F; {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ x, k0 p. d2 C8 ?: M
- *8 |9 [# U1 I1 f6 s1 Q2 G
- * This program is free software; you can redistribute it and/or
! x$ E; U4 \1 p) p - * modify it under the terms of the GNU General Public License as# s9 Q1 |/ \+ o% i5 c- e2 {+ @! \" z
- * published by the Free Software Foundation version 2.1 f, v1 f. u B3 T% U) g
- *. T0 w- J4 y* O& o# l/ n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ _* w' w/ m/ @! U( k
- * kind, whether express or implied; without even the implied warranty0 z, g4 P P4 K k) C* ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. t8 H4 e8 S! ^ - * GNU General Public License for more details.+ V$ m2 @6 m) M1 d* Z
- */
* h& d# I" e9 C# ?( d+ ?. t) |
8 }* g4 t) G% f5 H4 Q' M4 ?+ Q. O- #include <linux/module.h>
2 g0 d) K8 |' q' s - #include <linux/init.h>
3 O- v0 i- K. w# { - #include <linux/errno.h>
0 S8 w9 a, b3 z' O0 { - #include <linux/types.h>
T) N \: L0 n" N! U* W1 I - #include <linux/interrupt.h>+ J5 |$ w5 O; J& A
- #include <asm/io.h>
8 K4 L# i7 Y% ~0 V+ ^& g4 a6 p - #include <linux/moduleparam.h>; @; k# ?8 L0 u8 @- B
- #include <linux/sysctl.h>& ?8 }4 H* V8 I: ^
- #include <linux/mm.h>
6 {& n+ R8 Z5 O3 ` - #include <linux/dma-mapping.h>
9 U( [/ j5 M+ e6 n4 S, q - " u6 s Z, J5 M2 n5 \ c
- #include <mach/memory.h>, E5 g% @1 w9 u/ ?3 O; E o0 W! G
- #include <mach/hardware.h>+ q! a. F' D. {5 ^9 }! n, b
- #include <mach/irqs.h>7 g& @; o7 P- e4 Y: ~; @1 J7 |( ]
- #include <asm/hardware/edma.h>
* y% R; O- T3 E1 C
& z* Z _! T# i$ d2 Z- #undef EDMA3_DEBUG
$ Y3 C8 f/ k0 U7 D2 Q - /*#define EDMA3_DEBUG*/
+ A; |! i! M9 r2 n) Q% ^
! p# x* x& C& |/ ]- #ifdef EDMA3_DEBUG# j3 N5 O) ]+ X$ ?$ U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
T3 b J/ f% G- ~0 F8 x: I! z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 P# Y& N) @; w1 }4 W8 c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; H; c5 @# B5 J; b2 w1 L# p. S - #else
! V6 a4 W: N( `* ~ - #define DMA_PRINTK( x... )
+ o; L" p. x1 W0 I) p0 W, k - #define DMA_FN_IN
* P. o1 k; L. s- ^0 V - #define DMA_FN_OUT& X% O& p+ u T a6 ]% A" F
- #endif3 Z0 B! G9 J, u9 L+ r5 L; I
, h: @" n1 E/ C1 ]3 X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ E w# D& M* g* J! _
- #define STATIC_SHIFT 3- G n; @. v# @! f1 {
- #define TCINTEN_SHIFT 208 r% \. O+ {, K8 g
- #define ITCINTEN_SHIFT 21
2 J* ^& v! [ t9 P- S/ N - #define TCCHEN_SHIFT 22) V7 U4 p1 _; r( O ]
- #define ITCCHEN_SHIFT 23% Q# d3 i/ [ c' ~# R
- ! q3 v( g# H1 J( Q
- static volatile int irqraised1 = 0;$ q: T8 j/ M1 g( z' X% z8 \; y! S
- static volatile int irqraised2 = 0;" n4 v6 J& J2 N1 o {
, N5 L/ y/ u: Y" W, ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 d; n6 F* J6 F1 T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 v: R4 t4 g' R& `; @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) X- w0 h, s' e% M
4 z7 o Z4 {2 Z0 ~8 h. [+ ~, W- dma_addr_t dmaphyssrc1 = 0;$ w I5 x. b c% K3 P. d4 ?
- dma_addr_t dmaphyssrc2 = 0;% C2 V! P1 X; c7 \
- dma_addr_t dmaphysdest1 = 0;
/ B' q. S% X, N3 j: b' g1 Y" z- k - dma_addr_t dmaphysdest2 = 0;
5 Z3 b( Y1 Q$ D0 \$ n' e' v2 i& F
' `. B. P( x: n w3 T) R; b- char *dmabufsrc1 = NULL;
) M5 ?8 g9 ]% g O G; J0 e9 x5 I( F - char *dmabufsrc2 = NULL;: m: r' q: R7 W) Y& U8 `
- char *dmabufdest1 = NULL;% T$ h; C0 W ]: }) u' ^
- char *dmabufdest2 = NULL;
% M6 b; P! @ a
8 m1 g4 Y) ?& H% ?! E1 o# e8 r- static int acnt = 512;
r& Y h- R6 v/ R2 ~ - static int bcnt = 8;
- `/ ]& [/ f/ o% q" F' Z9 i9 _7 P8 d - static int ccnt = 8;# c: u7 |! W: `( _# U, }8 ^
. E0 _) @9 \9 M- |- module_param(acnt, int, S_IRUGO);
- e+ ]8 f$ l: L' ~, X( @ - module_param(bcnt, int, S_IRUGO);, @( ~3 K9 J- B( {
- module_param(ccnt, int, S_IRUGO);
复制代码
1 G2 H8 J; ~. E9 p/ \2 d
, _* y& h! N, a& W. K4 E8 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* s& z$ t3 v' p" x8 L1 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, b9 O. \1 e. E3 L* H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 P" Z; @/ q$ K' N9 f# f, r+ ^( T. n* V V. @3 H$ L$ q
* N& ~, ^0 D5 q* N4 E R. ?
|
|