|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" v. O! R; v6 v, s: Y- [code]EDMA sample test application
7 a- P- F! ] V - /*
0 @/ k8 ?; `* s) C - * edma_test.c' `$ E! S0 E7 A% S
- *
; N& g3 S1 @7 I# H% z; c8 R - * brief EDMA3 Test Application
! ^( k& h2 E+ Y/ L) J8 F& F. g - *
0 ?# f: _/ {+ X$ O - * This file contains EDMA3 Test code.
5 Q3 J! h: X. v - *
/ o4 V a- J- M, a3 ]: B" l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, F$ s/ S5 [/ J4 [ U4 ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- S4 f7 I; }' h2 S0 f! t
- * TO CHANGE.- O7 f7 w: o! G% r: k
- *7 l% V* V0 B# a9 ~! J; a" O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 M4 n6 S q2 z: H - *4 R' J" `6 {8 x
- * This program is free software; you can redistribute it and/or6 @( i- S2 V, O' n5 V/ A
- * modify it under the terms of the GNU General Public License as
6 L' h6 x- A% ?1 h - * published by the Free Software Foundation version 2.0 n; x P0 E# i
- *' ~+ l" d: t8 e+ p5 x: s6 m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ^/ ~# F- Q$ Z3 z
- * kind, whether express or implied; without even the implied warranty. i; I9 M/ u/ X3 ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& L2 `7 h1 Y( n% w: g" j% o - * GNU General Public License for more details.& s+ K4 E8 \% j0 }, V# M
- */
$ i- a' ?, F0 A0 {! B
# |( W6 f1 e- z5 x3 z- O- #include <linux/module.h>8 G" q0 A& S9 c2 t, Z( _* c
- #include <linux/init.h>/ i' r4 V4 P* c0 c# }, Q" f0 |
- #include <linux/errno.h>' {0 R# m% t9 `' s7 b
- #include <linux/types.h>
% ~8 {* Z. ^8 V) ^/ o+ X% J - #include <linux/interrupt.h>
/ q* r6 _, D, m - #include <asm/io.h>! W2 b' ~+ {" G, S* @: \
- #include <linux/moduleparam.h>
' [5 V4 Y( I1 N - #include <linux/sysctl.h>( ^ E! f- y, e* Y4 [4 m( L" Y- R( J
- #include <linux/mm.h>* f9 G v' E0 K( U# S+ x! W
- #include <linux/dma-mapping.h>' e5 n( J1 X# h( b( e7 R$ u
. o* a, E2 {* M; b4 I0 P- #include <mach/memory.h>
4 U3 j. W F( j" ?" h2 j - #include <mach/hardware.h>& u ~) r6 v' w( S
- #include <mach/irqs.h> ^& g( V7 S; }) K! j" o
- #include <asm/hardware/edma.h>" y" u2 c- G' c" T( t N; s8 R
/ Q7 f1 g- W G+ l/ K( _2 [4 R/ {- #undef EDMA3_DEBUG9 j" n7 o& A- n* p9 {+ ^
- /*#define EDMA3_DEBUG*/' X; p0 f3 m8 X& B
- / [8 a" k" G+ ~8 A3 A
- #ifdef EDMA3_DEBUG
5 C! W% u! W+ @$ D* g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* ^% c7 U3 B* Z1 E5 S/ ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- X' u; r- J. {; Y2 r. q o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( W2 F. |4 m; z* f! I D - #else
, {# {( w- }2 ^/ \ - #define DMA_PRINTK( x... )- V0 ?2 f& [: p8 R0 p8 e
- #define DMA_FN_IN; V( w0 m5 _( u9 t* z( V+ u; T
- #define DMA_FN_OUT
! G# R: h* b7 h1 Q+ `0 |7 I - #endif
: @5 S% A9 G. D0 T - v: K9 x+ [ Q5 N7 Q$ ^, K+ [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* J6 N3 j! |+ f8 s- u0 c: ]
- #define STATIC_SHIFT 3/ a9 Q! d; k$ | p! B6 R' x. K% [
- #define TCINTEN_SHIFT 20 v/ h( T8 e( }6 W' y! \2 t1 C6 f
- #define ITCINTEN_SHIFT 21
' |( o1 _* E8 m7 P4 U5 _" w3 f4 O P - #define TCCHEN_SHIFT 222 r+ {/ m3 j1 h! h+ c# x1 s6 ?
- #define ITCCHEN_SHIFT 23, R6 p. a n3 X) L
; I6 T7 [3 Y& A6 y( C- static volatile int irqraised1 = 0;
- \ r: {" g _5 F - static volatile int irqraised2 = 0;
- H9 k& W8 O- X
0 f/ S9 A" J4 X' X; V+ v2 [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 M, L$ k3 H4 I+ k- l5 v. S3 U7 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% n* ^6 }1 E8 i Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; d9 K4 @/ G( i" w2 W
! y' N2 h3 x" a9 K/ O- dma_addr_t dmaphyssrc1 = 0;
1 c. [6 @& C1 P9 d% U+ A - dma_addr_t dmaphyssrc2 = 0;
" Y6 W* R/ r# E3 V - dma_addr_t dmaphysdest1 = 0;
4 W1 c- }' ?$ T) C - dma_addr_t dmaphysdest2 = 0;% g( v2 Q$ H9 \- L+ h& I
- . G0 Z- E$ G. J1 n2 q
- char *dmabufsrc1 = NULL;- z% F1 w' m7 H; J, o: @$ t
- char *dmabufsrc2 = NULL;
4 J7 ~ _9 E5 R4 e - char *dmabufdest1 = NULL;
* v) C3 E- W2 ?$ p W - char *dmabufdest2 = NULL;
4 v! j) ^" D$ ~' f - 1 N. |$ s, ?1 B- c' v6 h6 s& Y- E( S
- static int acnt = 512;
7 r0 g# H# [' M+ j - static int bcnt = 8;
9 d! N. S3 Q2 T4 Z# s2 O x' p; Y - static int ccnt = 8;
, Y- U! h; r7 w0 T, Y6 J# A5 N8 v
/ W6 q n) M. H$ ]( T+ f" Q- F/ F- module_param(acnt, int, S_IRUGO);
8 t* ]! O9 ^. t4 Z - module_param(bcnt, int, S_IRUGO);
3 S9 |2 @; N4 J: l" ] - module_param(ccnt, int, S_IRUGO);
复制代码 4 S) L8 V4 E& ^; n/ J! o+ c/ N
5 o" _, O! }& W! s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 K$ X# l4 B/ i- e! M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& q7 N$ H4 i7 R) q5 z7 X! D$ K# q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 K* ^& Q& a; @
, u! B' m9 L/ _' [ s6 w- V; g1 S7 J) J9 p: Z1 _1 Z
|
|