|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 [1 L# Y( b7 e# u- [code]EDMA sample test application
* A- o; R- i% i0 O5 _( E$ b; o4 ` - /*
' w, z& J; n4 T2 J - * edma_test.c
: H* h) M x7 w4 i* z - *; O" [' l! K$ H4 H; G9 p
- * brief EDMA3 Test Application" q' m9 w, L- q; p. G9 v6 \
- *6 _ i# h# i% l0 o7 j0 H
- * This file contains EDMA3 Test code.
" Q3 B6 X: [/ E& p5 O0 h* t5 \8 ~$ P - *8 q4 m( U5 g" {0 i! ]2 }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. f4 `: A" j5 C! A* i) Y% u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! c! z5 U( x z$ F/ g- @: z - * TO CHANGE.; R7 k) U, R( s& e0 j p2 F& |3 R
- *
: M- @0 N5 f: y/ c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* y" e" E9 `$ V; R) w O
- *
3 C ?$ J4 m4 Q - * This program is free software; you can redistribute it and/or( ?) X9 o- M* D# s
- * modify it under the terms of the GNU General Public License as
. X1 g6 W8 w( W) C' S - * published by the Free Software Foundation version 2.* |! E8 B' L9 s; r1 g
- *
4 Z1 n! U' q) z. n4 i: I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 V4 @% c- @0 C# k, Y& v! L1 I - * kind, whether express or implied; without even the implied warranty
: Z! M1 M% D/ p) U" A7 b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 y9 u3 }4 X: ]6 y - * GNU General Public License for more details.
2 p) n' s. E) r% f! m! x/ B; s - */* a$ k3 D. G! w. r8 E9 R( D
- - g0 r+ B% u& t1 {9 Z
- #include <linux/module.h>
$ X0 W9 G' _7 p. ]( A - #include <linux/init.h>
" [7 H9 u& A0 L { - #include <linux/errno.h>; ^4 d q+ I% _3 |( `
- #include <linux/types.h>
. D: a3 }' v! N4 { - #include <linux/interrupt.h>
. L) K' S) C% z - #include <asm/io.h>. y( t$ k+ d: H! l; [2 I: B% K
- #include <linux/moduleparam.h>
$ }# y" ?% h0 G; g( J) u. ~2 | - #include <linux/sysctl.h>
7 ]7 G8 T7 p$ v2 e - #include <linux/mm.h>, a8 O2 w( @; ?$ _1 @
- #include <linux/dma-mapping.h>
7 L3 Z+ F# {* Q6 K
9 d' N0 l% l0 d5 s- #include <mach/memory.h>3 c, g3 F. X: G! }% G
- #include <mach/hardware.h>- E! m* W X8 [; T" @) M
- #include <mach/irqs.h> J; F: O5 }2 H8 m/ `" u1 G
- #include <asm/hardware/edma.h>
+ b- e& a) x6 [
3 n8 e7 t- `$ l4 A$ Z% K% ^' T- #undef EDMA3_DEBUG
3 W+ v: U9 t( J - /*#define EDMA3_DEBUG*/2 A) K5 Q9 F2 Z) V) q6 V
3 z" U/ f% y4 I/ I) U) p8 R9 d* g/ U- #ifdef EDMA3_DEBUG
' `& E Y: r( ] ~1 F9 q- l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- i4 X/ s- m6 S2 n) K( @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" n. u6 @- i% y6 [8 z( K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 F1 z S/ u& n - #else
0 e, i( Y9 u& R - #define DMA_PRINTK( x... )" v! |! d: ?5 ~' _7 m
- #define DMA_FN_IN3 J. z1 J& {) C3 W- o9 A5 Y6 u4 R' b5 g9 @
- #define DMA_FN_OUT
/ @- y o$ y" \ - #endif
" [, L7 {6 |& w" ~7 E. f+ ?7 }0 D - # o3 S7 x! T K6 j5 O* [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# R8 h% c2 {) x8 X* q) ?7 F! _$ W
- #define STATIC_SHIFT 3
* A2 r# R! H9 L - #define TCINTEN_SHIFT 20; P: D. ] Q0 I# x5 \, ~* b
- #define ITCINTEN_SHIFT 21
0 A/ {# s; U, x+ \2 s9 F6 u - #define TCCHEN_SHIFT 22
' F3 K$ i- m5 y+ o2 R" L/ x' C6 i - #define ITCCHEN_SHIFT 23
: l" T( r0 l6 |( `0 }; Y - 2 \6 y' X( D3 Y! x" |, y0 M/ i
- static volatile int irqraised1 = 0;
1 q' U9 H1 L% s/ i6 @) f" L8 M - static volatile int irqraised2 = 0;: }' k5 b2 y; B$ @
- 6 G. ]/ @# ]$ b4 E" d4 C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! {& Q1 m/ e" D8 o# B$ Q6 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ v, I. `, V+ {' j2 x0 I, `- q# p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' r, d' o% }1 K s2 ?( i
- 6 O- T% H% K; X5 `; n: c
- dma_addr_t dmaphyssrc1 = 0;# g$ x& @ I6 d" b/ k9 Y; I
- dma_addr_t dmaphyssrc2 = 0; R" u5 Z0 b, N
- dma_addr_t dmaphysdest1 = 0;
( Q- q5 ?( Y" n q' E - dma_addr_t dmaphysdest2 = 0;- K& N; h/ K) G8 X; B. p& @
1 I+ w# e+ P1 s3 w1 N1 j! i- char *dmabufsrc1 = NULL;
, R) B' F3 C, } I - char *dmabufsrc2 = NULL;
" d# g6 ?/ _( |+ K( c1 Q - char *dmabufdest1 = NULL;
( S3 ^3 ~( g* I" v/ b) K - char *dmabufdest2 = NULL;9 ~# t7 j3 D4 s7 H& Q* K
- : X: e' }' ` H* x& m
- static int acnt = 512;/ B/ [! M2 s0 j
- static int bcnt = 8;; r. F* c. R* q9 E
- static int ccnt = 8;: \6 C7 ^2 U: [0 c; m
3 F8 M) w6 Z- {6 Y$ t& }% a3 E- module_param(acnt, int, S_IRUGO);% J, f& T1 Y0 Q+ j4 o
- module_param(bcnt, int, S_IRUGO);
" I1 s3 `/ ^. l9 V$ A - module_param(ccnt, int, S_IRUGO);
复制代码
) Y8 W) N0 w E- q: u8 e2 R/ y* ?$ K. U w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% ^$ X+ E: E- P1 m) @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- E9 R1 z, p5 }- d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: T6 d. b$ T, d7 Q5 c b
% n, X: j2 Z2 c# X. G
- N# ?2 g3 V; a' _0 z- u$ i |
|