|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 \- h, `) [$ V+ q5 P3 C+ _& e z" v2 G- [code]EDMA sample test application
/ l8 Y9 u3 @$ s3 S - /*
$ w0 X4 p% c7 f4 f% j7 J - * edma_test.c
4 I% C; o5 s! |8 k Y - *
% B+ o. v& e7 x z - * brief EDMA3 Test Application# Q. v3 j2 f9 K9 P
- *
; I3 X4 Y E4 `& ~9 c' Q; Y+ g - * This file contains EDMA3 Test code.0 Q% `) l3 S+ m/ x6 R- }
- *
4 z% n; L5 v) \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 c) R" R/ u- A; S6 r. Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 |% s% Y* }8 p, F2 }0 H; X2 f- R - * TO CHANGE.( d+ h( u2 C7 c2 E. x) w' {
- *
. A0 ~* a8 j% w7 R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. z$ n2 p+ L2 } \1 L' W" E$ U
- *0 o% Y/ g1 n+ H" z
- * This program is free software; you can redistribute it and/or. F1 `5 ~4 P) a, z2 k
- * modify it under the terms of the GNU General Public License as
+ I5 S, ]' p. w {8 S - * published by the Free Software Foundation version 2.
; U: G- h$ p. @- F - *% S, l9 T) X/ H, G7 D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 b w. t, [2 z. O4 t6 A$ e - * kind, whether express or implied; without even the implied warranty: Y$ a6 X, }$ f9 M6 S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 ~3 H* N$ y3 u; \
- * GNU General Public License for more details.
e0 Q% x: W& E+ G2 J - */; Z5 z. T' _9 K9 K6 ?1 X& X
- , `4 k/ O" u @/ Z7 C$ z8 g) w
- #include <linux/module.h>3 ?( i" ~9 L+ G4 K$ Z) k
- #include <linux/init.h>
1 l8 t E- B2 G - #include <linux/errno.h>
5 t2 }! I4 {: i9 l1 ]2 i - #include <linux/types.h>( {' A- m- c- c/ X, `; Y) g( H1 D- x
- #include <linux/interrupt.h>
3 W" L# |; |( q2 G5 t: Q5 ^3 _ - #include <asm/io.h>: ]) Z j8 q5 U. Q
- #include <linux/moduleparam.h>
5 [& ]1 {, l. h( d" B6 X( Y& l - #include <linux/sysctl.h>
, v& B# v7 Y+ |( X3 p8 S7 W0 @ - #include <linux/mm.h>
. G& [& s( `$ J) [ - #include <linux/dma-mapping.h>
3 m! z, ^7 n) D. m+ u- a. @ - + X8 y3 G2 V" b5 o9 s/ k& U8 H6 Y( e
- #include <mach/memory.h>4 q& b; A, b0 B
- #include <mach/hardware.h>
" K; a D& p. s! j8 D2 b - #include <mach/irqs.h>
8 U F) r( p7 j - #include <asm/hardware/edma.h>
2 u# n; R8 @5 c1 b( G: g
. A% A) p0 {9 k! E6 X- #undef EDMA3_DEBUG J" A$ ]4 Y! r' Z
- /*#define EDMA3_DEBUG*/8 Q! H0 i8 _ L, D' V% K
- 5 u* O9 Z! s' L n( M" n, O5 E
- #ifdef EDMA3_DEBUG8 D& _/ M6 ?% K2 v" _4 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# w/ V! y, c* j/ [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 X2 R. H; T: y/ s/ d5 Y4 z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, K, L8 _+ _- X0 C( S - #else
, s% u: b- I) Q4 N. Q1 @ - #define DMA_PRINTK( x... )7 Y; ]# X7 k% ? v/ b
- #define DMA_FN_IN: j5 @* ^& y3 ~# k" U
- #define DMA_FN_OUT
% ]2 ^) ~4 \ ^5 T+ T - #endif
# z$ V3 M: T: L* g3 K - ! D' A/ l3 T b+ b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' r- X# n/ A6 H$ I - #define STATIC_SHIFT 34 E* o6 X8 v+ X( `, A& t
- #define TCINTEN_SHIFT 20
& `0 ] V3 `( H - #define ITCINTEN_SHIFT 21 Q7 s7 ?3 R* N
- #define TCCHEN_SHIFT 22
3 i5 K- ]% l- R2 b3 k - #define ITCCHEN_SHIFT 23
- p# |" v; T2 Y" u2 J0 F. Z - 6 b0 V/ }. X( n3 B% S2 [
- static volatile int irqraised1 = 0;3 S, J u" c E$ T4 W% b
- static volatile int irqraised2 = 0;3 u2 i5 T. R! W7 }8 G7 J/ {" X
- 7 R# d+ m$ N3 k5 M/ Y' @8 W$ e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 W0 a' _, V/ ` H8 k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; O% R8 a& v5 Q" y$ [. T% V+ c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* m2 ~% v) O. C9 C# z
% c/ l' [% ]% U! c* [ C8 I' n& ~- dma_addr_t dmaphyssrc1 = 0;
9 Q6 t7 z- V( z# R2 s0 I5 E: d* N( e1 g8 J - dma_addr_t dmaphyssrc2 = 0;: W1 Q* G* i6 \! V
- dma_addr_t dmaphysdest1 = 0; m9 ?+ q1 ] ~- y' w1 w
- dma_addr_t dmaphysdest2 = 0;
+ G) M9 n) F5 n% S3 g3 ~( g - ! e8 H3 }, a# H( m
- char *dmabufsrc1 = NULL;
/ X* X$ |+ u4 z) s" Y0 A- \% `9 G A+ f# r - char *dmabufsrc2 = NULL;" D: I" a4 m$ J; Y1 O
- char *dmabufdest1 = NULL;
, W( t! O! ~- B* ^ - char *dmabufdest2 = NULL;* R1 X0 V% F; z, k7 c1 d. ^
- ) }9 C" T6 \, j
- static int acnt = 512;
/ m. N' F3 b a D - static int bcnt = 8;
8 o$ y% Z: o- j: G4 I% S: ? p0 K - static int ccnt = 8;7 _* o# }: j+ u$ B' k
- 3 V: o; ]3 k. P( G- c2 u6 Y2 U7 a( F
- module_param(acnt, int, S_IRUGO);2 v3 O+ D. z0 G' s7 s
- module_param(bcnt, int, S_IRUGO);
) b' [9 a" T4 ]% j( ~ - module_param(ccnt, int, S_IRUGO);
复制代码 * r0 E( O: s+ p' r6 u R) f* I
6 h+ \5 T# k+ u0 a; c& N, c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& m* Q5 z' s3 |$ F5 q1 ^0 H/ karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* p0 |$ o$ w8 [# T, N3 C* G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 b$ s2 S3 P, T } E4 k$ w3 f: |% |" v% _, l3 ^/ a
% _# |- m8 j$ \* b |
|