|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / [' g% W; h) f% m
- [code]EDMA sample test application- o$ j0 u4 c0 h0 r& Q+ B- e
- /*
( M* S4 J) Y2 U" L5 { - * edma_test.c
: d8 @5 l; V$ c - *
: x) t2 M# t2 _& z: G; Z - * brief EDMA3 Test Application6 Z6 o) \6 O: Q8 Y
- *) \ k1 x' E. @9 r. o5 |: m* N
- * This file contains EDMA3 Test code.& P* Z% w& i5 q& p. H
- *
7 ^5 r* S. u( W3 r6 p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' p4 R2 c2 ?8 L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 a; U! n- z8 N/ W( ]% L) q
- * TO CHANGE.
* R* ?8 s a: z7 m5 n! B - *
0 v0 s( M) T! @$ e# z, b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) Z8 F+ b& N/ V* z - *' `+ I2 P. V, i* p7 k S
- * This program is free software; you can redistribute it and/or6 [, y" M+ H4 o7 M" A) ?- f
- * modify it under the terms of the GNU General Public License as
! h o+ b+ ?% s& K" s - * published by the Free Software Foundation version 2.! m, M! l% O; B& V
- *
4 D. V) J3 B3 {1 k, D3 z- H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: t k2 L8 _3 B# a: C- `
- * kind, whether express or implied; without even the implied warranty
' _. c% O& A! ]) w, l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 e6 ^- i: P5 O
- * GNU General Public License for more details.
5 ^3 J1 g z) _ J2 @5 g7 U - */
1 r9 m6 J6 M% K; u1 {
/ N$ h: L- w3 Y" u/ z S# S- #include <linux/module.h>$ q: i% b$ Q# N7 f, u. ]
- #include <linux/init.h>* Z1 |/ W0 F% {. ?
- #include <linux/errno.h>
: m x* P: U. p - #include <linux/types.h>7 B J- p0 r$ `+ i/ k
- #include <linux/interrupt.h>
1 T- ] h2 t, k5 G& J O8 y% J# `' z - #include <asm/io.h>2 J _; z) g+ T* w. `
- #include <linux/moduleparam.h>
d# W4 T1 a. @ W! s: I$ z, I- ]- ~ - #include <linux/sysctl.h>9 G- S3 V0 P$ {+ V
- #include <linux/mm.h>
* @- x6 j$ \! x4 \3 C2 D8 O- v" k - #include <linux/dma-mapping.h>, s: J3 c3 b: w7 R7 i: y8 |7 F
v6 [ x6 n# A$ c: q, [8 o- #include <mach/memory.h>
5 ~3 t* r. Y" d- u5 U* x/ C# e - #include <mach/hardware.h>7 G2 h: _: `* ?' c- ~5 n
- #include <mach/irqs.h> n" L2 R: c, T q/ G
- #include <asm/hardware/edma.h>
. N+ e; M2 S8 A
8 v2 J; D5 Q2 J7 @: S- #undef EDMA3_DEBUG
! T3 y2 f+ g' j2 e6 d, J - /*#define EDMA3_DEBUG*/3 J. r: C4 Y3 O1 q
) A6 |: R' W- f7 Y+ H- #ifdef EDMA3_DEBUG& O, @* {6 p5 N. V. u% D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 A2 I0 J% w4 ^$ M! h% X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 n# v6 k+ K$ b- I A( q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! j1 O: Y8 q0 N$ {( ?( a6 A - #else+ ~6 @ o5 K; [ ^& C
- #define DMA_PRINTK( x... )8 j( X" N, {0 P+ S/ l( I
- #define DMA_FN_IN4 r9 u& T( \- b U% i
- #define DMA_FN_OUT7 n0 P# W3 f( S& J* y
- #endif
$ n: ~5 m. O$ X6 y& ?, v9 S - - e* n- J' m( e% V; R) C( x4 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# d; d! E/ f# P" v/ N* s - #define STATIC_SHIFT 3
9 f5 ^& e) d: _* [ - #define TCINTEN_SHIFT 20
9 g$ e4 r. N( c - #define ITCINTEN_SHIFT 21$ A: w; `; w& {. E& j+ s
- #define TCCHEN_SHIFT 22
$ t. c) S" b' I; H7 Y& N - #define ITCCHEN_SHIFT 23
$ a& R! L+ ?- `# e5 r9 V - 2 J) M, ^& E. d* A0 M& y- D
- static volatile int irqraised1 = 0;
& c: _7 L) k) w% m8 d" y. a4 `# I - static volatile int irqraised2 = 0;
8 m1 b6 A2 `+ e. R - : s6 h+ }8 }/ j5 L& ?. f2 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 h! M- E( w/ s3 _: ~- g' S4 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# c8 E* C8 [/ z! X5 x- s- q' Z5 ?0 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 [& W9 Q6 e* U. D9 e
9 D" x/ `- v& Y& t0 ?& b- dma_addr_t dmaphyssrc1 = 0;+ B2 w* L0 d) _" U. a) S
- dma_addr_t dmaphyssrc2 = 0;
5 ], @1 G3 @: J$ r! H - dma_addr_t dmaphysdest1 = 0;
& U* G+ k$ W" b - dma_addr_t dmaphysdest2 = 0;) C: P5 O$ c6 R
- + T" W) n: S. _9 ^' T! I
- char *dmabufsrc1 = NULL;; g; x2 r b- J# m: O& V% F
- char *dmabufsrc2 = NULL;4 o0 w8 m+ H( y: u% R/ g
- char *dmabufdest1 = NULL;
' ~" I+ O+ T2 _& S# l% u+ e - char *dmabufdest2 = NULL;" n% ?2 S. P: B6 a% g
7 x- p( r9 {) m4 M- static int acnt = 512;
/ k' z: f$ H8 k, E3 \ - static int bcnt = 8;2 o! W" M2 k8 n( @4 D
- static int ccnt = 8;
! d# B, u$ w0 H2 z# g5 v
$ }2 G) I% `2 Q i( B- module_param(acnt, int, S_IRUGO);
) z' \! }6 K/ |, }" h9 l% c7 x2 M - module_param(bcnt, int, S_IRUGO);2 t7 Q j+ i* ]5 B p4 X9 g
- module_param(ccnt, int, S_IRUGO);
复制代码 j3 `& n! z" n1 c
' I( N; M& N! `' t6 B5 b' a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- n6 E% |; M# X4 @1 ?/ P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, b4 q% B: |5 h& p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ x P. i8 d1 S$ p' @
6 g. a$ n& o1 F3 A, }) z% a
* D% D" T2 \# e, u |
|