|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! \$ M3 T$ Y- N4 |& p3 m
- [code]EDMA sample test application
/ o3 m* I. S, `6 q( q - /*
/ R3 O' v, P+ v! k+ U - * edma_test.c
2 F/ G0 Z8 h' L* n4 U T: L+ u - *
- J# k) @. }; }& T u - * brief EDMA3 Test Application
7 ]: p7 V$ a+ z' O% S% z& r ?/ A, y - *
" z/ K+ v" `5 j8 @ - * This file contains EDMA3 Test code.: T2 |1 \7 E7 ]9 U- ?+ c
- *2 d _ M- v7 o$ V! S6 {3 A# d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) Z/ ]5 u( p. w/ f" K v3 b) U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- c; u$ A1 V7 a. n/ E
- * TO CHANGE.
: l2 q! E! ^" |& m: l/ {& D - *% ?; Q& s+ p9 \" |1 v+ C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! P, U+ _* i0 p - *
* X/ y: S3 m0 p2 [' p0 }0 { - * This program is free software; you can redistribute it and/or9 ?* B2 Y$ j2 x+ r
- * modify it under the terms of the GNU General Public License as" c. L! [% [4 f3 [! b) ^1 v$ G) y
- * published by the Free Software Foundation version 2.( e E( O; T& n( m$ }
- *" E/ n3 P# m& Z: h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. {& s) n4 ~8 G- H7 p' o - * kind, whether express or implied; without even the implied warranty
3 h+ ~+ [+ Q$ N4 ~/ J* p- j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) q% N9 a$ a0 }7 x& ?5 T - * GNU General Public License for more details.% J' f8 K8 ^# Q( d9 h. g1 F1 e
- */
* P# [( } u. i# O4 ~; y0 N+ y0 H5 Y' B
0 O$ @0 X* G% A/ E1 {- #include <linux/module.h>* T' c! h* r" w, q" {& ^ l' s; g
- #include <linux/init.h>" l/ [. X1 R6 O- p3 W# \. u' z
- #include <linux/errno.h>
! `! u* a9 r2 Z3 l$ i - #include <linux/types.h>) e" w$ V; S! W! |
- #include <linux/interrupt.h> n/ q l' _5 C V. `6 S
- #include <asm/io.h>$ n/ P2 {/ h( P& E" u" A# S
- #include <linux/moduleparam.h>
4 M( t5 [ p; j9 \6 z& l - #include <linux/sysctl.h>, w6 e3 A* w$ s7 W. X5 N0 q* c0 e
- #include <linux/mm.h>
7 }4 N+ q8 t# L( ^0 [' O7 L - #include <linux/dma-mapping.h>! \" C" X, _# g/ M5 {7 w
- , f3 Z% z& d* ^
- #include <mach/memory.h>
; J4 H+ U8 R2 V+ r* I8 P' j# U ]2 s3 d - #include <mach/hardware.h>& @* E/ | G3 A; h* x. a% |. o8 s% H8 u, c
- #include <mach/irqs.h>/ |# N4 z3 ~& G) r8 R2 k% C& Z
- #include <asm/hardware/edma.h>+ w1 v* D1 w: V7 d7 \ L- ^/ E- a0 i
6 M5 A) x+ P" q' F6 D' Z/ {6 D- #undef EDMA3_DEBUG. X0 q1 {: @" b
- /*#define EDMA3_DEBUG*/# G0 _5 |& a; i$ O9 A
- 9 n7 \% G8 e5 E9 V! K4 O
- #ifdef EDMA3_DEBUG
* I' b0 b% s( z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ V( `6 e! `0 T) G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 P3 @6 M- } }; L; ~- K+ k/ O& _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 s; ^. @* s9 a2 E4 s
- #else4 s! k* D; R5 K
- #define DMA_PRINTK( x... )* v" K. i+ N3 k( v) c) p
- #define DMA_FN_IN" \4 `8 o! Y' _$ W/ F* c
- #define DMA_FN_OUT8 a* o! g9 B/ y. [, S; f2 K
- #endif4 ~$ L: L- a ]/ v
- # Q- F# A1 a, S( }3 H8 D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' P$ h* K( h" F j
- #define STATIC_SHIFT 36 T7 j+ w, T: g! ~
- #define TCINTEN_SHIFT 20. Z3 p: s+ Z; {: z
- #define ITCINTEN_SHIFT 21
, I: I ~$ b# ?! v6 t) G$ Q4 x - #define TCCHEN_SHIFT 22* S g Y \; Y% e9 R' h
- #define ITCCHEN_SHIFT 23# l9 R ~6 }+ o. L3 n
0 ~1 v6 S8 H, e+ K: w$ B: @& N. b- static volatile int irqraised1 = 0;
* d0 _7 p8 U1 W* q- w - static volatile int irqraised2 = 0;0 j0 H- f. q6 }* l& l, c( D
- 5 Y; h5 R2 D! ^; x* s1 C# d( y: U& u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ H+ Q9 q. j; j, X! e/ ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 }5 B6 l; v6 p* b6 S& m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; \0 w, y2 I+ }9 u
) w/ s( g3 m6 R7 i- dma_addr_t dmaphyssrc1 = 0;4 ^3 D# a4 ~; v
- dma_addr_t dmaphyssrc2 = 0;
2 o/ c z% F2 i( |2 _' f" I - dma_addr_t dmaphysdest1 = 0;
7 O* G4 J8 h2 \ - dma_addr_t dmaphysdest2 = 0;
0 r D6 T" H: d( K - - j/ }- {( e9 |! ?' Q$ K
- char *dmabufsrc1 = NULL;
. f: O$ ?3 f T - char *dmabufsrc2 = NULL;
% i' f2 x5 m0 c/ s7 b5 @ - char *dmabufdest1 = NULL;6 r$ \/ y6 G6 W& b
- char *dmabufdest2 = NULL;- [+ S3 [8 G7 u2 w. c
- + m$ i$ f& X2 k x9 ^0 a
- static int acnt = 512;/ g. l) U/ {: G
- static int bcnt = 8;
( E; G- n+ D" e: H& T( ~4 |! f. A- Q - static int ccnt = 8;
7 [* x3 w, V! Z) o8 u/ E
4 T* x( j9 m: Z7 U: j: Q' i- module_param(acnt, int, S_IRUGO);% v/ O, P8 v! B8 W
- module_param(bcnt, int, S_IRUGO);+ u8 W5 d+ `2 l: ]. M! M
- module_param(ccnt, int, S_IRUGO);
复制代码 / b/ W- n& B1 {) u: A
( j- \9 r) Z# n: ~: Y: e5 q" | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" i: Q% Q" F) b' m, G" `( }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: b) h( I( N5 c: y$ }- q% o9 E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, w! x/ c+ r& s$ q" b2 j
* _% X& F: y0 D/ v$ D7 V
9 i$ W$ l2 w& d
|
|