|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # ?- R: E0 q, c; g3 E: M
- [code]EDMA sample test application
l0 t2 |6 t; D2 i- s7 ] - /*4 Q; }/ r- v) v8 h
- * edma_test.c
2 E6 _: ]+ E+ D7 ]- q& v; K9 t1 h - *
$ l6 K* O5 @$ K: K4 a9 _ - * brief EDMA3 Test Application
8 M2 c7 Q# Z4 r7 Y5 D+ N - *9 n8 ?7 s9 I- e% O8 Z6 N3 D- ~
- * This file contains EDMA3 Test code.
# k7 J- R1 K7 w% f- \ - *" Y* A9 r' M% o& Y0 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- K/ m' A2 |5 U) j+ l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: Q" ~2 F# F5 d& x: O
- * TO CHANGE.
( S, c+ e- W# m9 H$ R8 v - *0 ]8 F5 m/ N: O" U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' Z8 R' K$ k7 f& u - *. E: [! Y) b7 a* T: m) x
- * This program is free software; you can redistribute it and/or( h, v9 U& e' Z! W
- * modify it under the terms of the GNU General Public License as
* ^5 G; q1 X+ Y, E/ \+ F - * published by the Free Software Foundation version 2.
$ j1 a0 Q$ ]' n - *9 T" D. N0 o+ U* _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: B! x1 h, c( p+ x: d a$ n - * kind, whether express or implied; without even the implied warranty' f5 R# }) P& n, ]8 @' b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ w3 g6 a3 H t0 ?/ | - * GNU General Public License for more details. j0 M4 A$ g* j2 I- [
- */
4 \& @' j) K3 K6 |8 L - 4 T% c, l( _0 E
- #include <linux/module.h>
5 @" S4 Q- |, \1 j+ j4 T" M. R2 r) j- v - #include <linux/init.h> ]% A; Z; ^+ m; X5 P4 B
- #include <linux/errno.h>0 p6 }- d1 g6 G4 `8 o$ O: ~( o
- #include <linux/types.h>
' i. P9 F0 m1 W1 N - #include <linux/interrupt.h>
; R- X$ `) z9 _4 H - #include <asm/io.h>
2 Q- }, |4 b4 m4 s1 P# v - #include <linux/moduleparam.h>
0 }$ G' `) ` ?, f% p. } - #include <linux/sysctl.h>. A+ G* B6 |& ?5 `8 e/ }+ r7 V7 A
- #include <linux/mm.h>* Z. ~* `' p2 f
- #include <linux/dma-mapping.h>) m& O/ q$ u* ^6 J$ V
- * n" Q3 g% y( e/ r
- #include <mach/memory.h>
% L* P4 k9 E7 Q - #include <mach/hardware.h>
8 b9 ~. Q c( @1 d( E - #include <mach/irqs.h>
# P, b; q: ~# f! K: ^ - #include <asm/hardware/edma.h>
2 Y, m$ b2 K1 g1 G - ' Q/ [" C$ D' {9 k
- #undef EDMA3_DEBUG1 K4 t, u2 n/ e! j7 T
- /*#define EDMA3_DEBUG*/8 P/ @$ n0 \6 [& x2 l4 ~
- # S6 C: j7 n7 i5 @( E1 \
- #ifdef EDMA3_DEBUG. p9 t9 A7 C7 f1 t% l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) k. h4 [/ U8 y, L6 M0 |0 s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# x1 z5 E/ B- [( ?. Z Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" U. ?, r) P) ?" J& Q6 q
- #else1 y) n0 y, g& {
- #define DMA_PRINTK( x... )
: @* o) |: v0 A+ h - #define DMA_FN_IN
1 f: b: T/ Z1 F) }* ` - #define DMA_FN_OUT# p- A: L6 J1 m, A! Q
- #endif
+ y5 E8 C! x- C8 Q
* {$ _3 }* W3 C% _+ i- g: R" \( \$ L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* ~% j. l& r" H% j3 K( m
- #define STATIC_SHIFT 3
, E( D% T- Q; V+ c. e" I# a - #define TCINTEN_SHIFT 20
7 d q" ]. I$ }( `5 b. J; w/ \ - #define ITCINTEN_SHIFT 21
( @% q4 V5 O1 u9 s. @ - #define TCCHEN_SHIFT 22
' `( P2 z) L! C) c* G - #define ITCCHEN_SHIFT 23
/ O0 ?5 f6 G4 l! Y2 G - 5 l/ h, Q5 @4 V+ I% [
- static volatile int irqraised1 = 0;
$ x' u" t5 p! h3 u' O5 M - static volatile int irqraised2 = 0;
8 M1 v) H Z) Q! F8 _( O# d' d
9 T, ~0 z1 C: ^1 s, u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: f. T# w6 r5 B+ E- t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 c( T5 ?* ? [2 ^# _# D( B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' h$ p' U) z# T. Y
- i! z& B3 @8 m. f* f) W# Y- dma_addr_t dmaphyssrc1 = 0;+ }8 V# N* C5 R. P7 N' H; |6 V
- dma_addr_t dmaphyssrc2 = 0;
9 N1 V; X+ ]+ D; ` - dma_addr_t dmaphysdest1 = 0;
- j7 d" y/ [6 D* d- f4 p7 C+ j - dma_addr_t dmaphysdest2 = 0;9 y1 b& {7 y; b! N/ S2 I r
' _6 @* G) K( m- char *dmabufsrc1 = NULL;/ B8 B, N' `' a: z V' Y1 W% }
- char *dmabufsrc2 = NULL;( ^" r9 b4 c8 i0 F
- char *dmabufdest1 = NULL;! m- C! n* U( ]/ B) n" E2 }
- char *dmabufdest2 = NULL;
" m( ^/ p$ Q6 ?3 ]7 [& F% F5 U
9 M% n i& C; x7 G: q- static int acnt = 512;5 K( L3 Y: W2 z3 \1 M, W. q
- static int bcnt = 8;4 W+ M, d5 j( M+ |$ g( I% q
- static int ccnt = 8;, R6 _4 v0 H1 i. O" Z
- + B9 r) @0 U H) b$ [/ t0 _! }
- module_param(acnt, int, S_IRUGO);
7 ~( u" q4 B1 H. P% R - module_param(bcnt, int, S_IRUGO);: V1 Q n- A% A j0 y
- module_param(ccnt, int, S_IRUGO);
复制代码
1 d1 U3 D4 F# s) o) X& |0 X l: R. ~& T: _+ W9 W2 K' T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ o2 |1 o# C6 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 |8 t- z f3 f/ g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) m6 F3 W6 r7 C8 P, }( ?# a
2 O( v! b' l O' V8 l. L
' w, t6 Y) D# H+ ]+ y8 j ~3 \ |
|