|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " C$ `; S" @! e3 Q# }( p6 G6 M
- [code]EDMA sample test application
1 R+ }% `2 _$ C- N5 v! J - /*8 @) D" J* k; }6 h; Q- T) I
- * edma_test.c& Z# d/ B. i7 N# v
- *+ i& v0 l* {+ V. I
- * brief EDMA3 Test Application' k' b( G. V& S8 M6 N
- *
+ B ^ a' x& P* X - * This file contains EDMA3 Test code.
1 b1 }9 ^: p) [3 q7 l$ O - *
, J* ?' a( f1 X3 _& U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: H, q, |, i+ O; ~* v9 P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- D$ \1 U0 o I
- * TO CHANGE.5 l) K* q, d, m" j$ j, b
- *
: M2 N& O- ?* r; P7 ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- \+ V( a' P2 S2 _
- *7 X8 W2 J' Z' I+ E t1 k# m
- * This program is free software; you can redistribute it and/or( w6 J g9 v* ^+ @) _
- * modify it under the terms of the GNU General Public License as
2 c' ~; M8 T4 |$ b - * published by the Free Software Foundation version 2.6 U3 ?- c' a4 m- X% B
- *
5 G# H* T. W2 B, s5 U) c0 x9 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# N- |% `- @$ t/ E* F: h - * kind, whether express or implied; without even the implied warranty
- c8 B5 A8 |" Z3 |% _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. }$ \" C& P* t. E3 t: j" N0 |- s& z
- * GNU General Public License for more details.
& J4 Z. n$ m& |' M9 E( j - */) G9 P2 f- b7 t! a+ ~
- W: P7 ]8 ~$ `% |
- #include <linux/module.h>
! e# ?$ M# ~, v6 ^8 z3 j+ s - #include <linux/init.h>: P7 n7 ] _5 _" |) \6 w9 I; F- |
- #include <linux/errno.h>. ~ @. v/ S: `: P4 r8 G' Y! K- X
- #include <linux/types.h>8 Y4 g& q1 J2 z
- #include <linux/interrupt.h>) W# D: p ~" b8 P
- #include <asm/io.h>
& Y& O4 ^& m! R - #include <linux/moduleparam.h>
# V/ l* h, `# j' s7 }7 W - #include <linux/sysctl.h>
" g3 G' K& R# e: X' [ - #include <linux/mm.h>
F5 x6 B$ n' D8 g6 d7 J8 K, ~' f - #include <linux/dma-mapping.h>
4 R! T: T2 v' f% [
, o" d/ V) ]. B5 I# n; L' {* c- #include <mach/memory.h>& [+ i, q# j* @# X
- #include <mach/hardware.h>
6 |4 b5 y1 g! z* w+ s7 j - #include <mach/irqs.h>
! Q+ z7 C8 {& N& f4 E$ c* U - #include <asm/hardware/edma.h>
) h$ [- H7 ^3 G: R - " D9 e. k4 m( Y K. P+ g t2 G
- #undef EDMA3_DEBUG+ ]* T8 P# Z! V; ]
- /*#define EDMA3_DEBUG*/ _* a+ p% Y' k* E
- , }- g4 M1 X4 c, p8 z
- #ifdef EDMA3_DEBUG
! {# ]) p: _/ Z$ a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): O) Q8 M* v& J* B8 O1 y {$ o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 P+ a$ B+ R% A- j9 ]" q. x8 X' o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% A9 a# N" u1 X. O
- #else
' h3 L1 k8 t# B1 w; l& |+ B - #define DMA_PRINTK( x... )1 f! S5 Z5 u9 d0 @& k7 u
- #define DMA_FN_IN- @6 I3 X8 R, i/ [
- #define DMA_FN_OUT9 |) j: T/ d0 p( @" S! l+ t
- #endif+ h) L! j9 w9 F
/ z9 x+ G3 g- O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ H3 S% V, c2 P* Q8 ^' L A
- #define STATIC_SHIFT 3
8 V( P; a& E. a9 D& H* k. ` - #define TCINTEN_SHIFT 20
2 I; F! e9 H; |% ?( d) Q& W - #define ITCINTEN_SHIFT 21
1 H |. i- p6 ?5 ?" T) x; @$ @ - #define TCCHEN_SHIFT 22
( x* s" P/ @: v0 C! A - #define ITCCHEN_SHIFT 23; X) \+ X% T' C6 x' e
b0 u+ } B9 K3 E& f; \9 H- static volatile int irqraised1 = 0;
, i, F- @. d1 d; [ - static volatile int irqraised2 = 0;
- M# K' B0 q! j3 p r* n# a
% [3 Q* }# }. `$ B- g* L' ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 C# ]* ~, g0 {0 x7 n5 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- U2 t6 |4 O4 F6 G7 S+ b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( E; K m' c7 z1 ?8 }: ^; N
+ X0 V3 C+ c U8 Z% [; i l- dma_addr_t dmaphyssrc1 = 0;
8 I3 o7 x v1 \5 i - dma_addr_t dmaphyssrc2 = 0;
) w; H2 x# E8 a$ I) ?0 G8 y6 f - dma_addr_t dmaphysdest1 = 0;" Q) L8 a* t) Z8 @- U" e+ }: n G: b
- dma_addr_t dmaphysdest2 = 0;( T) P0 a" l! M: ^( V* h
- ! f! }7 {+ @3 A4 a6 c# o) I
- char *dmabufsrc1 = NULL; i1 e3 ^, \+ C- J2 L) O
- char *dmabufsrc2 = NULL;
! t9 B" T0 e* N+ u - char *dmabufdest1 = NULL;' j9 f. T1 {4 v$ p6 ?5 Z
- char *dmabufdest2 = NULL;" s, L( c" p- W! V9 S6 s5 [" H
0 v% A8 e) {3 W5 r# ^9 j- static int acnt = 512;
+ T( i! f7 _6 D8 d! }9 G* O- O: P - static int bcnt = 8;
! z- z0 N% _& u/ `( R/ e - static int ccnt = 8;
: \! X9 @1 y; `
) J" F3 T( Q3 ]( Y3 E" }; X- module_param(acnt, int, S_IRUGO);( u# d5 y) {4 X. i
- module_param(bcnt, int, S_IRUGO);
5 |5 a9 s4 h. N: F9 e - module_param(ccnt, int, S_IRUGO);
复制代码
F- U8 Q' B+ ]6 A, G
. M6 @: {9 Q8 u0 y% j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 }- B2 b. Q9 B2 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& z, s0 X S2 ~( g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 x% W( U) b. ?0 s' u1 G* m
4 }' H7 T& l5 w4 u6 V' K/ c
5 i' q0 A" g4 e+ A
|
|