|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 O9 n! \9 a/ H( O! L
- [code]EDMA sample test application* L- D, }. B, M# \' s( {; I7 n* Z
- /*
6 d: \% V+ D8 _: l - * edma_test.c
# [/ b8 A* E2 O* T; R( @7 { - *
# y8 Q- | E% f6 T - * brief EDMA3 Test Application
, L; Z4 U& H( Q Z% X1 h3 H% E8 D - *9 A( {2 u e0 O/ F0 A0 \
- * This file contains EDMA3 Test code.; [* c6 R# M% [4 p! b
- *3 p* ^7 |1 P; g7 T* C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 J7 H7 u6 J' l3 C$ u, G! l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 P: s3 [; }: h. q* `
- * TO CHANGE.
4 f3 `: |1 J7 y2 f - *
: w. W! R \( @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* I7 U: E g" p q) V0 @: v - *
$ k/ \/ n; N Y: H7 H d1 X - * This program is free software; you can redistribute it and/or
! O0 x; Z2 e4 [3 V& U& b - * modify it under the terms of the GNU General Public License as/ m+ g5 M2 D( K) C- k, |
- * published by the Free Software Foundation version 2.5 v. {0 v { Q, p
- *
4 i" h0 E$ b) p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: f8 y# v! w: H1 Q: m2 P3 A - * kind, whether express or implied; without even the implied warranty
6 ~; A( z: F/ [# x7 N) V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# P( q @' D, U: }" C# O; ]" O9 G8 ~
- * GNU General Public License for more details.# J- |- }8 G6 P, N/ x
- */
4 l% G. X2 W& J5 p2 Z. Q0 |5 N1 t
* Y* g9 @/ s+ \3 g _# V8 |- #include <linux/module.h>. q/ y. ^6 \4 M! W/ h
- #include <linux/init.h>& Y0 }$ ^# l2 _
- #include <linux/errno.h> f7 ^3 R% P1 L' W6 f9 `% u' O
- #include <linux/types.h>
2 C( d9 y" L7 H) R8 C - #include <linux/interrupt.h>
. M5 }: o. }7 Q8 f# w - #include <asm/io.h>
9 I9 t2 X* ~' D7 y$ I# ^8 [ - #include <linux/moduleparam.h>
7 f; E" ^# P5 ]: b3 K" j+ m/ e - #include <linux/sysctl.h>
( k9 e# z0 Y- [: }3 w - #include <linux/mm.h>
) s# R% M/ X2 n3 g9 D - #include <linux/dma-mapping.h>
h- R8 F& u# d L' V" B( @
& J1 _! f/ K$ K! p/ a- #include <mach/memory.h>
# h1 r i, t- J/ u! }: p7 R, M - #include <mach/hardware.h>0 \, K6 X# g0 n2 W! @
- #include <mach/irqs.h>
% H" s6 D0 ?* I5 Q - #include <asm/hardware/edma.h>
, A* v' k' h% S- b# C - 3 x0 c. `- S: D( ^, _* t: y6 p9 R
- #undef EDMA3_DEBUG
; t1 T/ \9 j/ s$ e. u4 N0 O- F" ? - /*#define EDMA3_DEBUG*// ?2 j* U' y- L, x
: E& W3 Z# t" t6 `# V: G- #ifdef EDMA3_DEBUG
- W9 b' x( W/ X2 s* y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' L* s/ s& \ P8 ]6 J* a B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 j4 P) S2 E+ W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 g. I" j0 W6 ?2 u/ ]! I9 X5 \ - #else
, ]) H( J' H/ } - #define DMA_PRINTK( x... )
: }# Z2 }& ^2 H9 d - #define DMA_FN_IN
5 `8 M* \2 j- U; J G6 g" P/ r$ [ - #define DMA_FN_OUT# G0 ?3 i5 x2 N( o4 r' i
- #endif4 M4 O$ s# p* T1 W4 P6 m
- % x5 Y$ h: p c7 ?- S" B' L% s( W9 i1 p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), E" ~" X) r. O3 \8 A
- #define STATIC_SHIFT 3
9 S% K+ z; m8 U" o - #define TCINTEN_SHIFT 20' S$ n: c' r4 h ]) G
- #define ITCINTEN_SHIFT 21
9 O* u V5 J+ h7 _5 D% e1 W - #define TCCHEN_SHIFT 22
6 s' Y- h2 ~+ G; R/ P - #define ITCCHEN_SHIFT 23# r( L/ f; s( S2 r h7 t: B/ l
W- g/ m' v2 K5 X; [" K6 M- static volatile int irqraised1 = 0; U8 j! H! e# d$ T# M
- static volatile int irqraised2 = 0;3 ^1 D2 d5 F) ?3 O: a& J7 K
- / x6 \0 O c- X) X! I' l" w8 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Y5 Y* V6 j$ U$ b' a& R! w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 f! q8 N3 J$ b' `& n3 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& y$ P5 ^( h/ h$ A% r9 X0 P6 W, @
6 E% J1 B$ h' T- dma_addr_t dmaphyssrc1 = 0;9 K' F/ A& ~, g; G5 Y2 s( o
- dma_addr_t dmaphyssrc2 = 0;" z2 i8 E( x _5 ^
- dma_addr_t dmaphysdest1 = 0;
k4 B8 f, f6 r6 b3 g4 C - dma_addr_t dmaphysdest2 = 0;% B5 h$ F$ J9 J9 n" {& m A+ R
# }5 P6 m# ^5 M5 |/ b3 w- char *dmabufsrc1 = NULL;
' m0 F9 P, j& i6 {- l: [7 h6 N - char *dmabufsrc2 = NULL;
. ^3 K* g! g( B - char *dmabufdest1 = NULL;2 n& e% E% R" B& C+ Q3 w" H
- char *dmabufdest2 = NULL;
* H1 A* R$ c2 ^5 w* @6 n - . k/ D: v- `+ H$ m& x# F
- static int acnt = 512;4 `& n7 V3 T v4 b8 `9 p
- static int bcnt = 8;$ B/ I2 a: N. c6 v) }+ a
- static int ccnt = 8; l8 N' o+ k& a, d' ~, s2 a; N4 P
) w- Q0 ]- `" \% D* _- module_param(acnt, int, S_IRUGO);
3 w/ n' l6 C1 Y# l5 z$ L - module_param(bcnt, int, S_IRUGO);. ]( K6 ]! A" u3 ]) \: E
- module_param(ccnt, int, S_IRUGO);
复制代码
( S& Q* y g% F3 \3 g8 _& ^# o, ?: O* q) x# t5 T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, v+ k; D# R! `, f. X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 ~0 q9 ]) Z( b+ y8 a1 @# q+ D$ j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" W7 f; y! O' h. `4 W9 T! _5 c
, ^% l8 g+ H9 }8 N# a0 v' o6 R
: E) b' ?( X# T1 v0 i |
|