|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( I% V" U( @' I- Q/ H- [code]EDMA sample test application
' Y! X, u/ U0 d1 E" W6 X - /*2 ]2 W. W1 ~3 p/ S% t/ w9 J5 H4 r
- * edma_test.c" x2 p+ ~8 T- s( U7 z
- *
9 F( ~ l3 ^" t% i - * brief EDMA3 Test Application- ?6 n$ E; P o5 h, J0 U* Y3 S
- *
4 M/ H9 \0 X2 Y7 ^( Q - * This file contains EDMA3 Test code.
?" h9 j* T3 B$ y/ g - *
; X0 G5 n/ k# `/ A. i; W9 R2 q6 Y3 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
V# D& ~( G, S8 e5 n) n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ \5 W) D. T' W3 k% `- S
- * TO CHANGE.
9 v/ l) J( d7 V8 V4 g1 G: g0 z - *# Y3 Z) a' i) z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 Q, r3 t* w2 u" u4 }/ ~" V - *
2 F# A1 T/ ]7 u, q: D - * This program is free software; you can redistribute it and/or
3 O% U ], S+ I: L* k F - * modify it under the terms of the GNU General Public License as, v% X8 F9 n: a- k) R8 l
- * published by the Free Software Foundation version 2.& [6 F2 [) s6 t: a
- *
6 t$ q1 U0 F9 _# J8 S0 H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ S1 G9 ~( c9 @$ X# O+ A" j2 z - * kind, whether express or implied; without even the implied warranty2 T: [3 W n- p3 x7 Y6 z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% w2 G9 M2 U+ H6 ]* S8 E - * GNU General Public License for more details.
. K! W3 V# M) G8 K8 z8 @) a# _ - */0 I( w6 K3 ]' ]0 v, b- b) w7 ~
8 `, d. H+ A9 w7 T! @# _- #include <linux/module.h>
4 y y! r. F9 B( U - #include <linux/init.h>
; h) c7 @/ _" ~* P9 v; W - #include <linux/errno.h>* N0 R$ Q2 ^' v
- #include <linux/types.h>& f5 d N4 o( A: ] E
- #include <linux/interrupt.h>* n, y# m5 z* g# s4 T9 \. O
- #include <asm/io.h>
$ W! D; B. @! A d8 c - #include <linux/moduleparam.h>
3 l1 q( t% O- O. Y8 N1 R1 ~ - #include <linux/sysctl.h>
3 B; q; C. j, k& ?# m - #include <linux/mm.h>) U; o2 g4 B0 N! w; f
- #include <linux/dma-mapping.h>
# z% Q! `6 I H3 g' K" U v - * s9 S, l5 I% r0 n; b6 j, q# M
- #include <mach/memory.h>% H9 D5 s3 t2 ^0 m' t3 |% Q4 i
- #include <mach/hardware.h>1 T* |5 {0 ]2 P3 L7 O' J
- #include <mach/irqs.h>
5 c# ?5 l8 p9 R- D9 s - #include <asm/hardware/edma.h>
0 M0 {7 @ o$ O# ~ - : n1 p/ Z% E# b4 J* Y
- #undef EDMA3_DEBUG
! T S% R1 x' w; U$ K Z - /*#define EDMA3_DEBUG*/
7 C% k2 V; H$ B2 _ z
' w$ Q0 Q9 h$ [6 z5 c% g- v- #ifdef EDMA3_DEBUG" }# @8 c- W# Y1 h' X- D. s: `6 B: H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 J0 E2 Q; N/ J) b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ r/ d, S" Z b% _& j" r7 H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 r. n6 O% @) e - #else
' s- o1 x1 g* g* N4 J5 I - #define DMA_PRINTK( x... )
, n/ _. |# W, a+ }, B/ ^" Q - #define DMA_FN_IN
2 \( P8 y+ g, ]8 X8 F5 \. I E - #define DMA_FN_OUT
M% w R9 L2 w- B: O d$ q - #endif
* x+ i9 ^- L1 X1 d F, m - ' T. r; H& H/ W3 I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 s5 u3 ~9 ~; F" W
- #define STATIC_SHIFT 3
# t/ {7 R9 C# |, \) O8 ]4 [5 I - #define TCINTEN_SHIFT 20
Y7 A$ ~& s( p; W- d4 F E1 @ - #define ITCINTEN_SHIFT 214 C8 x) q" G+ x$ W7 }3 J
- #define TCCHEN_SHIFT 22
7 `) \& J' d8 Q, e2 H - #define ITCCHEN_SHIFT 23* |4 O( ]$ X- }5 g% u1 y+ [
4 N; ^( X* N8 P/ i- ?9 A- static volatile int irqraised1 = 0;( f$ @/ I" e5 W3 j$ r
- static volatile int irqraised2 = 0;- H: ]( I0 X) _8 X" k( p5 P
0 S. X2 P3 h+ C/ h- m: O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 Z" p' b' l( T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ^$ f- n; z. v! K2 h. h0 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ~5 z! P( Q# T% K5 d( G5 {
/ a) A5 Y8 B- F. O- C- dma_addr_t dmaphyssrc1 = 0;
6 f- t2 C& H0 B9 t) \4 }' d( L) N - dma_addr_t dmaphyssrc2 = 0;, U! d* Q: {6 {1 p% c, l
- dma_addr_t dmaphysdest1 = 0;! |1 Z5 \7 O! @4 ]% w8 M, x$ n
- dma_addr_t dmaphysdest2 = 0;
/ q9 x* ]( W' Q& l. P$ d - $ r6 R* V: E3 u$ c/ g
- char *dmabufsrc1 = NULL;1 s4 D# g' G6 F" d/ `7 b
- char *dmabufsrc2 = NULL;5 A X% E! i, D6 n- |! B
- char *dmabufdest1 = NULL;& h) Q* y9 v4 W
- char *dmabufdest2 = NULL;
2 ^" r$ M0 Z/ @0 s: R
3 i" R3 q8 h7 w0 J! [6 N- static int acnt = 512;8 G# x) M: Q( x3 b' d
- static int bcnt = 8;
$ K6 S1 s" [4 I/ v' p9 N8 B - static int ccnt = 8;
3 }) Q7 y) o% t - - G& p3 D/ g; I: x
- module_param(acnt, int, S_IRUGO);
; n0 U, y! F% \1 J% w# T* l - module_param(bcnt, int, S_IRUGO);
% T" Q1 P7 G) O5 x$ ]. g - module_param(ccnt, int, S_IRUGO);
复制代码 s: x: D1 {% D6 n5 i7 S
# u8 o, Q1 {+ i6 Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 r' L) F5 W+ u$ e! o6 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& p5 Y5 O v7 j% X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 |! ?; Z1 @' r* u% S/ C; G
" M9 c+ H; y5 B, q, ]. X. G+ y) s( D" S0 e
|
|