|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; \! e' E" Y Y; d$ q
- [code]EDMA sample test application$ l7 _8 m; G# E7 E
- /** ~+ ~$ J7 s2 Q4 A
- * edma_test.c) n% ^# S/ n I% {2 P
- *
; v, L$ f" I6 b - * brief EDMA3 Test Application
1 E6 J3 t/ @. V0 l/ R% M0 I - *
; O3 q/ Y9 d' I) m+ z* R - * This file contains EDMA3 Test code.
1 e# P2 \% d- }4 s( \& b7 M) ] - *
0 Z! k) q: |6 b0 ^8 C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 o c: o& }: m5 i8 Z2 D/ ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 d _% Y1 L. H6 T# M- I5 u
- * TO CHANGE.
% D+ X3 h/ g9 @, j* M4 c - *4 _9 e" [- G1 E8 s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ Y" u5 i$ k R - *2 k' m' }; P X) `3 Z
- * This program is free software; you can redistribute it and/or! z; {/ N; e3 n2 _, `9 ^
- * modify it under the terms of the GNU General Public License as
8 O. g# I, }2 Z: K: |3 ~: Q$ U - * published by the Free Software Foundation version 2.
/ O2 }8 p% D1 w2 c2 ~! _* h3 I H - *
9 E& m0 M. E4 e2 P4 A4 ?# n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 `% L, B! u; g; ], O
- * kind, whether express or implied; without even the implied warranty* u$ |9 e" h2 l' u7 H, ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ \+ J2 Z& ~- ^1 T4 L
- * GNU General Public License for more details.. I8 h! B& A8 L9 ^& }8 e
- */9 J) w7 S/ o- J
1 v$ F4 z3 F( y- #include <linux/module.h>
/ R# X. n: E/ f2 Q - #include <linux/init.h>
) ~- [! E" q" C7 o; F; a - #include <linux/errno.h>, _5 G1 m& p) V
- #include <linux/types.h>$ c+ A, M7 {7 a! h7 }9 Z+ ?! B
- #include <linux/interrupt.h>2 i5 V4 Z% d% _% w$ d! C+ c
- #include <asm/io.h>+ S1 C6 Y5 j; q& G8 V( k1 P
- #include <linux/moduleparam.h>
& i# t- H! S/ B# \0 a# u - #include <linux/sysctl.h>; }3 G% c2 V, l( C
- #include <linux/mm.h>( m" Y' G' z9 J! V2 E
- #include <linux/dma-mapping.h>! F( G9 _, i; l+ ~% u+ ^9 g F$ M
% a* Q# B- A8 _3 f3 i- ?1 b6 U- #include <mach/memory.h>
. o: f6 F4 E' I0 ^ - #include <mach/hardware.h>
! F/ \7 V) }( I* x - #include <mach/irqs.h>
; s" a7 i$ F+ r% x - #include <asm/hardware/edma.h>3 P& S2 U) J7 z0 K9 l
, ?: {4 I! U" }) P, ?- #undef EDMA3_DEBUG
) J; R. ^1 i4 y8 V% Q - /*#define EDMA3_DEBUG*/! m3 ]5 a7 A3 j7 A$ \* D/ d; n
- . r" a! D# E* K( |. N* }
- #ifdef EDMA3_DEBUG, R$ S- E: r3 p) z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 k" J- a7 ^ H! F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# F. N: T* G' h) q; C) ~* H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 G' `) Q! R3 R, \) H q
- #else- k0 }- u( P8 p
- #define DMA_PRINTK( x... )
: M8 v6 C6 k- X) T8 E - #define DMA_FN_IN
& V _/ ]) H# M4 y0 [ C' r - #define DMA_FN_OUT1 t3 e6 c! v5 H/ J
- #endif9 J! d0 x. W0 E& a
- ; y3 A0 `; R+ e5 S* O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* V8 L0 N+ G) G& @& H& P
- #define STATIC_SHIFT 3
: i ^ { P; C4 t z0 P - #define TCINTEN_SHIFT 20
" ~. V; |3 w$ G- Z- k' |* n - #define ITCINTEN_SHIFT 21
% K# M( R* O2 M8 h$ r, E - #define TCCHEN_SHIFT 22
+ E0 V/ K" R9 U8 u$ `1 ~) l) ?, R4 Y - #define ITCCHEN_SHIFT 23
- a8 V. o7 q5 O" r - 4 P4 V. D4 o( T
- static volatile int irqraised1 = 0;
7 a) q' X( a4 D0 h - static volatile int irqraised2 = 0;
& v" y5 Z. G; J7 c - * A8 ~6 t( k `5 `8 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J" X) @3 p9 k3 f i1 X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ Q! Z' a: `. r8 h1 J, \8 d& @7 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& A) w7 s% W/ q" P# Z! Q
- 6 u0 Q2 q8 N O$ h
- dma_addr_t dmaphyssrc1 = 0;8 E+ y' n# T) c3 D
- dma_addr_t dmaphyssrc2 = 0;& y5 ^9 d1 `+ T4 y; F
- dma_addr_t dmaphysdest1 = 0;
[) p4 X4 s+ d4 K5 E- J/ k - dma_addr_t dmaphysdest2 = 0;
( y" V M6 i0 T1 q3 Y - % E+ ], V+ S2 C4 b6 M
- char *dmabufsrc1 = NULL;
! `& e! J9 h5 E# m$ K% u - char *dmabufsrc2 = NULL;$ b( \ V8 J- z3 z( N. H) o% |
- char *dmabufdest1 = NULL; ` P" w( m- z6 E
- char *dmabufdest2 = NULL;0 [' m) ~6 l0 V5 K$ g) n) i, N
- 5 q6 Z! E. L* s! G; o- e
- static int acnt = 512;
' ?) U8 H5 y! { - static int bcnt = 8;
6 I& t% N: \ O) c( r3 r - static int ccnt = 8;$ @4 m& M% l( l1 z) o
6 e% w% ?5 F9 [$ S! Y+ n# ^- module_param(acnt, int, S_IRUGO);) w* a& a- c) z, }. J0 q; z5 m
- module_param(bcnt, int, S_IRUGO);
1 Z0 K$ F0 v" f4 k - module_param(ccnt, int, S_IRUGO);
复制代码
6 o/ Q8 ~" z& P( |: o& I- d- y' \. c& ~# ?6 e3 z* y% m0 K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 K1 a1 V, }4 s3 ?& [; \4 E6 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 l9 o' F2 W' Z- m6 r' ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, m2 J X+ S, [+ j9 r9 i
0 ^7 Y2 U" s& P6 i, t% U0 m! v
! c% [8 L3 O, x& p2 l% G& X- q5 _ |
|