|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 `/ v& b; |2 f2 q+ G) i# I' z- [code]EDMA sample test application
3 C6 [( y( E1 M( u" b9 X - /*
2 {5 z3 J+ q! N9 O# y& V0 D, T6 | - * edma_test.c
2 u( K& ^6 T6 W5 ]* \ - *
7 V$ a& e5 n+ _1 P5 i- ?. S - * brief EDMA3 Test Application
2 q, D5 I3 O/ u+ P3 _$ ]6 a5 D+ J - *$ T$ s9 x: Z: N" |- ]7 j5 c" n
- * This file contains EDMA3 Test code.
) j" t, p4 U( J6 v - *) c6 L8 y- B6 p8 q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. _5 |9 l- p, b7 Z0 Q9 \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% l# p. l% T8 {5 ~9 h7 d5 S* O5 x" Z: M - * TO CHANGE.
0 K- Y% g- ~3 I4 s. P* ] - *" X, W5 H5 r$ b9 K8 L/ i$ T& W, a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 K2 ?/ G- S3 F - *
/ K, N( h4 a$ S3 ? j7 a# T* Z I - * This program is free software; you can redistribute it and/or. I" v' U) j. x! E# a
- * modify it under the terms of the GNU General Public License as
# ]; _$ f4 U/ V4 j' x# q - * published by the Free Software Foundation version 2.
4 |$ {: x( P$ j - *) p$ L% h/ `& r1 ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 K3 L0 M0 D( Z) J* {4 \/ O
- * kind, whether express or implied; without even the implied warranty
* w: M$ }% O/ p0 N9 ~4 c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 X6 }0 v O0 c- G9 N - * GNU General Public License for more details.
* o; e" F1 w3 M; d; x) A, C - */
8 E5 E1 L! B; i, {5 ] - 8 ~8 J6 n0 I+ u4 k6 k9 M" a
- #include <linux/module.h> X: ~/ |+ S( [7 |. P4 @2 v
- #include <linux/init.h>
- K6 y( `/ w& B - #include <linux/errno.h>
" y" r# ?5 X: a( k# ]. o: q1 u+ _7 k - #include <linux/types.h>
; c0 _. _4 F B* y6 q& c - #include <linux/interrupt.h>2 k% F. ]0 w4 P3 a& d
- #include <asm/io.h>- o$ A6 k* W2 B" v S: z
- #include <linux/moduleparam.h>1 E. ?9 U9 X: g' D- I+ \% S
- #include <linux/sysctl.h>
& v$ D- ?# j5 n5 Y1 X6 h - #include <linux/mm.h>4 K3 X0 v: u4 w8 B$ F. n) x
- #include <linux/dma-mapping.h>! \/ g# ?8 L' b7 t" m3 W& D
! n! X/ {3 H4 f j- #include <mach/memory.h>
1 r) K8 t& J2 T- \7 L - #include <mach/hardware.h>
% J I. ]1 s4 U% E' g! U5 \ - #include <mach/irqs.h>
% w6 u: e* r( V" f M: r3 s - #include <asm/hardware/edma.h>
: T; Q/ f9 g$ U' Y9 U9 r
; z7 b$ [" P) m7 L6 i0 c6 E8 A' b& P4 x( O- #undef EDMA3_DEBUG
& s: N. Q4 g u4 C6 X* A: V+ V - /*#define EDMA3_DEBUG*/
2 v! n' Z" D. F5 p) h) b4 n& Z - ; B: K, Z" C; I* ~- m2 ~( E
- #ifdef EDMA3_DEBUG+ N! R5 F! N" W9 V5 _4 o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& c: B# ]( A! p# Y' n! s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 j5 i* L& j0 ]# `- n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 R2 E, r2 D- u/ l) p& A- A - #else
9 e3 h2 u& D2 u8 X6 N/ z - #define DMA_PRINTK( x... )
& I9 T. S7 }3 K7 N; Y, H0 g - #define DMA_FN_IN4 v! h: T( U: H, F
- #define DMA_FN_OUT
9 G: u, ]+ m) u6 L6 A* R- Z - #endif* C$ U3 Z% b, i4 U
- ( T! d7 R/ I0 t( e( k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% M$ a, Y6 a& m' T/ T+ T* s2 g9 r
- #define STATIC_SHIFT 3* d3 w3 f* D+ l4 g3 v' a* _
- #define TCINTEN_SHIFT 20
5 B" p4 D. Z& S! p/ s - #define ITCINTEN_SHIFT 21. C; i7 P/ c) v2 @5 m
- #define TCCHEN_SHIFT 22
2 v" N" B6 r M: W - #define ITCCHEN_SHIFT 239 S- d. Y& P' ]* ^( L' n
, S* @3 ?; W6 L( p9 l- static volatile int irqraised1 = 0;
6 `8 F9 }. v. b/ T$ [ - static volatile int irqraised2 = 0;
, S7 R* N+ j6 I. D! r
' T% A& O( ^+ r$ @: S% s. X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 P& F4 C4 f; Y* d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
[4 Q8 w: o* f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; h, s8 |8 K. Y: P4 M, n' Y" c
- 2 @; k6 D! I1 m/ V
- dma_addr_t dmaphyssrc1 = 0;
+ A' t2 Z7 f7 s! o* r: h8 G1 x - dma_addr_t dmaphyssrc2 = 0;
5 `+ S0 r+ l% D6 a( D( c" M - dma_addr_t dmaphysdest1 = 0;( ] H/ q: y; L* Z
- dma_addr_t dmaphysdest2 = 0;
& D4 U3 M) A1 u% ~- w
9 j8 `4 U* e m# G: K$ ?- char *dmabufsrc1 = NULL;* ]+ r) @- ?4 q8 \
- char *dmabufsrc2 = NULL;. i1 P" A C6 @5 u/ M
- char *dmabufdest1 = NULL;1 @' o* |' B# k) ~
- char *dmabufdest2 = NULL;
1 t* D4 o; M8 X$ O; o
1 x8 a! S2 n2 Z2 ^- static int acnt = 512;7 G6 o$ y" S3 z$ b! Y" T
- static int bcnt = 8;$ d2 r9 K! j& V3 ?5 h9 S: }( r
- static int ccnt = 8;
' S5 X* k# m. y, E h( \* z i
3 f' z) k' A& @' i$ S7 Q, _- module_param(acnt, int, S_IRUGO);
, x- v/ Z2 e/ ~* p- L4 q! T/ i; v - module_param(bcnt, int, S_IRUGO); R& H# ]. J1 Z2 ^9 U7 y* a2 F
- module_param(ccnt, int, S_IRUGO);
复制代码 / A: c+ Y: s. a1 N$ J
2 i. `9 d. n: r( Z( A. b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; d, \$ P+ J) r4 s! X" k2 e0 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 S' x/ y5 ]. j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& P- i3 g6 x @8 P! m9 Q
( A' |- t" Y, o
' {; s3 X: f! k& N/ v; ` |
|