|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 o- t9 E' {: C4 |( o S, v ^
- [code]EDMA sample test application' l- ], M* O2 d/ X( l6 T
- /*
" D$ Q6 b) B4 [" E' e6 a - * edma_test.c4 y/ v& y( k1 J ]( {* ]
- *
- [* I2 p0 Z' V* S/ M( i' z+ Y+ y - * brief EDMA3 Test Application
4 ^+ H# B5 w- Q5 j5 n - */ z) t8 Y% |- G& V9 l+ f- g
- * This file contains EDMA3 Test code.
* F+ G' j! X ~: q& ]' Q6 h2 \+ W - ** S, E# l' z) w9 x/ v3 b4 x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, I6 a" t- [" v* H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* ]1 Z5 ~: x2 m4 T7 \* a
- * TO CHANGE.
2 t3 `; K6 Y Q t: ^/ E - *
7 a' T- W7 p; ?: R) g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" D5 r! W/ h9 {, e" Q4 A- h
- *
8 H- b/ f8 u, O/ o @! j - * This program is free software; you can redistribute it and/or$ P% h1 ~0 Q2 \" l( S. `+ D
- * modify it under the terms of the GNU General Public License as
5 a k* {; B2 L - * published by the Free Software Foundation version 2.# B& W/ s+ `/ ?2 z: ^1 r1 I1 K0 P1 b
- */ _5 E1 _) ?) L4 Z9 r# M2 R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. N8 F+ n* L+ N- b. `. Q8 H) o, l - * kind, whether express or implied; without even the implied warranty2 W! f- W, {3 l! }& @ G) e: e- j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 A6 C- _! \; u/ k- E { - * GNU General Public License for more details.
7 k/ h* D8 o! R, ~3 T6 B, _ - */
$ Z$ Y( K# S& R: N5 i6 P% D/ {& L - ; `" ?& ?+ g, }/ l' s
- #include <linux/module.h>8 y" k4 x5 k% H' @) D$ I
- #include <linux/init.h>) T5 {+ q) O7 W0 q. g! q8 a
- #include <linux/errno.h>/ B. @" }) `0 {. ]
- #include <linux/types.h>
6 d6 T% K4 X% H% K: {( ~ - #include <linux/interrupt.h>
% q `' Q4 b, Z- N - #include <asm/io.h>
) p4 V2 X7 b. d* v' {( Y% U) d7 v - #include <linux/moduleparam.h>
3 U9 J7 o; \ o# f2 a# y - #include <linux/sysctl.h>
" N" F" M" n& l: O1 `2 y, G9 X - #include <linux/mm.h>6 R1 A" U) p8 [8 ~* B5 y
- #include <linux/dma-mapping.h>5 }" C9 F1 a2 Y5 b: d' r
- : s! [* B" W9 S+ {- U& I! [
- #include <mach/memory.h>
" X9 e* O' w. p3 Z - #include <mach/hardware.h>
" _* K6 V& i0 ?8 V0 M/ Z - #include <mach/irqs.h>
0 z; c$ k" a) y# Q' Z& p - #include <asm/hardware/edma.h>
8 |- p4 d" K; O& ]7 H
$ C J2 D, ]) {& t7 n, t- #undef EDMA3_DEBUG
: i$ w" X& C \3 w. e2 W) O - /*#define EDMA3_DEBUG*/
9 H3 r Z+ w; q - $ K1 I( p0 A' p7 q8 {$ A
- #ifdef EDMA3_DEBUG/ m; P4 w; `/ I/ D7 ~7 }+ D5 h8 X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 m5 Z, h( k- Y& s. t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' _( n6 G- @" y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ D8 i" k0 Q' G8 s( j! V - #else
2 m! |$ D# a' Y6 e" l" f - #define DMA_PRINTK( x... ); B( g5 e6 C, j( V; s7 ]
- #define DMA_FN_IN* X0 S' `8 L; @
- #define DMA_FN_OUT
1 ~" l9 E, V) o& K6 G* U5 C* W - #endif6 E( D5 J/ s5 r: m4 O
- 9 S$ ~, n% r* m& O* K9 t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 ?. I6 }( m% I [+ H3 Q - #define STATIC_SHIFT 3
+ d! L/ p/ `4 b" ?# A0 u - #define TCINTEN_SHIFT 203 p( |# M5 B; V4 N9 m! w* Y
- #define ITCINTEN_SHIFT 21) m: l8 T! n$ r+ f
- #define TCCHEN_SHIFT 22
" U. B9 P8 i! ?* g - #define ITCCHEN_SHIFT 23+ p! t+ Q8 n, J6 ~. F& }2 x
: ?4 i4 R& t. w! m9 x% |+ l- static volatile int irqraised1 = 0;$ ]& K" ^( h2 Z
- static volatile int irqraised2 = 0; L f2 V$ Y. a* S- ^6 `
- 4 I9 T9 A" s3 W3 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 W1 m2 a8 e1 i X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% |. c* T# q/ B2 u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 L8 v# e7 Q: U; n
- 8 @% p5 u/ k5 x8 o/ V3 j
- dma_addr_t dmaphyssrc1 = 0;
$ J% l: s1 t9 ?6 X9 A) ~% G/ ~ - dma_addr_t dmaphyssrc2 = 0;
8 ? u4 F* p, ]/ F* l; f - dma_addr_t dmaphysdest1 = 0;+ O( R* R: Z V2 f
- dma_addr_t dmaphysdest2 = 0;4 n! O( j, N0 s) N% x8 |
5 f5 K4 l$ p, D- K- char *dmabufsrc1 = NULL;
5 Y: v3 w8 d! D' A( D3 r - char *dmabufsrc2 = NULL;) [ M3 J) @: [7 Y0 b
- char *dmabufdest1 = NULL;( A" {4 _0 w1 t* e! a i- f4 `
- char *dmabufdest2 = NULL;: G# Q3 Z5 n$ g* g8 ~
- 1 N8 P5 |2 A! {7 J/ B
- static int acnt = 512;
0 p& [# K1 e# r2 K9 Z( F/ P - static int bcnt = 8;' Y' w, _) w/ w
- static int ccnt = 8;3 l1 M1 ^7 f t6 Z* \) T# M
# [+ s$ e! b: j* B) F/ a) K/ N- module_param(acnt, int, S_IRUGO);
) s* L- |( n5 W4 w ? - module_param(bcnt, int, S_IRUGO);
/ i6 y$ \, _ M - module_param(ccnt, int, S_IRUGO);
复制代码 2 S# A' q2 f$ Q. K
5 `* P8 x7 Z7 h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* D+ I' _4 Q1 R; N" D/ b' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- O" q: i% c. b% |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! \# `% J" ?' V$ i* w
t+ O; b9 x/ Z1 I# D0 Z7 C- h
8 D7 u% u" F7 F! q# ~6 {. B |
|