|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 l" m3 X7 k+ P/ W" k, c- [code]EDMA sample test application
, E( A* X2 H, E- P - /*2 `: b( a; V& j% X9 S
- * edma_test.c- `! I/ }" X0 z. ]+ Z
- *# v. B1 m4 m7 B5 H
- * brief EDMA3 Test Application6 G2 x6 a6 D- ]5 _, P0 [% F
- *
/ j4 E, T) z1 t( C {8 i - * This file contains EDMA3 Test code.
2 z$ b" N, J% J- P* N C - *% S, N- W: ^% a. @8 T, o+ t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ x; G* b3 c( j- E9 |9 i& f3 |0 c: T# d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ P" Z6 [6 X" P f6 D' a( b/ j* a! _
- * TO CHANGE.
6 V* z2 ~& L$ p& _9 h2 h0 ` - *
1 b; i9 {/ ~& Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! g1 K, K3 b& t/ F; ?& p2 p: y - *
; x( _0 i$ p+ d3 b - * This program is free software; you can redistribute it and/or
& _ E1 o4 U# J5 l9 _- ` - * modify it under the terms of the GNU General Public License as8 f( i- F) I9 z0 [
- * published by the Free Software Foundation version 2.
% g. n7 b k% Q - *3 f5 Q* q& x7 B3 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 s+ W5 C* k& [2 e8 b9 |. L9 W; ?
- * kind, whether express or implied; without even the implied warranty$ Y5 i) \" [5 B# K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. y$ }& N& _: V# G- S/ s - * GNU General Public License for more details.
6 u" t" M. n0 z9 _( F - */7 x) K! o' X/ A1 L
1 `5 t' }0 g, N5 l7 Y0 ]. y; G- #include <linux/module.h>" E2 |; y/ i1 N0 O$ c7 K
- #include <linux/init.h>0 x1 F, [- Z9 X* n( t, A1 }, \, G
- #include <linux/errno.h>9 N4 I- A: v/ J/ r/ X' ?
- #include <linux/types.h>
m$ X# a: I# m5 N4 A - #include <linux/interrupt.h>1 `, Q1 P, {9 J; E0 c/ o9 k5 O
- #include <asm/io.h>% P8 E( _: W% w# n y" J8 C/ W5 i+ @7 W
- #include <linux/moduleparam.h>0 s4 |8 }- {4 f: c, V) E
- #include <linux/sysctl.h>
Y) s3 Y6 E' I% {9 i; ^% g* L - #include <linux/mm.h>% k( M, T7 i7 _
- #include <linux/dma-mapping.h># \, k0 q7 d1 U+ i
- $ N5 s3 M( d7 ~. b1 r
- #include <mach/memory.h># H: f/ l8 h& Y! U2 y& U$ C$ f
- #include <mach/hardware.h>
! X, S: r6 N. q# ~6 { - #include <mach/irqs.h>5 I9 h" T# N1 n
- #include <asm/hardware/edma.h># }9 t9 L1 I7 ~& E
- F" {3 m0 z1 E; m% z: T. {
- #undef EDMA3_DEBUG
# @5 k0 n/ L3 q - /*#define EDMA3_DEBUG*/
- }0 T( e9 i, M2 @; s; d - + @* w# U) W5 ^! u
- #ifdef EDMA3_DEBUG
0 U6 x1 t$ O' Y6 L9 C( c+ B" m0 S4 ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ A7 |8 n4 g% Y7 j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 Q% F6 L/ i( S! k/ {4 T4 q" g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 I+ p8 [! g4 Y% l - #else! [5 y- ? V) u. E
- #define DMA_PRINTK( x... )
0 m [; L' `7 T - #define DMA_FN_IN
, x( i6 m* c. @' I0 | - #define DMA_FN_OUT
) {, P2 v2 A2 c8 l* g7 g \ - #endif( o F, S: _- x/ _" f: |: X
- : g! z! |" B' w/ G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* N& t6 Y! j/ g( L, l: N - #define STATIC_SHIFT 3
6 r7 ]- m5 r; G1 r. Z) c l - #define TCINTEN_SHIFT 209 D: @& x$ g. ?3 u* {: Y& g: f& O, h) I
- #define ITCINTEN_SHIFT 21
/ O' S* r! j- ?. i# N- I. B9 L! G - #define TCCHEN_SHIFT 22" @) b A4 H& W
- #define ITCCHEN_SHIFT 237 H, d$ O/ c, z- t1 _
5 \& u) Q4 ?( {% K& P' u$ N- static volatile int irqraised1 = 0;1 f: M7 H6 ^+ Y2 X
- static volatile int irqraised2 = 0;3 i9 D9 C& j# f0 |
- $ x5 F6 @7 f+ E5 V4 A; ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 M5 r5 o' j+ `7 Q% |. m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Q6 U" R; s _) C h7 |& h& `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; \+ ]/ G& A0 l# l8 T' y0 H
) D0 j; M: R& f7 r! O- dma_addr_t dmaphyssrc1 = 0;
0 h; m3 w+ D. S0 K+ ]5 \( m; U - dma_addr_t dmaphyssrc2 = 0;5 n1 q" C ]/ T8 P
- dma_addr_t dmaphysdest1 = 0;$ x" h2 n% q/ M$ m9 H
- dma_addr_t dmaphysdest2 = 0;: c5 y1 ]$ U% S% D" t
4 I6 O5 N. t! m. h- char *dmabufsrc1 = NULL;
# d/ o4 V. |# h( y( E" `; S( w - char *dmabufsrc2 = NULL;
9 r+ [5 h* A- o/ E - char *dmabufdest1 = NULL;7 h7 p8 @: D$ b9 C( T
- char *dmabufdest2 = NULL;/ C; b' T& o2 R. e3 T7 Y3 [
- * @' _1 u7 Y' k$ z6 z* n
- static int acnt = 512;3 W9 [/ G, H4 R# _
- static int bcnt = 8;) J' x" \+ H Q6 R1 K
- static int ccnt = 8;8 ^- `: t" }5 t( `: Z
- * w+ a+ E$ B8 L, q: U
- module_param(acnt, int, S_IRUGO);* ]0 q3 O" U# G' R( ~3 X5 f9 j' ?
- module_param(bcnt, int, S_IRUGO);4 c) t# q8 \) H: u+ l( ]" _, _
- module_param(ccnt, int, S_IRUGO);
复制代码 % p. Y* w; y/ F1 i2 E, R
/ y7 u o9 w6 \, }5 H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- o' d9 P: G- [ B3 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 P" d4 k* H4 X. J4 ?" y* ?' T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! |* G/ K8 V% `. D) j* T
/ ^' R* F% B/ C* ]* W% ?: Z" Y$ ^7 e( l$ e2 a
|
|