|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , k9 ]2 M4 V& v) V
- [code]EDMA sample test application% Q( {" P1 L& E7 O( v, d4 i" w- H
- /*5 O0 ]+ j# W. \5 G
- * edma_test.c
9 a" l) k! N7 R2 q' q% g - *" x, R9 _8 e: f! Z
- * brief EDMA3 Test Application4 s( ?' z* m8 x _% a( ~
- *
7 J1 ]9 r6 `3 g ]) R - * This file contains EDMA3 Test code.
% g. ^: W0 U7 y1 T& r - *
2 p9 B$ f7 Q' S. {1 ~5 ^8 D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; d" j2 }; G( z# j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT h2 E, g9 B( P( E( B: m% }& C1 @9 {9 Y
- * TO CHANGE.
( r9 {' o3 Z/ z7 ^7 W$ D9 ~ - *
% m( z: I6 \4 d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 I6 Q8 V% G* D( C9 T& \' e7 X
- *) g! O. _; L/ P8 O1 q: ^
- * This program is free software; you can redistribute it and/or( ?# h% `5 ^/ U6 Y/ l
- * modify it under the terms of the GNU General Public License as
% `3 x, r6 e) M - * published by the Free Software Foundation version 2.
# Y! t0 @ _* f5 G - *
: G, D/ H) j9 A6 X% U. w+ M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; U% ~ C: `3 R- b( g - * kind, whether express or implied; without even the implied warranty
) u' w$ A/ V! @5 o4 Z/ y3 r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ p5 `6 p4 P R$ d4 @
- * GNU General Public License for more details.( X# G+ v6 C/ \( l, h
- */
" j# _" J; u3 L4 Q
E g8 m8 ]% c) L4 j+ f- #include <linux/module.h>
, Z. P9 R, g- Z- s% N" z: E7 N( R - #include <linux/init.h>0 x, ^: m' E2 z5 ?
- #include <linux/errno.h>
1 A4 n6 |; @- \. P) l, s# D - #include <linux/types.h>
?2 p; Z2 ]( c2 e) [ - #include <linux/interrupt.h>) |! T" E+ I. B7 L3 P2 J
- #include <asm/io.h>
( e8 c' Y( @' C; }& B0 p1 R8 X - #include <linux/moduleparam.h>: j1 B; U1 Q0 Y I5 D0 K9 m
- #include <linux/sysctl.h>
5 ], M3 H! ?) S - #include <linux/mm.h>: [* g U% A3 d! I; m
- #include <linux/dma-mapping.h>
' H; R2 c+ b% Q0 D; y! g
4 p) G4 z2 g" B- #include <mach/memory.h>
9 K3 M3 N% V# U/ w$ i$ } - #include <mach/hardware.h>
a8 p T: ^) e0 e$ H0 l' E4 f - #include <mach/irqs.h>9 U! m( f) X2 ~ N
- #include <asm/hardware/edma.h>; N% `, Z6 W6 v4 Z+ p6 ?. g
# @- @# M: b$ G- #undef EDMA3_DEBUG
! O) Y5 E' Y' e( W8 B& Z - /*#define EDMA3_DEBUG*/
8 f6 l5 L: |8 r, u$ B
, w' h, Y; t- H l- #ifdef EDMA3_DEBUG
( l* r" l% Z( F2 ]2 ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) e2 A4 e' b! r( G9 D+ |9 H3 z4 o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ A1 @: M0 r9 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 V( o( ~" U: k7 t2 k9 N: h: M
- #else
. D5 |& @& n$ n - #define DMA_PRINTK( x... )
4 z9 ~* ^7 V# o) v9 h& ^, \ - #define DMA_FN_IN
) W; t3 w0 ~. e9 \ - #define DMA_FN_OUT0 K4 q/ d- |6 z% K( g( C# x9 v) G; u
- #endif; o/ X9 P- h8 ?
- 9 n# X2 `2 b: L- X1 k; q+ g( c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 W6 r3 Y5 Z5 r( G3 F - #define STATIC_SHIFT 36 V/ f: [ @: l6 y( l2 t# X8 q7 [
- #define TCINTEN_SHIFT 20. {7 h! P1 c6 D9 w$ o* D8 d- W
- #define ITCINTEN_SHIFT 21
7 s2 L: z: T9 P `. I5 l - #define TCCHEN_SHIFT 22
* z/ P) x1 x: @8 {4 w' G/ H) _! r" L - #define ITCCHEN_SHIFT 23
* [$ m v9 R" I: K; f# v! H - 2 v. u- h2 N% i
- static volatile int irqraised1 = 0;8 p- i W0 y# R# v1 V7 U
- static volatile int irqraised2 = 0;
. ]% w' ?' f& z" _3 H! C - " f; ]6 I" `% e9 e8 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 r, z a* Z' c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" |* k& r4 P" F% {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- C7 {. }! r+ |! Y% w7 k2 Q
- R4 f3 @4 j1 e& Q2 B& v: i4 r
- dma_addr_t dmaphyssrc1 = 0;( a6 h, j; A1 ~/ |9 A2 J; J8 o( \
- dma_addr_t dmaphyssrc2 = 0;" o6 P3 |3 e# }
- dma_addr_t dmaphysdest1 = 0;
1 r% o1 c" h9 {- H3 R) ^) N+ V) n - dma_addr_t dmaphysdest2 = 0;
* e5 w& ?4 j/ k4 ]# P
# w% O) |, ]! s( g* _ N' L- char *dmabufsrc1 = NULL;
$ b. z! I( T8 I- Y' z5 B2 l - char *dmabufsrc2 = NULL;8 h, W& S! X6 t; r1 ]: ]$ t
- char *dmabufdest1 = NULL;* }. s: X$ d9 o6 ?$ y. T
- char *dmabufdest2 = NULL;
# ~# b) V$ R/ T0 g; v+ a+ E - - G5 q* I2 f: u# h- i
- static int acnt = 512;
: E( c/ r( {& ~. w* W% b$ L& R. V - static int bcnt = 8;
+ W9 k0 x; }0 P r: u5 J( y6 | - static int ccnt = 8;0 ^" w! x2 V' p) j. }2 Q( A
+ m5 u8 }7 X6 ^% o3 Y/ I, ]- module_param(acnt, int, S_IRUGO);1 p/ U1 {8 W3 e* N5 A) ?8 H% d
- module_param(bcnt, int, S_IRUGO);
& u- N* O5 A1 N - module_param(ccnt, int, S_IRUGO);
复制代码 6 x' e5 L' g2 q* Y( m1 j2 ~
# X8 O Z( @" u4 Z7 V0 j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ f( x; w4 _1 [% g/ V* Y5 o" Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) p' [. N8 p' L0 W8 H# O3 A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: C( v+ R5 j: ~2 B! P; H( I8 G! k8 o1 J1 t+ D" S' r% W
6 a" a" a$ N9 {5 O7 i$ i' i5 [
|
|