|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, S! [ o2 ~. d8 w- [code]EDMA sample test application
% ?% G- |# B6 U& l* m/ h6 Y - /*& z- Y) t% K" ~1 ?5 z' c- T% [' ?
- * edma_test.c
/ ?( R3 i- |% X7 M" |: V - *
; g# H/ K* M- W' S# n0 [% W - * brief EDMA3 Test Application
# u8 o; `' r2 I* ?' K. ~: E j6 o; M - *
; |: p5 F6 i8 d$ P9 ^ - * This file contains EDMA3 Test code.9 i9 L) t& `% ?3 V
- *
" q& a+ ~6 E+ I3 |: o/ m9 U, O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 T+ ~8 m; k2 c, o$ f: s6 n$ i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 [. y7 o) I- M1 F
- * TO CHANGE.0 B8 s7 w, W6 I
- *
" T6 C* q& s( ~# w( n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 I j" E0 f$ f- s9 W
- *" w# }) F" p: s; p
- * This program is free software; you can redistribute it and/or
8 L9 B! n9 h7 I' B5 C, l - * modify it under the terms of the GNU General Public License as
- P# \, E3 U& X: H8 i: e) H$ g - * published by the Free Software Foundation version 2.4 S& d2 R. Q1 I% K; P
- *8 x+ a# U2 E( C) B# F! I: k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 t3 k8 g6 k4 [/ g% h - * kind, whether express or implied; without even the implied warranty
6 B9 |/ U! _% n w" B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. y3 r- m5 H n3 J7 \ - * GNU General Public License for more details.- t/ ?: u) s. o
- */# x. m6 e6 H. H1 n9 z) f
- $ G% C; m, p+ U2 I: y, [3 p7 A
- #include <linux/module.h>
4 `1 k6 h+ ` h! C# [ A - #include <linux/init.h>; ?' ?7 W1 f; S8 t4 B
- #include <linux/errno.h>6 |" U+ I- I* {0 j! Y% @4 B8 d
- #include <linux/types.h>( R) s) x h& l" @. b
- #include <linux/interrupt.h>. f8 e2 M) R) c) B
- #include <asm/io.h>" c! ]2 H5 d; d- A
- #include <linux/moduleparam.h>
1 x: E6 B) K5 [* Y - #include <linux/sysctl.h>4 ]1 x0 L0 A* y
- #include <linux/mm.h>. p3 e, |1 E$ x3 K( t
- #include <linux/dma-mapping.h>+ Y' [, N# O5 S7 q
- 4 e4 |6 G# q! {$ v/ T
- #include <mach/memory.h>
3 \- J: @. \4 ?" u5 C: W" k - #include <mach/hardware.h>1 D" ~( e9 f/ C3 A! N( d
- #include <mach/irqs.h>9 Q5 I b& @! @2 E
- #include <asm/hardware/edma.h>
) |" _; s) e# f! c5 \: {8 ~ T - ! H) H' m6 T: ?0 M
- #undef EDMA3_DEBUG: l, {7 r' K6 C) x
- /*#define EDMA3_DEBUG*/) W* O" E3 M" K. `
- 8 O* H' C* g1 J# D+ m+ s& D
- #ifdef EDMA3_DEBUG
2 @" g# g) S# U4 G W9 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* h1 ?* a0 ?' }# ?- X2 B7 m: h, q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ X: D3 v4 P: R5 }* Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 o+ g3 r+ W1 Q+ T8 t h5 n: c
- #else, u( W& t. e% o6 v9 D6 O8 l
- #define DMA_PRINTK( x... )1 k1 Q+ f# d/ ]% s; X
- #define DMA_FN_IN) z/ h& g$ C( d$ |( J
- #define DMA_FN_OUT
! O" R0 |) x6 e - #endif* {" s0 i/ f/ j% N; ^2 O* z
- / M5 V' X9 P/ a" T9 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* T/ B. f; X9 e( q; I8 W$ Z - #define STATIC_SHIFT 3
! z2 d [+ H+ T5 { - #define TCINTEN_SHIFT 202 {0 {" I( O7 p8 X; o
- #define ITCINTEN_SHIFT 21# ~ I+ O- B% _1 G4 w3 I
- #define TCCHEN_SHIFT 22
, N5 Z% C% g* l# S u; p6 }5 } e - #define ITCCHEN_SHIFT 239 k' D T! F. i0 k+ u' i. f0 r
- 1 I7 q" ~, P* h' k
- static volatile int irqraised1 = 0;2 J0 {, {& \! I. B+ u4 N! p
- static volatile int irqraised2 = 0;5 E2 h( Z0 X+ i
- 9 u1 [6 g1 g3 x: Z0 {4 R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. n1 }6 O$ Q" r# R0 s) _2 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" k3 k Y2 ]) ^* O* B6 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' m2 a5 i: u9 T! O$ v q
- . v1 X: {- X! w9 e
- dma_addr_t dmaphyssrc1 = 0;
& C, D$ E7 q# m1 `2 E- A' o - dma_addr_t dmaphyssrc2 = 0;" N; ?- V* d/ H' Y
- dma_addr_t dmaphysdest1 = 0;
& B5 H% ^9 n" M! @0 z+ R3 |- H - dma_addr_t dmaphysdest2 = 0; b) V' v0 ]2 Z% y1 `9 k# x( M3 z
- f3 B7 f! d- k* B) `- char *dmabufsrc1 = NULL;
0 O- @& f! L9 ?9 H% m - char *dmabufsrc2 = NULL;
) q3 c5 e- C# f: x - char *dmabufdest1 = NULL;: h( \# ]6 u' w4 b# Q6 F: S* `
- char *dmabufdest2 = NULL;
# g4 B' G, C3 D/ x - 7 h# b! A8 R2 C6 @" F
- static int acnt = 512;% C4 u8 j# L( U% k' ^1 K
- static int bcnt = 8;
, B" }2 C% }& D/ x9 a: o! E - static int ccnt = 8;0 G- f5 g+ D* T& _7 D
9 z) }" V8 V1 y9 U2 t* }- module_param(acnt, int, S_IRUGO);
2 Q2 C8 M% w8 B8 K9 F - module_param(bcnt, int, S_IRUGO);
, @# m; b1 F' w, ]( x - module_param(ccnt, int, S_IRUGO);
复制代码 3 E! {/ ?! s3 v# y; r- t3 D/ G
9 M- f$ C1 ?3 l/ p4 C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ u* D+ \/ o; P$ u/ O2 \5 C9 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 u3 h; _* H( N6 q: }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 A) n1 H+ `/ i" z8 @( ^
; Q. d& I" `# `1 q, N% `( e& ^4 L: S) {2 r
|
|