|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - N7 l( a6 y5 R1 ^/ u4 z/ F
- [code]EDMA sample test application
- Q) D1 [* w8 b+ t0 [ - /*: H/ m8 ]% |' e ?9 ]- u/ k9 M
- * edma_test.c
6 t2 t6 x) X9 x: m( T - *# k( z$ [' D2 z1 P7 j5 ?; U" ?
- * brief EDMA3 Test Application1 j( M; X" m* a
- *7 J6 l0 U3 x: _$ N p& Z
- * This file contains EDMA3 Test code.; i9 T: U2 b# F' n; y
- *
! l1 U. A2 j; H z/ ?' Y: O9 ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& }% j- a' S1 g, k z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ L5 i( z y' S( w. U+ v - * TO CHANGE.+ F+ N/ ~: v' v2 H8 I5 l+ K
- *
# [: z V1 e, D# x, f' l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 O5 M! u( h# G6 X) t: O* S - *
8 z( p% a' c, s9 o e' _: | - * This program is free software; you can redistribute it and/or
o2 ~4 n9 ]( `( G3 e# ]6 I - * modify it under the terms of the GNU General Public License as- ]; u; p d' S/ N$ E$ O+ d/ J! W
- * published by the Free Software Foundation version 2. ]; C. K- m! \- T& a, G
- *
1 h/ H' h; m) Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 R# i* x$ W3 G( b5 E8 ~
- * kind, whether express or implied; without even the implied warranty
; Z4 b- G2 O2 K, J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* F! `' B: ?4 R4 n& B% i
- * GNU General Public License for more details.
1 q3 d p$ ~" g1 x - */& a1 Y N0 [, y4 ~& D3 s
: c$ j9 M* J5 l( K* w* Y- #include <linux/module.h>
8 m$ Y' _6 S; G" a4 Y* y: ~5 |+ ?5 b' } - #include <linux/init.h>9 h# l: R/ O* ^% Z9 Z
- #include <linux/errno.h># R H# B6 E( m0 A! R
- #include <linux/types.h>
' \ y+ l2 r d - #include <linux/interrupt.h>) V8 v$ q0 h; y+ X* H
- #include <asm/io.h>
* R; ?! m7 \5 } - #include <linux/moduleparam.h>$ |1 L2 H ^8 U
- #include <linux/sysctl.h>$ Q* z- R/ J9 C2 T" |) d* q
- #include <linux/mm.h>3 U" W2 Z- O. W2 |+ \8 ]2 V
- #include <linux/dma-mapping.h>- T+ V, X% @6 a& {
0 C: e" m* z+ A, y1 A- #include <mach/memory.h>& G: I, L5 Z5 b. t. p% L) A
- #include <mach/hardware.h> `/ l1 e7 q8 F3 @% v) j; m' m( h
- #include <mach/irqs.h> O& z9 u! ~& p
- #include <asm/hardware/edma.h>+ V% S- y& {( n4 e& k, r+ q
- ' L- q# T! O7 ?# }( e: y
- #undef EDMA3_DEBUG
# `8 d9 M* O, | - /*#define EDMA3_DEBUG*/
& V& ]; a6 R: V' @* H% I
$ ~ g& t6 `7 r H! j6 m% R' x- #ifdef EDMA3_DEBUG) D L: t' n; C0 f8 ]: x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ ^9 P* H. @ w$ S, o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 T: O% \5 o" @! o" w. Y+ t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% Y5 y! q& _' a+ `( U( K
- #else
7 C* F0 x$ Y- M; _; [ B - #define DMA_PRINTK( x... )
3 C5 Z$ B) U8 P2 i3 O2 t; M# R - #define DMA_FN_IN
! O. J L1 R" E4 N - #define DMA_FN_OUT+ K$ D4 s7 S' O2 `" m
- #endif3 f) M+ i; Z& ^
- ( L5 S0 J* T4 g7 `( {7 n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ ?0 ?5 i) x* ~ - #define STATIC_SHIFT 3# X, O% ^( ~! V0 j H9 s
- #define TCINTEN_SHIFT 20" }, F* ]% g2 u/ K' v% G9 [2 o
- #define ITCINTEN_SHIFT 215 q3 M" o/ H8 X; t5 |6 j
- #define TCCHEN_SHIFT 22) R' E6 f) ?' @8 Q
- #define ITCCHEN_SHIFT 23
/ B8 V- w6 a, e - 8 G2 U. ~+ d( D2 V& S. J
- static volatile int irqraised1 = 0;; _2 C1 c5 j* t! r8 L9 }
- static volatile int irqraised2 = 0;* G, ?( z% D; q, N3 i. D( H
6 w9 w1 u: Q$ t3 R8 b/ x7 x X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ B6 q: q6 D9 p4 c& F- m7 g3 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 U1 o B9 {( P8 [* a4 x& P8 I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* N0 T2 P& w; m A& N" J
/ G6 q+ Q7 z, t6 n+ {! u- dma_addr_t dmaphyssrc1 = 0;8 {; m: o" {: E
- dma_addr_t dmaphyssrc2 = 0;: M w! q' p* p+ b
- dma_addr_t dmaphysdest1 = 0;6 |; n2 W- l- C+ m& j% v
- dma_addr_t dmaphysdest2 = 0;
- D2 U) b1 U6 ?$ s
) Y* w$ h' I. A9 ]; _- char *dmabufsrc1 = NULL;! C; d3 ]6 ~. H K( p
- char *dmabufsrc2 = NULL;
* P& e- G6 A. l1 H - char *dmabufdest1 = NULL;
. j% m" r4 U' K+ ` - char *dmabufdest2 = NULL;) t9 r- F0 p! X1 l$ }
4 L9 \! _, k) Y! J- static int acnt = 512;
8 v( v& U5 `9 T) i" a0 ] - static int bcnt = 8;1 b) Z# k% z! ~4 l4 V# N
- static int ccnt = 8;9 Q3 R( Q% u, B1 O" N( R
1 \$ f# y4 i+ F5 r. t4 C% j9 k- module_param(acnt, int, S_IRUGO);5 f# r1 k, M& q6 `
- module_param(bcnt, int, S_IRUGO);
# G! ?7 u1 r/ x) S5 |& S5 U' r! O - module_param(ccnt, int, S_IRUGO);
复制代码
' s4 w; ~# ^$ Z2 N
' ^5 f. T! d1 C% d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( l I' H/ E& e( X! ^$ {* Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ b0 X, S1 {6 a( u( |! | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ \4 @4 h) }- w) ]
9 ^5 X' }' ~3 ?1 ^/ T3 _
, a9 z* f& N! V. O; [ |
|