|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 t- J2 M2 x4 T# ]. }- G- [code]EDMA sample test application- w) z% r" w4 f# H* z
- /*
7 V5 K. L4 b# ` - * edma_test.c7 \( m" S/ q" X$ `5 K; j; d" F5 c
- *
2 E( J9 v! H' ~7 n$ m - * brief EDMA3 Test Application
7 O4 y, S5 D) }0 c& e7 [2 O - *1 P6 c+ \! T1 j' a* T0 {' c t$ d) ~
- * This file contains EDMA3 Test code.
( G' Q3 f0 D5 {5 C- y1 d - *
6 V" s" l: Q G( P9 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 D' u v5 k( t# T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" i5 }0 Z: y9 l
- * TO CHANGE.
3 r% H+ Z- l% Y$ Z5 O6 ?) C! [ - *2 i% `% H( ^3 V r/ e. M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- J( i6 G8 d" m. [+ P( c8 g5 p
- */ P5 t2 C/ }0 {8 n: f' v
- * This program is free software; you can redistribute it and/or. I/ G% P z- W# a$ R, |. J
- * modify it under the terms of the GNU General Public License as9 i" S+ W! Y! O& O
- * published by the Free Software Foundation version 2.0 h0 `/ ^! s" d& i$ W: n
- *6 L2 s& |2 {' _- {0 X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; g) M8 i K1 I/ `* C - * kind, whether express or implied; without even the implied warranty
. Q& X, J7 Y! v! p+ i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ ?3 X2 D% K$ S( j9 r! n4 E( a& | - * GNU General Public License for more details.
, U+ }- V. v8 x5 R - */
0 [ b7 l" U) m% J - 6 R* Q* T5 f& j, r+ i# J7 H4 ~6 s/ U
- #include <linux/module.h>& i) B9 V3 D: Z( j9 S
- #include <linux/init.h>$ p" u1 w5 l- w$ F, z+ y
- #include <linux/errno.h>( `/ v2 X" P: u- M8 r5 s
- #include <linux/types.h>
- ?) W4 R6 e: F) P* i8 t ^4 x - #include <linux/interrupt.h>* w9 v8 t5 n1 R* O! P3 i( x- R1 J {
- #include <asm/io.h>% H7 d1 {9 P, W7 L8 m
- #include <linux/moduleparam.h>
7 T/ e- v- _5 \, @6 z - #include <linux/sysctl.h>
% ~. \: V3 ?% v - #include <linux/mm.h>
4 o# X' O# u2 T0 T0 d - #include <linux/dma-mapping.h>4 O5 Q7 P+ ?# I9 Q; x
- : f, k: J" X9 q6 P0 r. h
- #include <mach/memory.h>% f; p( d: R" r
- #include <mach/hardware.h>
% ]% @: C0 ^$ o$ K4 g - #include <mach/irqs.h>
, f7 g5 @; |5 r& |4 ]2 `& Q; a - #include <asm/hardware/edma.h>" ?9 R$ h2 Z* r- {2 t9 Y
2 K% K4 P' f U" Y! A$ L- #undef EDMA3_DEBUG& e1 {7 t* l6 [6 w" F$ E$ N' c# o
- /*#define EDMA3_DEBUG*/
3 J5 u# e" }& [; t7 i1 u5 x/ G$ _
' k3 {+ u3 G, B- #ifdef EDMA3_DEBUG% A7 S+ }. L. q8 _& g C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ D' w4 L& y2 A" j: E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- T8 @' Y0 m ~. d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
p$ k# k2 S5 V! k. y5 A9 q, D - #else+ R& `5 a8 @" I; _( c
- #define DMA_PRINTK( x... )
g$ H) c; U9 v5 C' W l9 D - #define DMA_FN_IN
9 s' V1 X& `; X' U" m& q - #define DMA_FN_OUT, N7 S2 e8 b B
- #endif: L( l0 i: E; J' ~5 u7 \7 p9 h
; O+ L9 Y7 {/ {- b* @- #define MAX_DMA_TRANSFER_IN_BYTES (32768): [: [' L8 x+ y; U
- #define STATIC_SHIFT 3
. E7 K1 R E s; y0 O - #define TCINTEN_SHIFT 20
5 |9 \1 p8 S! l8 P - #define ITCINTEN_SHIFT 21
0 Z9 z7 ]0 Q( J' i! L! T' Z - #define TCCHEN_SHIFT 221 _3 w! N' ^2 K% p2 U+ a6 R( j
- #define ITCCHEN_SHIFT 23
( A0 \: N9 L6 c X: ]/ B - & f/ V/ k2 t2 m& |# e* _
- static volatile int irqraised1 = 0;3 m; l, t& g7 {1 F+ w
- static volatile int irqraised2 = 0;
N r1 J1 K2 D; u
' I" K* i' W9 V [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 z: W& g. S7 f" t3 i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, H3 @# a" B- e9 F! E9 b8 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H' @: E, j0 E
( d, `9 y- t5 Z! l" L- dma_addr_t dmaphyssrc1 = 0;
$ F8 _; {3 q% [1 c3 i+ l I# J - dma_addr_t dmaphyssrc2 = 0;
1 Y0 e i3 e& @" G - dma_addr_t dmaphysdest1 = 0;
2 N$ n2 F7 s! j* C - dma_addr_t dmaphysdest2 = 0;' h) X, m+ |* @
/ I2 U3 L/ L! A6 u6 b. _9 C- char *dmabufsrc1 = NULL;
0 y. n9 M2 p0 z, w) _1 L - char *dmabufsrc2 = NULL;
4 J$ S4 d: x; f - char *dmabufdest1 = NULL;
/ R. H3 e( W3 z% D; h# x" Y4 \9 p - char *dmabufdest2 = NULL;* s% k7 K1 D: K/ C- _. T* v$ h
; J) e4 }+ U# n- static int acnt = 512;
4 S# t9 {& ^2 n: @+ o# t/ m0 y - static int bcnt = 8;
2 T S2 H: U/ h1 v1 f - static int ccnt = 8;: z% d; G6 A6 e) F$ ^4 R
- # S$ Q) g) O. i7 z# Q h- F' E E6 N1 I
- module_param(acnt, int, S_IRUGO);
/ \( p8 k/ a O& Q5 K$ a( y - module_param(bcnt, int, S_IRUGO);* x; Z- }. Y2 f2 @0 p. [
- module_param(ccnt, int, S_IRUGO);
复制代码 v4 p; t- Y2 Z% k6 b% ?! j7 y) _
! ~) { \; o1 k V8 B, d- y" a/ K K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ A2 p( F, f+ b& \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# r5 N0 ]4 w; @- I5 E* G& s+ M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- e2 J" j" O3 _( J: n) l
) E$ x6 `: L: C
0 K0 B9 `, v! s8 Q4 g- L |
|