|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " c7 a& b5 S q1 F' M% R. L% h
- [code]EDMA sample test application* I( r8 P$ x, P7 h: n+ M
- /*: n9 r( }! h- M# R
- * edma_test.c
& s" B( V# b) @8 v - *
% F( U; z# Y4 g$ G - * brief EDMA3 Test Application% I8 V4 }0 ?: `8 h4 H
- *
4 H i; q2 G; c |( s: N% N$ Z4 O - * This file contains EDMA3 Test code.+ _( `8 s$ @( [( {8 I! x/ A% _
- *
, G5 J8 I( u! O" b: k8 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. W c* P) I/ U+ U3 ~5 z9 v+ k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ [$ X, T* t4 m
- * TO CHANGE.# Y, |, t" |" E$ E: C
- *
. m' |" K4 u, L2 z, J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- ?0 d* r+ X, G1 }9 n( S
- *
7 f$ F' ]4 ]; U6 B. @: X% p- l - * This program is free software; you can redistribute it and/or
' e( J; ^$ r( C: c* j - * modify it under the terms of the GNU General Public License as
% P2 B7 J# H: C. `0 e - * published by the Free Software Foundation version 2.& `5 S* M/ @" E# q" @" w
- *
, c( a$ d) y5 e" M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; u! E5 A+ J! A+ `- k - * kind, whether express or implied; without even the implied warranty6 `2 m1 S1 i3 C* j4 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 F1 m) o! x$ j1 t% G. x - * GNU General Public License for more details.2 m7 X# M+ ^# }) F" g
- */
5 U$ E* ^, ~: g# {/ ?9 a) H
& I$ o+ ~- P8 E4 u- #include <linux/module.h>
* K) s9 \9 t( R: g* F0 F$ O- Q4 w - #include <linux/init.h>
& G* `5 J; a( E* O2 g - #include <linux/errno.h>
; c) A/ P2 u/ z1 k: [. W% X - #include <linux/types.h>2 [& z7 b0 Z( V1 g
- #include <linux/interrupt.h>
* f1 k- Y' O/ [3 p - #include <asm/io.h># H5 M) l7 @" ~. ~' I
- #include <linux/moduleparam.h>
* Z+ Y2 Y, C- _% x6 ^ - #include <linux/sysctl.h>
3 Q }6 J& ?0 ^+ g; l1 I1 O - #include <linux/mm.h>5 |- T/ m; F- e* e% Y& }
- #include <linux/dma-mapping.h>
" C( k0 ~- ?) R% Q. D4 p" Z - 8 L5 @$ S6 y8 R0 o
- #include <mach/memory.h>1 z0 g) D a) `) S( l4 a, h
- #include <mach/hardware.h>! c+ q& V% D1 P+ \
- #include <mach/irqs.h>: z. Z: O# E9 x! Z
- #include <asm/hardware/edma.h>
( R1 ~2 V2 Q- a2 Z# ?; k - 4 }; Z3 I3 L/ T v; ]9 A2 b4 F
- #undef EDMA3_DEBUG% C) ?! K& I% q1 s* |/ x- W
- /*#define EDMA3_DEBUG*/
0 L) [& I3 X8 J! P3 ?
% K6 S/ J- _8 D' G( v9 H+ `9 |- #ifdef EDMA3_DEBUG
( V$ W& o# @7 J$ x% T4 u/ W0 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ I @0 a+ N p1 t$ ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), Z2 ^) \$ o- b8 N. r( ~1 d3 V7 U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 l) R" b, }0 |6 L, g1 v& T/ X; N! @
- #else
c/ r( |6 U1 N" m& ]5 p' _ - #define DMA_PRINTK( x... )6 _ q" k8 ~; @+ F+ v
- #define DMA_FN_IN! {9 Z: e5 u* l7 y h! {1 K# U
- #define DMA_FN_OUT8 Y1 @* D8 f+ \) V2 A8 [# P
- #endif
5 F, _" H& S3 K- d) G- v) W x! { - 6 f% v: [* r6 d% ?( x8 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ ^4 o3 U3 f/ o8 n* S9 U2 n - #define STATIC_SHIFT 3
8 Z: S8 P, I. N, f) X. W - #define TCINTEN_SHIFT 20 Z* P6 j: q) g# D+ j# F* h
- #define ITCINTEN_SHIFT 21
: N7 J3 G5 `7 ^! f - #define TCCHEN_SHIFT 229 p |3 u4 W. p8 C5 {4 v: _3 O
- #define ITCCHEN_SHIFT 23
6 T* I- d4 c R( i; x o! `
5 R9 `8 A, [! n& l& F7 e! B- static volatile int irqraised1 = 0;
0 a" j+ w6 E/ m' g, a, x2 ]& L/ C - static volatile int irqraised2 = 0;; R' N3 ?# a# s& b$ u0 J' S
- + n( `8 ^; K( \6 R3 ^+ g5 K6 y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 {/ Q7 m) v8 s/ T0 v \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 P( O/ L6 v+ `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 K8 `( a% \6 U1 Q* I( @! Q4 f
' A& j4 ?8 g9 t+ H6 s3 R) o- dma_addr_t dmaphyssrc1 = 0;0 E! f2 `5 K0 Q% w; y
- dma_addr_t dmaphyssrc2 = 0;/ S+ e' m8 B# {' u
- dma_addr_t dmaphysdest1 = 0;% r2 _* y0 C9 s9 `* c$ |
- dma_addr_t dmaphysdest2 = 0;
) Q7 X/ H" A2 o e, C' y. K8 H+ _) E - . m* `" c4 r5 c5 Q3 d( J
- char *dmabufsrc1 = NULL;
/ }0 {: H4 n/ y) C. n - char *dmabufsrc2 = NULL;3 i& ?- j( G7 P9 R7 a% ?" i# c
- char *dmabufdest1 = NULL;6 {1 S! h9 W8 o1 [9 `! P
- char *dmabufdest2 = NULL;
/ g* n9 U$ t* x$ d) y+ n/ I C) o
. o% p& w: J8 s5 M* C9 [' J- static int acnt = 512;
; K3 T& R4 m; u9 m+ l. E6 t - static int bcnt = 8;/ |8 k6 }) c' b3 a7 s
- static int ccnt = 8; T' i, M- I; }: f( m
8 ?) R4 w; E2 `) q+ f/ K, \6 t- module_param(acnt, int, S_IRUGO);
/ M/ d _) f+ I# r4 | - module_param(bcnt, int, S_IRUGO);
. a, v* L* u6 C" G; e! ?" ~2 ? - module_param(ccnt, int, S_IRUGO);
复制代码
( I0 Y( f$ {9 N; D" Q1 ], q1 G+ D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 u- W" p1 B X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( ]; V) ?. i7 Z- y, [3 Z% B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 `8 r& Z5 o2 M7 N8 P
) b* k [9 m! S5 d9 `5 ?3 g4 F; A+ a
/ h) _' L& ^% @1 s+ U1 N8 w |
|