|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 f/ y2 E' N. M; L" S' K8 s- [code]EDMA sample test application
0 Q$ u$ v& a, l S1 t8 c - /*
! Y9 [ V; d; D - * edma_test.c; d4 m0 K0 P& M- {( K7 {$ h/ O
- *
9 \6 n5 X5 [4 Z2 w - * brief EDMA3 Test Application, B" s0 H: e( p' M. F' b: N
- *
$ Q9 @) s. [3 O' D: H - * This file contains EDMA3 Test code., c. V( H& m7 z% o5 _" m3 v, c
- *
; x7 t6 T$ o3 } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 M. T1 I! c/ L$ _' W, B7 x' s9 _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 I* z$ n' r. A5 e- E - * TO CHANGE.8 H( b, c- U/ ]7 ~9 |
- *
& z- H/ y4 g7 N$ [. N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. i7 B1 f0 K2 B* i. U$ S' X
- *2 T' V9 f+ }9 ?7 @/ x* a* n; C
- * This program is free software; you can redistribute it and/or
+ o" ]* }+ B3 z, X+ g- K5 K* }% i - * modify it under the terms of the GNU General Public License as$ y1 I- S9 C# r
- * published by the Free Software Foundation version 2.
+ l' _) c5 @# I) G" s - *7 H0 N- N% c3 x/ L1 y) o/ h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% D+ T, B$ i3 F. [1 d - * kind, whether express or implied; without even the implied warranty, Q/ V! {$ ^) c$ n' o* s: Z( J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% m" M9 A! {0 |* D8 J: \) {$ }
- * GNU General Public License for more details.
, W) ^& `% ~/ J! G4 U8 O - */
2 J" D6 a9 [' S+ N+ d P6 q - ; P7 ^7 M9 l2 w @/ ]% N( Y) w% w5 ?
- #include <linux/module.h>
6 S% p1 `- C! M, p& S4 m; b; f - #include <linux/init.h>
) A1 u+ K: z* K, F0 u% {, S8 c - #include <linux/errno.h>
9 d1 ?2 u* d T! ^) R, o6 R - #include <linux/types.h>
- ?- P2 h+ x% N6 u- } - #include <linux/interrupt.h>
: e. H/ T# A) y$ \. y - #include <asm/io.h>
9 B' M- A& V+ Q0 K7 S/ E- E - #include <linux/moduleparam.h>
$ X, s8 P! ~: h5 @' Q- I - #include <linux/sysctl.h>
6 S8 _/ k9 u5 ]3 k - #include <linux/mm.h>4 F( z3 z2 p5 w: P6 w7 I
- #include <linux/dma-mapping.h>0 U9 E" c' P; W# `& ^) k; S) ~
1 y1 w/ L4 A* {/ h; ^- #include <mach/memory.h>7 C; M O3 o0 x8 T
- #include <mach/hardware.h>2 j. s$ t" N5 H
- #include <mach/irqs.h>+ N% Y K! F7 B) r# V6 m2 J
- #include <asm/hardware/edma.h>
a* H4 L, s. v - 4 @" _" O8 W- X) l- x0 D0 G/ s+ v
- #undef EDMA3_DEBUG
9 k" y4 l( V3 Z - /*#define EDMA3_DEBUG*/; ~0 T: v' }! D' t2 H9 s* f
% `/ k# j! N' [8 t c& E( T- #ifdef EDMA3_DEBUG! P. U; d( ~" |1 l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 G9 }$ `+ N6 I( F3 W* W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: A4 @8 M4 S- ^6 {, N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 r4 ^& t# ^+ d" I X! |* H! k0 { - #else
- b$ ]8 X6 B+ S ^. }0 k - #define DMA_PRINTK( x... )
; O v. _4 L* r6 d. O2 r7 d- t - #define DMA_FN_IN
: s. ?/ A7 ?* ^ - #define DMA_FN_OUT9 ^" C- H, p: p6 G5 @/ V# A
- #endif
1 f* m2 K9 i" ?
' I4 R. A K; f: y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' L8 ?& H' X- G5 r$ ] - #define STATIC_SHIFT 3. V/ ^: g% p( }7 q" q; x! v8 L
- #define TCINTEN_SHIFT 20
) w& o: ?0 p: G8 R2 T - #define ITCINTEN_SHIFT 216 L; G; s9 Z! {1 ~$ F
- #define TCCHEN_SHIFT 22
% C) e% q1 f8 V6 } - #define ITCCHEN_SHIFT 23# q8 m2 f m* X6 G4 ~$ M0 L4 |
8 \, l) f: d7 M7 O, r- static volatile int irqraised1 = 0;
6 n& y8 {' C& p - static volatile int irqraised2 = 0;3 [1 h, ~# ?* _2 Q. O
* w2 U# O. o5 M8 h6 X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% `! X& L3 @, O# C/ M. N6 Q& ~) D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 _: m* d: g7 _6 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ A i* G8 ^% E - 0 H$ O, z4 G `' e
- dma_addr_t dmaphyssrc1 = 0;1 U d3 b" S' Z9 [6 w) E
- dma_addr_t dmaphyssrc2 = 0;) R0 Q9 H6 b; s2 O/ p4 P. L
- dma_addr_t dmaphysdest1 = 0;8 J8 a, @4 U0 g* T, {1 @4 |: t3 r
- dma_addr_t dmaphysdest2 = 0;
3 z! U) T3 h5 v) \
1 _7 H6 @9 H% p5 W( p1 `3 s- char *dmabufsrc1 = NULL;
( @9 Q/ m5 A; A5 S5 f# t/ d - char *dmabufsrc2 = NULL; r- Z, h+ b5 f1 E# V
- char *dmabufdest1 = NULL;) H1 R- H7 v. l" m# b- B2 j
- char *dmabufdest2 = NULL;
7 R; l' n* C. a* D! ~ - / E8 }& b& S3 O6 M" i2 M
- static int acnt = 512;. C9 r1 @( y3 U, p8 i
- static int bcnt = 8;+ h6 a6 [" c4 o6 ~
- static int ccnt = 8;
3 O2 }, Y6 V! L/ U+ T$ F; B, P
X: i+ c6 X0 x% Y- module_param(acnt, int, S_IRUGO);
; N+ i3 e: j0 X0 _3 m/ Y& L" u - module_param(bcnt, int, S_IRUGO);
0 y% p$ @4 X6 U - module_param(ccnt, int, S_IRUGO);
复制代码 ; ^% r2 p4 I. I# T' v
! x' M* l9 o! I5 p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* I' w6 w q- r, warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 w1 x/ u. r$ Y$ H0 q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# [: F/ s6 o+ n
: M- k1 X4 R, Z, s& \; {
1 m) T* s8 h& I! M
|
|