|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) S" }) @( \5 y! `1 B
- [code]EDMA sample test application! m; x% Y/ U0 d- ~+ j
- /*0 _1 j, o( z1 a% v; H* e
- * edma_test.c0 \8 d+ I5 U2 a0 j7 l m' N- P
- *" |3 u' u+ M* s6 a3 v. l! |' M
- * brief EDMA3 Test Application
! I% y; _! h! a$ | - *6 x0 T3 @5 e/ m
- * This file contains EDMA3 Test code.
, {" _/ V# g$ q5 b& w) \+ a - *, F6 e, e; O' U2 s, p3 c# c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: W; a, y# ?7 h3 t; e3 x2 ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: k5 O: w! i5 ^! k; M - * TO CHANGE." Q( O" P2 }1 R) E, [9 j: m
- *2 [. a7 _; F; q- `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 m3 F- M8 m( r2 U# l9 R( _! ? - *
0 k% z* O8 T# C$ d0 [3 i - * This program is free software; you can redistribute it and/or
$ T7 C; C2 z; F# f: ]" e) d$ W - * modify it under the terms of the GNU General Public License as
7 z' A" g* u4 ^+ k - * published by the Free Software Foundation version 2.! P, m* p8 ^8 K
- *
2 S& m# I8 j' U2 h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ Q+ x+ J; S& Y$ _! ~ - * kind, whether express or implied; without even the implied warranty7 y# P5 a- i( c' {" |. u% y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* {" J9 J% f: c2 J. |5 ]
- * GNU General Public License for more details.8 ]2 B; p( m. o9 \: E
- */3 }% q h4 x% m$ `7 H4 P% _7 I/ u
- / k: ^# F% j1 k+ `' R( T; w4 Y8 y+ `
- #include <linux/module.h>6 B, a# \0 ]% S N( m
- #include <linux/init.h>
' V% v- L" W9 o( B) O- O5 q - #include <linux/errno.h>. ?1 n$ H7 l) \) s2 b j: o$ w4 s
- #include <linux/types.h>
/ v( W# Z" |' J$ x# B - #include <linux/interrupt.h>6 u# z& ]/ d1 {+ l0 j9 h) P( y3 ?+ C
- #include <asm/io.h>/ l+ C5 [" x+ ~& [( ?
- #include <linux/moduleparam.h>
( N. Y. W% F5 e8 t. l - #include <linux/sysctl.h>) {0 }7 i* M0 @; ?9 p4 P
- #include <linux/mm.h>) v8 D: U$ k2 Q2 _( y- B% A6 t7 s
- #include <linux/dma-mapping.h>: x5 M4 Y! ?6 O3 u# ?$ M
- , V- e2 o6 u, v3 j! [, m
- #include <mach/memory.h>. O2 w e- Y2 \" M
- #include <mach/hardware.h>1 L/ P) _: c6 n, N ^" h
- #include <mach/irqs.h>/ | v+ H' W$ Z8 R
- #include <asm/hardware/edma.h>
! Q, R. [8 P4 g
) Y9 `+ [3 ?8 T. t9 s5 \6 q# F- #undef EDMA3_DEBUG
, w: R* L; p7 e* e" ` - /*#define EDMA3_DEBUG*/
2 \+ |: _0 O' s$ ^# O
/ \2 p( r ^0 p9 M- #ifdef EDMA3_DEBUG
8 A% W$ W" n, L( i( H4 p4 ?6 G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* Y, k9 v. L9 a# F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 V$ _! y0 g# g7 D/ J2 U) n; }( N7 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 B% G/ Q. V9 j9 U1 E - #else( o& n+ [- g2 s8 N+ y
- #define DMA_PRINTK( x... )# }. M5 k. ?) k, y {7 L! q! A
- #define DMA_FN_IN
5 N1 m0 u4 ]: O; m; O3 w - #define DMA_FN_OUT
2 n. u, l+ Z e, T( E - #endif+ w* |" Y5 f& j7 \, D6 i ]
# Z1 C% b/ K# D" X' T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 i1 @+ P8 J$ h' q Z - #define STATIC_SHIFT 3
! F9 B. i3 v8 ?5 m - #define TCINTEN_SHIFT 20
8 P- A4 @. [2 f; i9 U$ |, I) X - #define ITCINTEN_SHIFT 21
) k5 R: H7 w$ x* N! p* n3 y5 ? - #define TCCHEN_SHIFT 220 f6 ]" _5 a2 d1 K; s
- #define ITCCHEN_SHIFT 23
2 R' n7 `4 b7 C5 r! B; {0 {' ~ - $ S X7 E2 Z5 \+ X4 k+ T7 A
- static volatile int irqraised1 = 0;
0 F# I" E7 s2 c0 {+ e$ l - static volatile int irqraised2 = 0;% H6 m n/ u/ D' D8 X
* f" D% f. c6 ?( s# o$ @, }; W6 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) x7 N* v; b6 I7 e( S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: M+ E' d$ g( p4 ]- h. _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 v' V9 J6 C+ q* p3 M
R$ n$ C# q* p }9 O1 @ G+ f- dma_addr_t dmaphyssrc1 = 0;% u X- e: O8 ]
- dma_addr_t dmaphyssrc2 = 0;! n; r! [, R4 S- x% B. ~3 d% ]
- dma_addr_t dmaphysdest1 = 0;. x' k" V. [6 S3 L
- dma_addr_t dmaphysdest2 = 0;
& B9 m, W: I1 C1 @. T- x - % l. m" D |* T2 V! F% h
- char *dmabufsrc1 = NULL;
' B$ T$ d7 u$ @# N - char *dmabufsrc2 = NULL;& V! i- c0 R- w% t
- char *dmabufdest1 = NULL;5 w* D" H3 S) M+ h' H( P# ^% X: H
- char *dmabufdest2 = NULL;
8 F: V$ ?/ {7 |! }
4 D! ^8 a) d( `6 ~5 a" }$ s- static int acnt = 512;
& n8 f' T# ?) ^: \1 I - static int bcnt = 8;
3 \& f' X! _ C% q5 Z0 _& S - static int ccnt = 8;
, f0 S$ N/ _! p. _8 ~ - / a9 A3 M- q9 v j
- module_param(acnt, int, S_IRUGO);
) L, U: @9 Y# r# N$ l6 D0 J - module_param(bcnt, int, S_IRUGO);
4 i9 |' s' b& r. \" Z - module_param(ccnt, int, S_IRUGO);
复制代码 . [: _+ [+ _' C. y* C# f4 p
" o n3 i9 R0 T/ u4 M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 q- A/ f. }3 r- _" H5 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 }. e* n: L2 T* e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 _+ L) x! [0 {
' p1 U& N @5 b* a8 ^
' s# b* d# P# [8 T! u5 \. X |
|