|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Q1 i1 S- u4 L- [code]EDMA sample test application
6 ?+ ^; B& A* G6 y% J f: W' v* z - /*4 R$ m7 j8 j9 N/ L
- * edma_test.c( `4 [- C: ~0 O- O5 U
- *
' y# {" B3 i5 k$ ], W1 s+ S - * brief EDMA3 Test Application
: c: T, R! Y9 Z/ {: B# q - *
. d. ?4 f# d% v) O4 e! S5 C9 M - * This file contains EDMA3 Test code.
9 @) {1 h: L ?6 u" | |/ k - *
+ Z) R+ W' d. }$ [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ n. G2 p+ G# w& t0 w) {- R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; v* w* ~3 H3 z9 ]$ X4 [' @ - * TO CHANGE.
8 C. }! A/ t! E/ S3 r! ` - *
; s N1 h0 A+ w" _* M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 e; ^2 h8 t$ b
- *
$ a5 v& P8 r- z7 K2 D - * This program is free software; you can redistribute it and/or
; ~" V& r2 j- U3 z& b - * modify it under the terms of the GNU General Public License as
, ^/ j, s/ T/ {+ x* |! @ - * published by the Free Software Foundation version 2.9 I0 U$ B" i+ {$ {& g
- *. b" ^, t, @0 ~; i' A$ h b& b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& e& n) R' x; V8 D1 N/ n' W - * kind, whether express or implied; without even the implied warranty5 N9 f" v6 D$ l$ a. _% k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* G+ v5 s( T4 w( v - * GNU General Public License for more details.! O" E3 K$ T+ ~# S
- */3 r; g }$ N3 E- A4 }$ e
: d" X1 J3 t- J6 M9 S- #include <linux/module.h>
4 n6 r! H6 \3 {& | - #include <linux/init.h>
9 K( r$ k2 _- y. M( `+ p9 A - #include <linux/errno.h>2 d. ?& w( c5 C: T; s
- #include <linux/types.h>: [: v! z& L- C: {/ F }$ o3 ~
- #include <linux/interrupt.h>: x1 b. I h. G( M- O
- #include <asm/io.h>
1 a* D" ^0 O Z0 Y) |! b - #include <linux/moduleparam.h>
8 r- F+ h5 j5 f) | - #include <linux/sysctl.h>
& a" X8 {" K2 h! a. f: w7 \- X - #include <linux/mm.h>
# g. M1 Q8 R0 `4 ]& S; i - #include <linux/dma-mapping.h>
- w# G+ p2 ^2 x; F* [# h2 q6 Y
+ _4 c& q! A5 S; X( |- #include <mach/memory.h>+ \; s9 x* w9 q$ Z4 A$ r/ u& p
- #include <mach/hardware.h>
8 N7 m4 k/ E" w* t4 n* x - #include <mach/irqs.h>9 h2 R$ j" A/ B3 p- K: E
- #include <asm/hardware/edma.h>' t' P+ O! X3 R2 ~2 s5 {
f3 @" h6 }' c: h& j. r- #undef EDMA3_DEBUG
* N, h! `1 W$ S+ j - /*#define EDMA3_DEBUG*/3 H4 M( y1 t w, n. O
) u/ D5 G+ U5 J+ @- #ifdef EDMA3_DEBUG
& w& A5 O1 e/ e! a! v2 j. X2 Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 t; Q* f) P1 b. ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& Q( [% X! [* K4 L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) l( ~# T. `. P2 f6 [' D1 k - #else
- u. o# c6 [4 A. K: |4 ` - #define DMA_PRINTK( x... )/ I$ ~/ Y, k+ D9 _" s0 ~6 {
- #define DMA_FN_IN7 S: |$ @& U) d7 E5 d
- #define DMA_FN_OUT
1 j2 _3 V: \4 T2 Q - #endif- @, N, p( Z4 a. j% q: d
- " |2 H5 ^3 A3 y# [8 r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 w0 y3 W% t' [ - #define STATIC_SHIFT 3: g( u2 F# i6 e* E
- #define TCINTEN_SHIFT 20
3 n- R( L) o5 z. l6 a6 L2 h - #define ITCINTEN_SHIFT 21
0 u8 q5 J3 @" D: g, s - #define TCCHEN_SHIFT 22
, m; \, k2 ]3 u3 @ - #define ITCCHEN_SHIFT 23
* D3 c. `0 o5 N3 w
; V; @0 R& E; H: k6 ^0 [: C2 ~- static volatile int irqraised1 = 0;) j" l" Q' e& c e
- static volatile int irqraised2 = 0;
1 R: \# _% i5 b# z- {" |" c - , E6 G+ b9 z5 Y4 V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" o. c( |- P6 b6 I" m& P& G) w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. M& N0 M0 s5 g6 ^7 G" P, Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; q4 C1 J/ m5 ~, S
7 g/ q8 ^* {( a. F9 o4 H( K- dma_addr_t dmaphyssrc1 = 0;9 \, Y4 F7 [6 C
- dma_addr_t dmaphyssrc2 = 0;
9 T6 h2 n8 x& ^- q0 Y6 F - dma_addr_t dmaphysdest1 = 0;
$ h* X' Q3 _' F1 Q - dma_addr_t dmaphysdest2 = 0;% {2 A$ D) A& v7 ]. f
- 0 o! h0 o' ^( d7 z2 d/ P
- char *dmabufsrc1 = NULL;, n. x' d& h% m# _& V
- char *dmabufsrc2 = NULL;$ i8 B4 z+ o0 A \3 ^( B" s
- char *dmabufdest1 = NULL;
9 w8 P% H" ^/ s; {$ |0 w; y - char *dmabufdest2 = NULL;& U9 j3 ^9 m" w/ e' t' V
- , e7 w+ }- p% h4 G! i, l
- static int acnt = 512;
0 Y* `0 F( X/ Y- ?# F' d - static int bcnt = 8;" }' w3 [( P Y+ @' r9 i, T
- static int ccnt = 8;
" p' {; l5 L2 ~3 Q9 J
# }) l0 z1 U1 G- I- I- module_param(acnt, int, S_IRUGO);! h* F2 ^: U) p+ h# S6 N
- module_param(bcnt, int, S_IRUGO);
" W! r9 _1 [* ~, M' Y - module_param(ccnt, int, S_IRUGO);
复制代码
& w8 e7 z9 c/ C/ V+ a2 X) L3 S- X+ R; T3 l* [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 I; y5 W8 r0 G9 `7 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 {" o0 k# ^% P' w5 m7 |# Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# F% k0 ^. i) B4 u, j6 D
/ l, D8 u0 M$ j w. w3 j" \
, }; f: _, A3 M8 \ |
|