|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, H- j, B; A: R8 h2 E J- [code]EDMA sample test application# U; f8 s0 o' y
- /*
% j! J0 P2 o( q/ K* |& G1 C - * edma_test.c; n% r J% U1 @8 a; h0 [+ \3 p
- *9 n9 Z% x" y z2 F0 C
- * brief EDMA3 Test Application# K) K4 e0 c3 Z+ L
- *
( q8 G7 ^3 S$ F5 A w$ x7 U! f3 e* v - * This file contains EDMA3 Test code.
8 \8 d; f, B' V2 p( O7 H% q/ Q1 D - *, W* Q6 s2 V7 I% k! J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ \! S2 |! ?+ |( Y, P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* v4 P8 ~6 C, M4 ]! Y/ r2 B
- * TO CHANGE.
/ u$ ]0 k% @0 Y- S0 b - *
3 C" Z6 Q% _, O4 U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ q$ p" z V% V/ \
- *0 g' b* l. g+ Y% H4 h9 S5 d
- * This program is free software; you can redistribute it and/or, B9 y- P& `4 I/ I$ w8 F
- * modify it under the terms of the GNU General Public License as0 ?- W! l4 t" F6 H4 f( @
- * published by the Free Software Foundation version 2.
; f t6 o6 e3 w2 r - *
7 l+ g- D' a1 x! h: y" l# X ?, a2 Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 d$ h- p7 {- V8 }; i
- * kind, whether express or implied; without even the implied warranty' z% p; X9 W: f, r# y8 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& w7 A( ~& n1 B& n& C4 X
- * GNU General Public License for more details.
B* Z1 p$ q# ^/ Y$ O4 t, ?( c3 P - *// v( f* P( Y2 S) }% [' V
- % E. R7 a- v( I& X1 k/ v2 r6 l0 U
- #include <linux/module.h>
6 b: @/ a# {8 s% d - #include <linux/init.h>
* i' k: G0 n9 @3 D, j - #include <linux/errno.h>( [$ h. h* m7 l1 y) S* E
- #include <linux/types.h>, g, c- d% O. i2 q P
- #include <linux/interrupt.h>
/ _! ]2 Z' Q% l S - #include <asm/io.h>
. `' r( [9 Q! t2 F1 q - #include <linux/moduleparam.h>
2 y2 N1 T" x) G8 P! Q0 v - #include <linux/sysctl.h>
- V/ M; f9 X5 Q- I, [- T - #include <linux/mm.h>! k" V6 E F, _ ?1 t
- #include <linux/dma-mapping.h>
- V: o! X( ]# a" Q
% E4 d- r9 b! i- h& @7 A- #include <mach/memory.h>
8 y+ Z( Q/ ?( h; k# I3 L; I; c' O - #include <mach/hardware.h>
5 p) k* a! L5 R# L6 X$ m - #include <mach/irqs.h>% {9 e5 q# ^6 J
- #include <asm/hardware/edma.h>
3 V! F! `; c2 ~
5 z: L {+ Q: s4 U) X& [/ a- #undef EDMA3_DEBUG
. I* r4 O5 \6 l( j7 D! q- j - /*#define EDMA3_DEBUG*/- E6 B* c/ g5 }2 m9 c6 m+ e+ t
+ j# v- o1 _" T+ |% q, h- #ifdef EDMA3_DEBUG) J/ K7 Z# Y8 b0 Z8 ~3 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- E5 R7 B+ V8 h: M" o: f5 W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& l0 w% z, Z, h) R0 W. k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& I$ N6 C! O6 E7 i7 M$ g' ^+ O; y
- #else
! ~3 O* |0 e4 `4 O ~4 p8 U6 i - #define DMA_PRINTK( x... )
0 a0 i% @, x) N - #define DMA_FN_IN
- |, Y. R2 ~. w0 Y: _; H I$ j - #define DMA_FN_OUT4 m4 E; c* t X' ^- {" K" W6 X% ]
- #endif, N+ z2 p/ `% z6 k5 Y! R
- ; B* c4 B4 o9 G; @5 N/ I4 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); a8 Y, u; }, {8 {4 l+ t% H+ q1 y
- #define STATIC_SHIFT 3( x' Z2 y5 L3 d
- #define TCINTEN_SHIFT 206 w. ?) r* T: E# ] U4 V5 e
- #define ITCINTEN_SHIFT 210 |4 o+ J+ ^& \1 U( J
- #define TCCHEN_SHIFT 22
2 l/ X! |! G' R" W( M/ k. A - #define ITCCHEN_SHIFT 23
: Z0 F; r1 o& k3 Q
4 Q- U& _: A& ^& N. J! x- static volatile int irqraised1 = 0;2 J7 @/ r5 E* {& [1 H& V" T9 T
- static volatile int irqraised2 = 0;
5 A2 q5 z0 V5 Z/ M4 I - " [' w; @6 ?2 L- Y, Q. w4 P* ?$ m! P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 g4 b# D) }# E9 R6 { p) X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 I ]8 h! r0 H/ Q& z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 z; L+ n: J0 J0 X! A9 Z
* G% f8 E# `' `9 X7 X4 g* G& R- dma_addr_t dmaphyssrc1 = 0; N* w( x* d' d1 y; }8 a, y
- dma_addr_t dmaphyssrc2 = 0;
) O6 K9 m: x, R5 s9 y: S - dma_addr_t dmaphysdest1 = 0;
1 J1 v3 O1 m1 ^' s* P - dma_addr_t dmaphysdest2 = 0;
* W+ f1 D& k, [3 ] - + y& J; R$ B% M D3 {0 Z
- char *dmabufsrc1 = NULL;
) W- W) V0 @; x - char *dmabufsrc2 = NULL;
# h5 J7 U0 m* p' `/ T" A - char *dmabufdest1 = NULL;
+ [$ s' w2 [) {5 I1 I0 _; D3 ` - char *dmabufdest2 = NULL;, \/ i O0 W" u
t( H/ o f0 }! k! c% m1 e- static int acnt = 512;* n) d6 t' |, W8 _: h" q- [4 t2 g) H
- static int bcnt = 8; B5 N6 L$ `' q, i# E
- static int ccnt = 8;- t/ l* E, W0 H( n- W+ g" M* Z! h
" U C1 N' m& t1 D3 y: o6 R- module_param(acnt, int, S_IRUGO);
g3 i5 ]. Z2 A - module_param(bcnt, int, S_IRUGO);6 q6 `, n" A' B% }
- module_param(ccnt, int, S_IRUGO);
复制代码 1 f y" b+ ]7 s: z0 P
" j* i. T" H1 O: |) r7 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 v* F+ c" U# e! ~* T" \/ V9 }$ I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 D0 F! r/ C6 U; L/ { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; m- T. e1 i& Z
$ U7 K# ^$ F! Y9 e- d* l
' E( m& h2 @* X1 t" j |
|