|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 F: J' N* y' Q- N1 A2 V. r- [code]EDMA sample test application. b. Z( N. m& a- J0 z) E+ X
- /*
* O. O" G, ]( j' u$ M2 k% m2 ]3 l0 m - * edma_test.c
+ P! _) |3 P# K9 V - *6 A/ s8 k1 N! h ?* W' [
- * brief EDMA3 Test Application6 j- l8 R8 O3 G% i
- *
" I4 H; W( K" g/ L$ d8 V! ~ - * This file contains EDMA3 Test code.1 f) G! P; v4 p# B2 y3 B3 P- Z
- *
2 B$ p7 O# ~: u! T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( d- e* Z% v5 n' X4 P7 O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& f4 y- C" Y3 |4 Y6 q
- * TO CHANGE.) z7 | e" L. L( U8 r5 E
- *4 l5 B( ?! @" m# d! i6 |* @4 N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 p. o- u, J& F
- *
7 [, I8 j& f1 L3 q- |' _+ x - * This program is free software; you can redistribute it and/or5 f! q- |6 E+ S
- * modify it under the terms of the GNU General Public License as+ v9 W# A) C0 @! Y$ H
- * published by the Free Software Foundation version 2. b. z, d6 [$ L- b
- *' f: V. d2 f+ Q2 V: Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. p( M' q1 d& d - * kind, whether express or implied; without even the implied warranty, `/ Q' G/ ?# [4 I+ P) i$ @. z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 t4 w5 \+ S( n& D: e1 ?( J
- * GNU General Public License for more details.
$ s* A9 u; l* N' E5 W; B8 B - */
+ N2 s8 W0 l' Z: h+ d4 B7 U - ( _" k+ O3 `, J. {/ J
- #include <linux/module.h>
, C. Z# U& a/ E9 f" ] - #include <linux/init.h>
3 o2 c r0 F2 Y1 K7 K m- k4 f3 C! S - #include <linux/errno.h>
1 |' T k. F7 _4 p4 L7 {. ` - #include <linux/types.h>
5 e' I& X4 | F* x+ b& B: ^ - #include <linux/interrupt.h>% [* F. r' r, z2 U
- #include <asm/io.h>
4 T) _) O1 ]& o) h% V. X9 ] - #include <linux/moduleparam.h>" ^. D M& U; p, W
- #include <linux/sysctl.h>' W% G$ V5 Z, ^' m, H8 ^4 S0 N
- #include <linux/mm.h>
. Y) |* |. l6 R. ~/ C* D - #include <linux/dma-mapping.h>
( q5 K1 K' l2 b
- H+ `/ \7 Z) A3 s/ `- #include <mach/memory.h>
# L- k$ W& j7 e: K - #include <mach/hardware.h> Y$ R! G4 Q$ y2 r/ A( |
- #include <mach/irqs.h>- j- ]! r9 z6 e' m6 [
- #include <asm/hardware/edma.h>
/ h0 [& ]! E, x1 F
0 D, t ~6 a: n+ S- #undef EDMA3_DEBUG
3 `% S% o5 n, ]4 E; c8 ` - /*#define EDMA3_DEBUG*/- @* N5 T* X+ o
- 2 V0 e: s$ m% i ]+ q6 }% ?
- #ifdef EDMA3_DEBUG: }: _# Z, r3 O9 F3 U y& E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ A6 k: S* t# x* b' C2 b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; s M0 K9 {* f5 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- \* W, F1 [: O% F6 T
- #else' O2 s- Z" I5 M7 i2 a/ J- w7 L
- #define DMA_PRINTK( x... )
% _# q+ N0 x. B, K - #define DMA_FN_IN
8 n* O) c2 \7 i, N; e - #define DMA_FN_OUT
5 V. s v' o( P' [4 w - #endif" T/ l" J2 B& j! o/ i0 m4 ]
" x6 P9 r) f! Q* D( G) p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 \" J4 X9 i& u j - #define STATIC_SHIFT 3# Q; b: m, q) k. |1 I2 u% _
- #define TCINTEN_SHIFT 20
, ]# n4 ?2 ^4 G2 M) C- ]5 R - #define ITCINTEN_SHIFT 21
. }: v, {7 k7 Y, X - #define TCCHEN_SHIFT 22
+ ~3 t3 a8 O5 \5 i3 @# T - #define ITCCHEN_SHIFT 234 u1 S* Y# T+ i' I/ y& q
- ; t: s7 z' L. G; M1 h# {9 o/ d
- static volatile int irqraised1 = 0;
/ U, ?& X5 y4 {* y; f* L1 ]. G - static volatile int irqraised2 = 0;1 L' y: h( G. B+ f" Z
: ^- l7 L# y8 D$ n0 [$ w6 H! s% y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. s$ Z+ }8 a# M% h% ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. z# w! {6 B* ]8 W/ M- c" p7 f1 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 L( W) c( E) F2 ?/ u E
, P) t" ~; m4 p4 x8 H( W7 g. P- dma_addr_t dmaphyssrc1 = 0;7 P8 P9 l2 W" o+ ` ~ C
- dma_addr_t dmaphyssrc2 = 0;( H5 [* Z" X6 e- u1 @ `% d! B6 S V
- dma_addr_t dmaphysdest1 = 0;
; Y5 Q# B4 x7 m8 `* v$ V - dma_addr_t dmaphysdest2 = 0;: d8 F. w5 P0 H- ]7 X' R' Z
& g; z0 K2 j; C4 t- char *dmabufsrc1 = NULL;
3 a) [+ N; ~$ E) _" `! b. l( z" a - char *dmabufsrc2 = NULL;
; b! W5 a* {1 h, [$ d! R - char *dmabufdest1 = NULL;
# u1 h3 s' ]8 `, F# q! a - char *dmabufdest2 = NULL;
# `2 m! z. ~" `7 V
# S' ^/ g% ~! z) @# W6 E& \9 d- static int acnt = 512;
0 I0 q- X4 y r7 M/ P% o5 C - static int bcnt = 8;
6 b! k' S2 s7 ^8 S1 A# T - static int ccnt = 8;
: |" {' M+ S8 w0 ] - 6 O' C. F; z& f' c B/ v( y$ Z1 t
- module_param(acnt, int, S_IRUGO);* l6 l7 @8 N9 t: x5 U) G
- module_param(bcnt, int, S_IRUGO);
. T1 n( D+ b4 J/ N - module_param(ccnt, int, S_IRUGO);
复制代码
; v+ [' d! j% Q. a4 \
+ V2 }' N! b# |/ \& ^) L/ A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 q. s4 W, D/ Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 K q4 M* O. ]1 N& t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" D6 X$ v+ S7 Y8 x- n' v; _+ \0 p" _
! ^% l) d9 D% D: {$ b( {9 N1 E6 L
|
|