|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 B; C2 a5 P: t5 G% M' c. i# J
- [code]EDMA sample test application
- H& `9 o) Q+ X - /*
6 f" F3 Z8 x1 G: T5 b - * edma_test.c
3 w6 P w. }" M& W, \4 q0 W! ~ - *6 Y3 j/ H6 a/ v. T' H- u* C8 ^
- * brief EDMA3 Test Application. r; I" p/ d* p) s2 V
- *
2 s% t# l$ O4 d% v& H) R - * This file contains EDMA3 Test code.+ y2 d0 s4 [) n/ g) i) V2 ~! M; J$ U
- *
4 m Q) w& O4 U9 l) R$ L% A$ w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% q/ W1 M2 `: t. Q) o) V; ^ j1 n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) B% V( R; p$ d2 q5 H
- * TO CHANGE.4 b5 Q0 J- Z7 \
- *1 `# F' Q5 T _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& m1 X7 m1 {9 @+ U" u! b - *
4 D/ q P/ \: p3 R+ P9 ] - * This program is free software; you can redistribute it and/or* F) t3 |+ L, y# U% {
- * modify it under the terms of the GNU General Public License as
1 X4 y R4 o" s& I! N - * published by the Free Software Foundation version 2.4 S% |! q5 B- ^
- *
! Q9 }/ x! ^: c1 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 Q8 F( j. y0 C2 Z9 [( g6 W6 Q& \ - * kind, whether express or implied; without even the implied warranty+ ]2 A+ h* ~9 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: n r; L; [! ~; h2 {/ h
- * GNU General Public License for more details.
3 i9 B5 ?: i S4 b - */: @$ M4 b, E* r. t2 D; R3 p
. N. Q: C. g* k: M( z# v- #include <linux/module.h>/ V, q# E r( ^9 M! S- j' n
- #include <linux/init.h>) z$ b+ ?0 p. p. |. U& m) o2 {
- #include <linux/errno.h>
( a% X# X! J* P/ g1 k - #include <linux/types.h>
2 o* \0 {8 a2 m1 c( Z4 ? - #include <linux/interrupt.h>: m' o, f& U" B# O! n, O0 R7 }
- #include <asm/io.h>5 l' S- ?7 H3 r. w l
- #include <linux/moduleparam.h>
$ A& ~3 f F2 J, w* S' a+ ^ - #include <linux/sysctl.h>
; i8 @& _9 l- N& x) U& b/ Q' @ - #include <linux/mm.h>
8 o5 s0 d% T Y! I( ~) A0 c6 s - #include <linux/dma-mapping.h>& n/ a( b8 U5 S1 [/ _
8 v @; R9 l) D- #include <mach/memory.h>0 k9 Z* |6 K3 m: f1 r" I( x, q; ~1 G
- #include <mach/hardware.h>4 C# t5 o$ B6 b0 a& X8 p. f
- #include <mach/irqs.h>" g% s" e" n- f6 s4 l
- #include <asm/hardware/edma.h>
6 d. Z4 W/ k# [
1 Z0 v9 B$ A, ^2 A: ]% J4 d; |- #undef EDMA3_DEBUG) P/ {9 ~# H9 B3 k
- /*#define EDMA3_DEBUG*/4 k& L, b0 L! ^6 Y, V h
4 n' A' |7 d, P- #ifdef EDMA3_DEBUG* E) g& G( z9 e3 s0 ~) w/ J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), m9 a0 i0 Y9 K4 k( l( z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 F# F( l9 t# q. u$ p+ j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; G, H% W. t! N: S0 k - #else4 H4 g4 N& D+ l- g' |' H! a: A- Q
- #define DMA_PRINTK( x... )
5 I2 g* G4 f2 \! R- P - #define DMA_FN_IN& Z5 ]: F/ M, [1 O$ x5 H: j; W
- #define DMA_FN_OUT
2 G. O$ B, k3 e: e - #endif: r( x2 @9 f4 r0 m0 q) h$ C: H
- : B) E. G& O1 H+ S$ l. T3 R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# i* L( i/ V5 w$ A$ U3 d
- #define STATIC_SHIFT 3, O) {! ^( l2 {) `1 N% E
- #define TCINTEN_SHIFT 20
6 G, Z( @ p R8 { C& Q - #define ITCINTEN_SHIFT 21) y$ w+ ?/ \& r# G* e
- #define TCCHEN_SHIFT 22 D7 b& y: Y" K' f
- #define ITCCHEN_SHIFT 234 P/ c. [) J' N& ^- \2 g
- 3 g/ d! V# n5 [5 t6 S$ ^; G
- static volatile int irqraised1 = 0;
+ \5 t, l& R2 Z: c8 M - static volatile int irqraised2 = 0;
+ ^1 O9 [( V+ u; L- ?0 F, R3 a0 q - - p5 g" ?4 Z a9 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 _8 |) {9 K4 I+ F" B$ J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 q4 Z1 E- E. u/ q2 b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% _( O8 @5 w+ t - & c- l9 R2 t, x' e
- dma_addr_t dmaphyssrc1 = 0;
0 P. l2 l- Z$ Q, O& Y* ?: j2 X - dma_addr_t dmaphyssrc2 = 0;
1 ?! W, B! a r! V) ? - dma_addr_t dmaphysdest1 = 0;
8 w+ q6 p2 v4 S5 `8 U- w - dma_addr_t dmaphysdest2 = 0;
; A/ V- ^$ i8 c6 T* q - " ^+ Y( F! A% a# B# \' O
- char *dmabufsrc1 = NULL;
+ ?8 C( ^8 w. Z' h5 ` - char *dmabufsrc2 = NULL;
" `) n% D9 x- B - char *dmabufdest1 = NULL;
8 u5 L( c; i9 @- b9 n; k9 v - char *dmabufdest2 = NULL;* @ W& t! Q! b7 X/ t
- G; a' k. M* u- j W0 H- static int acnt = 512;; S5 R. ~; \+ G* ^$ V
- static int bcnt = 8;1 j H; q$ M2 Q: u
- static int ccnt = 8;0 k) D8 a$ `# @0 B8 J
- ' |" S/ s- K/ f# ?$ I
- module_param(acnt, int, S_IRUGO);& n9 G' f; f1 Q& o* [
- module_param(bcnt, int, S_IRUGO);8 F+ \* C. `: _. t3 ~
- module_param(ccnt, int, S_IRUGO);
复制代码 % v% ?- \% Q3 P% G
( d7 J5 z* M* K9 }6 ?' j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( M" d1 B6 e5 d z# ~ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 E5 ?, j& t9 L" h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, N4 b" J% z u2 n
# j0 W! ~; K: v- I7 r1 y6 O; `
9 \1 e+ q7 S3 H0 ] |
|