|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 [: K; }2 c, Q l1 f# B4 D+ U1 v7 ]
- [code]EDMA sample test application4 P+ W8 K/ }; ]3 Q) m( ]" r% r( S* g
- /*
3 @( f- b$ A+ ~ - * edma_test.c
* _( H" x# T4 ?) x6 m) M7 t - *
6 T. M, n0 O5 Z8 f9 ~" I - * brief EDMA3 Test Application. n C3 {* ^% G" j3 w( E
- *( r( C* O, B7 u
- * This file contains EDMA3 Test code.7 \+ a) i# D- P H, I2 V+ K
- *
6 |$ X, u- {" g7 n% [+ Z" x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 M% O" f V2 R- @1 g8 R) Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ _, d s) b' w( H) a" {
- * TO CHANGE.
' Y4 k y4 {% N: A - *7 ?6 L$ l% X3 X) A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 L K; n$ P) F0 t" d8 l - *
: `4 ~+ D0 E: L* J5 C9 v - * This program is free software; you can redistribute it and/or M( T. N# h( M8 M a+ n& h
- * modify it under the terms of the GNU General Public License as$ s, c$ m) F" x: F* H1 G$ H
- * published by the Free Software Foundation version 2.
! D Q8 e" W4 { h, L - *, h* g2 f& x' F' W# ~/ u: U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: o3 Y* }2 h3 {9 K" d0 f - * kind, whether express or implied; without even the implied warranty
0 }- Q: t* J* ^# M2 {) H6 @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% j9 D/ E1 x7 J$ |: x2 r
- * GNU General Public License for more details.5 q+ M" m! N- S5 W. a
- */
3 p% z8 D9 U) N0 } - ' S9 e5 T0 `2 z3 w$ L+ |
- #include <linux/module.h>
5 O+ I4 X+ I1 w! h' f. v - #include <linux/init.h>$ K' q2 q8 ~0 B: G
- #include <linux/errno.h>
0 D4 k3 J. ?7 Z7 u. ~ - #include <linux/types.h>: W) L- U+ k/ S; {7 g+ S
- #include <linux/interrupt.h>$ i9 p% N t" n! P. K
- #include <asm/io.h>
. q: ?! e( A- f& B - #include <linux/moduleparam.h>( T- G2 v) k D4 j# Q. j; l% p
- #include <linux/sysctl.h>
: ?0 D8 S8 o+ d7 s0 H( y - #include <linux/mm.h>
- t/ F; c) W- f# T - #include <linux/dma-mapping.h>
7 |! F V; j" X: _: _# N - 5 a# `) I+ `0 S# E4 l! v# a' H
- #include <mach/memory.h>
3 d" c4 @4 j% ~; z* ^ - #include <mach/hardware.h>2 I M9 k, z, O4 N- R, g
- #include <mach/irqs.h>
! }0 X1 {/ |/ }7 r) Z1 o. f7 X/ U2 G - #include <asm/hardware/edma.h>
K+ n8 I) I5 L* ^5 A2 A5 ^
1 l9 D; m5 D- h, z- #undef EDMA3_DEBUG
. ^$ x, a: ?, O+ w- s! p - /*#define EDMA3_DEBUG*/
2 U/ N" T& B1 _5 F- J0 @# K; C; ~ - 7 S* b" `5 w0 [, w
- #ifdef EDMA3_DEBUG8 M4 q( o- |6 z" ~% b# i, h; p4 t8 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): @9 F4 ^- ?) Y0 }0 h" Q# _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# H* \/ o4 i. u& z! C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); i. _. X+ R4 K4 F: @- n1 d4 u
- #else
1 ]: o* B- a$ U. N - #define DMA_PRINTK( x... )/ w; h$ J2 Z; y3 N( S7 \2 F
- #define DMA_FN_IN; j( ~5 G9 t, E S7 G5 I, S& J
- #define DMA_FN_OUT
( n) z0 l5 R2 N, ~9 A# U - #endif
" D& a( ?+ M, R8 A$ e$ c' G+ \% d - % y `$ W4 \2 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); v1 |+ ?. y# I" x/ ]
- #define STATIC_SHIFT 3% G+ _9 d9 v) m+ M
- #define TCINTEN_SHIFT 20$ z0 C4 R# Z4 P$ V3 [' [ {- `3 Q" A
- #define ITCINTEN_SHIFT 21
$ \) ~% S3 k9 D0 d" c. p - #define TCCHEN_SHIFT 22/ C. V+ ]* a* l/ h9 G1 T
- #define ITCCHEN_SHIFT 23
$ [' u5 T' k! |7 `
/ [6 \+ K- @/ r* d1 D! J! ~7 F- static volatile int irqraised1 = 0;8 Z2 A! _+ |+ n$ i& F. y
- static volatile int irqraised2 = 0;
/ T- c0 c# h0 r" s# d4 ~, T5 U
$ t% b7 p: E: I6 q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( _! `; b7 C2 j4 H7 x j: a/ H5 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ~4 W j" s, y0 n( Z. I Q4 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 o$ L2 w7 R4 |
- 8 ?0 J* _6 S8 s
- dma_addr_t dmaphyssrc1 = 0;
: u$ B) v* g7 b; _ R4 d+ h - dma_addr_t dmaphyssrc2 = 0;
# I( Y3 S% ?" |$ C- c7 `9 s - dma_addr_t dmaphysdest1 = 0;3 m& c/ X- l8 a3 o
- dma_addr_t dmaphysdest2 = 0;$ b7 C- J7 K e0 v
- % d# C3 e) B8 E5 ?$ `; s
- char *dmabufsrc1 = NULL;$ T( S d3 \* i+ ]* L- \
- char *dmabufsrc2 = NULL;
! p2 E8 r2 t3 D3 y1 \2 V: t3 ^ - char *dmabufdest1 = NULL;4 _% i$ }' I {$ g% H
- char *dmabufdest2 = NULL;
7 j- k0 ?# }! m3 ?1 N' {
+ M% _1 J; l6 q3 L- V% F- static int acnt = 512;
% R; S, e* b8 m/ |' Y/ E - static int bcnt = 8;+ i+ S5 C/ I+ S7 W; P
- static int ccnt = 8;" F6 \% i0 M1 {( I
- ! @ v! v5 ]' F9 X* Y* I2 ~
- module_param(acnt, int, S_IRUGO);
9 t) b0 ^1 a0 @+ { p% I - module_param(bcnt, int, S_IRUGO);
# c- x& K+ I2 @ - module_param(ccnt, int, S_IRUGO);
复制代码 4 s, u0 B7 M( B# x0 j' e
* H- Y: d( k2 |% ~" O2 u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 }5 t0 W. l ^+ k# Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 r' U: F/ Q% U: u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; C5 v# I9 \& ]+ V7 I8 F$ b
/ }4 W$ k# d" T7 g* z Y# A# u- X5 u* z: L. U
|
|