|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% N+ u- C3 ~% P) K- [code]EDMA sample test application
7 |$ u1 w# v6 S9 g+ y9 K - /* |1 }; C0 x3 z
- * edma_test.c
) P) Z* B7 V7 `4 r% R - *1 p# K8 q* a+ u
- * brief EDMA3 Test Application
# y7 ~* z8 i8 O7 ?7 T( S - *2 C- r6 p* @, [+ V; g% E) w
- * This file contains EDMA3 Test code.
6 f( D# I$ k8 c M9 G: R - *
8 r' t1 Z/ c' j7 [. T/ m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 {6 h) r: e9 J' X( ?; J& i* @; @) Z6 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( ^: f5 B1 t; t/ x6 J1 ? R- B! ^0 ] - * TO CHANGE.
2 ^/ g/ @2 L& r$ x; e - *5 p% l' Y4 [$ {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' o- P1 X8 S: l - *( g+ z/ n* ]$ v
- * This program is free software; you can redistribute it and/or8 x( c/ U, E K+ i0 H
- * modify it under the terms of the GNU General Public License as
" \$ X2 R: V8 J4 [4 D( k5 m# d - * published by the Free Software Foundation version 2.. A' ?' d, {0 G% n: j. s
- *) @: S/ b9 i3 w+ \: j' H. j9 o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' i$ G4 j! B% l1 H7 b - * kind, whether express or implied; without even the implied warranty, Z7 ^8 ~. p% |/ W# W. ?+ c( @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 C5 D" n: y% L% Z' c - * GNU General Public License for more details.$ U8 I* k! ~2 p/ R! l2 c
- */
& h+ V0 K0 H7 b: L+ H, J
1 ]' s) w7 \8 }9 x- #include <linux/module.h>5 D4 m0 x* | M. _7 w, ]" x& K1 O1 o& T
- #include <linux/init.h>
# M# N D' p6 d) l- u. Q5 B: p - #include <linux/errno.h>
1 P1 M& K/ h J `7 c - #include <linux/types.h>
8 r. g, c+ M9 T( A1 c - #include <linux/interrupt.h>7 Y( ]0 l7 ?4 H0 u3 C& y
- #include <asm/io.h>
$ x7 ~' s- P* \% P" D2 ? - #include <linux/moduleparam.h>
- H- T: l3 G* j - #include <linux/sysctl.h>
5 n, P% L3 t# Z - #include <linux/mm.h>4 _7 K0 D8 J6 t9 h% Q# \$ f0 \, U# B
- #include <linux/dma-mapping.h>
4 g- k, c/ O9 r& f- L - " G" Z5 H X: F1 b$ f2 d
- #include <mach/memory.h>
) U3 ?: r. A/ t; {5 P* M - #include <mach/hardware.h>5 L' {, c5 ?% e: g6 U" D5 _' I
- #include <mach/irqs.h>4 ~ I; h& O/ p9 G) k
- #include <asm/hardware/edma.h>0 D& f" I" Q0 H# _
- ! W" ^0 A3 L+ u" ?) A
- #undef EDMA3_DEBUG+ h# L* W: l; ]; ?
- /*#define EDMA3_DEBUG*/) I3 F, S; {7 D0 i, A+ \. h3 X8 E4 s
( [* K7 ]/ Z. }- J9 U9 j- #ifdef EDMA3_DEBUG
& s4 C4 n4 ]3 a e& m0 i+ k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) n$ L3 V" d M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 I( x8 G2 k+ l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 { A0 |5 N. U2 ^! c - #else
' P# V) [8 `3 @) t# ~# B' C. e - #define DMA_PRINTK( x... )4 F1 o% C2 Y; S5 M, L
- #define DMA_FN_IN- Z. q) N- {; q* L
- #define DMA_FN_OUT1 y% W: y- b# W3 s' ?6 B" W
- #endif3 z3 Q5 ]- X b2 I# n( ~/ ^& A: e
- ' W2 o: F. l% d' V, E/ B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ n* |, O/ W7 `
- #define STATIC_SHIFT 3
$ v7 P- ^# a h3 B - #define TCINTEN_SHIFT 204 l2 a: n! r- Z, N X3 r
- #define ITCINTEN_SHIFT 216 z9 B4 K3 Z1 s) }1 c9 G& u' F; P
- #define TCCHEN_SHIFT 22. _( h+ z6 _/ r5 Z
- #define ITCCHEN_SHIFT 231 c( \' ~& \& O0 q
& K$ E' e$ X3 h0 ?6 |- static volatile int irqraised1 = 0;
1 ~7 A# ]0 m U% u0 q6 | - static volatile int irqraised2 = 0;
8 j- [& @% J' k( O' t
# G( ^5 W4 ^9 {$ @) b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 ~4 C; Z. F4 v. | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, e) A c8 X( d4 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 a1 ?0 {4 } @2 c% b1 g
7 L" Y+ Y. _3 s5 ]. j- dma_addr_t dmaphyssrc1 = 0;! ?* ~4 ?1 k" ]! |: X! B
- dma_addr_t dmaphyssrc2 = 0;
, F7 _9 s5 a7 b% f - dma_addr_t dmaphysdest1 = 0;3 F* G* T7 E. I: K, r! q1 V0 d
- dma_addr_t dmaphysdest2 = 0;
% K; ~, N! T6 X( t. o! P8 i7 P" \ - - o- j6 J; U# T! _/ T
- char *dmabufsrc1 = NULL;
7 P4 {/ A. g6 a# p0 i - char *dmabufsrc2 = NULL;2 E9 E4 n5 _5 M) I
- char *dmabufdest1 = NULL; z% Y+ M: V$ f9 c; b
- char *dmabufdest2 = NULL;) ?& i; p: _5 N3 O0 r4 J9 g" n
6 L6 ^9 u' w* k3 V- static int acnt = 512;
( {" O+ \; z0 R# M; H( v; z - static int bcnt = 8; z9 x, _7 H1 |$ K) ~
- static int ccnt = 8;
! d3 e* w; V" k+ ~ - . V' a' H+ |# e- s
- module_param(acnt, int, S_IRUGO);
) O- l. Q1 q: V! v( K& q - module_param(bcnt, int, S_IRUGO);' b5 C+ A1 s# r; @' C% E! o' n8 K. t
- module_param(ccnt, int, S_IRUGO);
复制代码 {& L1 _% m* t4 Y9 H' t, s
# N4 @4 k9 j$ V/ Y; p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 n, C# i. P' z. n, j" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 g r; |/ y7 R! u% t2 E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 T5 a4 `; \/ K8 {0 A9 l7 B
6 v) g& w. B6 X) e+ z9 t4 K; l9 B3 S* w S. U6 T- {7 F" ?
|
|