|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; c! W; p. n2 f1 _( {! ~* D- [code]EDMA sample test application5 `' G, S8 @# O7 P# T9 X
- /*
8 `' o# S# q7 P3 F0 x - * edma_test.c
! T) [# T) s X' F7 m - *
9 g, ^, r5 x2 e7 A# W - * brief EDMA3 Test Application1 S9 _( K5 c/ ^) j, V& R5 N9 w) ?0 O
- *
8 w3 _& G, c6 K2 d9 m4 @3 ~ - * This file contains EDMA3 Test code.
4 r+ c/ H, Y5 L# M9 j0 B( A( p - *
) W% ^% ^1 f# ]: s o9 } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& T, s* f* ]; d$ N0 U4 ~8 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 k, m, [5 A; R" V! u
- * TO CHANGE.' N7 I* n6 q: u4 X S: g' _
- */ X# E/ l1 w8 O, U9 s+ T! O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. ]% X1 H3 q) b) D - *" {) m9 T5 h: y; ~9 L+ o
- * This program is free software; you can redistribute it and/or
! F( N5 C" K* v - * modify it under the terms of the GNU General Public License as
8 o5 k' {8 P% ]1 A# k1 \8 f - * published by the Free Software Foundation version 2.* ]9 m1 F7 F6 \/ c4 o& q
- *
% \0 d; L* h! E$ J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' H$ B8 z9 ?: ^, w
- * kind, whether express or implied; without even the implied warranty
9 D% t+ o5 f/ h; \$ J$ @: V) T+ Q% I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; \& h0 e3 q; B( D2 u - * GNU General Public License for more details.
) `8 z* ~2 I( C" Y: N - */
$ A7 R3 H; G* ]9 _7 s+ J# E
* G- ?0 A% y' }5 I- #include <linux/module.h>
8 r7 U* o0 M; r2 c; j! K$ Z. s - #include <linux/init.h>& q8 a7 ~- g- U: s8 o6 D
- #include <linux/errno.h>
5 ^, r4 b5 a y3 |8 X# _) L5 P: q2 g( \ - #include <linux/types.h>
4 k0 I; \1 g# D( f - #include <linux/interrupt.h>
) \0 M- X q! _# N; O - #include <asm/io.h>
( w' _0 Z! p+ K' c% o - #include <linux/moduleparam.h>6 G( {# [; S) N0 @
- #include <linux/sysctl.h>; H1 Q4 w0 f3 \% g
- #include <linux/mm.h>( ~" I" E: R+ D$ o# F6 Z- V
- #include <linux/dma-mapping.h>
5 }' n& V$ w3 \. Z s% E/ j* X - ' K0 _6 s U: ~3 t0 ]! H
- #include <mach/memory.h>" M/ B" ]5 }$ F
- #include <mach/hardware.h>2 z& Z. ]2 @$ O. B; X
- #include <mach/irqs.h>( v- I% _5 I# O/ }9 d1 g
- #include <asm/hardware/edma.h>
/ x$ c* N+ K- K4 A% V! ~4 Y4 F/ I5 w - 7 [6 V8 N3 m: B& ^6 e
- #undef EDMA3_DEBUG7 X0 u8 k' Z1 x6 I
- /*#define EDMA3_DEBUG*/, _; L& t% J$ ]
3 b; A: m6 z$ h% p$ y {; U- I- #ifdef EDMA3_DEBUG
! G' K6 e J4 y+ M5 X' k' H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: R1 T! h0 p1 |& u$ t: a3 z8 u0 o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 D) j8 n2 L1 G% u2 ]* e# Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. [$ K$ }+ L6 d - #else @5 C( L! [+ ~2 i- H: N
- #define DMA_PRINTK( x... )
+ p" P; M2 k! u: ]: c - #define DMA_FN_IN' X4 E9 c* v w; D3 ?
- #define DMA_FN_OUT' v0 p* C6 f1 J/ `/ T# R
- #endif5 H! |+ ^* b. m5 I# Z/ r6 Y
3 U0 I% m; `$ b1 u2 F$ n7 U( U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( q( b4 B' J& e
- #define STATIC_SHIFT 3" ~" \9 a) `) S9 e% \: ]7 A3 A
- #define TCINTEN_SHIFT 20
3 ~) E% D2 V3 P Z* e4 ^ - #define ITCINTEN_SHIFT 218 p" _- j/ Z0 X9 q
- #define TCCHEN_SHIFT 222 F( ?) {3 G9 r$ ?1 h; B
- #define ITCCHEN_SHIFT 23
' P9 I, c8 A( T
5 Q6 l8 b8 k1 H! H; D) U( s- static volatile int irqraised1 = 0;
4 s J9 A1 f. `2 _5 ] - static volatile int irqraised2 = 0;
j0 ~% q* G1 O. m8 r+ x' V4 y - / n8 q+ x+ j- ]: z. e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) R) M# k0 Y1 S6 O2 l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( L2 H0 l1 B [( X% U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 q8 ]2 @5 u: n+ [0 n1 O: ]
" V% n4 S+ J4 d/ m) z8 T4 a3 o- dma_addr_t dmaphyssrc1 = 0;
! J7 h0 x" D% n0 Q - dma_addr_t dmaphyssrc2 = 0;2 Z, B6 d7 ~! Z5 g H i7 o" u
- dma_addr_t dmaphysdest1 = 0;
- q- E3 y) v% g8 B - dma_addr_t dmaphysdest2 = 0;
5 x# c7 D! H6 ]- D, @( O& h
0 T& u7 S( @6 I7 G) m d- char *dmabufsrc1 = NULL;* r5 Y) w5 f) r; q Y
- char *dmabufsrc2 = NULL;
5 z2 o; f5 X+ p - char *dmabufdest1 = NULL;
+ B$ U5 P! e4 D' x - char *dmabufdest2 = NULL;! [4 d" b% b- ]' U1 r: g
6 U& @" h+ ]) A4 E$ B/ u1 k2 L- static int acnt = 512;3 Z. E/ U& U+ I5 @9 B) x0 s, v* G
- static int bcnt = 8;
( Q$ `7 h" \) C( s0 M: H - static int ccnt = 8;2 m, C/ C1 P: k4 G2 r
- ) s7 ?! F# |% r. U
- module_param(acnt, int, S_IRUGO);% E, A; V! f: A3 G- N( \
- module_param(bcnt, int, S_IRUGO);
" f7 n) X* L1 ~9 w2 b; z# ] - module_param(ccnt, int, S_IRUGO);
复制代码 2 |+ k1 D/ F: F
* ~+ H, J! F, A! ]; f0 g, g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 ~- O0 v9 j% p2 f0 N2 c7 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% G/ C! {' \, H2 K6 c; z5 g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* X* X+ ^+ R/ Y3 J# y5 T8 a
2 R& w& D* ~0 w: ]3 J
: V% ~! G7 X( y. p' o8 w, k- ^ |
|