|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( ?2 ~. f. M9 [2 k; N( M- M4 A3 B- [code]EDMA sample test application* K: q5 w) u4 m: L0 G
- /*
9 r! x$ B& p7 g - * edma_test.c- M) m5 _; y4 ]1 o7 X2 t
- *2 a; r) O" ~3 a% E# j
- * brief EDMA3 Test Application/ O# z' f4 [2 C( I3 T( y0 O* ]
- *
( B1 _7 `4 r0 f$ }4 S9 `( Z% O4 U - * This file contains EDMA3 Test code.
8 N* F+ p$ G0 i, o) h% o* E - *
9 _; B0 U2 j- B5 t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* I0 s! i) }9 }$ B2 N* w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 I+ n8 [. E9 @' |* ~* `8 F) W) c- ]
- * TO CHANGE.# w$ }; ~5 _2 E; Y
- *
0 I/ G# s4 h$ ^. K* T+ `3 ?9 ?1 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; b: B% P' i6 o& [) Y2 W8 {! X: @
- *1 i# ^! Z( @# M$ _% E& J; I% G& D
- * This program is free software; you can redistribute it and/or
5 V) T6 x ^% F7 ` - * modify it under the terms of the GNU General Public License as
- y) J6 a! E# W& j. D& \ - * published by the Free Software Foundation version 2.
$ s, z, K ^) H- y/ l- T - *1 w) X4 S7 E$ Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ `# I& p5 j) _0 k% ~; f* J9 A
- * kind, whether express or implied; without even the implied warranty
4 k; y, t8 k% G8 \. O6 r3 a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. X; u- r9 M6 t" E) u6 m
- * GNU General Public License for more details.
& ]7 z+ l$ I/ `0 L4 p1 x" r - */: l S Z7 m) ~8 V) N# D
- . E2 m7 u, q- y+ e* L9 C" z
- #include <linux/module.h>. J7 D. s2 k- X6 a J
- #include <linux/init.h>
2 F) S; `6 u, U) B m - #include <linux/errno.h>8 S% g2 k' C. J# F9 g' E
- #include <linux/types.h>0 T1 ?) ?0 e0 o: |$ g
- #include <linux/interrupt.h>
3 i0 y" i* b( |/ t - #include <asm/io.h>
+ I% H; W7 g8 U" n0 X5 M% p - #include <linux/moduleparam.h>
/ M( V& `- K* [0 X" j4 [ - #include <linux/sysctl.h>, q0 Z4 E; N% [2 v1 u9 `) A
- #include <linux/mm.h>. n* _( ?9 z1 c. t/ x
- #include <linux/dma-mapping.h>4 w& X5 O% u0 r9 v# Q I
9 n% ~' \0 y1 l' y- #include <mach/memory.h>5 I7 [1 Z( T- J7 ]# Y7 k
- #include <mach/hardware.h>
* b$ Q- @5 {! X - #include <mach/irqs.h>+ J3 o' _, L; _, Q* Y5 A) X4 Z" r
- #include <asm/hardware/edma.h>/ s, R- r; b( v7 t9 o1 |
- ) ~6 S/ z8 L( P) r
- #undef EDMA3_DEBUG- N/ D1 Q3 l9 k8 m$ i
- /*#define EDMA3_DEBUG*/
5 B% Q$ {. a: ~2 S. b( N, J( @ - 7 S" \; V1 m- g& j% ^
- #ifdef EDMA3_DEBUG( i- j, b+ [4 W8 O9 z% R4 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 A' R% \0 P! A6 r. H1 F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ \' q' b9 l0 y! G' n! f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ @9 A2 l% n4 ~, H+ {& f, [ i - #else# \, i* d5 A# x$ @1 D7 Z5 E
- #define DMA_PRINTK( x... )
4 q* A; {0 |6 r' {3 l7 Z$ G& k$ V - #define DMA_FN_IN5 J2 k& ?1 @. c; P' d+ Q
- #define DMA_FN_OUT2 K6 {# D" q( w3 P
- #endif7 h; @6 P+ n) B
+ J- t6 V( c; h ]- m4 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% H2 P5 x$ U" w! C/ z6 ] - #define STATIC_SHIFT 3
" y" w" Y; q" I - #define TCINTEN_SHIFT 20
: T( \# n7 Y7 E' Y% G6 Z - #define ITCINTEN_SHIFT 217 y/ t1 E8 { P1 F" A9 z3 V
- #define TCCHEN_SHIFT 22
* v- j- n0 z$ X$ H - #define ITCCHEN_SHIFT 23$ X' ]! r/ o2 r/ u: r% ~
6 A. Z6 E8 `" U; F& N- static volatile int irqraised1 = 0;/ G/ J! _) {5 y
- static volatile int irqraised2 = 0;' B+ K( W4 J; C0 E9 e. x
- 1 P. G$ j# j/ g7 S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ a! {9 e" Q }$ j. V+ p7 c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 {; G2 D" p) i6 T$ h0 U5 j' x% U/ L) o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ~' k$ P2 C4 d
- . n8 U- z- Y5 u6 t
- dma_addr_t dmaphyssrc1 = 0;
& y$ H/ {* {' B3 n; E4 F" o1 B$ e - dma_addr_t dmaphyssrc2 = 0; h# `# Z* p& |7 r3 v2 c
- dma_addr_t dmaphysdest1 = 0;- k. q5 _+ W T- Z
- dma_addr_t dmaphysdest2 = 0;- j% J( w8 q0 K: ^; }2 `
6 G- T( @0 v5 E1 L7 N' [! J9 c+ ?6 N- char *dmabufsrc1 = NULL;
% n9 o U% B8 h* u* ] - char *dmabufsrc2 = NULL;
( C6 l5 p1 W3 p - char *dmabufdest1 = NULL;' m0 l' M7 Z+ k0 l, F: M
- char *dmabufdest2 = NULL;
/ B3 x, D( Q3 U2 _) K3 e6 c
' D& [! O6 l* }5 c' d- static int acnt = 512;
$ g* s) ?9 m3 U1 ^8 i3 q - static int bcnt = 8; U5 J: j2 f% P
- static int ccnt = 8;0 j, `: ^) @& O h* l
- 6 A. Y" `: k4 A* T
- module_param(acnt, int, S_IRUGO);/ N/ y2 [# x6 R# [
- module_param(bcnt, int, S_IRUGO);) a( a; G+ u, i4 p
- module_param(ccnt, int, S_IRUGO);
复制代码
& E6 N% V% o# \' x* ]+ A! Y1 t7 y$ G8 G3 K2 \, ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, W) e/ E4 s, W# uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 o" o& n e- ~; ?9 g; }% t# d! e! o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 o$ r/ w2 B: s2 l3 X" a) P! i) u% ?
8 y6 ?: e. o2 }$ h7 `3 I# H9 ]' `0 e- F& U, T! b; H
|
|