|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 o2 ?$ @8 X' q- [code]EDMA sample test application2 p% A4 t5 S5 Z9 w5 @/ N, j# |
- /*
- r! C$ O" e* x/ m! h - * edma_test.c
7 r6 b- n1 t7 {0 P; B* v' I+ H - *' S( Z9 \, x! w: o1 M* \
- * brief EDMA3 Test Application
+ l9 \; c' H: C& j3 r. S: R; k - *) h3 J7 N C) E( M! q- @
- * This file contains EDMA3 Test code.
3 j& l& k/ w" \, [' J; h1 ~( L - *
8 G: t" f" ]8 m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) e1 t2 p O4 Q! E i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
L0 x3 p ^6 K6 d - * TO CHANGE.
S- o1 Q" s4 X& U' L$ x. L - *
: P0 A. }, k+ l* x! j0 v4 q* W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& h/ F/ y& s& H8 m7 }& @6 L
- *
" t) l% i4 }# p( ~ - * This program is free software; you can redistribute it and/or
0 B3 j" H) ?1 u4 Z. K - * modify it under the terms of the GNU General Public License as0 {8 B9 z* b; ~5 e
- * published by the Free Software Foundation version 2.
* C; J8 b; ]" G. F+ e$ B& t' q$ ] - *
* V5 E% y( Q9 M9 g$ ^$ T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. [' {# n$ X( p8 z. x* t
- * kind, whether express or implied; without even the implied warranty
1 s- H$ m' }; K6 I% a$ e* z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. t% G5 f$ r% S+ F$ u7 f
- * GNU General Public License for more details.- |5 w1 i2 u% M. r% h4 t; @% m
- */0 v3 J5 g* n( Y9 l, G$ {0 |
- % C9 B( o X, R6 z
- #include <linux/module.h>4 [# Y4 }; \# e5 J4 a+ ?
- #include <linux/init.h>
$ ~" t3 [! l# \) i/ k - #include <linux/errno.h># d! K1 J7 P; R. L
- #include <linux/types.h>
9 V) [. I2 W( B9 y% C - #include <linux/interrupt.h>' F: ]; [# R7 y \
- #include <asm/io.h> B5 a) F( Z3 p3 d0 Z# W" P# _
- #include <linux/moduleparam.h>
. r3 b* d0 `+ G q+ y - #include <linux/sysctl.h>
& a3 _5 X/ d. N D - #include <linux/mm.h>, @$ m' d$ y. v
- #include <linux/dma-mapping.h>: z; f6 T3 y! W% ^' t
, ~- s6 T7 }7 Q0 u0 T- p5 x4 L- #include <mach/memory.h>
- A+ x) j- q& R - #include <mach/hardware.h>6 [" w7 ]" K6 p3 _9 h
- #include <mach/irqs.h>
6 E; t5 o6 S, @ - #include <asm/hardware/edma.h>
) O3 j0 w6 Q% z1 S; r" M - ' l! q+ F( G5 W9 {
- #undef EDMA3_DEBUG
! _5 e0 ^. i! b1 z1 a; J; s( o - /*#define EDMA3_DEBUG*/+ _# k9 I: G- Y( W
- 7 S' B i! g8 b% [& j, A3 p5 r
- #ifdef EDMA3_DEBUG3 H7 n) b, }, L( W' z2 r- y2 A- P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ \8 ~9 R/ V% |( b: f6 l3 o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% `& T0 V& ?, o4 v1 T% r% V+ m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 w. q1 Z; _8 o - #else
0 b1 W; p, Z! G7 K - #define DMA_PRINTK( x... )2 @$ F* A! j8 c
- #define DMA_FN_IN
+ n) F# ^- |& m6 w% i7 e - #define DMA_FN_OUT
5 `) _, A% k! a& O9 e - #endif3 k5 C% Q" _0 b) p0 i$ J
3 F! Q9 Q% P+ V0 c4 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! T0 s7 G! v) G - #define STATIC_SHIFT 36 Z8 [8 G/ T9 U8 r; I: Y
- #define TCINTEN_SHIFT 20
, X3 B- x# E+ R" t0 B5 M - #define ITCINTEN_SHIFT 21
; A/ l; Q* s2 E; r, u - #define TCCHEN_SHIFT 220 m; r7 p7 @- o. V& c+ P0 U
- #define ITCCHEN_SHIFT 23
7 p: J+ L* s4 D. m v5 L* `3 @+ ~ - 3 n6 h& ]# K2 u2 Z6 b. n; Q8 e& _
- static volatile int irqraised1 = 0; K5 U. u* B$ v z* w0 t# J1 I& G
- static volatile int irqraised2 = 0;1 u. m, J$ X! Y
- 3 D7 ^ I) g* C! w# X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ b# s- H' u4 n; I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P1 C0 k2 C4 h; D" }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ w. q; x+ S: l6 G - , R+ m* ]- ?/ V: n& p7 u9 W1 G1 W
- dma_addr_t dmaphyssrc1 = 0;2 A+ b( w) X. h
- dma_addr_t dmaphyssrc2 = 0;9 H4 \3 s$ O0 ]" m' J8 [
- dma_addr_t dmaphysdest1 = 0;+ } k. y) e: }3 R, T' Q
- dma_addr_t dmaphysdest2 = 0;% h& F+ D7 ]4 N' s0 X9 [( r
- ) |' a" K2 \$ Q% a. M
- char *dmabufsrc1 = NULL;
, q9 q, u! g! M1 t - char *dmabufsrc2 = NULL;
8 X P9 C( L } - char *dmabufdest1 = NULL;1 I! d9 F0 R# q- D1 p* @( ^
- char *dmabufdest2 = NULL;
8 A; j# h; y. u o - 1 F! z& x- z1 P. f0 u8 L
- static int acnt = 512;: i C1 W" L# g# `
- static int bcnt = 8;
+ h, s$ F/ w* r' B1 k - static int ccnt = 8;8 R6 w* q1 E" u6 k$ z
- . y/ ^; A! E2 y7 g
- module_param(acnt, int, S_IRUGO);
3 U# |6 f# J: ] I# { - module_param(bcnt, int, S_IRUGO);
# E, }* r& U" d8 }) b* l - module_param(ccnt, int, S_IRUGO);
复制代码
4 I7 f' A6 l2 L/ @9 l
! U- m4 k2 t& M2 L' h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) v0 i( ]5 y4 N C' _( i, ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 A4 l% k: A3 \( I9 D: m4 v8 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 D. U) g/ w. e
6 L9 R* B; i; `. p
$ t* s7 g# G) [0 z( d
|
|