|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- U6 ?9 Z; j& w4 Z& q- [code]EDMA sample test application& Y) T/ j7 l L/ X1 n! t
- /*
$ h5 S+ l. e) X* U( u! \) M* U2 }# Q - * edma_test.c
) _: X4 \) Y; s5 v7 n% O - *. O6 ?, L& M$ [6 c
- * brief EDMA3 Test Application
h( R1 M) I4 u( h1 h - *( O3 @: L6 N k* A% X6 m
- * This file contains EDMA3 Test code.
0 S9 @0 F2 F* u1 x/ W1 f( ~ - *7 {' d5 ]+ V! [* ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 G( ?$ } j! I) E* l/ M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 W6 _. g0 k% f$ ~) w
- * TO CHANGE.& Z( f1 S+ e w+ r: |6 L
- *. l+ @; ~8 V* c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' }& x* F* ^' X. X+ J, v& d$ N
- * v& R( b+ P& B. p5 K D& X
- * This program is free software; you can redistribute it and/or6 A; p7 j) i7 @) d) _
- * modify it under the terms of the GNU General Public License as
* u" n! n; c, ]4 x - * published by the Free Software Foundation version 2.
# F9 t2 r: p7 \4 @9 R# I - *# ?* a9 I9 t+ l: E+ B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 l6 U% r' n9 a% r0 {1 [
- * kind, whether express or implied; without even the implied warranty5 X) m6 i6 |5 s7 f8 J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 O' U& Q5 l% `+ N, D - * GNU General Public License for more details.
' f& V# h( D3 f6 q; ` - */" ]( v% k4 q. E( t2 v
5 w. i5 g& G/ t, F, R& }- #include <linux/module.h>( F6 X, m! z6 Q5 n/ n1 Y- w
- #include <linux/init.h>
" d, u0 C; z! ^$ W9 V/ y - #include <linux/errno.h>! X. ]* T0 L, A# G3 O
- #include <linux/types.h>
4 W, q4 }& x# J$ h0 `3 S% g - #include <linux/interrupt.h>
1 l* Q' i3 u- B% L& s5 K - #include <asm/io.h>1 R) G, w1 X* ?/ G
- #include <linux/moduleparam.h>
' H* y1 I+ e b. Y - #include <linux/sysctl.h>
" J5 z# c" g2 P. D - #include <linux/mm.h>
/ p+ d- S6 V, ^+ I' b2 s0 i - #include <linux/dma-mapping.h>
) T5 K/ r2 n' W
, u/ w7 _1 a4 m5 G- #include <mach/memory.h>- y* ?3 k6 W3 j0 Y; o7 Z4 g; y& v
- #include <mach/hardware.h>
% F, W: U4 `1 N( P - #include <mach/irqs.h>! h# H8 h1 z! K3 {
- #include <asm/hardware/edma.h>& G* }4 s6 y- L" G
- ( C! c: B! P7 R; o
- #undef EDMA3_DEBUG
% Z' p3 k. e+ n2 f - /*#define EDMA3_DEBUG*/8 f( S* [8 Y6 t5 c% H
, P) H2 \4 ~0 @; F( x3 f- #ifdef EDMA3_DEBUG9 \- b# j. P% l2 T8 |3 Y9 m7 e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( v2 F) o4 V' Q1 {/ B- w0 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 D8 ?: l4 e8 R. t% a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 E5 B" O. U" m( b& | - #else
: I i, L" q; r* v# ]( ~ - #define DMA_PRINTK( x... )
: K6 T$ a2 j7 @8 m7 w. { - #define DMA_FN_IN" S9 R$ K% l+ ^) W5 f2 D
- #define DMA_FN_OUT! y8 \8 T9 y4 t. o% ^
- #endif
7 q. W( w: K- Z' h( j- l$ K6 s- n - & \& ~ R% z c/ H8 ^( o q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 L( X, b5 g5 P8 u/ k: s - #define STATIC_SHIFT 3: N; z. a6 U( c& \; J
- #define TCINTEN_SHIFT 20
3 ? g2 J ^1 V0 _" ~. t - #define ITCINTEN_SHIFT 21
2 o9 A. H: ]; u4 }* ]. M! l! ? - #define TCCHEN_SHIFT 22
3 I$ I( H! |0 I M: u6 R - #define ITCCHEN_SHIFT 23
4 ~* P" T$ [5 e- u9 q - ; V+ f% X i3 C
- static volatile int irqraised1 = 0;0 R6 f/ }# E+ i5 b% G; g) V% _
- static volatile int irqraised2 = 0;
# m5 S8 j- T+ Z
) g1 {9 p& ^( ?0 r8 V- P; f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v, J" c2 e2 i2 @! Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 a/ Q) k; L; N7 T! v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% Q$ X& m9 u" t/ C; I, z
6 F* z4 B c1 h* ]7 J$ h+ E0 V- dma_addr_t dmaphyssrc1 = 0;4 C; ^* G, e6 D3 P
- dma_addr_t dmaphyssrc2 = 0;
' ^0 A6 H: i: _7 h- ]) Y* E - dma_addr_t dmaphysdest1 = 0;
/ i9 V/ @' d/ j6 t9 E# d7 C1 P - dma_addr_t dmaphysdest2 = 0;! s6 U- r0 a4 v# @
; T5 `3 [: G" v3 h- char *dmabufsrc1 = NULL;+ o' L) k4 k) M) L* Y0 k8 o
- char *dmabufsrc2 = NULL;- v* P: q, [ D; N
- char *dmabufdest1 = NULL;
J+ ^2 \. }3 s8 j' F( [7 q0 \ - char *dmabufdest2 = NULL;
7 R, F) e' u( y6 [ - ! T- x8 [1 U1 y6 `7 ~1 ~
- static int acnt = 512;
9 R- W. X/ u; Y9 A$ |7 i - static int bcnt = 8;, E2 I7 j6 S3 d9 C6 U( \
- static int ccnt = 8;3 q% ^* t6 W( b0 E8 f3 n
! w' H+ V7 ]1 t1 { v: E8 }" x- module_param(acnt, int, S_IRUGO);; q3 k* G* O6 ?/ G9 x* u( U2 j1 g
- module_param(bcnt, int, S_IRUGO);
7 F# t5 D- T f G& f+ ^ - module_param(ccnt, int, S_IRUGO);
复制代码 - p+ j5 j$ a, i7 D! \& O
& e; n4 l) {2 f8 X( d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' ~6 @4 J: X( v# Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 X/ }: e+ v: O: {) w4 G( K1 {% b: V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 h: C+ B' A8 ]5 u
% Z* e4 j3 V6 \9 `; M I' {* A' x/ l4 Q8 J
|
|