|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 b2 Q, K1 C- x
- [code]EDMA sample test application
! o m# V; R4 _1 g2 D% H - /*
8 @! d! F7 H$ i8 _/ Z: d; K - * edma_test.c
/ D7 M6 l7 |% x( V2 f2 A - *, @9 v6 ~+ K3 ]' Y
- * brief EDMA3 Test Application
, c+ }4 x' A. i# @ - *
5 Q. T6 M: y; q4 y5 H+ S - * This file contains EDMA3 Test code.( q8 v0 b: g" Q, ?" U! ?3 c
- *) v W. M8 x& h" `/ y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" p3 @0 F# B; e( W: Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 K: i1 \$ U, }8 t6 c9 D& ^
- * TO CHANGE.4 ~4 P/ L0 | R8 |4 j
- *! ]3 x9 D2 c+ V1 L' `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ W- A8 e% o- Q! T2 b
- *# j+ F' a2 E: Y; }; O
- * This program is free software; you can redistribute it and/or
2 A9 a5 t% q$ \& b4 Q - * modify it under the terms of the GNU General Public License as
7 v! z! {6 t8 O: d3 ] - * published by the Free Software Foundation version 2.) p4 U/ h) f: A, f5 M; e E
- ** E2 p7 \9 J/ }7 Z* @& m& {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) l# {& t) B. w J1 }& k' ~
- * kind, whether express or implied; without even the implied warranty/ |# r6 }7 Y& y9 T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# Q3 T2 {8 u3 n: _. f
- * GNU General Public License for more details.
/ V4 S% V4 @, p# _/ s9 ?: j - */
0 W. k& S- Z: C- P8 ] - 7 ?6 z9 Q# L) a2 \5 f6 M1 e
- #include <linux/module.h>( g. L" o& ?6 e3 ~- K! f
- #include <linux/init.h>
' v1 P# X1 e3 H4 X, j - #include <linux/errno.h>
+ q- D2 o' ]2 A - #include <linux/types.h>; U9 Y ?: l M. l9 Z5 @" I" J
- #include <linux/interrupt.h>
! P. }( u8 E" U. T- ^; Y8 @ - #include <asm/io.h>
& K, {' F* q3 q, S: ]. F/ s7 I1 ~ - #include <linux/moduleparam.h>
) h/ q/ _; G1 j9 y# | - #include <linux/sysctl.h>& j6 |! X) K; F$ X- N* C. b. J5 O* l
- #include <linux/mm.h>
* ]* n% g- \2 n# T, V6 A3 c: } - #include <linux/dma-mapping.h>
5 V# o% N/ ^6 f1 X
2 p5 j7 K+ h: p$ o- #include <mach/memory.h>
8 P4 `; n+ Q H# R - #include <mach/hardware.h>, u! D& e' \7 {& o
- #include <mach/irqs.h>. u$ o2 d8 Z& ?5 C8 P$ f
- #include <asm/hardware/edma.h>
. _# O0 I- P" w, {6 F - . D; o8 t S3 ?1 o3 n
- #undef EDMA3_DEBUG( U5 G5 h J R( E9 W
- /*#define EDMA3_DEBUG*/
" u# }- c' c, B/ |
/ S8 m0 n% ^) [0 |! G+ Z* [- #ifdef EDMA3_DEBUG
5 F; E; z- N" W- m6 u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 u( m5 _; W1 S/ I' Q5 c, V+ T4 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 ~9 Z( A; B7 q: N- y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- L% [+ [. A" `3 U' d3 g
- #else4 T* }" d: n" r7 T2 k- R @! `, G+ i
- #define DMA_PRINTK( x... )
) d" q; f# ^0 y4 y1 }3 g - #define DMA_FN_IN/ T4 i! b2 h$ A
- #define DMA_FN_OUT1 S) E0 t; B' ^) u
- #endif
" [+ U. J+ i/ b* \, w, g+ d
! y# a! f' B9 P! k7 T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 q7 Z9 y/ e2 ~7 c. p. }4 V
- #define STATIC_SHIFT 38 S1 l n, o& x
- #define TCINTEN_SHIFT 20$ e6 x# _9 g" i; r7 P
- #define ITCINTEN_SHIFT 216 @- E- k6 G) Q4 M; }$ a. K
- #define TCCHEN_SHIFT 22
4 ]: D& w3 e1 B6 L9 U& \4 V - #define ITCCHEN_SHIFT 23( @% P. w. G$ D7 Q0 Q8 V8 v
- " ~3 M; |# W& d0 W' `( ?. K8 N
- static volatile int irqraised1 = 0;
; v4 v7 j* E8 i - static volatile int irqraised2 = 0;
/ P. O" E4 r; }% a8 W+ ]* _* ` - 9 ]* L( {$ B$ t- x7 w7 }4 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 c* r; G/ T0 E+ j3 m, E) { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" }1 U& L% V5 K8 b5 t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" o" g9 m, C" t& _$ K: b
( Y# o2 Z6 X: r. z- dma_addr_t dmaphyssrc1 = 0;
# w+ q( ]6 X# I# h3 q( @- A: D& _ - dma_addr_t dmaphyssrc2 = 0;* c: U& G, A2 B* @) {. [+ e
- dma_addr_t dmaphysdest1 = 0;4 k1 _7 F7 b a9 ]: A# e1 g
- dma_addr_t dmaphysdest2 = 0;
* r. m, }, Z+ P; j - . R0 {! P+ w" S" \& ]; c: e
- char *dmabufsrc1 = NULL;
5 G* Z" Z0 R: {) w5 C& e( Y3 h% p) _ - char *dmabufsrc2 = NULL;
. y! N0 K: d$ L6 v0 `8 O - char *dmabufdest1 = NULL;- I4 A2 U6 v$ }6 R/ F: \) ~4 y
- char *dmabufdest2 = NULL;, c& e3 C7 M8 {
, D! k* N& N, ?; {% G+ Z# q% P# r, ~! R- static int acnt = 512;! @# f( }; v7 O
- static int bcnt = 8;0 B2 _" `2 q9 j4 i
- static int ccnt = 8;
: [1 n; u! O0 w3 j - % k {+ T$ I& C3 j6 t
- module_param(acnt, int, S_IRUGO);
( a! r7 ^( H4 K" z# w - module_param(bcnt, int, S_IRUGO);
6 D9 a/ F( [' J" j: s- f - module_param(ccnt, int, S_IRUGO);
复制代码
' M2 d; T1 s% s" `, p' h% E
9 z' {* l3 P( L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 ~4 d' S% x/ `, Z: l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, ^( y+ K0 T e0 k P" e; Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& f4 C1 M/ K& F7 R
3 a$ G* G+ o4 ^6 r- A H& _( I; {2 ?+ T. C3 x9 B
|
|