|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 [9 X7 b+ p& E0 j% A; L$ P
- [code]EDMA sample test application% r8 t; L! F, x! j
- /*4 }2 L* F3 F. B
- * edma_test.c
3 c* z3 C. L5 t2 U' } - *
$ `) [# D+ t% o& y& x - * brief EDMA3 Test Application- M6 P5 A( A, E) k- i
- *
, j8 a/ k$ u& U, P) \' x# t( j1 T# ~ - * This file contains EDMA3 Test code.
V% ]- e. H& n6 x/ \( } - *
( k& ?1 C7 I. h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ l; J( L1 V8 V8 c' X, ?$ D# u( B' _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ b7 N6 x$ H* y' N5 N - * TO CHANGE.! {7 f6 q/ u- u9 I; j! R/ a$ z) p- {
- *
0 a6 F! _* `( A% y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; v) ~2 o( S' d) t( s0 E - *
: b, `: G: \, `) b% w - * This program is free software; you can redistribute it and/or5 M7 l& b5 [* i; b x
- * modify it under the terms of the GNU General Public License as
* S1 R# k Z4 @ - * published by the Free Software Foundation version 2.
; G- ?1 |! f5 o. z - ** L$ g0 }7 r' O5 v" `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) g- t( ^) V8 @ - * kind, whether express or implied; without even the implied warranty
- P( T+ U4 Y, l+ F2 t5 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; ]; \. n& j( N* q7 W
- * GNU General Public License for more details.& Q) s" E V5 B5 z
- */
5 D1 l% \) q& o1 v9 b - 9 ?, ], P5 z4 r
- #include <linux/module.h>1 W% O* o8 V; X% i V: M
- #include <linux/init.h>
h9 C2 A5 n/ v3 X9 R1 R - #include <linux/errno.h>( {# [* a7 `) }2 V. p9 v1 d3 H( i s
- #include <linux/types.h>
- T) @( a6 D% h# }, `" J8 j - #include <linux/interrupt.h>
- H5 y% \, v5 I - #include <asm/io.h>
6 ^1 Z. a" V) T5 \+ J- v: G9 O - #include <linux/moduleparam.h>
! t% w u1 n; x& l } - #include <linux/sysctl.h>5 z: S& W( ^5 C0 j, Y$ \
- #include <linux/mm.h>
2 J, D2 w% Y6 \1 U* Z) ] - #include <linux/dma-mapping.h>6 E1 V* r1 j9 O/ t6 H
9 n" u, M9 o' V( v; J- #include <mach/memory.h>+ v& U+ e, n( C( s3 B. r
- #include <mach/hardware.h>8 |# e* z2 a1 b# ]2 c% o( Q- I
- #include <mach/irqs.h>
" A4 P( H5 n# t9 Q% Z - #include <asm/hardware/edma.h>
8 z. n3 D% T9 M$ T - 7 O0 M7 t% f9 f8 z |# k
- #undef EDMA3_DEBUG
+ F" X H8 Y: c% ]: B1 d* ]( Q - /*#define EDMA3_DEBUG*/3 ~' F- R1 D& ~; d: z/ m
! `* A, G8 E+ q2 o b2 l9 t% |- #ifdef EDMA3_DEBUG, j6 F/ y0 a0 m) Z* B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) J- z9 q1 H/ z+ ]4 Q: ~0 ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! C0 V3 s1 M0 x) ^0 i; v! c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 e E- V- ~5 J/ N% A
- #else
3 L- l& l4 S" Z" N - #define DMA_PRINTK( x... )
" W, A8 f/ `( t* J8 | - #define DMA_FN_IN' F8 W* ~7 ^1 o: h/ [+ m1 ^: K
- #define DMA_FN_OUT
2 @" e ]' N- Q5 \- I - #endif
" ? E& N! I9 H/ X5 l/ L
, [/ @0 H& r @- G2 W* H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 ~! h/ ], C1 J; B
- #define STATIC_SHIFT 3
3 j# T$ D1 i H* \+ X/ \/ h - #define TCINTEN_SHIFT 203 K: w$ [6 Q3 m# }8 z* C& C
- #define ITCINTEN_SHIFT 21 ?! k0 h( Q: o& g( t; \( b
- #define TCCHEN_SHIFT 22+ w+ g$ c- g+ j* r6 H3 M
- #define ITCCHEN_SHIFT 23
( ~0 x" e4 q; i" d
, Q6 _& e9 L* V! g& Q- static volatile int irqraised1 = 0;
( C: r9 y+ ^3 e* { - static volatile int irqraised2 = 0;
, Q, e" q& U5 k& w4 T% a) | - ; m8 W$ V( G* w* ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% M6 h) _$ t! A3 N3 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ v" X0 E- ~+ Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ~* d1 i5 z/ |# ?6 G7 J+ `3 H
3 ?8 \- }$ T7 x' Y% T9 G% I- l' R- dma_addr_t dmaphyssrc1 = 0;
" G; } l* K) V+ H( U: k - dma_addr_t dmaphyssrc2 = 0;
7 K- p. Z1 b8 ` |0 X! y( _ - dma_addr_t dmaphysdest1 = 0;1 h ]# K, O. V% A" v
- dma_addr_t dmaphysdest2 = 0;
7 f6 b, q8 m. w" {" M: E; r8 o, D
; W* c: p _3 O& S* f- char *dmabufsrc1 = NULL;
# R7 G6 ?% C! k- E - char *dmabufsrc2 = NULL;
; C4 r7 {% v( |4 g0 ` - char *dmabufdest1 = NULL;
$ x5 |& v2 O- ~# B6 u* q - char *dmabufdest2 = NULL;8 f3 j0 I1 h/ h4 Q
- * x: P* x4 x8 C( \5 o/ ]
- static int acnt = 512;
* W) H, |; _/ u9 _: ~4 M- M4 Q. F - static int bcnt = 8;
1 p7 b! ]3 k* j) q# w6 a. x* K% z - static int ccnt = 8;
7 u- X' L' ~. ?
; T& a8 k. j' L5 C, t& L- module_param(acnt, int, S_IRUGO);
) E, g( s! d3 p! w - module_param(bcnt, int, S_IRUGO);
% B) J. H; N9 I, k/ ]- G/ U - module_param(ccnt, int, S_IRUGO);
复制代码
+ n% A+ I( E0 _! k6 g" p4 T% I$ |/ \6 g; _. F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& P0 l0 c7 Q8 t* ?5 F1 d9 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( j4 P6 D7 Y: f$ m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 Y2 T9 N2 F/ _( J+ w2 n
: ?7 {. g/ d# \+ I& T: l$ S% s+ |! V. T! [) M
|
|