|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; _0 o6 T& B- Q4 \2 L
- [code]EDMA sample test application% |6 G O: \% k( R
- /*
1 U: _: l+ \& {3 W) n, x y - * edma_test.c9 M3 W* g- d; L; P' }2 l1 w i3 b
- *! R4 x) [' q' e& |$ n( b
- * brief EDMA3 Test Application2 o% s2 F6 W" C [+ S$ q
- *) N7 g/ W+ S; X& K0 y! I! A* ^
- * This file contains EDMA3 Test code.
: M; } k5 V& N5 a" |; ]9 } - *( _/ i) D. z" c2 M& b$ a2 ^8 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) i) ?$ _2 I5 y- v% n: r# c5 k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; _: n8 L5 n6 m0 u; p* `* A
- * TO CHANGE.* Y1 b' \0 n$ x4 x7 l. p& g+ h! e
- *
+ c: N5 K8 V6 j; y: m9 K; Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ I/ U: s4 U$ s+ y( q - *
- G- ~. h4 k0 m; r. z; ` - * This program is free software; you can redistribute it and/or
|0 s- e/ v$ g# C - * modify it under the terms of the GNU General Public License as
6 O7 G1 Z$ F* f r" k8 h - * published by the Free Software Foundation version 2.
# C& a0 G5 Z$ x: t% b% H6 c2 x - *. a$ h# p8 [/ y3 m' y5 z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% \: f1 S- ~) X% w# W3 ` - * kind, whether express or implied; without even the implied warranty* E" T* ^9 V; t2 N. z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 f* ]3 H, f- l+ A) m9 Y# [ - * GNU General Public License for more details.: B: h% S, U8 ]
- */
2 _6 _' E% P# D) X& j
8 M: T# J; s; y$ M- #include <linux/module.h>
: @/ V( U+ m9 v - #include <linux/init.h>
" g5 t- m( M" A - #include <linux/errno.h>
/ t& R/ O* V. I. Z2 J - #include <linux/types.h>
! k' i$ \3 |2 \$ M - #include <linux/interrupt.h>
8 I. T* K6 o5 }, R$ \) L9 C7 o - #include <asm/io.h>
5 O* L4 F) P8 Q# Q6 x6 ^& J - #include <linux/moduleparam.h>* g0 @" ~3 X& V, G
- #include <linux/sysctl.h>9 E. P% G) E3 `1 f, s6 O0 P
- #include <linux/mm.h>$ P+ `) t6 Z, K5 f% z, p
- #include <linux/dma-mapping.h>7 y( @: n- r3 N
- 3 D4 G Y3 S1 |% I+ `; B
- #include <mach/memory.h>) H1 B1 d% Y7 S2 h: ` `4 x' u9 m
- #include <mach/hardware.h>9 [8 p$ \: c/ u( c
- #include <mach/irqs.h>6 k- F+ b- @ ?& V$ j8 z
- #include <asm/hardware/edma.h>
6 @. J" Z0 j' }0 ?9 U' t/ n" X
: A* G% g: ^0 D5 H* X. [7 R2 K- #undef EDMA3_DEBUG6 J' b1 f5 ^. {1 K: z6 N
- /*#define EDMA3_DEBUG*/' e' y: Q. A" S r/ J
2 [; u0 b; K/ H3 O# ^- #ifdef EDMA3_DEBUG
' ?; g' d, l$ O5 z% W+ ?1 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( ^4 L" W5 J! c" M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& q+ h4 C( U2 P% j/ D0 O# {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% v: q8 t) X' Z' k0 }* c - #else7 n6 x$ r F. J) f X
- #define DMA_PRINTK( x... )' y1 ~7 q' a9 n3 F: i# N4 @5 n7 Z8 N9 T
- #define DMA_FN_IN
4 R! I' Q7 z7 L" J# v5 |9 L a6 t - #define DMA_FN_OUT! j: c' W o1 a# g# ]
- #endif( O; W3 h ~3 [( u+ Q8 `
- J4 D0 w; k3 W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ u. Z0 @+ e( \1 }; @) F# L$ j8 X
- #define STATIC_SHIFT 3
1 Y3 d4 V, O# c* t. N - #define TCINTEN_SHIFT 20, p N. J# x* b9 }4 ^
- #define ITCINTEN_SHIFT 21 B+ d+ i' F$ R; W6 l* x
- #define TCCHEN_SHIFT 228 q+ N4 \$ X" |1 f
- #define ITCCHEN_SHIFT 23
4 k+ A2 n0 S" w4 @0 P
* U8 B6 \# X" |% L3 {5 v, X- static volatile int irqraised1 = 0;
8 h3 E) ?$ w0 i! ?- d4 _6 q - static volatile int irqraised2 = 0;3 W1 N0 J; i# y/ X) L
( v Y6 `- M; s% `) b% j; A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. W# ?8 L. a- }8 l9 q5 N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* W. R+ }; V, c( m& L' k: Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 u; I1 y4 ?, \( G; D
2 T" E/ `# T- G+ u2 ~) U& t4 s- dma_addr_t dmaphyssrc1 = 0;
+ s4 O; ?/ U6 g ^1 U2 I1 H& w% L - dma_addr_t dmaphyssrc2 = 0;$ c$ x6 u3 B$ {$ e" c' ?8 B: y% }7 ^
- dma_addr_t dmaphysdest1 = 0;- J& P% d; B0 P) h# j: s( ^
- dma_addr_t dmaphysdest2 = 0;
& e3 \. H, K- u6 Q; N2 e: t1 _1 ^ - & H J5 U% [5 G# p9 A! O" Q e
- char *dmabufsrc1 = NULL;
& y3 D) W* K* a& R- S - char *dmabufsrc2 = NULL;
- I3 L$ X) @( Q1 G - char *dmabufdest1 = NULL;
$ i! P9 w& } \5 b( a7 p1 P - char *dmabufdest2 = NULL;
7 c* a( `0 V) z6 L
3 x3 u' k# G1 I: N& o$ }- static int acnt = 512;1 }2 y2 R. _' ?) p
- static int bcnt = 8;) a6 O3 O) ~" \* B" ^# T
- static int ccnt = 8;, n8 ~1 B6 E) B+ ^
3 d# O$ P& A+ u2 d6 q+ e: X* q9 c- module_param(acnt, int, S_IRUGO);
3 \% H# E' E3 n5 l9 h _ - module_param(bcnt, int, S_IRUGO);
/ b0 b, L0 y) g! J, r# s - module_param(ccnt, int, S_IRUGO);
复制代码 3 T. i1 X8 N! g s' l7 g* v
/ w' H- V' Z6 B& X8 D1 ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" M0 x$ F* v3 W0 \1 S2 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ m7 q' ]+ m( L: t! z2 ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 @' u* _ E7 i4 W) G8 d) C( R5 ^) Z% m- K3 c k
( W+ F0 t, D# c5 X# ~; c
|
|