|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 d3 ^* M. L9 r/ O6 @
- [code]EDMA sample test application
1 w* K& ^/ ~* \5 w& b - /*
8 M! {7 g8 b6 c" C7 y; D F - * edma_test.c
5 p+ b- n# p$ d7 b6 f0 k: S+ p - *
6 B8 V% G$ b4 b: }0 B - * brief EDMA3 Test Application
^- S* i/ h( G1 W7 u$ J - *+ F' ]. L0 G5 N0 h4 W1 ]
- * This file contains EDMA3 Test code.8 k7 W% Q- l- b# l3 t3 D# U
- *
% T6 H# l7 O* p" B y {6 U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! \5 A2 H. W' P5 r" `5 }8 o' t, f {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* q% I) C. |+ B# ]
- * TO CHANGE.: |- N/ V9 i9 x: u3 w, l
- *3 a/ M) ^$ U3 i" p0 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 i* Q% _; @0 v2 B6 @9 J - *
, h9 d( ]1 [. g/ g( Y* }( H" t1 S, @ - * This program is free software; you can redistribute it and/or4 }! `3 ]" @5 v. z% }0 t7 f( q
- * modify it under the terms of the GNU General Public License as/ W, I" p. Z1 a( k" ^8 P F
- * published by the Free Software Foundation version 2.
0 ~0 h8 x- `1 f4 m- K/ C- e4 | - *
1 Q D. C# V/ c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& L, ~' ]% q) ? {0 A - * kind, whether express or implied; without even the implied warranty
2 \3 i+ R# X8 X% c% V% a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( b. @0 C! k. Q d4 G: E8 U4 ? - * GNU General Public License for more details.$ q6 Q; T, `& s ]
- */) }; N3 q* m1 z, T& |6 u
k( o# N- `# V; J/ _- #include <linux/module.h>, D4 Y5 Y% W3 p% N7 @2 t/ J
- #include <linux/init.h>' [5 \3 ^3 ~+ B4 a! s
- #include <linux/errno.h>
9 j% S9 \0 g% A. `9 [0 n - #include <linux/types.h>
" s2 U1 I1 `$ P) y* e0 a/ f - #include <linux/interrupt.h>! n* ]) Z) U( t0 V/ D2 l+ M* |+ ?! c
- #include <asm/io.h>
9 W" T+ i. U' @- z$ R) C - #include <linux/moduleparam.h>- [) o9 U$ J0 c7 R* R! {1 e0 ^
- #include <linux/sysctl.h>
# k8 _3 w8 J7 X8 a1 U: j - #include <linux/mm.h>) J0 z6 x& V4 B% _* e
- #include <linux/dma-mapping.h>
1 o. [; Y& j& F - 6 z+ i6 s* x9 L5 }, }
- #include <mach/memory.h>! T8 q) k' O- q4 `* b% d6 X
- #include <mach/hardware.h>
% b; \* X# j& H2 P7 i/ D% L - #include <mach/irqs.h>; U6 Q1 V z, s L& `; c% u
- #include <asm/hardware/edma.h>+ C% v6 O5 r9 ~5 ^( {
- $ h" L p) r2 z+ A' Q/ j! j
- #undef EDMA3_DEBUG R( D' P7 X+ `3 `
- /*#define EDMA3_DEBUG*/# Q+ D' I: D: z( U6 {4 p4 o; k
/ H( @- Z# B+ v5 G, {, }- #ifdef EDMA3_DEBUG
& c/ [, X1 n+ D8 C& t' C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! K+ ^5 x5 F! j$ c: M6 h3 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
d2 Z& H1 y& u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; v( Q$ S' _" F - #else" v5 A: i& j! H5 J% y; O
- #define DMA_PRINTK( x... )% L" d3 G* Y* w7 Q, d2 h( ?: G* O
- #define DMA_FN_IN
! o9 s) Y; `& B - #define DMA_FN_OUT9 C3 M x2 B* ]- u1 }3 Q, }
- #endif9 j" |3 t. b6 l0 d
, i% H* Y; j& {) s3 d' H) `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& I( f" k7 T, Y5 y. E+ {1 q1 ^ o - #define STATIC_SHIFT 3
& G3 v8 ^7 ]+ N. N7 F8 @2 B/ r - #define TCINTEN_SHIFT 20
' Q9 D5 m3 A( C* Y D& ^ - #define ITCINTEN_SHIFT 21
5 z+ l7 j& q6 b) t6 [/ D; ~ C - #define TCCHEN_SHIFT 22
- x1 m3 Z/ z* _$ i1 N - #define ITCCHEN_SHIFT 23
7 a( [! \2 @& I7 `3 g3 l0 s* s - ' C; ?% O/ i: c% m
- static volatile int irqraised1 = 0;
- w6 v+ n. g. c- J Q - static volatile int irqraised2 = 0;
* K( B1 h. b( B$ x$ I - P: d4 c, T1 R' B8 \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% j2 f% v* M- k" X2 W# s2 D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 V' b3 m& E7 R( H: J6 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 C" j& t. O. U& H
- & S; ~2 f5 |$ i0 t2 q; [# a
- dma_addr_t dmaphyssrc1 = 0;. D) T6 I' M9 E+ i& j# z+ R
- dma_addr_t dmaphyssrc2 = 0;( j) g' o7 `$ @0 W( w
- dma_addr_t dmaphysdest1 = 0;- M+ z0 q* Z' U9 V& {
- dma_addr_t dmaphysdest2 = 0;' h3 ^" L7 L3 J2 t( S+ ]8 T
- ; h/ ^1 {) D# `/ _. ^5 V8 V
- char *dmabufsrc1 = NULL;9 i6 t7 w2 ^0 I8 r& `* I
- char *dmabufsrc2 = NULL;2 M& h, c4 X5 V, j" Q" E4 m2 f" F
- char *dmabufdest1 = NULL;
+ g8 i6 l$ O2 ^3 s2 _" o - char *dmabufdest2 = NULL;: ^! a9 ^$ D- N/ ]% N: a
# B" u) z3 ^7 N A# d U! o- static int acnt = 512;
$ E( {# E7 E& } - static int bcnt = 8;
& \' U3 i0 A; C( ]1 F - static int ccnt = 8;
* \3 t+ T% F* E, q7 J l
L; E; \ L1 V( ]$ U. v9 K( z* k# b- module_param(acnt, int, S_IRUGO);1 m4 i/ A2 {6 |8 S6 M: Q
- module_param(bcnt, int, S_IRUGO);
/ P* t7 ?: m8 i: Z9 n. T- a - module_param(ccnt, int, S_IRUGO);
复制代码
8 V' W* k0 u, _/ t4 y, v/ i& ~$ k( [, A* A3 W# q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! d0 {* h+ k8 _" ]8 `9 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 b1 E: o3 l5 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ Q' F- A) k* b% J/ l! r
( _+ y& j7 W, Z* s0 s9 {! }5 g3 ` N' U f
|
|