|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . `) @( ?0 f( u* W
- [code]EDMA sample test application0 {6 t6 g4 r/ o
- /*
0 }* ]; P( F/ X& z7 y, Z - * edma_test.c( n% d4 `8 c2 ?" n" m3 @
- *
9 C7 w* I! L! q. H; i - * brief EDMA3 Test Application, e- p X* P. j: g L3 u( C
- *) M4 H U+ o0 W$ S0 W
- * This file contains EDMA3 Test code.
9 _ B) N) N! o/ v - *4 K; _, J# v0 H- M( h6 }3 g% J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- t7 _( }0 s) A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) ^: \) K: I S2 l4 V - * TO CHANGE.* w6 ]1 i3 k$ x$ R, \ b! x' J
- *" l! m1 o# v# P" p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 N2 L5 q2 N7 q1 I' ?: [ - *
( m/ P9 M/ B9 u& h6 h `) { - * This program is free software; you can redistribute it and/or
5 g+ {) Q' R2 `* h/ ] - * modify it under the terms of the GNU General Public License as9 R) W) @7 D7 Q+ e, w3 @+ k2 X
- * published by the Free Software Foundation version 2.
9 Q: _8 q0 g8 U" x4 B- J* X - *
7 j6 D: w4 V; B/ L8 w2 r- d& O/ } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 F8 p: Z: g8 L, e( r" Q - * kind, whether express or implied; without even the implied warranty" [! M9 H. R( `+ `. J7 |+ Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 ~) w# ?; l! N! H5 e6 v - * GNU General Public License for more details.3 z" w8 Q. y- I/ W6 u4 m2 z
- */: O4 M0 x$ Q* [! H0 T* G
- & e& q- n9 m6 p3 L! `3 M
- #include <linux/module.h>
`: x, s, A3 f - #include <linux/init.h>2 b& q) |7 ?; ]0 f$ Y
- #include <linux/errno.h>
; ?. M3 O. f6 ]4 ` - #include <linux/types.h>
$ g Z5 o, L' a - #include <linux/interrupt.h>
% T& L% g8 f4 Z3 x# ? - #include <asm/io.h>- D8 Y6 p4 M* ~8 z$ x' m( a5 S N6 [
- #include <linux/moduleparam.h>0 P) k. X, _% U/ n( x
- #include <linux/sysctl.h>
& l6 w6 e4 d+ W/ G$ z+ r - #include <linux/mm.h> T1 r% X6 V! ]2 t" L8 S0 g5 E
- #include <linux/dma-mapping.h>% H4 ]5 f( x) |0 Z/ } D* O# b3 @) P
- c' \) S; W7 V+ N# y/ S8 A0 y- #include <mach/memory.h>9 ^5 t+ G x2 |5 J
- #include <mach/hardware.h>/ o2 A F# W3 \7 o2 q
- #include <mach/irqs.h>
* d8 t! b, M+ s, r. k/ e - #include <asm/hardware/edma.h>
- ^8 ]- P7 R! |# L- h/ e
: _8 a' P5 z6 s' y6 H2 V) [: C. R" _- #undef EDMA3_DEBUG% }5 ~1 k, l8 S) K% ~4 b$ @6 H9 j2 A
- /*#define EDMA3_DEBUG*/ `7 l2 T' `% `& m
k! q& U% {% z$ R n5 b1 I- #ifdef EDMA3_DEBUG
6 X; h( A# N3 }3 c+ A4 W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- F; p3 C4 l% I2 A& v" s$ j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 H9 y r& ~6 ]) F: U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; i* Y( \: x" t: \/ x+ l - #else4 z" N5 B. S8 y! p8 U
- #define DMA_PRINTK( x... )
# E; p+ `5 P/ G: t3 N( `( v - #define DMA_FN_IN6 `; A4 x; Z/ w8 c) p" B
- #define DMA_FN_OUT$ X# w2 U8 H7 n0 N$ _
- #endif
( K/ }) y% }; I2 M
% c$ }% G- k" ]0 G9 ?' D. B: E0 B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 E/ q& c6 D7 t
- #define STATIC_SHIFT 33 |9 u A" R! v; Y7 e' A
- #define TCINTEN_SHIFT 20
! v6 D$ x1 }9 A. \, ~* }; ~ - #define ITCINTEN_SHIFT 21
0 B% W3 t2 q+ c - #define TCCHEN_SHIFT 22$ n# I& T |( B' s/ I9 O! K
- #define ITCCHEN_SHIFT 234 ?4 n0 w9 a' q. E1 J
m0 @1 I8 ?3 i& T7 c. {0 ^% k- static volatile int irqraised1 = 0;
5 r l' ~, r* Z+ C - static volatile int irqraised2 = 0;
Q, H4 S6 n7 }$ ~1 \5 ]: R
' \4 }- u- ~: p, f& J2 S* R0 f2 v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 \6 b- w, E2 C9 `( V. k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D& a( M: r; @: | a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! z5 b; c5 b$ ?) W9 h7 v J0 D
4 n- Q3 g6 }0 V- dma_addr_t dmaphyssrc1 = 0;! e7 A9 z, }: D) Y, r0 S
- dma_addr_t dmaphyssrc2 = 0;
- [' j; A% g7 W% o9 ? - dma_addr_t dmaphysdest1 = 0; f' X( v2 _# ?: Z8 a
- dma_addr_t dmaphysdest2 = 0;
+ P9 q" }8 g* m - % `% H5 u0 v9 R! h* w( r' V
- char *dmabufsrc1 = NULL;3 @$ h$ \, x. u# c3 f3 \3 P
- char *dmabufsrc2 = NULL;
+ l. h% [( f% I6 I - char *dmabufdest1 = NULL;
4 m$ a8 O4 d+ K' E( ^ - char *dmabufdest2 = NULL;. v9 I: w( G% ?; B2 v
3 U+ E3 e1 ~2 u3 ?! P9 S/ U: q- {- static int acnt = 512;3 B( `, i; @+ q
- static int bcnt = 8;9 ^7 k q- i) c! }" j
- static int ccnt = 8;. K1 h( S. m( U. v/ V
- % N/ H& |1 ]# Q0 S4 w* r) l1 C
- module_param(acnt, int, S_IRUGO); g' h$ V# K/ t/ \: N' _
- module_param(bcnt, int, S_IRUGO);9 ]: R0 ~5 x7 e
- module_param(ccnt, int, S_IRUGO);
复制代码
$ N4 |2 x9 K4 t4 @
/ c8 V' E! [# X- H( ]1 l% J6 D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' J l7 c7 g5 P: O+ Z: J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- h, ?6 G* M/ y$ T0 s0 h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- I( B. p. r" j7 p2 P
" q% y- {: }; w! d' e `, f# p7 P
4 J9 @1 P- L$ Y |
|