|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, D9 c8 y; j2 d9 S- [code]EDMA sample test application
* R+ L. ~% u6 A$ Q; _9 j - /*% O6 ]( I# P" l: J
- * edma_test.c
. r2 Y) u f5 \! X" ^$ I - *
, {* g; u# ?& e, g/ z: c6 e - * brief EDMA3 Test Application
/ R* i! A2 X8 C - *, q9 Z; e- e6 j
- * This file contains EDMA3 Test code.
! \8 e/ V: h7 x" g( X6 i - *
2 \& w5 h, }) d, R T4 Q5 A% o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 @9 {( E3 Q" o; T/ O; P, h3 E$ p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. P$ f, u8 V1 G0 T- P8 F2 g
- * TO CHANGE.. E( t! Z' J' R/ e5 q1 y
- *2 f+ J" V( J+ Y1 o! ]5 D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( P! d Q. @* C: a0 @6 A) f8 W
- *
6 d. i1 v- B; T1 m( G% _$ A6 e, ` - * This program is free software; you can redistribute it and/or2 o0 N8 b% l" {, H
- * modify it under the terms of the GNU General Public License as$ i9 q4 |( T% h ~ }
- * published by the Free Software Foundation version 2.
3 a, H7 K: X* ~& Z - *" b2 b. F" S+ V/ _% ^% l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. r. d$ c, {, u. z5 S" Z - * kind, whether express or implied; without even the implied warranty* M' I7 `1 w, E- d9 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) c8 e; X* X1 M0 i+ L - * GNU General Public License for more details.# o2 t$ \$ ]+ q6 A, V' M7 @* [# C
- */3 K f. M1 W! p
3 N% D7 q0 L$ o7 `* S y% d: A- #include <linux/module.h>2 e% U7 J* f$ J7 v7 G( _5 H
- #include <linux/init.h>
+ _( ^4 f# c+ _. t1 s3 g Y - #include <linux/errno.h>. ~$ {- ~; T+ D: Q5 y
- #include <linux/types.h>
9 ]: m0 m _# t8 [# _. I - #include <linux/interrupt.h>! R- ?9 j0 I3 J! u9 B: _
- #include <asm/io.h>3 c: x9 d/ ^/ Y! M) L4 p( f0 U5 E
- #include <linux/moduleparam.h>
+ e6 W. A3 P. ` j - #include <linux/sysctl.h>" Z1 E' W0 @3 r% H5 o
- #include <linux/mm.h>
i D; U/ h" s" J p - #include <linux/dma-mapping.h>
( x- v9 v; A Z5 } b# B+ J - . |4 `0 N. ~% F, d- s& H
- #include <mach/memory.h>) _# r' B. N) [/ T' \% ]# N
- #include <mach/hardware.h>
' }7 j# |9 {* j# Q8 v - #include <mach/irqs.h>: q6 l6 r5 t4 C
- #include <asm/hardware/edma.h>/ m, m1 m4 Z2 o j
- - K, H' r7 ~% y0 o1 h
- #undef EDMA3_DEBUG( l: P# \2 _& v. |7 y5 R
- /*#define EDMA3_DEBUG*/
! [2 [+ ?6 ~" f* t) j) d& z - & e2 }# h" y& ]7 i
- #ifdef EDMA3_DEBUG' R6 \4 O0 U: {$ {' E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 R/ h! P/ N( V# H1 R0 C$ f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 j% p4 z7 d E3 `- @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 z5 ~; h- U7 D/ s+ o
- #else
. d l2 o( l; C% N. ~# R - #define DMA_PRINTK( x... )
: S( b0 X8 X$ n+ N$ k - #define DMA_FN_IN
8 y0 O0 C0 q3 G# y w( `: } - #define DMA_FN_OUT
/ Z6 L# Y0 t M* P - #endif
. H) J- z! y: @ K" l* }/ o
3 z U) Z4 e! L4 o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ p, r7 O& W; h3 ?6 U. h2 f5 t
- #define STATIC_SHIFT 33 |6 O. L' t6 s8 C z4 R
- #define TCINTEN_SHIFT 20
" e5 N/ q" m3 ^8 y9 [ - #define ITCINTEN_SHIFT 21. c$ J) u+ d" r) H& B- E
- #define TCCHEN_SHIFT 22
/ \. C. J C8 q- ` G: D7 Y - #define ITCCHEN_SHIFT 23
, u+ u- ^6 P4 y/ @: G d - / S8 L$ \' a! J$ a _* q& M
- static volatile int irqraised1 = 0;# _" K7 l9 Z% k A( }. K
- static volatile int irqraised2 = 0;
. _/ Y$ T5 o- @) V9 E - . B4 z2 {' A x) j: \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ o6 G3 E% `' X. F9 S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 k4 R3 l# D$ _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Q' D# P8 b+ \2 ^- ~! g, u, @' U. r5 S
. }" n5 P: N: [6 @: o) _: u3 \) g- dma_addr_t dmaphyssrc1 = 0;
8 f5 \5 f5 S# K( K/ z - dma_addr_t dmaphyssrc2 = 0;: K; N+ E+ H+ |- l! a6 U
- dma_addr_t dmaphysdest1 = 0;
6 y; C- X5 E# W; |0 P) ? - dma_addr_t dmaphysdest2 = 0;! L* d8 g4 \& H7 ^, o: U1 O% z
: B/ x3 }: ?0 _( E' f! {5 V- char *dmabufsrc1 = NULL;+ J/ K" H# t! d+ y+ `
- char *dmabufsrc2 = NULL;
% S/ Y# w4 p9 {' w9 I - char *dmabufdest1 = NULL;
2 y" O4 w5 k7 _+ } S2 L/ P - char *dmabufdest2 = NULL;& V9 w& I8 j0 W% d! j9 R+ x
- 6 _/ k7 Z' u# F1 l. |3 @
- static int acnt = 512;" K. h% D/ C- E: [; d _
- static int bcnt = 8;
; S: k" }3 \( f* W: x% x% j" x - static int ccnt = 8;6 N1 X6 q! `9 ]9 \3 Y: P2 D
% o5 I2 S1 E$ s- module_param(acnt, int, S_IRUGO);9 V! s L1 [6 g
- module_param(bcnt, int, S_IRUGO);
( k6 A5 r; ~$ d- D7 D - module_param(ccnt, int, S_IRUGO);
复制代码 $ f* G4 N. m: C/ r
' K9 E2 g: `; Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ {) J8 R1 K, yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 ?) h- @2 w" E" F6 i. W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 [# G! Y8 O0 H4 \! G# G
7 a! T, L7 C) E2 K. w0 f# S, u/ Q3 t* R$ H3 j3 d
|
|