|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 p/ V* ?% j8 G+ Q4 y7 f- [code]EDMA sample test application
& q8 r) M" e2 {# q. @ - /*4 S" c( ]! X$ K5 @ ]
- * edma_test.c
2 u. Y% E2 D R2 i% j M1 Y, g - *6 `+ v! X; k5 g' v. T b/ z
- * brief EDMA3 Test Application7 |3 ~! e8 V% N2 ?& H
- *9 T9 J3 K, {( l! I* W7 [
- * This file contains EDMA3 Test code.
l; D. B+ d' ` C7 j8 C H6 E - *0 R; l' |" A# h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ P' K& j& U0 a8 f I# w8 @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. S! D* q2 ]7 K- w6 I: n - * TO CHANGE.
- |' Z6 ]& i& n3 z) u1 x6 j - *
% d9 c. f% Z9 F K+ w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
O0 d9 O* F. ]" \, [* R/ \ - *
; w% T, S9 I% F' S1 ? - * This program is free software; you can redistribute it and/or
9 K: r) Z) J8 B7 Q7 ~, p - * modify it under the terms of the GNU General Public License as6 E1 I2 `3 G7 H, N1 J) l# n% L$ t* M
- * published by the Free Software Foundation version 2.
3 y9 \1 x3 A; N - *- m( B4 E7 b; M3 b7 i7 |/ S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( v) S6 A) P: A1 o# H6 F% e w - * kind, whether express or implied; without even the implied warranty
9 x: L8 ?: T4 [# `5 g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 l: `! m+ R8 ]/ v$ ]
- * GNU General Public License for more details.; c. p7 ^2 B6 Y# ^
- */2 Q$ X$ b8 ^0 C+ y- P
- # \5 e4 }4 J' V# R0 t/ \: ^
- #include <linux/module.h>$ o) X# Q( x8 D4 S/ [5 l
- #include <linux/init.h>" {& l/ q' P9 @
- #include <linux/errno.h>
# I* i9 ~: t* y - #include <linux/types.h>
' h- x; A! B7 R - #include <linux/interrupt.h>
" ?) y0 V# w, B7 c( [! N! L6 b/ | - #include <asm/io.h>0 ~* _/ }9 z6 H8 Y
- #include <linux/moduleparam.h>; e' G, X, R' o" [, c
- #include <linux/sysctl.h>; B# {7 R/ q% b1 S* {6 W7 r/ K1 g
- #include <linux/mm.h>3 [9 D/ p2 Y* G3 O2 M, V
- #include <linux/dma-mapping.h>
2 u& ^( w) k% ?: t/ O! m
7 G, P* P+ G9 h, a- #include <mach/memory.h>
" y3 c! P8 i& q J0 ?' g - #include <mach/hardware.h>9 w; @. n% j8 v3 s
- #include <mach/irqs.h>
2 f8 r7 v) v" c, g# E3 V - #include <asm/hardware/edma.h>
& g0 [/ ]0 F4 D, O9 L& d - * E W. p @. b- o) h6 r5 J3 ]
- #undef EDMA3_DEBUG
( x8 {8 k: l4 v# H, F. A8 z - /*#define EDMA3_DEBUG*/" v) `2 _9 c0 j9 w j+ D
+ Q3 I4 w0 v9 r2 e, ?* i( c- #ifdef EDMA3_DEBUG
+ M5 T! t- W; Q H$ D- F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 l' H0 N+ m! h A3 D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ Q( I6 A+ ~, O4 v. D# v( I4 T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* j3 o6 q m- q9 j
- #else
1 M/ y( X6 p+ S0 G' x: ?4 q' O - #define DMA_PRINTK( x... )
K3 P& W. F0 ]) q6 |6 X - #define DMA_FN_IN
" p- q b% {# M0 A' ]7 O - #define DMA_FN_OUT
) r: i7 r+ L, z! \$ y: G - #endif7 x7 s, P3 n. @2 [
. F" Z v! W0 U' T2 F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, M5 U4 M1 k3 O l; Q - #define STATIC_SHIFT 3! j( j9 \2 o& B$ U7 _4 H
- #define TCINTEN_SHIFT 20
8 Z/ y3 z/ J! d" Y - #define ITCINTEN_SHIFT 21
6 J9 k# T" R# e - #define TCCHEN_SHIFT 22
! y- K9 O1 B% p, t1 N - #define ITCCHEN_SHIFT 23
/ ~0 Q4 x- Y; u% y" I( \% Y
- c$ _& e; j" K* j- static volatile int irqraised1 = 0;
; X& K& `8 S% }% A, R/ X/ } - static volatile int irqraised2 = 0;
! k2 {! }- a# C) G. ~( d
a, t: |( Q* t, P" n! e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 D# j: ?, s. T* m8 n% t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! l6 O% ]. W- N2 m% M9 n) I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 L$ ^2 P" V1 A6 H- l
/ |. r* E7 ^' T8 H _- dma_addr_t dmaphyssrc1 = 0;
' D8 |6 u, T6 W3 t- k- Z! h; K+ } - dma_addr_t dmaphyssrc2 = 0;
: \/ x' ~, z1 x9 P - dma_addr_t dmaphysdest1 = 0;* q _" m- Y! R+ c: r: a7 B* r2 s
- dma_addr_t dmaphysdest2 = 0;
1 X, ]1 M6 F/ D' c1 T$ e, `) L - ' e/ N( G# U( z& b/ B
- char *dmabufsrc1 = NULL;
9 S% f! K4 u6 B8 L: M - char *dmabufsrc2 = NULL;
( h0 e6 _8 B; C5 p1 N! n - char *dmabufdest1 = NULL;
& ]4 C, J$ g. Q# Y - char *dmabufdest2 = NULL;
. T, `2 T/ ^- U7 K0 j
8 \; d* u! q0 t/ J( b& w4 G- static int acnt = 512;
0 z5 f1 t- q# l% ?4 v$ J9 o0 Z1 F - static int bcnt = 8;8 {2 N* _3 Z* }) v. ^9 {0 d
- static int ccnt = 8;& K$ x1 C+ n! J3 Z
- 5 _; y8 Z4 ^& Y5 `$ X* @" ?( d
- module_param(acnt, int, S_IRUGO);6 S9 p" Z2 { b
- module_param(bcnt, int, S_IRUGO); [" b9 O4 C5 G% U r
- module_param(ccnt, int, S_IRUGO);
复制代码
+ r7 _/ [$ k S- O
2 S$ X# R) \/ e- S7 ^: h4 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
I5 |1 z4 S- \8 S/ Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) b: a. X+ Y3 j0 [& n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 q+ \2 R% w, z9 K& A' r) \$ H/ q& c- f
! t% u, E; C j4 ^8 P5 D1 }% D
|
|