|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 k+ |8 C6 y( O( d- [code]EDMA sample test application# q* d9 j, t, h( c8 y/ o
- /*
! q- `3 n! D5 t - * edma_test.c+ p( H' F- e) w1 R$ t, D
- *
) o$ V$ V- f# D0 x0 F% X# q9 T - * brief EDMA3 Test Application
5 l; t! F/ x; P7 T' M* e! B - *
, G: `% [) q6 R% W$ L; ^ - * This file contains EDMA3 Test code./ w8 b; j+ `: G: ]" a* O. w
- *
: I7 B" _$ [9 P% w9 | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 a2 A2 {6 {2 G; G' F5 B% _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 S4 e/ O/ N! ?/ W& ^3 R
- * TO CHANGE.) i1 e0 t6 n" p
- *
5 c: T" @& v( H, w2 s- M! o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& i* _+ J. A4 M6 `
- *
* r- p& f) T, K+ o' l+ R( k: c" d - * This program is free software; you can redistribute it and/or
$ P( c% p0 B) a1 X5 Q i; r - * modify it under the terms of the GNU General Public License as z! {4 _' A( v" W K
- * published by the Free Software Foundation version 2.
% v! E* L* @* H3 ~1 c% l - *9 X# J9 U9 G: Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ [1 l ^/ P, ^/ Y. u - * kind, whether express or implied; without even the implied warranty
, U+ h) s/ C- e8 U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 ]6 @0 t1 \" v8 \' W# }' N - * GNU General Public License for more details.
/ [1 C, K# K8 q# k V; r6 I - */0 H2 V3 q" {5 U1 `
# U, j/ }* k) Z! X- #include <linux/module.h>
9 l; L" u) H5 _; E - #include <linux/init.h> G7 c2 X5 m. N! ]* G w/ \4 F! ~- U
- #include <linux/errno.h>
* {) B. F( Q0 O. n - #include <linux/types.h>
' ^1 b- t) _' p! D$ z- }! K" i - #include <linux/interrupt.h>& C8 C- c: ^/ K/ d1 d
- #include <asm/io.h>% A, o: i$ E9 z- g5 r( X8 j; P
- #include <linux/moduleparam.h>
9 I! V* ]+ \ s. c+ N3 w - #include <linux/sysctl.h>5 @0 ?, l$ f6 r4 J
- #include <linux/mm.h>
+ t5 j: g b+ _" _2 G1 ]( i - #include <linux/dma-mapping.h>
( }/ f9 p$ n7 f9 o) v8 N - 1 g. j: N# N2 F% I$ R5 ]
- #include <mach/memory.h>* s" F) f+ ?5 e0 Y) B2 C: w
- #include <mach/hardware.h>
/ T+ S% {6 I7 d% e4 `4 R: _! y) g - #include <mach/irqs.h>' V% C* W7 w5 ?0 Y% p9 i; Q
- #include <asm/hardware/edma.h>
0 n0 N' |0 u8 t; J5 @ - 5 p; _& [3 M- ` B1 ^' y- U
- #undef EDMA3_DEBUG* `5 ~/ x! q K+ n c
- /*#define EDMA3_DEBUG*/5 U* B; c% X9 ^( Z5 |2 A
: L$ _: i- }% e" e! Z7 R- #ifdef EDMA3_DEBUG5 o* ?) {) `% W9 F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ^1 S' m9 w" {: W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! c0 H5 c7 J9 P/ ~ | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. @: P4 B- Y3 L7 w - #else
" z" b2 a$ } r - #define DMA_PRINTK( x... )
& v! h( m) Q5 ~& C1 K$ Y - #define DMA_FN_IN
5 _4 j) J! y' ?+ x - #define DMA_FN_OUT
" U3 B- c& q8 D9 p+ K - #endif
, n) g' x6 {* [, P& G$ `1 D
0 Z& F# e0 e# U6 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768) w. ?& w! J+ p' B$ U
- #define STATIC_SHIFT 3; y4 p4 i5 j0 Z( L Y/ r: P2 I
- #define TCINTEN_SHIFT 20( \* S8 v# s" g: @# O1 ?
- #define ITCINTEN_SHIFT 217 V W) J" B( P) w* | J6 j o: G
- #define TCCHEN_SHIFT 22 A, `% t H; w: Z
- #define ITCCHEN_SHIFT 23
2 Q$ A1 u! O) ]# K6 T9 W" q
" m! F6 |: }) g9 c* d- static volatile int irqraised1 = 0;7 { _# g% x( A. g
- static volatile int irqraised2 = 0;4 b1 E* q- d0 {! H9 p; j! K( J0 v
6 F7 a/ h, w. A( l- ]% a9 p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 w; {6 j0 x& f( S O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 P' k# v0 Y! V- A' l! X* ^% [7 t D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 s: @& K0 B+ v% C" J' K
% x& D4 ], [# L; I8 B- dma_addr_t dmaphyssrc1 = 0;
, E6 u5 e5 E; ? - dma_addr_t dmaphyssrc2 = 0;8 d( d' n( ] G$ G
- dma_addr_t dmaphysdest1 = 0;3 K9 o. W0 e' M1 B# U. V
- dma_addr_t dmaphysdest2 = 0;9 |# L+ x4 W, ^2 R) I8 E- k
- . I% u7 F$ c& F) k' Q/ H7 \% e. X
- char *dmabufsrc1 = NULL;
$ i0 q# i: x- k" w' r; w - char *dmabufsrc2 = NULL;: T! Y& j+ ?, F/ n( c0 G
- char *dmabufdest1 = NULL;0 O, z! d1 C) H L# {% `
- char *dmabufdest2 = NULL;
5 G6 T. I. v1 i' h* o+ ? - $ n" u. `9 v2 J' S/ |' [- q
- static int acnt = 512;8 e( g4 S" C3 a9 z4 w7 C' y Q
- static int bcnt = 8;
4 S/ [; c* ?/ w& `+ @9 n7 ? - static int ccnt = 8;
! y* o! `3 \' M! [- b - , ~! G2 M1 E8 w- j- R1 n" m
- module_param(acnt, int, S_IRUGO);6 V, i/ d7 s. q& t
- module_param(bcnt, int, S_IRUGO);
/ a! c. Y, D! L8 p Q: L - module_param(ccnt, int, S_IRUGO);
复制代码 6 B( o( T% P5 O, l: X; x
1 ^0 ?$ i5 w- m- S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& V2 U5 z! m4 D. c7 z" A/ _2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( I" P9 r! P3 A" K8 C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* n( F2 e9 o" W4 P8 e4 b# K Y2 I( w" o/ W# k" [' E7 x* f- y; Y% ]. a
. k' P6 v6 Y+ v# m3 r, a" X5 B |
|