|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ N4 }2 e8 i% d* W$ n8 w- [code]EDMA sample test application
5 G& @- H7 r$ _ - /*
/ W% b+ ~, f5 R0 J9 G- ]6 B3 r - * edma_test.c
+ T) H& D* z4 I+ a M: e - *
2 o* i% C5 V7 I" s2 @: R - * brief EDMA3 Test Application
$ Q" y. R" S+ `* R% Y. ]/ q - *
, O6 R C; J9 D, I/ X& |2 ^ - * This file contains EDMA3 Test code.
* V5 ^ I8 D9 x( X - *
E/ |( { D& u, y+ b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" J! Z4 }9 u! G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 i4 y \5 o& j" X- q5 V! I& e
- * TO CHANGE.
# b+ H3 Y. }, ]; D+ W, O - *
) @1 ]+ j/ G- u, W: R0 k# d5 R6 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 L4 ?: |7 g& O! R: e, K4 e
- *
5 l ]4 R \- ~! {/ p! {6 S4 L - * This program is free software; you can redistribute it and/or" _# V+ d2 F, f" v
- * modify it under the terms of the GNU General Public License as. g6 z5 w& y( N3 I) l! A0 [
- * published by the Free Software Foundation version 2.9 L; l; E9 s" V! C, V6 i# }$ p, x
- *
4 ~9 S3 t3 Z0 R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 J+ j- k% s# b/ O - * kind, whether express or implied; without even the implied warranty9 U( v+ ?* A# M( e* Y; i( [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; V5 z: k8 X; b - * GNU General Public License for more details.
7 n- b) ]- v r. f) V6 I( r - */
. H( ]* ]& e+ A! \ Z) O( T4 ]
. d/ o% t$ i9 z- #include <linux/module.h>1 ~1 f! [% u6 c- G9 X2 P) v
- #include <linux/init.h>
. |4 T. `) T& i; D0 j2 R - #include <linux/errno.h>
2 M3 [' c& K& c. ^2 S - #include <linux/types.h>3 ^6 @% [" i1 H9 p* j( m, G! `* ^
- #include <linux/interrupt.h>3 f: q+ ^' ^ }0 g6 b* s
- #include <asm/io.h>
" N& G A8 u& m% Q8 b8 o - #include <linux/moduleparam.h>
6 t# B' u: B" F2 ] - #include <linux/sysctl.h>
' R% }0 Z/ D+ S% A# T" J1 e- G* u - #include <linux/mm.h># ^ i0 [5 b7 P T) O
- #include <linux/dma-mapping.h>- ~8 X% @( C4 m5 ]3 P) h
. _$ x$ \! i) Z& G" M- #include <mach/memory.h>
" E/ ]* {$ V& D% Y - #include <mach/hardware.h>9 d0 r7 b0 D1 R' U8 S0 P5 K
- #include <mach/irqs.h>
& O# `9 r* S+ [* y - #include <asm/hardware/edma.h>5 S& g1 N* h0 Z6 R* }; n! c
- 3 g8 u* o( N: C2 P/ h
- #undef EDMA3_DEBUG
; x) q* q# J6 C* o4 T0 T - /*#define EDMA3_DEBUG*/% D3 }/ B5 W" C2 [, d6 t
, p. M# ]4 \, f, d1 ?- #ifdef EDMA3_DEBUG
% W+ g" z1 G$ p8 i& ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 h/ g$ p! V1 ~" j$ a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% m' r; c6 x3 \2 n, ^* x+ s' G" [3 B0 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& b4 ]8 M6 W+ b
- #else
! ]# K' w5 F, [' `$ f, G/ H) |/ U - #define DMA_PRINTK( x... )
' q3 d. c. i* P. K2 V2 c$ f - #define DMA_FN_IN/ J8 d, v% S, R6 |
- #define DMA_FN_OUT
. K; k+ Q( x( P. D3 y - #endif
* a o" {& u- y" D: [
1 g! \. v# S& A2 k; c, b: F- h% M$ P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 b9 @2 [1 L7 O; ]2 _3 \# s/ ^
- #define STATIC_SHIFT 3
" m) i" I" t' Q {& g% b; d - #define TCINTEN_SHIFT 20
! }% ^) T; v1 E: F% P - #define ITCINTEN_SHIFT 21
( z" s* e& D+ N7 x - #define TCCHEN_SHIFT 225 s, S) z- L, G% n6 n( X
- #define ITCCHEN_SHIFT 23
! P* `% O3 r2 o F$ S O8 a' c# `
( a9 S% V9 i& U$ `- static volatile int irqraised1 = 0;! b. R4 j) ^8 A
- static volatile int irqraised2 = 0;
! i$ o8 J' C* u6 g - , w. ^$ ^' q3 d! o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( l* c% G6 E2 h/ J/ v4 o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); E9 e/ A' E& e; _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Y1 x1 K- h/ G' I7 u
- . [( {. g6 ~3 j( ]& \2 _9 }9 |
- dma_addr_t dmaphyssrc1 = 0;
) M, }: r! ~4 g5 L. N - dma_addr_t dmaphyssrc2 = 0; {( |3 A3 K! l8 H' i+ R6 V
- dma_addr_t dmaphysdest1 = 0;/ j$ Z* N) Z/ P1 @+ m6 j
- dma_addr_t dmaphysdest2 = 0;
8 Z% F$ n& |( H p! B
4 t. F$ k3 o E- char *dmabufsrc1 = NULL;7 s4 N" `, ?* U% P K; m- s2 a
- char *dmabufsrc2 = NULL;
9 C3 F% u. D% n7 l7 f# b# ]9 `1 F+ y - char *dmabufdest1 = NULL;+ Z& f8 `7 s7 @ m; B% [' ^' ^9 \
- char *dmabufdest2 = NULL;( B) q$ V _! n6 K3 q
- # ?2 \- {: b9 X
- static int acnt = 512;
% v3 B" m0 ^3 N - static int bcnt = 8;
, a3 J* l e9 l7 K8 b4 h9 c - static int ccnt = 8;
$ D, l# `5 {/ f - / k. \* p& |5 c! V
- module_param(acnt, int, S_IRUGO);- `+ u) E/ `/ u9 V X, R7 f; x
- module_param(bcnt, int, S_IRUGO);
4 `; y0 L0 D; E - module_param(ccnt, int, S_IRUGO);
复制代码 4 Q% t: x6 q3 u; J+ G* i9 s
- i0 a3 G; @% }7 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 n( C/ `) }( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' L- ]* ^- O. E& \9 Y# v8 h. O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 w, u4 a& ~1 h% t1 Q, W
! s7 s: V0 ]6 b8 ]" U4 k P$ N3 |& V3 O& X
|
|