|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 [7 c% a" o7 ~
- [code]EDMA sample test application
; L( Y* U) g$ n2 t$ U) D0 e& [7 p - /*
1 Y5 Q! V% f4 e$ t) b0 q$ W - * edma_test.c9 @! s7 [( b7 D! B6 e# S
- *
" j% y/ \; F8 a0 F* R' Z3 b - * brief EDMA3 Test Application
% e1 h% R/ e9 g" H) q" Z - *3 `* c3 r5 {0 f3 \ |5 p
- * This file contains EDMA3 Test code.
& H; J4 k0 J6 U; s! c3 M' o0 } - *
% p. N0 r1 S# q: D( x1 } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 B0 U a g1 ~! M! s' o3 U$ F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 }0 P% f% s m! t; ^. b - * TO CHANGE.8 `# Z) Q4 Q5 v3 b6 R# H, e0 g
- *
6 y5 F9 t/ @. o4 D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 A) \, H9 U6 @0 X. u; ] - *
+ `" H. K6 X: i/ d# m; Z - * This program is free software; you can redistribute it and/or
4 b6 h" ~" b0 I0 _+ G: F - * modify it under the terms of the GNU General Public License as
7 f4 R1 K" V u# U - * published by the Free Software Foundation version 2.; x) h% q4 B# V" z
- *
' B5 D6 s$ A$ e! W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 L. W# K1 F2 S) a
- * kind, whether express or implied; without even the implied warranty, r9 w3 q$ p" T- Z# e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" i, u$ {8 R! T5 ?. R( e - * GNU General Public License for more details.# {) V" S' f" g& k7 S3 G: F/ g# A
- */
1 O# S0 o5 E" Q3 e% k
+ l4 |5 X2 x0 q) @! A5 i- #include <linux/module.h>3 e9 i. F! {1 u7 E$ s9 J! P
- #include <linux/init.h>4 ~" v* f6 ^$ g! \! g
- #include <linux/errno.h>' w3 m/ q6 p! W/ b( w
- #include <linux/types.h>5 B" T* x, ~4 D8 g6 {
- #include <linux/interrupt.h>
$ r" Q* q% K- d. T0 Z% a - #include <asm/io.h>
/ @3 I6 G5 V% l" [0 g - #include <linux/moduleparam.h>$ S$ V( w/ D; R8 u7 F" [- b4 f
- #include <linux/sysctl.h>
1 G. m8 t. a- C) [# i - #include <linux/mm.h>2 F; s/ d1 u, C, p0 h. Y% x
- #include <linux/dma-mapping.h>2 {7 v" `5 h2 @+ |8 o3 J* @
' l# g* X8 E, ?7 o! P- #include <mach/memory.h>/ V- s# c' q- g+ s3 d
- #include <mach/hardware.h>
9 Z0 h% M* f6 _ q4 w( s( a& L& e - #include <mach/irqs.h>2 b& G3 i! {0 Q% R2 b
- #include <asm/hardware/edma.h>9 H! B8 @0 r+ Q+ m6 W5 n3 u* Y
- $ G9 ]) d3 P" Q" R: y
- #undef EDMA3_DEBUG
/ k" P. z3 D( S: M7 d - /*#define EDMA3_DEBUG*/
2 \: c( o& S h, s) l9 S, H - , }4 ?! j4 ]' H" P) e/ r
- #ifdef EDMA3_DEBUG# H& r$ \8 }6 Q( _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' R+ B, x% C+ ~; A) {5 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 y% N- U5 T4 ~ ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 G1 I! k, V( h& ` - #else5 w/ L8 z3 D) Q' G
- #define DMA_PRINTK( x... )
4 _# v7 ]/ _% O6 V - #define DMA_FN_IN+ {$ G" P: j6 y" K4 a( a8 \0 r
- #define DMA_FN_OUT
+ ~" e$ k( R7 e - #endif. D0 Z; @: ^: u! C" s( d, v9 c
- - y6 J8 j* g& z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 @: d! c4 i% N( |! E - #define STATIC_SHIFT 3+ B0 j1 \. D- ]* k1 u
- #define TCINTEN_SHIFT 20
7 y1 H. P) r6 D3 F5 a$ W - #define ITCINTEN_SHIFT 21
) n7 I& Z: ^& I E* x/ _ - #define TCCHEN_SHIFT 22
( K/ S6 _* R; r% K$ U0 P/ { - #define ITCCHEN_SHIFT 23
' d/ ~8 u6 |7 Y! n* o, \. G - 3 \8 U2 ?. ^" k! W) Y
- static volatile int irqraised1 = 0;
+ A8 w. G; V2 o4 z - static volatile int irqraised2 = 0;5 J _9 b9 i: `
4 Q8 h; z, d& U* q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) R. E$ H N$ @6 H$ ]0 X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! T# X3 F- b+ q/ U8 m' G5 n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! M) a: R6 q+ R! t- b7 G* K
- ; H1 }0 O1 C9 n
- dma_addr_t dmaphyssrc1 = 0;
7 d' e! d4 }& W% I+ J - dma_addr_t dmaphyssrc2 = 0;
* C& z$ E5 y5 ]0 V _ - dma_addr_t dmaphysdest1 = 0;3 ]0 L! j+ T" p# ~; b
- dma_addr_t dmaphysdest2 = 0;8 m8 C; F' t: X F3 N
- + y! V: }$ f/ J# |8 ?$ }
- char *dmabufsrc1 = NULL;
1 C7 V& ~; I5 Y9 v9 H - char *dmabufsrc2 = NULL;4 P* b: N; i3 V* ~: d% e+ O+ u, w5 J0 r
- char *dmabufdest1 = NULL;/ e/ n1 @, g( X0 N9 ~) `) G+ k
- char *dmabufdest2 = NULL;" d+ p- S0 Z& ^/ ]" O: a0 P
9 L, |% T: ?1 j4 {6 `/ q$ j0 M. d- static int acnt = 512;- R" u! S1 y! z
- static int bcnt = 8;
- h; I* h, v4 j* e4 S9 a' J9 T - static int ccnt = 8;
) @& ^& U5 k- Z% q d2 i, V
. F Y2 n# q- m4 T: I) t- module_param(acnt, int, S_IRUGO);
# t* @& B" k! e; d; E+ ]' [ - module_param(bcnt, int, S_IRUGO);1 @' _8 A- z% G/ s
- module_param(ccnt, int, S_IRUGO);
复制代码 - m. n* a7 p9 j! M. W
; X# K+ r1 ]/ u# }* d3 x3 B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 @, k0 T8 x. i. o7 a% S' }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 [1 L0 W; o4 l2 S. o$ N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 s; p+ x& ^! S0 ~8 T1 Y$ v) I, u+ q, o7 T- a( h
, D1 m: s- u( j) a( u* ? |
|