|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# C! U9 ^3 m: D1 z3 m- [code]EDMA sample test application$ ]7 ?! V$ O2 n7 c4 v! v$ _+ [# [+ i- m- b
- /*0 C4 u- C% H4 x$ @! V
- * edma_test.c5 O/ R% _+ J9 s; U+ W; Z
- *
" X s! Y7 F% X, h# u$ j. ] - * brief EDMA3 Test Application
I {" w$ ?) {7 w% d - *
" [: L" P4 a0 n1 R - * This file contains EDMA3 Test code.
3 w- l; T/ {' `* e" g, | - *5 q7 U3 I% q( ~ n% c3 Z: b: B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: s& }3 g) u+ R8 `9 o# m( e5 S+ }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) t* k3 c+ K0 h7 j- f1 e
- * TO CHANGE.6 U% I4 z* O) y3 Y) F$ X( {0 m
- *
" t" \- e2 h' t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. r6 a% P$ U) J0 _. C
- *
8 c8 N# S5 t$ I2 g# G! M - * This program is free software; you can redistribute it and/or
+ q) W. q# U1 W9 j6 V - * modify it under the terms of the GNU General Public License as& K/ s. D/ @7 m: m4 N2 v
- * published by the Free Software Foundation version 2.
3 Y6 f; B3 G+ R* d4 n( _ - *
# G& A6 r r0 a3 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! {. x+ u9 L. V6 ?9 ?8 U. R' I7 v1 ^
- * kind, whether express or implied; without even the implied warranty( \2 {- Z! R, K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ ~0 r& e& y7 u* V7 ?
- * GNU General Public License for more details.
; G- m, P. U: }# W( N - */" i( h5 g: q6 B. Y
- ) N7 `6 X& @5 U" I
- #include <linux/module.h>
% |* \. w; Y- P! i( I$ p; r1 @ - #include <linux/init.h>
; o" s7 L+ [7 g* U; |1 x5 M - #include <linux/errno.h>
$ z2 C. s, {; V - #include <linux/types.h>6 B% D% J6 |7 R( |6 A7 d/ J$ I# n
- #include <linux/interrupt.h>! L4 [1 V7 e1 v: i
- #include <asm/io.h>
- f5 Z; N8 s8 }! r5 o - #include <linux/moduleparam.h>) w) |2 ]% n0 m: {
- #include <linux/sysctl.h>
( d, R& _* c' O5 f - #include <linux/mm.h>& j" _1 y$ [, t6 S$ y1 N: u
- #include <linux/dma-mapping.h>
4 v! A; y4 {3 G - $ D8 V) @3 \" k: n; Z, s
- #include <mach/memory.h> a2 T/ p5 U( E5 k7 V2 t
- #include <mach/hardware.h>2 Y+ K4 z6 g+ t& ^) g4 Z( [4 z; a
- #include <mach/irqs.h>
7 j& z4 ?, s. O ^* L7 S* j. b - #include <asm/hardware/edma.h>2 b! M: Q4 g8 ~! P% |4 ~$ S" I. \
- . x4 \" T% H4 ~, l) s& Q% O
- #undef EDMA3_DEBUG
) V: \7 P- ], K2 f' D: l" o - /*#define EDMA3_DEBUG*/
r* C! b' g) v- ]2 z" Z - . k' A. n+ `, k% d
- #ifdef EDMA3_DEBUG$ g, S9 @* L; a6 J" F/ X* `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; k6 F+ a2 | ]0 ~7 c) D% V; I( c) S t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 o8 }$ R& T( M0 h8 W1 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 }% l- A: s$ E- c& @8 w% O - #else( ^* T x/ p0 J" }0 T2 z3 g
- #define DMA_PRINTK( x... )
* \0 D4 Y$ L# p7 }5 p - #define DMA_FN_IN
' t4 _$ P6 Q+ C" ? - #define DMA_FN_OUT9 W& }, p) ~, ^: N: i& z
- #endif
; E2 \7 I I: I5 Q: t- D% ?7 C
1 g! o0 A: ?+ S3 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 @" ?; l0 q3 K/ |% T6 z( D: T - #define STATIC_SHIFT 3; h. |+ s6 E: f. p' B4 Q
- #define TCINTEN_SHIFT 20: ^3 G' B1 {8 [/ Q! B
- #define ITCINTEN_SHIFT 21 ^1 c% Y5 k$ F: J* ?% U, D
- #define TCCHEN_SHIFT 22) L! w0 c, m0 g8 d6 X3 o
- #define ITCCHEN_SHIFT 23
0 j9 `0 z- F& F5 x9 D - ) Y6 Y9 p: Q1 ~" ~
- static volatile int irqraised1 = 0;
* A* O& F' j* i8 |) _ W" f. x/ | - static volatile int irqraised2 = 0;
' q6 b; v, h. T" r/ z - ; i# N! A. G- I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! f) k) I0 U# C7 x; M. g0 N: Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% K8 X' Z" m9 `$ n- a0 X0 s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- w( L {- L! Q& z0 G" L - ! U& l) Q4 j( j2 V/ I# ?1 z
- dma_addr_t dmaphyssrc1 = 0;, c& B1 d2 N: p ? {
- dma_addr_t dmaphyssrc2 = 0;/ d' y$ U- u7 L8 ~2 @: L/ g# R3 ]
- dma_addr_t dmaphysdest1 = 0;
+ n) a! N4 P# A, [, N; c - dma_addr_t dmaphysdest2 = 0;
; f( Y/ w! y( ~& r O B - e/ L$ T+ t) ~/ {
- char *dmabufsrc1 = NULL;
+ o0 i, q A2 ~) Z% L/ @ - char *dmabufsrc2 = NULL;, h, w. i; |0 d T2 u. k9 ~ ]
- char *dmabufdest1 = NULL;
: F6 G. i! f, D6 h/ \) j7 | - char *dmabufdest2 = NULL; L" L3 s( B8 |. t0 p5 T
; e+ T+ Q3 a1 s, k' V8 X- static int acnt = 512;% o6 p- C% Z* `
- static int bcnt = 8;) D m2 e; O3 w( g9 e+ J) o
- static int ccnt = 8;8 x- g+ ?# h/ Z0 z% f) d \) h0 A
- , C. o$ w8 B' @+ Y! ^
- module_param(acnt, int, S_IRUGO);
3 p' D4 Y/ A/ `# |$ U3 N - module_param(bcnt, int, S_IRUGO);0 H" ?3 S0 u3 b: y/ i) y
- module_param(ccnt, int, S_IRUGO);
复制代码
% s6 g- a+ H5 n9 K0 a
, G3 H- a7 J1 l5 d) c8 p) r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ?' o/ q! {$ [4 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ i2 \4 M h5 t' D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 l- H2 y" k' }- [& _
[7 k) F6 r* B7 \& b" W$ Z' @3 b1 d/ d- H* }
|
|