|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& p( ~3 H# E9 D" Q1 P7 c" W8 D: V- [code]EDMA sample test application
. A5 \% D$ L) R' U6 R' d( Q# U - /*
6 O$ q+ c N, y8 u( m# _7 b) W - * edma_test.c
+ O, S# G) _, c" ` - *; c$ i W e# H) h; y4 V
- * brief EDMA3 Test Application) L4 h) Q- C( H
- *3 F* k U' m, X" d
- * This file contains EDMA3 Test code.; e) o( W* c3 r- A4 K
- *
! }& E/ s' T+ b3 W1 ?4 ?3 Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 v) t# f& z6 i9 p0 |# a% D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 _/ C: Y ^3 j$ ^4 F) P
- * TO CHANGE.9 H+ F' z, `3 p4 Y" H
- *$ E6 O B1 \. t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 Z8 X8 x) I: f) H/ N8 [
- *0 |4 K& F. r1 Z9 {* u1 |+ F
- * This program is free software; you can redistribute it and/or3 K9 d! ?5 L+ l9 U, y+ {
- * modify it under the terms of the GNU General Public License as
0 w& n3 n; M; ?- E- V - * published by the Free Software Foundation version 2.. V" o; N- H7 W7 x# D
- *
" Z0 N4 T1 ?* n W- L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 {7 q, }4 q, S1 E' \" A5 H' d9 e
- * kind, whether express or implied; without even the implied warranty/ o: V' u3 t' f7 V. R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& Q8 ]: N+ R" U% Q8 r - * GNU General Public License for more details.
# \2 v; H, J% I8 R B - */
& M4 ]; J2 N, K+ ^" }3 M - , m/ c( O# I" v% q
- #include <linux/module.h>
9 {- U s! N8 x, p - #include <linux/init.h>
# r1 g* ]7 _) a - #include <linux/errno.h> H& b( g/ t- T, K3 \; w1 A
- #include <linux/types.h>
3 `# L! `; a$ m- i- y - #include <linux/interrupt.h>% d. q. c) I7 \; b8 t! x3 G" }" E
- #include <asm/io.h>, Z+ N/ [ \- R* a) w% e' P; D
- #include <linux/moduleparam.h>$ z1 G9 r- y& q3 r! f2 S6 Q. g
- #include <linux/sysctl.h>) h! B' m% |5 J/ d$ t N
- #include <linux/mm.h>
! Y- \: W O% d5 {, J+ B - #include <linux/dma-mapping.h>
( |+ J" ]% q1 z0 G# Z, r* w2 S
" J1 H9 a+ y- G; Z6 F- #include <mach/memory.h>' y( a m: {0 R# l9 `8 r( e
- #include <mach/hardware.h>7 I7 R! B0 G8 [, W' ^7 n8 W/ T
- #include <mach/irqs.h>7 O) D% `! v4 x _7 \5 V
- #include <asm/hardware/edma.h>
% R& q. P# ~4 b. f3 h: v7 q - 5 o# _9 W. O9 o* V4 s
- #undef EDMA3_DEBUG; o; q3 P" t+ E; C' T6 _# f% r
- /*#define EDMA3_DEBUG*/. l3 {6 x, c, u5 O
/ V2 e- e) ?7 `' `( G; S% V- #ifdef EDMA3_DEBUG, O7 s7 h2 A# K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ _9 h5 L; l' J2 D2 n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 X7 J |/ }6 O1 d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# L: [) Z& M, D9 z - #else
U8 g; m- T( j" Y - #define DMA_PRINTK( x... )
L, u3 R1 X# y4 C - #define DMA_FN_IN
e$ Y0 N: F8 y5 T) c8 s - #define DMA_FN_OUT
0 W k9 S" d `7 `! Y4 @5 ^ - #endif E* {6 T- @ Q8 V! S
8 y" f' Y8 Z( a' B3 ?2 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# @: `# J' X" J- b
- #define STATIC_SHIFT 3
$ A( i6 V5 m; v0 m4 H7 F7 ^6 M - #define TCINTEN_SHIFT 20& \7 T1 l) {0 l+ a& x
- #define ITCINTEN_SHIFT 21
- s$ a9 a5 q( r, j# b - #define TCCHEN_SHIFT 22
. I6 a! ]4 \8 j6 _5 O% E$ g - #define ITCCHEN_SHIFT 231 u' M, M- R$ L0 ]; c2 ~0 \" v
" L* E" D+ U5 f: @6 R- m V8 O+ m- static volatile int irqraised1 = 0;9 {( _ k) F- B% [) T* @7 j2 v
- static volatile int irqraised2 = 0;' K4 `$ ~3 ?" ^& g8 Q- _
% F' K. B4 c- z4 B' c. h% R" o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ }0 G. E# z8 _* b8 T0 M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; O6 A: d' z" V2 B" X% M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ C; r/ }5 X- ] l, a, ]: v2 c# K, z
- $ b3 X/ @$ a. c2 p3 Q, E- [3 o8 j
- dma_addr_t dmaphyssrc1 = 0;8 m. s o7 Y& A0 _* M- e
- dma_addr_t dmaphyssrc2 = 0;" n0 [1 @% s( B
- dma_addr_t dmaphysdest1 = 0;
1 N- h G1 i: C& q# l) q, k+ } - dma_addr_t dmaphysdest2 = 0;
+ C5 n; Z( c( K. A6 B: Z - % |6 ]7 c9 p2 T# r
- char *dmabufsrc1 = NULL;
; z t' a" b6 [ - char *dmabufsrc2 = NULL;3 d" l6 s0 l: q3 M$ P. ^9 ]! M2 y
- char *dmabufdest1 = NULL;* g* C$ @# \' D3 P! Q& l
- char *dmabufdest2 = NULL;
% ?# _$ d4 p0 u! p& h - t" z6 y1 p3 V; M: C; P
- static int acnt = 512;
r) |$ ~2 J9 {+ }' C; x" P - static int bcnt = 8;# w [7 l8 U) S6 V# Y8 E$ m
- static int ccnt = 8;
0 X% u0 V" n; i7 D! l0 p9 d) X# m
( U5 e4 Q9 ?+ y; T1 B5 c9 F& `- module_param(acnt, int, S_IRUGO);
$ n8 \5 e* L5 ]1 l( E* f - module_param(bcnt, int, S_IRUGO);
' A' n$ {2 u+ t$ }9 i) s6 Q! I - module_param(ccnt, int, S_IRUGO);
复制代码
* ~. T" a1 N1 X+ y4 j4 U5 J" F/ g- f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 T- e: M- b) y, P$ qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ Q+ J( p( ^6 ~5 {$ H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' L% {8 w3 L8 G
. X8 R6 e8 I, Z, S8 R( i4 `; a. g' E( [5 B# v3 w) A, I
|
|