|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; r `( c) U+ I6 Z- [code]EDMA sample test application; Z& z: H$ Y" z) C* J9 e3 y$ f% O2 k
- /*4 j$ A5 o3 \) W" Z5 q" Q
- * edma_test.c
. {1 k! A. m- z0 S2 r; g2 r - *
8 P% \" R. P, {0 g; {: |9 C - * brief EDMA3 Test Application
% Y+ T; d- Z5 ?6 i- Y. h( o - */ \- z3 R0 K* P7 r% }
- * This file contains EDMA3 Test code.
% @2 [# i" L: W4 s' f - *
9 w" n Q8 Z; Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: L3 L6 S9 ]9 d7 R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, \( V( ~, H) b: |; [ - * TO CHANGE.
! }. `* X# d# `! i& B2 P9 H - *
& u1 x6 ~, W5 ~4 f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; z5 y, g4 S' r1 Z, @
- *
, ~; q& j+ H9 c/ L) w {5 P/ m* q- x - * This program is free software; you can redistribute it and/or9 V1 z6 a0 n& B2 k! B, Q# b6 f/ V
- * modify it under the terms of the GNU General Public License as
5 ^8 w* \. ~1 b2 V, w5 Z! q/ } - * published by the Free Software Foundation version 2.
E; Q2 T" l$ n - *
# E3 Q3 a7 ?; R( l' k; K' {# Q K M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! u. a6 }( X: n: ~ - * kind, whether express or implied; without even the implied warranty# R; C$ x7 V, ?1 t- _9 z( K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 _; z+ _4 D! q N* X- T9 ^ z - * GNU General Public License for more details.
1 L8 @5 U4 F6 ^ - */
' N+ w/ H2 z' H: j, d+ @ - % U: i7 O% s5 ^& t7 S" F
- #include <linux/module.h>
# V l% j6 e7 R8 H% w* D - #include <linux/init.h>/ O8 U0 q$ V1 e' }
- #include <linux/errno.h>
6 \. [* v" J0 J% @ ?& J - #include <linux/types.h>9 V5 b1 e# b2 `. |* y
- #include <linux/interrupt.h>5 \2 p' ^- j( S/ w$ e5 I# ~
- #include <asm/io.h>! s$ ~! ~5 k7 p. A8 g6 _
- #include <linux/moduleparam.h>! B) f L4 T. s9 L8 ~4 W
- #include <linux/sysctl.h> o: W" h. T; j3 w( |
- #include <linux/mm.h>
4 G7 y) [4 v/ R% Y) t - #include <linux/dma-mapping.h>
! p7 g! L5 W( V; R; F( z7 b
3 @0 ]# a! E9 k6 N1 x- #include <mach/memory.h>5 R) y' B" n( O7 p" v2 o; j _& I
- #include <mach/hardware.h> I8 s6 h6 ~. c3 O4 E, x
- #include <mach/irqs.h>
1 v& `. Q& C& A- Z1 ` - #include <asm/hardware/edma.h>8 v- j5 ~, K/ O, Y
- ' A3 b* V# |4 f2 c/ t9 @. k( C
- #undef EDMA3_DEBUG/ I4 e( W8 t0 r( U; l
- /*#define EDMA3_DEBUG*/* {5 O, Q9 R' I' ?3 R+ M
3 }& `0 W" g( L6 i+ Q- #ifdef EDMA3_DEBUG ]% a8 U# A9 {/ x3 H) N6 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 F9 P6 a [5 b$ E( c, e2 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" G6 _8 J6 _ C, y8 y0 h; d2 k; V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; X& i1 X. ~0 N$ R% l2 @ - #else
9 n" M& c2 D. [/ G - #define DMA_PRINTK( x... ), F* E; f' a7 e j8 u; l
- #define DMA_FN_IN
1 e. N( E0 d; Q4 a/ G8 U - #define DMA_FN_OUT) V3 ^& X, R1 o ~
- #endif
+ }7 T s+ f0 F3 L' _
/ g z8 L" t( K" E) }+ v* {- #define MAX_DMA_TRANSFER_IN_BYTES (32768) E8 m8 l3 |0 m
- #define STATIC_SHIFT 3
0 K2 r& p5 o" u: K: | - #define TCINTEN_SHIFT 20- E4 s! q4 t0 z7 o
- #define ITCINTEN_SHIFT 21
* F' Z' L) ?1 p) l - #define TCCHEN_SHIFT 22
0 `3 S, Q) r1 q7 s4 s - #define ITCCHEN_SHIFT 23( F" ?1 h( D; ~/ V7 K
- 3 Z( v0 o) F0 K) k+ N
- static volatile int irqraised1 = 0;' P8 V8 b5 q& w' R* N) h( S
- static volatile int irqraised2 = 0;
% t; G0 r& H# P; X - 0 ?' z9 t* E/ A3 u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! c% t; y9 N3 s* z7 {) z4 o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 l4 Q' r" }$ | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. Z% O: u6 @2 h) m6 k# Q
2 a+ X0 i, O- m8 T& ?0 y) f- dma_addr_t dmaphyssrc1 = 0;
: G7 ~; t, ?% u - dma_addr_t dmaphyssrc2 = 0;
' j5 P2 K% b" [( ^ - dma_addr_t dmaphysdest1 = 0;
/ p( ?" H1 _# V. }+ P - dma_addr_t dmaphysdest2 = 0;" d6 @* |+ o3 q% S3 j) N* |
- + z( [ T7 l- Q6 w. t4 G
- char *dmabufsrc1 = NULL;
/ s& M4 L0 z! x& W4 f6 h - char *dmabufsrc2 = NULL;: J3 a, ^) ^3 \* O- F" }; s
- char *dmabufdest1 = NULL;
8 D+ J& j2 W, J! v3 o0 G+ C - char *dmabufdest2 = NULL;" h1 `3 p, m2 H( t" f9 C G; N
- & }0 g$ ]' o! W5 ~6 T7 Z. P+ r" C
- static int acnt = 512;
! N" G h: k7 ? e Y/ K - static int bcnt = 8; j4 J% G$ r* N: A v
- static int ccnt = 8;
, N. E' ^+ g1 }8 \: C4 s( | - ( q7 @1 S# n& x# Z" Q+ ~
- module_param(acnt, int, S_IRUGO);( J4 a3 {4 T! Z& V
- module_param(bcnt, int, S_IRUGO);3 F7 ?$ w. Q+ a! u. a. F
- module_param(ccnt, int, S_IRUGO);
复制代码
" I1 i& B6 k2 q' j: `5 N( a5 N* a3 Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, I5 O7 e* p: O7 l/ l0 F- d1 x1 S5 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# O" v+ M z/ _) h; ^+ s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 D4 Y) v5 G, Z
, o; b% W% m! w8 _0 j% ^3 K0 e
, m% M! h% k) K- B/ R |
|