|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 c9 S- m. ~' V n8 n5 }" b- [code]EDMA sample test application; d1 s Z' `; Q+ y- d7 ~9 f( h
- /*
; m$ Q# R# [/ w% a7 e& @; E+ B - * edma_test.c' }* R* c, X/ R2 a* o7 {
- *
- j; l& |- b# Y9 H - * brief EDMA3 Test Application# e, n+ H% m+ {. m9 i
- *
$ g" t+ @ r( w- ~- \/ u, K - * This file contains EDMA3 Test code.$ ^0 X+ l& O4 F) ~- d" O. M9 X
- *
$ g0 V* d4 ^6 M# A" J l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: a4 G- \$ j/ g1 |* N; ]5 C/ M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ E, y4 x. l, x7 Q - * TO CHANGE.
. Z* g* R3 i3 Q' u8 n: k - *
4 Y0 O2 v) p- D* e& F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- ]- w9 K" g! Y4 u- w1 m - *
0 n# x4 e5 @1 Z; S - * This program is free software; you can redistribute it and/or- Z( l( {* W; h8 v1 S7 F/ \* D) [
- * modify it under the terms of the GNU General Public License as
/ D' ~6 m8 o5 ^* j* k0 {( S1 A - * published by the Free Software Foundation version 2.3 M. z: @% E7 j# }
- *
2 P5 }0 Q( E6 S' E% e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) q% ~& z6 O% ]! T - * kind, whether express or implied; without even the implied warranty$ I$ n* O, t1 s5 Y9 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 c2 r1 l+ \% q1 X4 [6 ] - * GNU General Public License for more details.% K* @1 `6 o) K5 C }- T: W: `, K
- */
, N8 U3 U) P( N8 `2 m5 ?5 s - 0 [ k( B4 k. h2 V" R, g: e
- #include <linux/module.h>
+ ]( Q: s$ J' n" W6 u: W - #include <linux/init.h>+ W) W8 y9 K" k# A3 k+ D+ B4 E1 {- ]
- #include <linux/errno.h>- `3 F# h w* ?' S
- #include <linux/types.h>! ~, J4 [/ L2 R t8 [7 G
- #include <linux/interrupt.h>
( Y- p3 P0 Z2 E+ U. V5 g - #include <asm/io.h>
% Y5 E; ^3 T! v3 \3 ] - #include <linux/moduleparam.h>
% J5 j' @( \0 l# S& [0 v - #include <linux/sysctl.h>* P9 S3 f; Q! ^3 Q3 H% A
- #include <linux/mm.h>2 C& x- v' q# u' J' x% U, t% F% ?
- #include <linux/dma-mapping.h>- h, l6 Y9 d) G
9 B0 a" a/ r, B' {2 F8 Q8 v- #include <mach/memory.h>0 f9 j' V/ o& P9 e; v
- #include <mach/hardware.h>6 k6 d7 `: K" N8 k8 D: V# m, ?
- #include <mach/irqs.h>) k& F) ]* P' s: g8 }% p
- #include <asm/hardware/edma.h>1 J2 `8 t* U" V1 u( v
0 Y/ c, {- e/ T; w6 F- #undef EDMA3_DEBUG, z% C' P( o6 Q( Z3 I9 |$ `/ v
- /*#define EDMA3_DEBUG*/8 Y* X" I$ R8 l$ f
# B3 Y- i+ W* `3 X) G* h- #ifdef EDMA3_DEBUG' E4 o( w6 d# b% W J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! m; J3 @- @8 \; Z9 t# t( f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" m3 c0 u) n$ k* t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ ^0 A5 \1 A' A' X: G+ O; R - #else
4 z0 M: E, A1 N9 S/ @ - #define DMA_PRINTK( x... )% \" @' q- v- d( k
- #define DMA_FN_IN
$ F c( e K; Y7 V m3 M$ j - #define DMA_FN_OUT; ^# G$ @! K/ X8 h8 ^ F
- #endif
$ k' L' h( i% r
, C1 w) ~+ a# B2 o1 J! z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) h' k9 X: F0 ^: ^0 `, A$ Y, | - #define STATIC_SHIFT 3
+ {6 o% {6 o" i' l% o* Q4 \! `: _ - #define TCINTEN_SHIFT 20
2 X- c3 c& q" N8 _ - #define ITCINTEN_SHIFT 21& ~) l% Q. K7 l9 g
- #define TCCHEN_SHIFT 226 E+ A3 l% P4 Y; _ d
- #define ITCCHEN_SHIFT 23
$ y& H$ I- L, R - : l0 n" x+ {9 t p c
- static volatile int irqraised1 = 0;
* D& |! f3 @/ { - static volatile int irqraised2 = 0;
+ @+ E# v3 H. A7 @8 `+ P
) K( N/ S+ T B8 I" N+ k) R$ _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o- m2 I9 @4 B7 I* f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ~: K9 w" K; J! h* K/ ^$ D& `2 U5 w' m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( O+ z) M) r9 z3 f3 D
6 g' V9 v& K) p/ u. e+ {: k7 M- dma_addr_t dmaphyssrc1 = 0;3 Y7 M+ R" }- z6 `1 K- v
- dma_addr_t dmaphyssrc2 = 0;( Z3 M( o9 O2 \1 L
- dma_addr_t dmaphysdest1 = 0;6 c: y% [& o# v0 _# i6 R& o
- dma_addr_t dmaphysdest2 = 0;
2 {5 z. D" ~' k: N) e) } d4 ?
/ y" |9 I5 X. f- X) I- char *dmabufsrc1 = NULL;9 a: U! m2 k4 j# x- \
- char *dmabufsrc2 = NULL;! q! v' M$ O0 W8 F- P3 j& t
- char *dmabufdest1 = NULL;2 q$ t1 H1 W2 @: d( z! r/ Q' c
- char *dmabufdest2 = NULL;
( F, g# y. A6 V7 x4 _, }1 ~ - ( E' I$ E) T: ]
- static int acnt = 512;
- S, Y. }. z/ T+ R6 C1 U0 } - static int bcnt = 8;
6 T* e6 i* L2 b- O( r - static int ccnt = 8;! g$ A$ [2 w. h+ d8 f7 X; |
9 E$ N: M& _. N) q8 D$ J4 K9 p- module_param(acnt, int, S_IRUGO);: O6 i; k4 r# B% U0 i
- module_param(bcnt, int, S_IRUGO);
$ t3 D) ~3 c. Y3 F - module_param(ccnt, int, S_IRUGO);
复制代码 3 t5 J: O' K' l, @( Y2 u! K
9 ]8 G+ g! W. M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ ^, l8 c; [: ?- s) M& Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) K% e1 K- Z$ i! s ` k* N: z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 C1 a) y- }' t$ N
! g8 h7 Z B( W9 v) i
/ F; j# ?% `4 K5 { |
|