|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , i: G8 L% i5 M: ~% C- U" {8 r
- [code]EDMA sample test application% B, d$ e, C* j/ p
- /*
$ z6 y% ]: f. X. p8 Z* Y ~+ X% ^ - * edma_test.c* p7 M8 `+ m+ S/ g# |# I$ c+ |/ R% w( a
- *4 P/ Y( Z& y0 R( B3 `- J
- * brief EDMA3 Test Application
3 D& J3 }. _ j* {: Z - *7 v" X2 B3 y; x2 b, n
- * This file contains EDMA3 Test code.
6 D0 d" R/ I- z ~- t9 Y8 C* @& B - *
, b: G, H& t6 n: u/ ?) | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 h' e' C0 d; Z* v' \" v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ N& N$ ^' k0 @. O8 I
- * TO CHANGE.
( u* }( J6 W5 S+ Y- O - *
5 w6 l+ {, y+ C% D3 { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. b6 T8 S& f# V+ _2 |
- *
# s0 `( o) s; _! B! m - * This program is free software; you can redistribute it and/or+ C2 F; b b6 B$ f1 u
- * modify it under the terms of the GNU General Public License as
& B; g3 G5 X$ n3 |: K; h0 o: D - * published by the Free Software Foundation version 2.' k& j8 R. m u2 d. M( s7 H
- *) X6 v8 y4 k- m/ C! V2 r. p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; H; K. a7 ]6 h# U0 \5 _3 I/ t, L' X - * kind, whether express or implied; without even the implied warranty0 M, j; C5 T( F+ g% z1 O: x* |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 c' Y7 x5 q8 b7 v9 D) O5 p
- * GNU General Public License for more details.
2 t+ f+ j# j. u9 x2 q - */
! o$ S7 Q7 x1 n" h9 r! H! l. q - 2 `! D7 ]- Y2 _5 J
- #include <linux/module.h>
% N/ v; c$ I* r P8 r, n' U - #include <linux/init.h>
/ w. }2 z; O5 V% S9 Z h - #include <linux/errno.h>
/ y |9 L7 K0 q* b. q- p [ - #include <linux/types.h>
0 m* m+ m+ @4 B* H7 z - #include <linux/interrupt.h>
% `- h& \0 p4 O& u: R - #include <asm/io.h>! a+ I$ t1 w: G! ]- s/ M5 \2 h/ `
- #include <linux/moduleparam.h> `2 D3 |% \# I- _
- #include <linux/sysctl.h>8 l) v4 }# Z9 K/ B, R8 I; `
- #include <linux/mm.h>4 a1 Q& H6 A! i9 _
- #include <linux/dma-mapping.h>
+ h7 E7 C' {1 U. U - 2 p4 Y# k2 R, H/ c" Z
- #include <mach/memory.h>; J5 t) k* q3 z- T' i: m
- #include <mach/hardware.h>
# N v5 K; l/ X" O - #include <mach/irqs.h>0 y! O0 p. i* a0 ?: `
- #include <asm/hardware/edma.h>/ H0 C6 K* W; f# J) F# _
- # k8 I. G8 q/ X; G
- #undef EDMA3_DEBUG! D; X; P" S' R! @ \. e% p! _
- /*#define EDMA3_DEBUG*/! v- f3 s/ w# O9 l+ i
- % K+ o4 ?* c0 s+ k5 V: a
- #ifdef EDMA3_DEBUG8 y- S1 k0 @2 ]7 y/ ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): j7 e% N% u7 K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& O* P# r: m; ?6 g9 _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 _6 i4 |* Z+ P3 E9 w - #else
& I, z( K- X# K/ T$ s. a - #define DMA_PRINTK( x... )1 e m* V" i+ f6 D* A2 y/ G) A
- #define DMA_FN_IN1 `0 c" b& Q% Z9 m) K6 b
- #define DMA_FN_OUT
* w- O/ \ g. J4 ^7 _ - #endif
" t2 a% S, Q5 q% ~ - + n+ V% z( y7 X: m" `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 p" Z+ f. Q; a- r - #define STATIC_SHIFT 3
# F' X2 @ \) f - #define TCINTEN_SHIFT 20. D q$ K3 L; g: q8 d% J3 ?7 M
- #define ITCINTEN_SHIFT 21) g* B. l5 H$ N: X& P5 Y4 g
- #define TCCHEN_SHIFT 226 R2 i1 G( D' Z: Y* q
- #define ITCCHEN_SHIFT 23
1 u$ O) y) ]( k! n
/ V8 e: o, s: L& z5 B8 F- static volatile int irqraised1 = 0;. |+ i9 S) {4 o: T, E. q- l
- static volatile int irqraised2 = 0;
: a5 x# e7 K z% o# H& K0 U3 }$ c - 5 J* w! Z3 ?& |, z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& }& s" h, [+ o/ N n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 r* ]9 `, L' l) Y {& }" q3 V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 U# l/ Y% p: D( R5 o. C/ s
- ! h1 x6 M/ E# r; F3 `! P% k, C
- dma_addr_t dmaphyssrc1 = 0;
9 k9 G# v: K q/ Z$ b& ], F3 h - dma_addr_t dmaphyssrc2 = 0;/ \! ]: {# ?8 v4 d
- dma_addr_t dmaphysdest1 = 0;
5 z1 t. z$ e! o8 J( y/ [ - dma_addr_t dmaphysdest2 = 0;* [ E1 P# t4 Z {( w0 v# j
1 X9 G( S4 C4 F; w, V2 x- char *dmabufsrc1 = NULL;
0 a+ p( A0 R3 P - char *dmabufsrc2 = NULL; y! U7 }1 ?. J
- char *dmabufdest1 = NULL;
I( H& C4 ?6 h8 |, i* o - char *dmabufdest2 = NULL;
, K( V* l* L7 d' _/ n P) k
" p3 I( z; D: {' m5 o5 D- static int acnt = 512;
) @- q1 d0 i/ H& s7 D' b2 L. G - static int bcnt = 8;# ?2 C0 l) E# n0 @7 w1 O
- static int ccnt = 8;
. j$ O! e: U# `9 _ - / H. J' J6 x9 ~7 K' m: F7 r, O$ d
- module_param(acnt, int, S_IRUGO); C; @" O2 S* q( w+ B1 W
- module_param(bcnt, int, S_IRUGO);
2 Y1 n4 ]" {0 l+ V$ n - module_param(ccnt, int, S_IRUGO);
复制代码 ( G, ?' y1 w0 f s: V/ i
$ k6 c ~, ^* n5 ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 p% B9 z, T. X5 W) y8 D' `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" z( t' t1 ~" ?/ F' [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! Y5 k' h5 U" ]# v; _3 \0 s
2 D$ f5 {; q6 ^, L
& T' c4 a) j& C" `( X |
|