|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, z5 ^. p1 ^6 J% g& K; b7 [- [code]EDMA sample test application1 u7 W: \! Z% h2 v5 ^4 D' o
- /*
8 W. Z4 {3 U) D% t - * edma_test.c
3 t k" H, N$ y0 l, Q3 C - *. L/ k6 N* X% g( j
- * brief EDMA3 Test Application
+ Y- _- F% V/ @: _( [ - *+ w2 x( e$ q$ |; S: N
- * This file contains EDMA3 Test code.
- w6 M+ v6 U7 u9 s - *7 [7 S( d7 j: J0 Q# [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 |% ~ p7 g+ {) E0 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- f# @7 m8 Q% Q1 S: o
- * TO CHANGE.% b- L' {' o. _- c' U! C
- *7 @3 R) m# {1 _4 Z9 R$ |$ s% h2 s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- q' [: ~/ c. f Z- v - *
7 @: D' g$ |0 t5 D$ B - * This program is free software; you can redistribute it and/or2 e; w9 r: }7 O) M
- * modify it under the terms of the GNU General Public License as# s( D* G8 H D% E l( G
- * published by the Free Software Foundation version 2.
( p6 E4 J3 W/ Z2 X6 B! _& _ - *8 V3 |% ~9 e y. T K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# ^( q0 Z2 J5 L1 I - * kind, whether express or implied; without even the implied warranty
, ]( [/ k! B, U2 L4 z' } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# T1 H0 M/ D0 g" g7 B( ?
- * GNU General Public License for more details.# v% `/ }# T4 h, V! E
- */& n" u2 i% o. g7 `% z i+ j; O
- ) S/ g/ r) a% {4 `/ \# O
- #include <linux/module.h>
2 a4 q) |# j, w$ e; E% m, ?/ Q- A& A - #include <linux/init.h>' D; L, Y ? j8 j- S( r! J
- #include <linux/errno.h>
" `, U0 M' [! Q - #include <linux/types.h>
* M3 E G: s+ D- m4 g - #include <linux/interrupt.h>
* p* P1 O8 N# D* Q4 ~% f - #include <asm/io.h>
2 L" c% J/ D5 U% d/ c* O - #include <linux/moduleparam.h>( b, a/ K" `+ c6 @6 h2 Z! i! l
- #include <linux/sysctl.h>
) Y2 V; n! N" \( M - #include <linux/mm.h>
- O$ ?+ w, B. o$ G& O( I/ X# w - #include <linux/dma-mapping.h>
+ [0 D% X4 \- ]) L- ]( R7 k
. }& B+ [" E+ i9 H* v- #include <mach/memory.h>! Q1 o' }2 [6 B8 F
- #include <mach/hardware.h>0 }/ v# X. q- J2 ]4 h4 x
- #include <mach/irqs.h>
. O# v9 y4 Q0 C |4 o. ~ - #include <asm/hardware/edma.h>9 @6 \4 }8 f7 `* o
- # Q8 c) I" f8 M& i/ f
- #undef EDMA3_DEBUG- W2 b' `, `" E0 Z. E5 T
- /*#define EDMA3_DEBUG*/; ^$ a% J0 A2 x* M; I
$ u+ d! _" e5 |" x/ t- c- #ifdef EDMA3_DEBUG
" ]" z; `$ k y* N6 P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 P, v! W' ~; l- {) b4 V: q6 k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ ?5 l" Z* G x% e. ]1 r( z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' `+ ]. Q# a+ \' R8 i$ j - #else
$ V; j0 Y- U+ o5 h4 x: k( K; ~, k+ g - #define DMA_PRINTK( x... )6 D8 ]# `: O& y5 a1 G$ S1 v+ [3 @4 ?
- #define DMA_FN_IN
+ A' L6 O# d8 m4 g. c; x - #define DMA_FN_OUT6 t+ k5 e9 M: ~5 X$ E: ?
- #endif* i( y" H, g9 d/ r( a! N; v2 K
7 \$ q: f3 T0 f" a N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 \, u4 S) R" u- F
- #define STATIC_SHIFT 3- Z! R' ~% `0 Z z5 L; n! w
- #define TCINTEN_SHIFT 20
1 ]4 n: y* I. H$ ~3 c3 o" }2 { - #define ITCINTEN_SHIFT 21" }& W0 ~2 M* ~: s: q
- #define TCCHEN_SHIFT 22
9 C3 o' R- I, ?9 x7 i' c; r& I - #define ITCCHEN_SHIFT 235 y* l6 ?" [7 J6 d' c, @' Z
# o( ~$ q$ D* W( u- static volatile int irqraised1 = 0;! x, S- M2 ^+ B* ?
- static volatile int irqraised2 = 0;5 x3 v0 g. a; E& S
- 9 Q- m/ K* A! K3 z4 I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A0 |: y; o+ G# X$ I/ ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 f* `$ t6 F& C+ x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ i* V0 \( L( o. [# w- a
b0 Y9 P; U6 n( }$ K- dma_addr_t dmaphyssrc1 = 0;
+ W1 t9 O& x) K Q - dma_addr_t dmaphyssrc2 = 0;
9 b( N2 X, X5 G! s+ W8 W, O+ O - dma_addr_t dmaphysdest1 = 0;9 F7 a- e# n3 a$ U* P
- dma_addr_t dmaphysdest2 = 0;
- o. ~7 L, p( S% E
$ R) `3 ^5 t) E; r& O- char *dmabufsrc1 = NULL;
9 B w: S' G2 |! J+ Y - char *dmabufsrc2 = NULL;
0 ?% x/ ]- D6 M( S: A - char *dmabufdest1 = NULL;
4 B5 D. o% m' H1 h - char *dmabufdest2 = NULL;. R% b3 u: Z9 Q* c: b
& O' F* z* d6 L8 ]- static int acnt = 512;
' e; B: C0 i$ t) B5 o8 G - static int bcnt = 8;5 e- ?0 U0 N( b6 k) |4 S' ^
- static int ccnt = 8;9 m6 w" r( `8 e2 P8 n
- 9 z1 H% B) p I U, u4 `0 w
- module_param(acnt, int, S_IRUGO);2 B6 M7 Y" x. e) c6 B
- module_param(bcnt, int, S_IRUGO);
- ]; e4 Y5 m; B - module_param(ccnt, int, S_IRUGO);
复制代码
# c& m* W* i# m& w$ K7 a
( w7 Q: }4 s3 M- Q- w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' ~# c+ t: P" h) U2 f- Y, W5 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* b8 h8 H' B3 ^* H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: \6 Y- O( _/ m. s: p. h5 b* ~$ |5 q1 s) c( G8 `: V
" t# D# T& o, f5 H |
|