|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . F- ?* y3 p* L" @/ O0 l6 V+ K
- [code]EDMA sample test application7 ^% U- M5 \( y5 m' Z* ~
- /*8 Q3 c% S7 n& ^
- * edma_test.c
) ^2 j0 ~# v/ G) Z8 J) y8 k) m - *
8 R' [, _# U; m- h - * brief EDMA3 Test Application( o7 H ?9 Q, w& o' l4 {8 P
- *
0 Y+ ?" j w) F+ r/ m - * This file contains EDMA3 Test code.7 z+ X" D4 O9 N4 o+ U8 K N
- *
6 l8 q. c. D: V* p( ]6 \: n; ]! F) V( \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' u# i# [& Q- a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- K% \& i& ^' ?5 j; |
- * TO CHANGE.
6 y% ~. K% d. y0 \3 a - *0 E. A$ ~' D; @& C8 r/ O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 Z5 Q3 L- r) A( H) T$ ?1 d! t - *
/ v8 m* s% p; h4 u: [# Z - * This program is free software; you can redistribute it and/or7 B( b# h- V) C( K! C/ [
- * modify it under the terms of the GNU General Public License as5 V. K9 {( G) C, p7 [
- * published by the Free Software Foundation version 2.+ q" _' y& L, t
- *
& w7 b9 Z% J+ b' ?- J* u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 T0 a! c5 F4 N- \' Q6 {4 @
- * kind, whether express or implied; without even the implied warranty
; O& @4 f1 g; u% v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ f ^( g5 E! C; d0 H$ n - * GNU General Public License for more details.
! F. G+ K! n2 a9 s - */! w" y0 Y1 K" t* ]$ ^% c) q
! y. p) r! _+ q% Z1 Q- #include <linux/module.h>
4 f Y! {$ N0 r3 q" _9 m A5 C - #include <linux/init.h>: D% j6 I: ^' b
- #include <linux/errno.h>' ?1 V. }" M! l" l8 k0 p: n
- #include <linux/types.h>
5 U- K3 i# d1 i* e Y$ d - #include <linux/interrupt.h>: ~* i7 {& H3 K" F# [% L) s
- #include <asm/io.h>: p8 x- E* r8 ?+ G, a7 Q
- #include <linux/moduleparam.h>, J" l3 `4 y2 D# } ~( L( y
- #include <linux/sysctl.h>$ N3 c$ d$ G" q; ~
- #include <linux/mm.h>: H6 [# F ]5 i6 H3 z
- #include <linux/dma-mapping.h>
% \4 N# \; W$ E# S: ?& w7 p8 O3 m - ) f; Y" R2 L8 a8 N5 U w
- #include <mach/memory.h>
( Z) N) D1 x! U8 \6 X - #include <mach/hardware.h>+ S, t2 e$ G# a# V3 T7 g+ e" ]
- #include <mach/irqs.h>* U8 [$ D; b+ V! m5 b2 D9 V
- #include <asm/hardware/edma.h>
" O# d8 L3 B6 A+ f9 ]; K8 @ - & w' Y" b6 x6 [
- #undef EDMA3_DEBUG, V. c( G( }* c
- /*#define EDMA3_DEBUG*/0 p) B4 |. V& c7 p- ~
- ( d, I$ L) o& G5 L3 A0 Z4 G
- #ifdef EDMA3_DEBUG
5 f$ \, W5 x9 E& D2 X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 R6 r$ M: P+ T* S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* P: h' g% M! F1 |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); o& S/ s9 N; J# p9 f9 z
- #else# e* w$ Q' y7 l" d
- #define DMA_PRINTK( x... )( |/ t/ J4 s' u/ {: y: j7 Y/ V; }. a! R
- #define DMA_FN_IN
4 q( `2 L; m7 T. C& a - #define DMA_FN_OUT+ Q: x& X) b4 b+ b
- #endif4 P* ?- v' J& b- g7 o+ I" P2 R% F0 ]
- + _ l; y: q1 C5 o( o0 {" c; o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 W% w1 D5 A% I
- #define STATIC_SHIFT 3
* G; g: T5 y6 H; \5 V: c3 V' g+ p - #define TCINTEN_SHIFT 20
$ O2 U. N; Q8 c5 u9 H0 T - #define ITCINTEN_SHIFT 21
2 N6 A/ w) r0 v# y - #define TCCHEN_SHIFT 22
' y, ?, u& x6 A# n4 }+ Q - #define ITCCHEN_SHIFT 23% }. b: v+ s. R8 X
5 I G" z) B1 u* H- static volatile int irqraised1 = 0;8 x: J V$ ?, \+ y9 q/ B% Y# G% Z0 W V* S
- static volatile int irqraised2 = 0;
) k" t- P. g. ^! _% Q3 z3 ? - , ~- p9 o0 K$ Z# s9 |" n, U* s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- I' ^. F+ F8 y+ m, e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 M. `) x& ` n; j) L0 t- {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* |$ D" Y5 _0 j: j* U
- ! E- W/ |+ N8 X/ F i$ d: P2 r
- dma_addr_t dmaphyssrc1 = 0;
4 z! f- \0 u, Q0 \5 A - dma_addr_t dmaphyssrc2 = 0;
1 D" H) V. z+ N" C, |8 x) I - dma_addr_t dmaphysdest1 = 0;, ?! Y, ]" p: x) `
- dma_addr_t dmaphysdest2 = 0;. b% \2 q. f& n1 U: o: w& @+ E* Z ^6 ?
- ' M% ^& t# o3 Z* k4 z# {
- char *dmabufsrc1 = NULL;3 k6 g1 ^ n8 L4 s( |9 K5 u; Y$ d
- char *dmabufsrc2 = NULL;
! b" D# H9 x9 c - char *dmabufdest1 = NULL;
( g- t( D* Z, R) [; c- d4 H# c% G - char *dmabufdest2 = NULL;
/ G$ _; M1 k* j- B( u* r" X
; N$ ?+ V, W1 c1 ]2 Z6 B- n- static int acnt = 512;
2 J4 V7 B3 F$ n1 ^% R7 N0 u2 t - static int bcnt = 8;
6 f! t+ F9 m e, n0 w. E - static int ccnt = 8;" y5 l" u+ @7 V, A" b; q* V
- $ }- u) S/ T# S& U. C# Z9 A6 ~
- module_param(acnt, int, S_IRUGO);1 o+ \8 E* m& m
- module_param(bcnt, int, S_IRUGO);) b& C; z$ d- Z; G6 J7 b# J
- module_param(ccnt, int, S_IRUGO);
复制代码
0 W' T+ a8 Z9 e% t! m1 U. H1 W
; `- O a: c3 G# T6 [6 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ [6 u7 x! I! Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 S4 G0 q2 I# |% I. U* {$ G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, U& M: ^8 L3 ^0 U5 \ G% P1 f8 [* F
$ P, H0 q l( `6 k- P
|
|