|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 l+ x# L% V8 f$ b, L
- [code]EDMA sample test application
; K- I, S; a' N# ]( v4 o - /*: K1 i+ j! q4 T$ |
- * edma_test.c5 W- Z" G" k8 r# h' {
- *
6 I/ v, U+ y R, Q; J l - * brief EDMA3 Test Application6 F) L u( J D+ n, n9 O
- *
5 b6 h8 A: z( T4 D7 G# o - * This file contains EDMA3 Test code. i5 E* c. t) M" Q. i' T' M0 a
- *. U: p# ?6 Z, |' y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# V9 {: N5 O" L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 x! o$ p; k( R9 I - * TO CHANGE.
" `$ p+ K8 n' H5 c" G/ P; L" A' y - ** {2 t( R8 g- F/ l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, {- Y, d N1 v* D( R0 O - *& i& j+ O) G0 ? _7 \5 x8 O
- * This program is free software; you can redistribute it and/or
) J( i4 Z4 Q- G' m - * modify it under the terms of the GNU General Public License as6 p* c- W0 z+ q. n e6 `7 `
- * published by the Free Software Foundation version 2.8 d- f) f$ d# j. n! i: B
- *
+ v; a9 M8 q% z$ l" ^; L; w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: k" O2 ?& Y5 R' W$ m - * kind, whether express or implied; without even the implied warranty
4 n; H$ }; f6 c2 G! _% B8 Y$ F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; a8 D# r% t/ ?$ a/ Q - * GNU General Public License for more details.
) \0 y5 ?, M4 k+ S) x& y! G - */1 V# W) j* ?! W F7 J' P
( f$ ?# z+ I& Q0 c4 b$ y' r' t9 d$ E- #include <linux/module.h>& g! m# i! P% M( ^9 @. p) V
- #include <linux/init.h>
; j$ `1 v z. ^ - #include <linux/errno.h>$ O9 U9 ?9 g5 i A9 Q2 {3 `
- #include <linux/types.h>
8 K0 B0 a$ w5 U - #include <linux/interrupt.h>
- T+ r9 d: Z3 A - #include <asm/io.h>
% d" b0 r0 |2 S2 T" A3 t - #include <linux/moduleparam.h>( b+ c4 `: u' k# g- S( c& r; v+ E
- #include <linux/sysctl.h>! L5 V8 d6 g* {* p# [
- #include <linux/mm.h>
v9 G8 K% D2 a8 m& v: { - #include <linux/dma-mapping.h>
) f8 g- F3 G \3 ? - 2 A6 I6 I1 x. T1 y1 ]; \. ?
- #include <mach/memory.h>
) A5 `! }" V/ H6 U. @) f; \ - #include <mach/hardware.h>
~( H. e! l! v; K E - #include <mach/irqs.h>. q; O8 l' M2 z
- #include <asm/hardware/edma.h>( x& N3 w" J. `8 m. U8 F
- x! I, c3 `' L- #undef EDMA3_DEBUG
& {4 D( _" y9 I8 C: I: ] - /*#define EDMA3_DEBUG*/
: K6 s$ B' G4 C" P) E
( E; E# r0 d# o# V* K! ^5 M- #ifdef EDMA3_DEBUG" W2 N, s1 ~8 [0 L# Q/ ~& h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 v* X& ~# s- g( \( M- G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 L" I% Q5 z7 A* u0 j% K: u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" C) z4 i0 c0 @ o - #else8 i0 i# P& O' t
- #define DMA_PRINTK( x... )
9 i8 v/ L }+ }8 f - #define DMA_FN_IN
2 U" d9 W& D- z5 I - #define DMA_FN_OUT
, k5 ^3 _( M, A - #endif$ E; c# h6 z: y& b& e( }
- ( B: q/ v2 \) N. ~/ \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' `0 E* n3 X) F8 `1 T. `
- #define STATIC_SHIFT 3. P h) g% x# Y# t6 V) N
- #define TCINTEN_SHIFT 20* C1 f. S4 e. c1 c
- #define ITCINTEN_SHIFT 216 Q5 c! A: Q9 T, c* Y
- #define TCCHEN_SHIFT 22
; W3 M9 K% U" _, F9 |' S! V - #define ITCCHEN_SHIFT 23
% O1 m2 s) Y0 o# K - 9 `* n% ?4 b1 q+ c/ e0 I6 R
- static volatile int irqraised1 = 0;9 f2 x; c1 B g3 l
- static volatile int irqraised2 = 0;
; X0 t3 Z% | m) F; A7 V5 L1 {
1 b; U9 a( j+ N- s" G# m4 Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 C6 @1 T) b7 i1 ~6 z- m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% V% \( F4 \4 m3 I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" H: D' b4 D+ s4 s3 j - . j& V# Q+ V$ H" m& {. }. {
- dma_addr_t dmaphyssrc1 = 0;
4 g; W% D4 P" U3 v6 ` - dma_addr_t dmaphyssrc2 = 0;( R- R$ O h# _- X% A
- dma_addr_t dmaphysdest1 = 0;
* H2 X8 f6 u; E2 q2 U9 h2 L - dma_addr_t dmaphysdest2 = 0;) q+ k, K' W K$ S8 y
3 K, }* E0 ?) ?+ F+ Q- char *dmabufsrc1 = NULL;
0 i/ t2 U/ E) j1 ^0 w' A- J - char *dmabufsrc2 = NULL;1 T" {5 T Z1 p- I8 q, x, P7 t
- char *dmabufdest1 = NULL;$ E) `, N8 s" C; f
- char *dmabufdest2 = NULL;+ `3 n0 Z# D4 S/ I5 i- [
/ q7 |9 Q8 k: m: E ~5 w- static int acnt = 512;- z8 C2 P8 j( v. M$ n* @/ u
- static int bcnt = 8;
. {; n O# B% M - static int ccnt = 8;
+ |7 G* L* M. H& l8 m1 ~' K
9 [. u6 K! |: Z; ^9 N5 \) u- module_param(acnt, int, S_IRUGO);
( g$ f$ N9 z9 T, F3 V2 q - module_param(bcnt, int, S_IRUGO);! ]) @( q/ k; A2 v' N5 L
- module_param(ccnt, int, S_IRUGO);
复制代码
* K7 c& j6 u4 E# d9 q- @% s( L% `6 k2 w( f1 L; _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" _/ y" v" `5 p% Z+ c" Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) u* A2 |- \( e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 h9 O* L" ~7 {
; }2 o8 ^3 H8 }2 z4 M5 F# a6 H8 } i% g. }) _" w$ V
|
|