|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' F X# u0 }. o7 A' O
- [code]EDMA sample test application, e {2 D% @7 n% [; x' ~
- /*! w) s5 n: Q7 _; [2 A/ q' x2 w( [
- * edma_test.c
2 f8 n. Q/ }4 f, B4 T' r - *
4 f. a4 b$ |2 V* J" H - * brief EDMA3 Test Application
1 R# u! d2 F: _: x7 k6 u# w - *
3 [4 h* C$ v& [ - * This file contains EDMA3 Test code.4 m7 K/ w$ h- J/ H
- *8 ]1 H6 h4 k- ~1 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 ?- x% _. c! u# _ x$ d6 i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
C$ z* t2 G, U$ t - * TO CHANGE.
/ X# N+ g( V* S' _ - *
- m9 C+ _% S- W* X5 B/ V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 w( u' y3 M+ t5 a7 J* C
- * F# n) B; u5 {; W6 i
- * This program is free software; you can redistribute it and/or# C, b3 N! z! {. c4 I' C
- * modify it under the terms of the GNU General Public License as
- `3 G& r. G7 R1 H1 u' e5 n0 V - * published by the Free Software Foundation version 2.
- X; i& x$ ~2 L* b0 Q - *
! K2 U A- ^3 z' T" H9 ] k6 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 F' { P( V0 b4 J. n& W+ K" c - * kind, whether express or implied; without even the implied warranty, v; u0 y' d* m0 L9 I, s8 G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) }2 @3 m* i+ j: b5 b4 ^( S: W0 A
- * GNU General Public License for more details.8 O3 M, P, I8 \
- */! j8 q* `/ a4 O+ W
- + @8 c T) R2 F0 O) K3 j& Z
- #include <linux/module.h>& ^. n' p! d( q v! R* y$ E, w% s
- #include <linux/init.h>
: a3 p9 n8 s6 s. q7 q: s - #include <linux/errno.h>
$ v" W9 q$ Q) ]# U, m! | - #include <linux/types.h>
2 C9 E- ~4 j' M) \3 O! I( K - #include <linux/interrupt.h>
" j: S* Z: v% d/ \ - #include <asm/io.h>6 y3 N, C5 P0 H# }
- #include <linux/moduleparam.h>% t$ a8 ?9 _2 y) v; J
- #include <linux/sysctl.h>
9 S$ u! Z; q5 T) F! j3 T - #include <linux/mm.h>1 b+ S- h6 E- r$ S- c$ N# M
- #include <linux/dma-mapping.h>
" a! D8 @% c0 I
- m& L5 a" }% u8 V! L) f4 |; u! n- #include <mach/memory.h>
6 I; {+ f7 ^7 `" g - #include <mach/hardware.h>
7 ?! c* ]! L, ]8 C( H0 N- h - #include <mach/irqs.h>3 g8 q( p4 g4 N& n8 y
- #include <asm/hardware/edma.h>3 j) a4 `; P/ K. Z
+ t* a# c7 {' i& c6 ?% \- #undef EDMA3_DEBUG
: a7 ~9 r' @! l+ B7 f- y. | - /*#define EDMA3_DEBUG*/. S5 E) f6 b% c% s# J
F+ `! C* n; z" A# q3 I% ?1 x4 L- #ifdef EDMA3_DEBUG
2 n/ p' l( L! R3 q/ R( ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 U! c- F0 x9 c; }6 k6 x% l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
b8 E3 r/ C7 t: |- ]. n7 v( B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! h7 h+ W5 R' }
- #else0 ?! {, t+ q2 J* E( y8 X
- #define DMA_PRINTK( x... )1 l! B) G3 c' S+ B/ m$ C4 \) Y
- #define DMA_FN_IN
) B$ v0 m# I( k5 J% x6 ~# j - #define DMA_FN_OUT2 h# F6 _1 o7 \- p8 u! W- L5 e
- #endif
/ `2 W5 h( x7 k
: t7 y2 @7 z- C( {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 v, G( n2 D4 ~! J# n2 }
- #define STATIC_SHIFT 3
& R0 _9 s/ B L2 j - #define TCINTEN_SHIFT 20
" j6 z) e9 l/ B3 v2 X - #define ITCINTEN_SHIFT 213 q& {1 X4 N% p0 S
- #define TCCHEN_SHIFT 22. n& W: D6 A; N
- #define ITCCHEN_SHIFT 23+ t6 E; t* e4 j
- : l; F1 \% q! _
- static volatile int irqraised1 = 0;
1 I+ b7 | p* h$ a - static volatile int irqraised2 = 0;+ A! r& ?/ N7 C
- 7 @ h5 z7 b! t9 a' W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 p1 ]- D; t. r4 h( c6 P! Z; L- |- b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! x( @1 Y$ F% v, ^& p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ x# D8 M {8 ^" u" n# @& [ - + y0 ?" F" F+ x% E3 B0 w$ m
- dma_addr_t dmaphyssrc1 = 0;( l3 s. e( m5 }' u/ g; }# q/ o
- dma_addr_t dmaphyssrc2 = 0;# F/ m# R0 L* G6 \3 `
- dma_addr_t dmaphysdest1 = 0;' D, j- C) j8 U7 A% p
- dma_addr_t dmaphysdest2 = 0;9 `- F, S9 x% I
- 3 ^3 ]9 U1 U# P( F+ K. E& g
- char *dmabufsrc1 = NULL;8 v! p; `3 }# d& D/ m
- char *dmabufsrc2 = NULL;
" S# J7 Z3 O- M# } o+ n6 V - char *dmabufdest1 = NULL;0 m Q5 E- h$ i4 ]& R# H) Q& v6 ~
- char *dmabufdest2 = NULL;2 C6 A2 m: Z. `! K4 w( F& _3 o
& f7 a" q( }8 H6 b5 H6 ]' x- static int acnt = 512;. j7 x+ R3 M. @, R9 O
- static int bcnt = 8;
% m! x$ H2 n0 ?" F7 { - static int ccnt = 8;
& P3 e7 S4 @! U) r8 W - 4 o ?6 g# ]/ h4 b3 ]9 P; t1 T
- module_param(acnt, int, S_IRUGO);, V! |: R) l m( [8 f. T M
- module_param(bcnt, int, S_IRUGO);
$ J' W( J% n1 w& S - module_param(ccnt, int, S_IRUGO);
复制代码
/ O; m2 r. a @% y8 w: M- I
* v6 d$ {; Y: d2 x; i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: O: T; Q. Z( g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 q% K+ y: I4 f" I5 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. a* k) k, n' M' i4 u
0 j4 I1 I" N' i
W" h) D3 ]! J+ Y0 o- b$ q+ F8 y- O |
|