|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, `( u% b; R# q4 {- [code]EDMA sample test application
3 I+ h! l# y$ z7 o - /*
) L; D( b/ }2 O* y! I, [ - * edma_test.c
0 n) ]+ W1 A2 ?2 m5 }4 E - *
# \5 u: a2 Z$ }! s - * brief EDMA3 Test Application
8 p( d/ z/ U1 F* L - *
9 O' G- w S: \. Q0 e( K - * This file contains EDMA3 Test code.5 d, H I; a: `0 |
- *# B3 u" K3 U1 Y) {! j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ t0 |4 e8 N' [" S6 j8 {$ r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, l* V$ u: M7 E( ~9 E+ F+ t, K
- * TO CHANGE.; X ~$ U2 W5 i3 y# p" `
- */ p6 ~. y2 C! F8 C# o- M3 L- ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; w" w. k% z# X" D" H1 }
- *
7 A; z7 A ]: g/ g9 S6 C& N1 | - * This program is free software; you can redistribute it and/or
. f1 _. K' w' O) M$ D9 V$ H - * modify it under the terms of the GNU General Public License as
0 L! G. T* k% M- [ - * published by the Free Software Foundation version 2.
9 N1 t( q8 H5 N0 J) P - *' ?0 X0 Z5 W$ F1 I9 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ u, U! r L; _/ C8 @ - * kind, whether express or implied; without even the implied warranty& a, \" o& U9 @" R7 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, l4 C1 A! U9 f9 ~6 X
- * GNU General Public License for more details.
" y4 E3 z/ I& C: d1 ] - */) U/ m( y' ]. ]5 k& C0 n
- % p p) p% d# J+ D
- #include <linux/module.h>
; S Z5 ^( s- h - #include <linux/init.h>
7 d9 K: @$ @6 T% I - #include <linux/errno.h>
9 i$ U3 d4 |' c# H( {% n - #include <linux/types.h>! z0 F- c$ w) M0 z7 A" [( Z2 {
- #include <linux/interrupt.h>
, _' l2 X; h3 C( @" P - #include <asm/io.h>
; P/ ^/ ^! J& l9 Z- T) f - #include <linux/moduleparam.h>
. o# v- k) `- o+ h: r - #include <linux/sysctl.h>* A5 G" M' h; ]2 E' s
- #include <linux/mm.h>/ j) d) {+ f, m
- #include <linux/dma-mapping.h>
6 q2 n1 X9 N1 @, d( x7 h0 ^
% _+ q; ~- V, `- w- Y) B9 T- #include <mach/memory.h>$ A( d& o2 n! U1 f) X9 ~$ x
- #include <mach/hardware.h>
4 v3 Y- U8 \& S - #include <mach/irqs.h>5 g0 N$ D( ^" A7 R' z
- #include <asm/hardware/edma.h>' R) U' L% I. u1 D4 \* S
# ~- |+ @6 J& l$ e" c$ _, U- #undef EDMA3_DEBUG
. ^) `' W$ u$ e$ n, c( e) p2 C - /*#define EDMA3_DEBUG*/( p# W' ?$ y( i3 C
/ E# D# E$ t) h) B8 Z% C8 g- #ifdef EDMA3_DEBUG
3 A* w8 k- G, q. k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 p; f& Z/ Z* ~# P7 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 C Q; g) p0 K0 v' P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 y/ E1 t8 h3 _( g9 F5 H4 @, c
- #else
. z5 q" X, x: i- A0 ~ l - #define DMA_PRINTK( x... )' d7 g& T: R. r6 }" e
- #define DMA_FN_IN/ h- V T' R. T! ~) d i! K
- #define DMA_FN_OUT
, z; {7 ~. Q9 f- D- y - #endif
1 z+ u! w( }: r1 l# ]. ~ - / y/ {' u1 D' o9 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& g0 W" v) ^( A1 E% }6 o$ p
- #define STATIC_SHIFT 3
# m& a6 S* M5 N# J) l7 Q/ S - #define TCINTEN_SHIFT 20
+ t. n1 p' z& n3 G1 Y* Q. B. b3 m9 h - #define ITCINTEN_SHIFT 21
; M( |3 C* x1 o% Z# {7 g0 I$ I - #define TCCHEN_SHIFT 22
! l5 A3 W% `& S9 L) k2 u" a6 D$ p+ [ - #define ITCCHEN_SHIFT 23
7 N6 Q: p1 w7 N& X9 e* Q
: _6 \* x" @$ K9 }7 v- static volatile int irqraised1 = 0;
8 s" O$ C4 X6 h/ T4 [# n# F - static volatile int irqraised2 = 0;0 k4 n' Q: C' v0 m R
- , Y {( R ?' g% `' q8 Q' f2 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
q* o( |8 [( L3 ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! M/ R9 V& w/ E x5 P" {, [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: z; E9 ~1 j7 O/ V0 ^
- 5 z3 V. @& J# T* f9 E* _
- dma_addr_t dmaphyssrc1 = 0; f! U7 y) x+ @0 P) V3 w" o
- dma_addr_t dmaphyssrc2 = 0;
. s* p, n$ E2 C5 J& M2 w) M - dma_addr_t dmaphysdest1 = 0;5 i7 w9 D$ f, c; Y& X8 j
- dma_addr_t dmaphysdest2 = 0;# s" i0 c* e9 l$ W9 a% k) I& o* J
- , ^/ C1 B6 C5 J) l$ A2 u
- char *dmabufsrc1 = NULL;
2 D% m- g6 P k! o+ ~ P - char *dmabufsrc2 = NULL;& C* N; a2 T! a$ f4 h& E* S! U1 p
- char *dmabufdest1 = NULL;; ]+ e! p- E2 U5 |: P: m* D
- char *dmabufdest2 = NULL;4 g6 e" g- m; [* }+ A
- 5 ^! S* y0 Z5 l+ C5 j+ A+ o
- static int acnt = 512;% N( L5 s- c0 h, L4 p
- static int bcnt = 8;1 [& y% F( h+ z7 K$ s1 u' ?
- static int ccnt = 8; c% \+ ^& R9 i$ p
- Q5 B& b% U! e8 R$ _
- module_param(acnt, int, S_IRUGO);2 n/ v% b; X. a( P
- module_param(bcnt, int, S_IRUGO);
' b( T% M: u! H. t/ n - module_param(ccnt, int, S_IRUGO);
复制代码 ! u _+ `' ^1 _- i0 |
! s5 E+ W U: S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- G& J5 f- m) ]$ K* F ]& `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; j6 h+ ?& F2 S6 l) e5 g' D! [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' H1 k/ ?4 g( D* r; R2 v1 U+ S8 a* t* c0 a: o3 A! K" |
; q6 r5 [% Y0 \ |
|