|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # t, R5 r! D# F
- [code]EDMA sample test application
8 s# D" O4 i/ s - /*/ C, T& u& C c G( K x" a
- * edma_test.c f$ h; I; @ J& ~; I9 j
- *# R" O, w5 q# q5 W2 L' P9 g
- * brief EDMA3 Test Application
. ] j5 i4 E5 o$ s3 G R$ ` - *
- s z( b$ k* A1 j - * This file contains EDMA3 Test code.
; D u/ V" C9 n( { - *6 ]0 ?, s( \* K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 b5 b' {* n h, s) l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 `+ v7 V7 Z% E/ q
- * TO CHANGE.
, g# N3 m( u0 {& q: H: t: P - *
" u3 J$ S* N1 P4 j" g0 x: T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ K' N& i" o& I, I - *% f; [. C7 L4 h {
- * This program is free software; you can redistribute it and/or) a, L; j% U! x% c! O- m& w2 w
- * modify it under the terms of the GNU General Public License as$ ]" n2 @3 J# V" t- s1 T$ Z: u: t
- * published by the Free Software Foundation version 2.
, u# F( G0 f: m) `" c2 v - *. i3 C1 Q% R. I( v; B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* {% |! X( k2 c% U- j - * kind, whether express or implied; without even the implied warranty
% w8 R6 L$ h# j/ ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @) t- e+ }0 a - * GNU General Public License for more details.* v: K @% l3 g6 t) l$ w
- */0 J: V0 {6 l$ i
- . T: Y# k* U4 _1 b( l
- #include <linux/module.h>4 e9 ]9 @- a2 E& k. j
- #include <linux/init.h>! M, m* r; E' w& R
- #include <linux/errno.h>- d7 _. ^& \ e: N4 }3 \5 {
- #include <linux/types.h>
: _- K y. t% o# ?$ k - #include <linux/interrupt.h>0 S& ^$ A' C; q `
- #include <asm/io.h>
7 g6 s2 ]" n' m- _1 B - #include <linux/moduleparam.h>" X: \/ y/ I p# A& R! F, `" a
- #include <linux/sysctl.h>
7 i) F0 q$ n1 t( F - #include <linux/mm.h> g. V; t' R& j' j5 q$ }# x
- #include <linux/dma-mapping.h>
M- w+ P& S$ m7 Z) ]5 _) S - 0 e! J# ]& l1 U6 O. w9 e
- #include <mach/memory.h>
" S2 g1 O) P, E$ Q/ A) b2 O% b - #include <mach/hardware.h>8 j: H' ?% O* G4 y
- #include <mach/irqs.h>
! e( d) {) ~: g# Z6 j$ X - #include <asm/hardware/edma.h>
' |7 R' G3 J0 R0 v$ ^5 i6 ] - ( p3 o1 h- c1 Q: n
- #undef EDMA3_DEBUG$ ~7 A9 S" G; ^7 S5 X- k
- /*#define EDMA3_DEBUG*/
! N" c8 X1 e8 ?% B
% P+ U. C7 `8 F" q) e- #ifdef EDMA3_DEBUG
1 r5 I# |6 [( m2 E- G! q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 m% E9 G* E% z& } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ `" C3 \! Y5 ?& m4 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 v: `* P( Q3 H6 V# Y3 ?! a - #else1 Z) m& r$ {6 y+ Q0 y
- #define DMA_PRINTK( x... )
3 r+ u$ |" j5 ~0 | - #define DMA_FN_IN
, }1 p( T' a0 n. |. d - #define DMA_FN_OUT
, G% T# Q& z- n' S7 y/ ~ - #endif K1 `* T7 a8 F/ Z8 R4 R4 K
; g) i9 {/ ^# t9 L% l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( r: h# U! l" C
- #define STATIC_SHIFT 3
6 d$ F5 }+ m/ D - #define TCINTEN_SHIFT 20. C- E1 r- ~) A( X# E# Q& d0 r7 q
- #define ITCINTEN_SHIFT 21
* F, s. Q+ R, R' T' y. r - #define TCCHEN_SHIFT 22
5 J3 a @' Z" Z+ R3 N - #define ITCCHEN_SHIFT 23' ^0 J, f, E: F8 L% j
) p3 j8 W+ j& f/ v7 W; S- static volatile int irqraised1 = 0;# G9 l4 c* |: w2 t7 o
- static volatile int irqraised2 = 0;" W, k2 ~" f3 q% i2 z+ R& H
- $ H( [1 A( U' S$ B; C) y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 O# r/ P& t/ a8 J# E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: d) y8 V, R$ \5 [+ I, X) m- U/ j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ B* B# M1 C" l. d% l2 ~
& n x. o1 w1 w0 Q9 P) |' ^- dma_addr_t dmaphyssrc1 = 0;2 a; o+ W! S! m8 p( T
- dma_addr_t dmaphyssrc2 = 0;
5 m2 q' L' S V3 C - dma_addr_t dmaphysdest1 = 0;
9 F. M% u7 K8 b# O - dma_addr_t dmaphysdest2 = 0;
/ w" ~; Q3 B2 _$ f! J2 I7 w
( X" [8 `+ U( o$ N- char *dmabufsrc1 = NULL;
5 C0 d9 ?" U e7 U( D8 h$ |2 ~ - char *dmabufsrc2 = NULL;
1 \; p4 V8 g5 b0 J' O& T! C5 W) ? - char *dmabufdest1 = NULL;6 [) e7 I" ~' n7 `' r# V4 p) l
- char *dmabufdest2 = NULL;
# C$ d& B; {1 R' p
9 v. h1 W1 t$ z& R- static int acnt = 512;
) U( ~# L! |& d, B - static int bcnt = 8;" R4 t V$ g) O- d. T1 f
- static int ccnt = 8;
, d/ G+ M, H! U. U
; c' p: s& t% s# Z! Y* ]- module_param(acnt, int, S_IRUGO);
* l/ y* e' i' q. n- \ - module_param(bcnt, int, S_IRUGO); _+ Y, d% W" ^$ y. G
- module_param(ccnt, int, S_IRUGO);
复制代码 2 Q% S- t( D* `6 B" e+ x9 _: y x% [
1 ~4 \# `! c0 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( H1 q+ B ~+ \4 r# B3 Q2 X: karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" b2 n# t# J7 V& j' L n. @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ R! p( ?$ K1 p+ i4 m: r
& Z' I/ Q3 c" u8 R! | X
7 D* ]- {! t, L |
|