|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% ]4 Q9 Q9 X8 @' _ O: |/ n- [code]EDMA sample test application( G1 R" h8 y9 E8 {) p+ L& z
- /*
]* Z! i: y8 y# D4 I" k7 ?& [ - * edma_test.c+ T; n+ G) V1 F9 O4 {" n2 {
- *, q9 k6 r4 C1 V! i9 K2 T
- * brief EDMA3 Test Application
* A% G) }3 ~* A8 F) d( P - *
: S1 O3 Y( [. W. I) @5 Q6 ] S$ V7 Z5 T - * This file contains EDMA3 Test code.
4 \. }7 I5 Z" w& m - *
" R: g) V/ w% B9 l: T. |8 S2 m6 G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% k L+ b7 p7 T, R( t( G5 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 ^5 I& a4 [" O2 s+ r- w7 M - * TO CHANGE.
" u( C, w2 T% s* l - *
' M. U* O8 i2 X$ h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 S; H' }: T0 R
- *
' U( e7 t) Z: Y! @9 ?+ }% `+ s - * This program is free software; you can redistribute it and/or
1 _$ {3 q6 s% `; a4 R$ D& ] - * modify it under the terms of the GNU General Public License as3 Y' A" u! m( k+ o2 ?! y ^
- * published by the Free Software Foundation version 2.+ K4 f# X7 s" B! B) u
- *
9 P% I0 M* a% C$ f3 N- A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( P+ }' U! W( `& U) }2 y* V
- * kind, whether express or implied; without even the implied warranty
% }$ P( r, y+ P. G9 B- U" l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ F& C) Z+ j: [: E - * GNU General Public License for more details.4 C. `2 W8 q( k7 v! k
- */
& Z# d" P" \/ |) N - 2 X+ [1 m+ o1 S5 K9 J3 T! e
- #include <linux/module.h>
; W: P _5 f1 q0 h, p7 { - #include <linux/init.h>
9 K+ M4 F4 n5 B: R8 q( }; @/ Y/ y - #include <linux/errno.h>" y* ~) p7 n. A0 l" I8 |0 b) l3 u
- #include <linux/types.h>
" j9 k4 l" I) d7 O - #include <linux/interrupt.h>
6 C0 D+ I0 w( q% c4 X - #include <asm/io.h>
. K" I3 `8 {' e/ \ - #include <linux/moduleparam.h>5 d# e9 ?+ C& F3 ~
- #include <linux/sysctl.h>
6 \' T5 S3 c: z5 ^ - #include <linux/mm.h>2 H# a7 r. [9 D- ~
- #include <linux/dma-mapping.h>) R; c' E' x$ W. i; U; f
& d- g" `6 G' } V- #include <mach/memory.h>$ c5 v7 O) S: h$ i4 i
- #include <mach/hardware.h>
1 z( Z0 X0 U7 G: B) }' V - #include <mach/irqs.h>
* Y/ B1 g* w* R/ \! v - #include <asm/hardware/edma.h>; l9 U7 v( o" b7 A5 Y
- # S7 n1 ~# N# I1 h; x
- #undef EDMA3_DEBUG
' i. p0 B: c# O! C4 S' W - /*#define EDMA3_DEBUG*/
6 `, u1 a) f: p9 N# L - 5 L6 _, V0 b1 n) m
- #ifdef EDMA3_DEBUG
. `8 \8 \$ Y4 ^& z$ f* x* R4 |! k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( o/ s' z/ W6 k. A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 v# E' X5 ]1 f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 y7 }3 v# E0 q; [. C+ W/ ] u - #else
( k$ \3 B0 m2 N$ M0 R - #define DMA_PRINTK( x... )9 r9 g* n& J1 S3 G- x
- #define DMA_FN_IN! E5 V+ |+ g2 ]6 f# W
- #define DMA_FN_OUT
& h. p* B8 ?6 i. g - #endif
2 F& g x, ]* k Y/ \- h - ( W( i& T; _# `' c3 W# b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& D4 D: p: M4 E! m6 x
- #define STATIC_SHIFT 3- ^% P$ O; S8 g9 d' u# X
- #define TCINTEN_SHIFT 209 R+ [1 d1 y; S$ q
- #define ITCINTEN_SHIFT 21* e+ K6 L* l7 G, S! c) K7 n
- #define TCCHEN_SHIFT 22
' A- c1 L0 B# W - #define ITCCHEN_SHIFT 230 z \0 A8 ^6 l
- 3 g% [; I6 B( s$ F$ t2 k: b& e
- static volatile int irqraised1 = 0;
; X' ?, T0 e/ A% K - static volatile int irqraised2 = 0;
: X$ e' P9 s( o" N' `( i
6 l( D* v. K/ c0 b+ S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) q0 }& m- q) v/ a1 A+ C2 I h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 _4 j1 }- F4 h7 p U* J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ {2 U$ l( ~" f( {: k+ R
- ' k' p1 r9 q+ H" p/ g" t
- dma_addr_t dmaphyssrc1 = 0;
- v& C% G4 y, d4 X8 N1 Z - dma_addr_t dmaphyssrc2 = 0;) ~0 Z/ k9 {* Q! C+ m; O
- dma_addr_t dmaphysdest1 = 0;
. M5 b; b* c1 k, a& T5 w - dma_addr_t dmaphysdest2 = 0;0 o" h5 ?3 q8 j. o- A9 h
- 2 o8 a8 j* r% [3 C/ _/ D8 r
- char *dmabufsrc1 = NULL;
4 g6 _. p& w% A1 }4 t - char *dmabufsrc2 = NULL;
0 [% w" c5 z+ u7 g- x, W8 ]1 s* o - char *dmabufdest1 = NULL;
6 [9 B! u4 F) ^2 e5 m' z4 A - char *dmabufdest2 = NULL;3 U. K3 m* z5 d( M; n, d- U6 V
- 7 T; m9 C& b/ T) T |- P
- static int acnt = 512;
0 f- |$ e% }( m5 j - static int bcnt = 8;
- o0 a( {2 T( t - static int ccnt = 8;
; q1 D* Y5 o* T! X7 N - + D' t* j( O7 M) Z
- module_param(acnt, int, S_IRUGO);
+ F" ?$ M) t4 I5 T( f3 K- W9 K - module_param(bcnt, int, S_IRUGO);& S: _" s. \- r. N8 g# Y) H5 ^" I
- module_param(ccnt, int, S_IRUGO);
复制代码
2 u; G, l5 `* |$ g% c1 k- I) x d& C/ j6 z: J/ M+ p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) g; X8 |4 w( }" w/ Q# K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ ^% g- x. g: l C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) p- d" L. p% o2 X8 W9 ]/ Z
% R) {6 N* I# p6 g" X% ^8 @9 B: N7 ^* K7 k9 p
|
|