|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* o1 Q1 @5 s2 d: s% v$ N- [code]EDMA sample test application% @4 J% e( ~ u
- /*
$ |$ t/ @5 Z. k8 C4 B! O - * edma_test.c
9 d% l: t+ O0 G$ F2 |( \1 E - *" ?' n$ V2 d/ D& k) r
- * brief EDMA3 Test Application
+ I7 T( v- r K/ ? g5 t# k' k* P - *
8 x$ d; ~$ u. ]* k5 M - * This file contains EDMA3 Test code./ |3 U5 P, C5 ~: ~4 v$ v# m* f
- *
9 y# q* @0 m0 [9 U# p4 b% l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ {- x5 k/ [6 G; B1 ^$ h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% o( |7 H9 u: I6 l. J( @ - * TO CHANGE.
4 O2 I2 Y. z# J; Q6 k - *% W- ^) @$ w5 t0 z* T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% C) t/ \' @: [* X% g' u - *2 }; V8 {3 I7 N' P: \! j5 k6 A
- * This program is free software; you can redistribute it and/or
, S9 S$ i' y9 H1 F+ z3 u - * modify it under the terms of the GNU General Public License as
% T: x7 o# k+ z" Y" d! C( \ - * published by the Free Software Foundation version 2.
/ k( P- d, g$ { - *
( B2 i% a M* T5 a8 {+ ?9 h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- @* Q O7 ]7 C7 Q
- * kind, whether express or implied; without even the implied warranty3 P N9 C# {' R# A% Y- m* K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 L* Z7 v c+ |- c( l0 B - * GNU General Public License for more details.
! K: D- E4 Q" n - */* b% Y/ \' `6 X$ y/ e& e! u, [
- ) L7 J" j7 i# t) z9 o
- #include <linux/module.h>6 c3 F7 H2 ]; p& K, m+ J
- #include <linux/init.h>
/ |% \0 A$ t% l4 R7 R M - #include <linux/errno.h>
3 o4 E# l) o0 H2 s0 O1 o - #include <linux/types.h>: B7 K* z% q: |0 O$ s- [; w
- #include <linux/interrupt.h>2 h: e/ W) L2 T1 k, E) {' R) t0 c2 Q6 k
- #include <asm/io.h>$ |& _* C* F3 n$ U
- #include <linux/moduleparam.h>
6 q- u' V# `2 s9 i - #include <linux/sysctl.h> ]5 s6 W2 Q/ h
- #include <linux/mm.h>7 V" b" p( h; S2 d4 ?1 Z
- #include <linux/dma-mapping.h>
/ d1 ^* A u/ S( Z
; `' N* X, d: Y2 c/ Q- #include <mach/memory.h>
- Q% I! i1 }% j' B - #include <mach/hardware.h>
' X; ^: V1 r+ ?; Z! Z - #include <mach/irqs.h>
1 F3 M6 [3 ]% T4 P q - #include <asm/hardware/edma.h>
/ b$ _# w/ u' P - 2 }" ]. r! i9 W5 N U: [' a1 w
- #undef EDMA3_DEBUG
* f, k# D& W$ m% ?1 t% Z - /*#define EDMA3_DEBUG*/% l- T$ W& s+ O+ l0 w7 H( w) p3 D4 s
& r3 q/ M( N. X4 Q/ x, ~2 K- #ifdef EDMA3_DEBUG
3 {1 h/ ]! C- F5 L/ Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) D' E3 ?2 b: ?& c2 C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- X7 J( O9 U/ q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 P9 E, _- q7 X5 C% }0 d% B6 M% r
- #else: Q# q8 Z; a! E. y# Y7 Y# T
- #define DMA_PRINTK( x... )
1 } q1 ?7 j! o0 `. k3 o - #define DMA_FN_IN
: m6 ?& w9 c7 \0 o - #define DMA_FN_OUT- X* x( E: X# n" ]( P
- #endif
. c" g: `& k, F% ^4 @5 z4 v H
9 ~) l' G6 L* Z8 a& S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 y2 W4 I/ P) y9 r* T w. o! J- { - #define STATIC_SHIFT 3
- a8 G6 H' O9 o) o, B - #define TCINTEN_SHIFT 20* K( C+ N2 Q, e9 y( I6 n2 b
- #define ITCINTEN_SHIFT 21( U2 a @& t4 `! U1 b
- #define TCCHEN_SHIFT 22
7 t ~1 d8 j' g) u, {6 v' U - #define ITCCHEN_SHIFT 23
s; i& D( _1 A8 N! f6 W - * E( F; R N- m i
- static volatile int irqraised1 = 0;
; a- z* S) c- d/ C - static volatile int irqraised2 = 0;
" |0 b1 i8 g' k) ~7 w$ H& i& W2 i# H
% K- v) v& k8 S3 b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 S8 ~+ j7 r; C) I; J% K" ~8 K; o0 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ n: i/ z- \2 E2 T% y$ J9 r; Y' Y3 V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* O6 d+ C1 G4 @4 \: G7 h/ E$ O
. F0 W6 @. M) Q$ m- dma_addr_t dmaphyssrc1 = 0;
7 R* E5 }" ~" I, m. o - dma_addr_t dmaphyssrc2 = 0;
* J8 z$ W/ |# a% ~5 T, N - dma_addr_t dmaphysdest1 = 0;5 V5 r( g/ k; s# I6 G
- dma_addr_t dmaphysdest2 = 0;
* `+ Y0 P8 r; C+ J- u, \ - 1 j% t6 n1 K! U) r& C4 z
- char *dmabufsrc1 = NULL;
, {) W* r, y3 X - char *dmabufsrc2 = NULL;
' F" j, e' ^/ d& H - char *dmabufdest1 = NULL;
6 O q8 j) m9 L8 C! S6 g$ d - char *dmabufdest2 = NULL;# y1 L1 a# b1 u7 y
- ' `( |2 g+ q0 P. d3 U% g Q- Y
- static int acnt = 512;/ Z6 l3 d+ Z* L/ n: s! c# B
- static int bcnt = 8;
; Q' I( Q! m& c5 \7 `0 Q: b. [ - static int ccnt = 8;
" N4 p( y" L- t1 O
; @4 a( U# | ~$ O; D' s- module_param(acnt, int, S_IRUGO);! h8 c2 j) Z: x5 I; L$ d
- module_param(bcnt, int, S_IRUGO);) w9 W2 p( L) w; x9 N
- module_param(ccnt, int, S_IRUGO);
复制代码
8 A$ Z3 _* l+ G" g
- k N. z, B! A2 ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 G8 U: o* O0 p9 E% }, [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 I/ w3 Z& m: s4 `0 o* r. L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 C0 L& v% q. Q9 k/ K
& O: ]9 f7 R5 |& }2 |- m/ O( k7 p4 T" B& k+ M: i* A% j$ I
|
|