|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# V( ^ B% o5 v- \( i/ L- [code]EDMA sample test application
# `4 |( q% W& |; N* R - /*
! Z" ~) H9 Z) j% J' V) }' T/ n - * edma_test.c
- C7 Z8 v! E6 y1 q& { - *% P. Q0 H, D4 e" i5 v1 s$ k- [
- * brief EDMA3 Test Application/ ]5 x Y V* q: I
- *
8 J- \4 x, A4 }' K: d - * This file contains EDMA3 Test code.8 B+ I, E% h7 U. A
- *
% H- j& O1 z: V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ M7 ^0 K" k7 m- y$ K7 u! w+ M4 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- [& \. X5 [- p
- * TO CHANGE.: Z' J, _$ L0 k& ^3 V5 h& r: O
- ** u$ `, U- a M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; g. K0 }4 `. {8 V/ X& M - *: r. m& k5 [* R
- * This program is free software; you can redistribute it and/or( ]+ N8 d: h3 N* b$ o) ?7 L- z
- * modify it under the terms of the GNU General Public License as/ _, x7 Z$ ~" j" m/ c' W% t( t
- * published by the Free Software Foundation version 2. u5 O8 R$ e; z: E2 i
- * V3 {2 _- v" n2 V K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
G+ `- k3 s6 T# X e5 g k - * kind, whether express or implied; without even the implied warranty
7 F1 B% t1 N. r- s( x& Z* H: ]7 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ D. f% m; l3 ?0 c8 H W. n+ R/ v2 l
- * GNU General Public License for more details.+ [0 D: H: W8 O. X2 Y
- */
; p( a( }; L- P! g3 F! r) c
" x9 D, m2 q1 g5 l* K- #include <linux/module.h>) K7 M, f* [# T; C" @9 H' N9 d
- #include <linux/init.h>4 F2 X1 p1 ^$ {" ?8 l( J4 Z* C1 q
- #include <linux/errno.h>
1 W ?. W) u6 A( h - #include <linux/types.h>- L2 {( j* _; S4 D/ {
- #include <linux/interrupt.h>
h6 W( d ]/ a - #include <asm/io.h>- ]# S) j* \0 v4 \% i
- #include <linux/moduleparam.h>2 h. H( o, X2 r2 d- g( ]- E$ b0 X
- #include <linux/sysctl.h>' A, v& ?( b) o8 ?0 J4 X$ |2 o
- #include <linux/mm.h>
3 o3 Q! k. J$ s0 X; H. `# e - #include <linux/dma-mapping.h>
9 h, }' O0 ^# f5 {# u3 L2 c
/ F2 x; z% m0 i( m! M- #include <mach/memory.h>
* P6 B2 U1 Q3 U/ K! o - #include <mach/hardware.h>
' i& o; V4 D4 |% M: I$ Z - #include <mach/irqs.h>3 b F: A6 b! {
- #include <asm/hardware/edma.h>9 Z2 _2 h- F/ v
- I( w6 g7 Z0 k0 D# t$ s
- #undef EDMA3_DEBUG+ H E/ ^3 g! B5 r0 d' m
- /*#define EDMA3_DEBUG*/
& ?; {1 | f/ ]: Q/ E - 8 _) I0 F% k+ P) f
- #ifdef EDMA3_DEBUG4 e i' y9 ?" y5 s! l% Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ Q& d6 E/ N! { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, H6 I9 j6 ?5 |/ M3 K$ B2 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 p4 _! ^8 R' w; W6 k
- #else( b. C; R# m% \9 _: {: u7 @
- #define DMA_PRINTK( x... )
! u$ G- u( b& J - #define DMA_FN_IN8 S; e* O0 p: ~
- #define DMA_FN_OUT4 h; a0 D$ k) a G& ^
- #endif
( _& l' C5 L) t1 | - 1 q1 ^- d) R2 `( s2 d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' R! f9 o1 l, W3 F/ |0 ] - #define STATIC_SHIFT 3" c9 K7 B7 n) @$ q Z) @/ H6 X
- #define TCINTEN_SHIFT 200 I( H( M3 q+ D [/ k2 @
- #define ITCINTEN_SHIFT 21+ V( F, A% ]% v7 L2 [
- #define TCCHEN_SHIFT 224 K/ O1 s0 m9 J& S* ?
- #define ITCCHEN_SHIFT 23
5 X5 v' y# C# a" q2 \' [5 w! p
, C. J1 _3 s+ L- static volatile int irqraised1 = 0;
8 p; Y3 Z6 J: } - static volatile int irqraised2 = 0;
' m8 Q& C! K0 w9 R/ V; w) G - ! i, M2 V8 ^& Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 `3 ^. ~8 ]1 j! [1 V; z2 _# | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 @7 l* O O+ |% w; O! K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 c2 z; o. [, R" ]+ z, m
f2 @1 P _! b" q, [. B1 r0 n& a- dma_addr_t dmaphyssrc1 = 0;1 C4 @1 ~3 S/ F2 v1 t7 L1 x2 R+ y
- dma_addr_t dmaphyssrc2 = 0;* @( U( C2 Q3 E0 o+ [0 a$ a1 m+ @
- dma_addr_t dmaphysdest1 = 0;3 G1 U& ^7 d" @* X$ h2 S4 Q8 P
- dma_addr_t dmaphysdest2 = 0;
' o* C( G' a$ l( h1 X' Q; j - 3 N* d- Y+ I3 n) j0 v; v3 r4 ]3 v
- char *dmabufsrc1 = NULL;
( j4 C2 b8 J+ G' Y+ y - char *dmabufsrc2 = NULL;
. D' T: C0 l5 h - char *dmabufdest1 = NULL;
" i. Z# \ P6 W; K7 s( C - char *dmabufdest2 = NULL;& z6 t* A2 ~9 u {
- 7 [4 G) m2 d- Z! K7 s4 z, o
- static int acnt = 512;
5 x$ G6 A3 K- ~! H! A1 J - static int bcnt = 8;
* K" N$ ]4 k1 S$ r - static int ccnt = 8;
1 @. N, b& s+ _% Q; L - & d. R* H# T$ ^$ |1 i
- module_param(acnt, int, S_IRUGO);
0 |/ b& I8 x# \0 c( g9 M - module_param(bcnt, int, S_IRUGO);
# w9 J8 F( U' j7 S* B* E5 W - module_param(ccnt, int, S_IRUGO);
复制代码
6 o2 e" k8 i, S# w! I) C4 N+ Q% o- _. `, |# a+ ]9 U+ S- M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ f1 ~* \% t( J- e1 ~9 l% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 o, ~8 v! A; D, o0 A+ y$ Y/ C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ P k' U. O! X! f, G& e4 `7 [1 _" d- @& P- s8 t0 x2 o3 D' q: k) a
! P, ^# j; K6 w) N7 V$ i5 z |
|