|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & j9 H& B; w" @ E4 S' Q- j
- [code]EDMA sample test application! J& Q& P% K0 ~3 r
- /** a" T2 l% B7 L+ R+ d+ J! j
- * edma_test.c
6 | a. f9 J9 E Z7 | - *
* @$ o, v- ~" P. Q2 x# g! ? y; d, a - * brief EDMA3 Test Application
( D2 }9 u8 G/ r$ m/ E - *: j5 |4 E1 r9 T5 J# R
- * This file contains EDMA3 Test code.6 A. a# ?* U9 Q5 D
- *
% Z9 w- T6 G: E G z0 y2 H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 n4 K# O" k4 s6 ?5 e1 x0 A5 n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 ?; [9 u* F2 d; ^ - * TO CHANGE.; d. e( y4 V6 [8 _
- *) Z5 ]2 M1 ?$ n: \5 u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 c. V* @4 E! d
- *% l" N, J; D: Q5 h" ^0 T
- * This program is free software; you can redistribute it and/or4 O) J3 X9 I% A' W* [4 N3 W
- * modify it under the terms of the GNU General Public License as
6 v: X/ y8 R5 S) N- n - * published by the Free Software Foundation version 2.5 b# d+ l5 s4 Z) l- u
- *
! }' H% q! o$ T; v% r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# s( C" W. A% {/ D - * kind, whether express or implied; without even the implied warranty# O* F; y K& N4 Y5 {3 l: y8 @: \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! ]: }6 [' R% s
- * GNU General Public License for more details.& `* B! b! n! a
- */% A- p7 C) K$ v- ]- P% _; m: g! b
- + K" V1 @, D. G/ x/ ~
- #include <linux/module.h>
2 u, ~* s9 j' F4 P7 @ - #include <linux/init.h>
- w5 F1 { c0 Q" X! |% ?+ D - #include <linux/errno.h>5 w) j/ h% q' a% T
- #include <linux/types.h>+ w5 Y$ C$ m! W {! ]/ L
- #include <linux/interrupt.h>
0 R2 f( Y6 u2 { - #include <asm/io.h>2 H% N3 i" L8 P# ~8 ~+ t0 F; ?: |
- #include <linux/moduleparam.h>& N+ J7 }- t- R* X
- #include <linux/sysctl.h>
# T8 `3 B( P: u - #include <linux/mm.h>
7 b& Q4 W+ B8 @& |; h3 c* _+ B - #include <linux/dma-mapping.h>
; P$ H) j, K( p* N$ J0 H1 S4 ? - 0 t0 W" q' d {4 w* F: ?3 ~8 c" s
- #include <mach/memory.h>
8 x, c( v( a2 k! l+ r1 k - #include <mach/hardware.h>% y& j4 N/ P( E8 L" N. ^9 c
- #include <mach/irqs.h>2 @- \/ J5 P' ^& {. j8 Y3 \
- #include <asm/hardware/edma.h>
* V2 Z) |/ F* g$ L7 M - ) R2 A k/ k$ b* Q) p3 ]' v0 x2 j
- #undef EDMA3_DEBUG2 |7 T( j" n1 Y$ k5 R) v
- /*#define EDMA3_DEBUG*/
4 Y# S! ?* ^& q6 k+ E
2 T2 |: k) M; ~! j" ~" j! J% w/ `- #ifdef EDMA3_DEBUG
$ `# Y9 Y: u$ `% b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ [5 | Y: |$ }; {" s* N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ X0 f- x9 Y) e" i1 R$ a" {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 a' `, j8 R! W# a6 n( S - #else
8 P9 H {: `- H! i6 t) q - #define DMA_PRINTK( x... )- _2 l2 g! a. _ R1 J' W$ G+ `; P; S/ F
- #define DMA_FN_IN
; T5 G5 d" j" T - #define DMA_FN_OUT
7 ~9 ^1 K$ V( r5 F9 ~ - #endif! @' [5 N* H- r/ s
- 1 ^# H$ D8 i2 o3 ~- G- i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% ^. c8 E9 Z! q" }
- #define STATIC_SHIFT 3. [+ _) v' b* E* w3 |9 W3 w
- #define TCINTEN_SHIFT 20
3 ^! M8 @6 L5 P4 E* y! t- u3 _7 A - #define ITCINTEN_SHIFT 21+ w( K9 D* `% Q
- #define TCCHEN_SHIFT 22
! E7 \! U3 M A$ S# S - #define ITCCHEN_SHIFT 23
" z5 Q) ~; n0 y; h6 [* j - 1 m/ [' N; x" c: m
- static volatile int irqraised1 = 0;3 f0 Q& q1 a( }" C$ S3 q
- static volatile int irqraised2 = 0;
& ]+ a: C3 N, R9 _. E4 e
; c5 l/ ?: @, N7 C9 E: y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 l/ J/ g$ r3 s" S& |3 y9 n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); R7 i6 E" T4 n, {8 A! B v6 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 E" ~- M* V) Z' ~2 V& Z3 ]$ W - ; y: L' A5 o: c" r9 d/ K( n
- dma_addr_t dmaphyssrc1 = 0;
u4 P- R! K6 J5 K7 w6 B - dma_addr_t dmaphyssrc2 = 0;
m$ Q7 g2 X( p - dma_addr_t dmaphysdest1 = 0;
" X0 C D2 w ^6 I7 u - dma_addr_t dmaphysdest2 = 0;
6 W1 j3 }* z6 B$ M1 x5 j& G3 ?
) c/ f1 d& R2 E: h" z; ?3 N- char *dmabufsrc1 = NULL;
! ^9 z+ }1 a$ s - char *dmabufsrc2 = NULL;5 y( ~1 v: x3 s- r8 n; R# n" i' u# f; C
- char *dmabufdest1 = NULL;
, h% K2 h' i5 t0 ]" T - char *dmabufdest2 = NULL;
: R" A, y, Y' X; Z
2 N7 L! B. p! q! ?1 k ?, P9 C( O- static int acnt = 512;
9 v! |) V( @0 Z* \1 I: q5 | - static int bcnt = 8;
: Z$ T' @' {- n6 F, _8 J - static int ccnt = 8;
4 T% T0 s4 H' [8 c8 j - 7 ^) d. A/ k2 ]. B. N
- module_param(acnt, int, S_IRUGO);( J5 P' ~6 U8 v
- module_param(bcnt, int, S_IRUGO);
6 L% i# A, r+ L: r2 f2 z' y" p+ B - module_param(ccnt, int, S_IRUGO);
复制代码 . s, D- N6 j0 }4 i
8 o+ p' V1 o8 E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 D6 i5 W; e7 O: B" S- v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 P1 C5 i3 s8 N" `2 J) |) i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 Z# L+ }3 c- G/ v i/ J
7 `) @% b: `8 V1 Z( Y5 Z6 f9 H2 \/ ~8 p0 \1 a9 D
|
|