|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; a0 g/ k, @7 W3 C$ h; g- [code]EDMA sample test application
' z5 ~5 X% l) n* }, x - /*
3 i4 r; Z( o9 h6 G" a - * edma_test.c$ G6 K: W' F' P$ {$ w
- *
1 q$ v( {1 f# D- u' R. x - * brief EDMA3 Test Application
2 ^) [- ]' D. {* B- ~ - *
8 o' C1 i+ j: t - * This file contains EDMA3 Test code.
6 s* V6 y# j' u& O4 I/ _ C& G - *
6 s- J& m6 L8 w9 ~. {7 [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) v4 p4 G1 t, Z; p2 r0 B! {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" V( C) F& ^3 N" L: A! | - * TO CHANGE.; J* |2 J) m, H5 I
- *
3 b. `2 |; l7 } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* ^0 [4 S9 N) D; { - *5 A- u0 q; l+ |# K( j' r5 }
- * This program is free software; you can redistribute it and/or, e Q* ~: D0 d% e2 P7 l, z' z+ Q Z
- * modify it under the terms of the GNU General Public License as6 z( y- U- J+ s0 W: v
- * published by the Free Software Foundation version 2.
% t+ ]8 u% ]& k) U - *; z# J' O4 p: m: ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 @. ]& X3 ^) \+ {' h r
- * kind, whether express or implied; without even the implied warranty
# C+ X% l; l( T! m9 ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 Z7 O7 {# K0 `3 T
- * GNU General Public License for more details.; ]) o' j# U$ ?' f
- */
' n1 C; C5 k0 b3 D# s0 {. O - - C, X# n Z& h: d7 e
- #include <linux/module.h>) b: O! y# E) y, t m
- #include <linux/init.h>) r$ x4 l7 d, n& M8 }
- #include <linux/errno.h>. o( [* L O+ @! `% X
- #include <linux/types.h>
, z2 d0 H* f" k - #include <linux/interrupt.h>" N/ G8 x( R7 D: k# W U+ \ _
- #include <asm/io.h>
. T! n8 z8 O _2 i; A - #include <linux/moduleparam.h>( l5 I% m: y, r A9 Y# V% t
- #include <linux/sysctl.h>
% W; s! F$ {- D. a$ D( J. ]4 F - #include <linux/mm.h>" N8 t3 i5 o6 _% ^7 S2 p
- #include <linux/dma-mapping.h>
# s0 d+ b' y: W9 `/ \4 P
) a: }# R5 h9 _9 R4 \2 F/ @4 i) ^5 \- #include <mach/memory.h>; U0 o. v! a( s1 h2 A
- #include <mach/hardware.h>, H. S* |8 u" o1 J! n
- #include <mach/irqs.h>% ]9 w2 x% u6 R$ G+ x8 z8 h+ ?
- #include <asm/hardware/edma.h>
& ]+ u7 | a. j# e& C - ' h N3 g7 ]; L
- #undef EDMA3_DEBUG7 s5 O5 X% L0 N, U% `3 ]* H
- /*#define EDMA3_DEBUG*/
- {' `1 O# X" M) F7 L% [" } - $ o% G8 A; v# r0 [
- #ifdef EDMA3_DEBUG* h a' H' K& `7 _# q x! z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 P! ]9 X3 h+ C% S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# b6 T+ ` D; e; ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- X# o ?0 t# C, U1 } - #else
( X8 o5 `! p: X% g - #define DMA_PRINTK( x... )
; K" B( G: k; |& ? - #define DMA_FN_IN
6 ~ l4 [! r2 B- g) Y- J - #define DMA_FN_OUT
+ D% r- q7 C6 a6 N- B - #endif$ [7 u5 O+ \! j4 h$ L% w
( A- E- L8 V0 A- #define MAX_DMA_TRANSFER_IN_BYTES (32768). n& O! ?. s+ J
- #define STATIC_SHIFT 3$ e9 f3 @$ X0 Q2 o2 C2 V7 h& i# o% n3 y
- #define TCINTEN_SHIFT 206 j4 i1 ]! i9 ?# \0 m$ a
- #define ITCINTEN_SHIFT 21# N& q! l9 o& i. v
- #define TCCHEN_SHIFT 22
+ G0 X+ d' X" S! ~ - #define ITCCHEN_SHIFT 230 Y& ?# v& h8 p3 K0 [: I
( Q6 s7 |1 t+ ~3 D. x" C- static volatile int irqraised1 = 0;
+ |$ [; q% v" m- V! y - static volatile int irqraised2 = 0;
, }. b# t S& N
1 e: D5 Y" s. P+ }5 U7 o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 H% D c7 d& }6 W" e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ `9 e; r9 i% n( ]) _- B3 w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ z3 r: N$ K0 t% H/ L* a: f
1 F! Y# M- U8 ^; m" o% k" y- dma_addr_t dmaphyssrc1 = 0;
1 W7 s t) ]4 {9 i3 E/ d1 L - dma_addr_t dmaphyssrc2 = 0;
& k# [: J0 A+ M- U) w2 J* Z - dma_addr_t dmaphysdest1 = 0;( W: j6 I+ j* i( p% R
- dma_addr_t dmaphysdest2 = 0;6 h& C% A) {" `& {7 b
0 Z" ^* m* H, N% D1 e0 T- char *dmabufsrc1 = NULL;
( {5 y+ V; |6 k% Y% H9 W- D; z3 ^ - char *dmabufsrc2 = NULL;8 L( s) T" Q8 `" C7 d6 X
- char *dmabufdest1 = NULL;0 L/ }1 d8 i7 v# E" h8 R t
- char *dmabufdest2 = NULL;
8 E" t9 n/ {/ R2 i/ T0 ~
, S9 C, g& s3 B+ w- z4 n- static int acnt = 512;- N- u& |0 Y3 E& x% z
- static int bcnt = 8;
- p i3 n: h6 x - static int ccnt = 8;5 _! h* A; W9 b7 l+ `) U
4 i" l3 l9 C) o ` v- module_param(acnt, int, S_IRUGO);8 \! o' d W, _ _% h' I, F
- module_param(bcnt, int, S_IRUGO);. ?/ m3 a" C5 _3 k
- module_param(ccnt, int, S_IRUGO);
复制代码
% f0 n7 a& x: I5 D3 p" Q6 J% t
6 E7 e/ |* [* {4 ~" t9 R* G( _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) x+ S! `' b2 v: d6 ?& V8 farm-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& [# i1 i4 f4 R: r2 v" G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
C$ S6 P* @: _8 R+ N
( B% k# W2 S" c6 c5 w* I* k
+ t. X# f1 n/ T4 }, A |
|