|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( w& u! Q6 r8 R3 ^
- [code]EDMA sample test application. I+ E, O4 K/ q+ C; O; l3 m! ~( O
- /*
. Q/ @3 M: T7 }% x2 Q) \ - * edma_test.c* T4 Y u2 Z4 T9 _& i1 K
- *
5 f l: o# Y1 R& C& ]7 i8 ~ - * brief EDMA3 Test Application1 U& P @- ~% L$ z" C
- *
4 Y/ J# n! l0 E% S: a - * This file contains EDMA3 Test code.: S8 J2 m4 _& ^4 {
- *
8 R" r$ d* m) Q4 [' ~' a9 M2 w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& X I+ R# B8 E9 S# V9 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 U, N+ c. y6 K9 T* |9 I" [% d - * TO CHANGE.
) I2 b9 g7 J7 \# _, P - *
1 q: r. s) W/ J* ~$ V" a6 \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& @) n7 E% i/ M, [, A$ Y
- *$ B5 F8 f7 B e
- * This program is free software; you can redistribute it and/or/ @3 M" X) A0 |* n d( j0 O- R1 {
- * modify it under the terms of the GNU General Public License as* w" T- Q e' h# L, ^# X
- * published by the Free Software Foundation version 2.
5 ?3 T4 K. `( ^/ W7 g, K9 {- N - ** s( U% t6 c* V0 ^6 v. i5 S2 F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ o2 w1 I* z6 M8 U# t
- * kind, whether express or implied; without even the implied warranty
) c0 b8 L/ W: V& a0 ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 g) W' V1 B5 K% d( o
- * GNU General Public License for more details.& E s, {3 ]% h- p7 V" l
- */
3 s6 D8 o, v4 H* Y- `
9 i8 A9 }! Y' t) y1 ?- #include <linux/module.h>0 ~4 A6 A/ d$ v, C4 V) L
- #include <linux/init.h>
0 j' U: s$ D1 }" S - #include <linux/errno.h>
$ E6 S8 Q' \3 H6 \4 I% z0 @* m - #include <linux/types.h>
5 E# x7 N) o/ ^. S - #include <linux/interrupt.h>7 P- {6 X' p! z3 Q/ E
- #include <asm/io.h>, d+ h0 R8 x7 \. \8 R; u
- #include <linux/moduleparam.h>0 l. `6 ]: Y$ m' H5 y, V2 @3 z
- #include <linux/sysctl.h>1 c3 t z' |& A% B6 _- `4 Q* y4 C
- #include <linux/mm.h>
: ~, k; P5 n9 M& f8 n8 G) q+ d; H - #include <linux/dma-mapping.h>8 s6 j, S7 y" L0 A* h
- D/ z d6 i( g2 b
- #include <mach/memory.h>
* P6 r8 J. k# K1 I2 S - #include <mach/hardware.h>
6 H! ], ^6 K, _; _ - #include <mach/irqs.h>1 a" s7 d3 A) p) a( n( C4 v
- #include <asm/hardware/edma.h>
" t# @. F; s& o) V
, f( p6 [, D; c. \( M- #undef EDMA3_DEBUG
' ^0 L: W& f+ B, A8 r% D2 I+ S - /*#define EDMA3_DEBUG*/3 s1 ]. e1 A! q A5 u! k! c
, j2 F/ ?$ m. X' V& ~- #ifdef EDMA3_DEBUG+ b1 B7 T2 T! l) J8 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) I2 m' `/ Z+ T9 x& C5 j! g9 X+ K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) M8 T9 ^+ j: ?- n$ X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 i4 z4 ^ h4 K5 t f6 G - #else \, U: T1 G/ ?# N
- #define DMA_PRINTK( x... ): b( L+ c+ Z% A# _
- #define DMA_FN_IN
: C5 D% L% L% l, A. q% V6 `3 q, Y - #define DMA_FN_OUT
' o% t- @' N* O - #endif" A! Y5 w9 ~' x/ `( z. v
# a" y4 F7 n' \- #define MAX_DMA_TRANSFER_IN_BYTES (32768), N% K0 Q) e1 c9 ~7 v# C: i' \ c; {
- #define STATIC_SHIFT 3( l6 |9 a2 a0 `6 I
- #define TCINTEN_SHIFT 20
; f" O9 ?9 h9 N3 ? - #define ITCINTEN_SHIFT 21
8 T/ G# d8 V: V, A - #define TCCHEN_SHIFT 22
+ C1 m9 [" T7 k: j1 K9 L/ P& P9 ? - #define ITCCHEN_SHIFT 23
# a V' e1 r, Q. K, K
- H/ r# y4 l% O( K- static volatile int irqraised1 = 0;0 l, G/ b1 o! t! y5 V
- static volatile int irqraised2 = 0;
9 @: i3 P6 f4 Y+ q8 h( D. W N" m/ A - 0 p( S( |: V1 F z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. @; X8 G& g$ g! }1 L% p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& j; t' z& U/ I4 m" `# Q6 P F- V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: z0 F' \# a4 ^+ E
8 ~9 w; V" {# z$ |* W5 K6 y- dma_addr_t dmaphyssrc1 = 0;
8 Q( I9 ~8 V# `) f+ L. C3 ? - dma_addr_t dmaphyssrc2 = 0;
S$ ~6 O# G" {# ?* U6 ^# u - dma_addr_t dmaphysdest1 = 0;
- }6 ]' ? J! B* o u! T' }- e - dma_addr_t dmaphysdest2 = 0;
$ e1 C n) E8 B! E5 ?
2 B$ ]) A- Z0 e; K1 o1 P \( `* {- char *dmabufsrc1 = NULL;% X' E$ \6 T) G* l
- char *dmabufsrc2 = NULL;* S2 V7 e& ]4 o/ L5 d8 L9 L
- char *dmabufdest1 = NULL;
: V! p3 L( F4 l- o- H - char *dmabufdest2 = NULL;6 w" T k3 ~1 q# m \9 R' a
- 1 e C/ O3 x+ L
- static int acnt = 512;
- z+ l# t; d/ X$ {4 z8 H - static int bcnt = 8;
! A$ G2 {4 {7 |! N) x5 V! h6 w; W' d% x - static int ccnt = 8;5 ]& q7 g4 l0 N4 ~
- 5 o# s- k7 a Z) |7 U
- module_param(acnt, int, S_IRUGO);( Q* y5 T! P' [
- module_param(bcnt, int, S_IRUGO);, ^& G' f+ a+ V: ^
- module_param(ccnt, int, S_IRUGO);
复制代码 , w2 P* z3 ^9 G0 K* C
$ f6 \, j5 Z" t2 O9 R- ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* w$ `6 T7 a( M. d0 J! yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 d& G% F& m5 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 N' e5 b: M. p
' |% c( J3 Q5 i* r( X$ y' |3 D
& ?1 B+ `8 H5 C( E# d |
|