|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & h% A% i3 ^, k0 E- [; l: M; z
- [code]EDMA sample test application
3 f+ s0 Q) \4 e$ h& X - /*
8 P7 { C- {2 I9 F5 u: V7 g - * edma_test.c! t9 X9 F a! s6 P, a |- C5 o" v5 g
- *6 D9 v3 i5 j1 `0 a3 f6 u$ M, O2 X
- * brief EDMA3 Test Application7 u$ _8 I; B: y/ B& ^
- ** w1 K; G. w' |* |
- * This file contains EDMA3 Test code.
* n5 B, |7 K# k$ E9 w6 \3 d9 v- F' D: s - *
: q) g N y' m' M. ~/ M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE z( ]0 [ f7 S0 E, H/ R. n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
{# Q$ u/ z0 X7 |. V) a# M - * TO CHANGE.
8 t* F. U0 q% q1 @* Z' L. g - *7 |+ D5 h1 e( W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# n) R. X9 i" i# _2 d
- *
7 m2 L5 h2 r5 O1 c, G3 v8 Q$ r. ]# \ - * This program is free software; you can redistribute it and/or6 s# c( o% G: P. y. {4 T6 H
- * modify it under the terms of the GNU General Public License as |/ _$ w$ d( x, C. b
- * published by the Free Software Foundation version 2.7 B. e. G4 V; x: g1 h
- *: W% e, q4 ~% k* f8 z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 j2 ?9 `* u1 l' h6 S* l - * kind, whether express or implied; without even the implied warranty" q2 Z+ n& n# b# g- n0 L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 x& }8 n9 P s5 _' b& w q - * GNU General Public License for more details. Z- e3 ]+ ?9 J( N1 D
- */
+ t7 u' C# ] E5 V. W1 L - % n$ Z+ C! N" h8 @( {0 _, w
- #include <linux/module.h>
( A# d$ f7 g8 I; u0 L1 t7 Z - #include <linux/init.h>
( y( H' \8 E5 @6 C2 S) ~& ` - #include <linux/errno.h>
0 S" C9 s7 J- p# B/ P1 ? - #include <linux/types.h>
A. V5 G' y, J4 C( b: P - #include <linux/interrupt.h>
R* `( @7 ~; j% E6 J( w - #include <asm/io.h>
; V$ M0 B* G0 U7 w - #include <linux/moduleparam.h>: w( K- B) N7 ~+ z! a6 m, }4 M
- #include <linux/sysctl.h>
2 F# Z' ^4 c& E. d/ d - #include <linux/mm.h>' x3 ?/ t# _( ^; r
- #include <linux/dma-mapping.h>
/ K, U# e) R8 t+ | - , {, B. `, h. f* z" S" D
- #include <mach/memory.h>* G7 s* E3 h, d
- #include <mach/hardware.h>5 A) u+ r0 _+ }! a& m+ \
- #include <mach/irqs.h>, w* i: ~* s+ v; \6 R
- #include <asm/hardware/edma.h>
; R8 Z, Z. o# x - 7 q8 m& d( L8 i; }" G2 S7 n' [+ J
- #undef EDMA3_DEBUG
' b3 w$ W0 {/ g! Y) X5 S3 e0 o# w - /*#define EDMA3_DEBUG*/
8 X& p' ?. V X: J) `( ] - $ H1 y+ c5 B6 \ Z6 k
- #ifdef EDMA3_DEBUG0 K4 s2 N; x# ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 s5 g$ l$ m; o2 C$ ?# m# k- `, q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ ~! z+ i+ ~6 E/ J, [) Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' Y: M& |. K9 ?2 R7 M0 Z3 P
- #else
; d" P) X0 t) p% R. e* B - #define DMA_PRINTK( x... )
) l- L1 o7 T; N K$ |( B0 Z - #define DMA_FN_IN
+ n) A+ C3 i0 H$ N - #define DMA_FN_OUT& G& G& ^8 A! w D/ ^+ L" W; O0 b
- #endif
$ Z* P( `1 V8 @: G' \( | - % a! K5 C) `: q3 d: O# x. P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ y% S% {7 K( }6 F+ L1 l
- #define STATIC_SHIFT 3# X0 M/ f# @% \8 W
- #define TCINTEN_SHIFT 202 P( t8 C G7 n1 b! P
- #define ITCINTEN_SHIFT 21
! ^! U. Y4 R5 K" A - #define TCCHEN_SHIFT 22
& Y1 e$ i! H+ O" D9 X8 Y, C; c - #define ITCCHEN_SHIFT 23
5 W, F5 I/ y" x+ [& ~5 U - 3 ~' {$ y/ Y& s! E
- static volatile int irqraised1 = 0;; j6 V7 b; R8 I
- static volatile int irqraised2 = 0;( s5 r: D/ ^) S' h, V* q- \
' `4 v: e# G T; ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ O2 k) R1 S& M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 P) X! b: ~! {0 s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' V2 N( Y) n, P# |- C% e
- + ~6 v* C- _2 h( A
- dma_addr_t dmaphyssrc1 = 0;
6 @" o4 l1 h" j: [$ B b% k7 K& h; B - dma_addr_t dmaphyssrc2 = 0;! R/ n7 Q0 [, \& ~1 r
- dma_addr_t dmaphysdest1 = 0;
: m6 R1 K" W+ y! ? - dma_addr_t dmaphysdest2 = 0;5 D+ x7 z9 n5 g" U0 `( P' y
0 M% i/ E" j6 o$ U3 I2 u8 e/ G1 i- char *dmabufsrc1 = NULL;
6 w# F+ {: ^9 V3 a2 |- M- k8 ? - char *dmabufsrc2 = NULL;
# J1 i5 l0 F5 J7 | m4 a! g - char *dmabufdest1 = NULL;
- p9 q8 I9 P9 i - char *dmabufdest2 = NULL; h& w3 W% D; Q' z$ M$ z; t
4 s" i% q B# l+ j# N, g) t3 D- static int acnt = 512;# H1 R5 z1 L0 h0 a; s
- static int bcnt = 8;1 U; A! {( e- A, a& F
- static int ccnt = 8;
9 y( I5 I- N( ~
! `) L( r! a+ p& |, I5 d4 \* [- module_param(acnt, int, S_IRUGO);7 f6 A4 c- Y. G& @) M- w/ @9 O
- module_param(bcnt, int, S_IRUGO);# ^7 v# W8 u, O1 u
- module_param(ccnt, int, S_IRUGO);
复制代码 8 J$ @" l( u! I4 f! n8 g @
2 A: `9 U. G# t; j, ?0 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 [7 g( F# I' l" `% d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 P; u2 d9 e- n' ~- K) T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ d' l6 k2 o: s1 H1 v
# C9 n/ ]2 W Y) G+ J; ?3 y, N2 g6 J8 y& J
|
|