|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, T1 N# ^- k2 y7 |3 m- [code]EDMA sample test application
( J0 ^1 S t6 ?5 y - /*- p. ~% q- E) w9 z; ^
- * edma_test.c
; P. C3 U# _' {- H$ c - *+ x) P- W5 d" M
- * brief EDMA3 Test Application7 [6 K* c# u( m2 {% A
- *
- F2 G" B# W; o; ^9 \5 n# _3 d' f+ m - * This file contains EDMA3 Test code.3 L7 h/ X) f x; `' v8 M3 A
- *! u2 E' a/ r& l8 Q, w4 J4 l# j9 G& y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' I& y) C( U) ~3 O& u. N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) S+ U! R7 T J6 Y! b - * TO CHANGE. C: F# D1 A; B+ s2 E3 ]8 ]% z J1 u
- *' ]% R0 t: J: R. R) _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 U) C! z$ e, q9 i: { - *6 W2 c$ h3 W* w6 P* d
- * This program is free software; you can redistribute it and/or# f5 _9 T/ U i' d
- * modify it under the terms of the GNU General Public License as
6 m, W: P+ S: \! \2 k - * published by the Free Software Foundation version 2.
9 G: G1 |# m6 X( W" b9 P% p3 F6 a, | - *1 l. \) F6 l/ r$ T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: i ^3 N! v3 s; ~1 l$ b' u - * kind, whether express or implied; without even the implied warranty
) P% b* Z( x1 y6 r; u: g, E" S# k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 h- n e5 K9 K( g - * GNU General Public License for more details.
M. b: T2 Q/ e! ^ - *// P+ T4 e- b+ S# z1 C4 \& n' ^
- + n" T4 B' j( o! W- H
- #include <linux/module.h>
( F0 e7 u+ s) o* M- e - #include <linux/init.h>* d% P L" d- O, t4 Z& T
- #include <linux/errno.h>
9 {' x' k F2 t: p* b; w - #include <linux/types.h>5 P) f# J6 M& K0 R/ o' H9 ?6 _
- #include <linux/interrupt.h>
+ V. E) V6 w# r - #include <asm/io.h>8 D, D; `; J3 u+ ~
- #include <linux/moduleparam.h>* h$ O- W) O# s$ ~) |
- #include <linux/sysctl.h>
- w# n6 j& [& I - #include <linux/mm.h>
: e* L3 }$ I( D: p) i - #include <linux/dma-mapping.h>5 W7 d- `+ a2 @: J( f0 V( f% t
- ) m: }. W# x: u& E1 ]
- #include <mach/memory.h>
7 r' l- T: j6 D5 J" y" j - #include <mach/hardware.h># G+ p5 u j7 ?) L$ o U
- #include <mach/irqs.h>
3 [" M. `1 E. J" e2 G/ `( z9 T - #include <asm/hardware/edma.h>
- k5 U1 o: O8 w0 p/ E% p
2 l% z( F4 i+ y. {1 X; {3 ]7 X3 w- #undef EDMA3_DEBUG; s9 i8 d- M3 _& G/ {( m' R5 W Y4 A
- /*#define EDMA3_DEBUG*/( ]2 ~$ o% a, ^' a/ B; {3 |
( \- o/ ?8 G( g3 L+ X- #ifdef EDMA3_DEBUG% C) U2 l6 b8 ^# _0 C, H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& d( I4 Q7 C5 f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). H, @9 l j# E, a4 M" h x1 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 |6 y% W0 r& b4 G+ V6 p - #else! G! W; t3 v7 F& ? ?, S$ G9 h
- #define DMA_PRINTK( x... ). L, O" a$ V* V1 N! H) C
- #define DMA_FN_IN
& h& H% z4 O0 J& K; R( ~8 o& @ - #define DMA_FN_OUT. } l# c3 [* f7 \3 X
- #endif. E o; [, \. G7 X
- * u |8 u' r( Y6 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); Z; f2 m8 p" ?- D% X8 c
- #define STATIC_SHIFT 32 g8 G# z2 k2 M+ d9 Z
- #define TCINTEN_SHIFT 20
4 r8 I5 \7 z% D) v, g* c - #define ITCINTEN_SHIFT 215 t9 K/ n, n0 t8 ]4 P% `9 m. G
- #define TCCHEN_SHIFT 22
2 U. Z. S( e/ i; b( r - #define ITCCHEN_SHIFT 23
7 B2 W r: H7 x* c$ B; E - , K7 ^# w Q0 b+ h9 g: ?. e3 f
- static volatile int irqraised1 = 0;
# L+ k$ O! ~) ^ o. K+ b8 g7 c - static volatile int irqraised2 = 0;8 }0 k9 e F2 v
- ; x B/ F: q$ z! ^1 S+ {" _% W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 w* L ?) I# W4 t/ }5 h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% L& I/ `. q0 S4 x; c: L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 x* x/ t' H. Z7 c0 A2 E - / n4 F! Y' r& l9 ?) E
- dma_addr_t dmaphyssrc1 = 0;
' U& D5 [: W7 O, r - dma_addr_t dmaphyssrc2 = 0;
; t# N2 Y' b2 b+ \ - dma_addr_t dmaphysdest1 = 0;
, @: [4 J) g6 Y- [" o - dma_addr_t dmaphysdest2 = 0;0 `- S$ \8 G, s% I0 b
( o- a. }* D9 U$ `2 I/ S2 ?! u- char *dmabufsrc1 = NULL;
- X8 h$ c* l% }/ w4 ~4 M* Z7 o4 e - char *dmabufsrc2 = NULL;2 e% s& I+ B& I1 ]
- char *dmabufdest1 = NULL;2 d1 l' h6 w4 s2 y
- char *dmabufdest2 = NULL;2 K5 c$ i1 u$ g0 U: U6 Y R8 y
- ( ~' h4 S% Q- F) Q& v p- x6 x' v* P2 h
- static int acnt = 512;1 t. I: R% j5 | _ j( i8 |' s% t
- static int bcnt = 8;) w9 N2 h8 L, x& h
- static int ccnt = 8;: _, B1 X4 U; R) _1 e) W* x/ m
- : a9 t7 H5 N3 _7 F& S
- module_param(acnt, int, S_IRUGO);5 W+ a+ v" M$ X. S3 j! P+ F
- module_param(bcnt, int, S_IRUGO);
4 G9 l0 k$ Q4 Q% B7 }& L) R }" Z - module_param(ccnt, int, S_IRUGO);
复制代码
K1 {' G/ V: t( G ]( r q4 x, ?
& w) }+ t, c6 C2 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: \) m) d/ Z# i+ q5 g: sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* y3 }+ S& I4 d' r4 U& Y7 c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" f# ^) w; G' l6 B
* t& N- t' S" Y3 c, U+ J
1 [# b) A3 N, K3 v% C |
|