|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 \5 {) W) S+ F- [code]EDMA sample test application+ @( E$ @. O5 c2 I
- /*, b" L6 r; M' z3 x, b
- * edma_test.c& P: i G$ X: v, f: G' x
- *
5 S+ U( c/ j7 \% v) `$ o - * brief EDMA3 Test Application
6 v. ]( ?/ o2 _& h - *
7 T( k5 v8 d; h: [1 O% ` - * This file contains EDMA3 Test code.9 s& x" h I* A& R+ ~ G
- *+ j' R; o3 v" `( C/ ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 x: ~/ s+ q) Y+ Q$ p$ H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# k: d! ] W$ S6 H0 O4 T# O, E1 q
- * TO CHANGE.
, ]* E$ i* j8 R5 b* m- Z - *
4 I% l$ `8 N5 J6 O/ E/ J% f' Q% c' N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
T1 h. @" L' Z& \ - *
- O i: p8 K/ Z - * This program is free software; you can redistribute it and/or
! Z/ B7 [7 d5 Z7 n( H - * modify it under the terms of the GNU General Public License as
2 A( N) T6 n4 z" U, V a/ e - * published by the Free Software Foundation version 2.
6 T( Y( X; e: R( Y; p# h+ k - *
* }+ S; ~8 J7 o- r2 o: i4 R2 d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 h7 T5 j# R2 Q V( z+ l - * kind, whether express or implied; without even the implied warranty
4 d! f8 X( F9 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 d2 |0 |, H8 Y8 V0 k* ?0 _ - * GNU General Public License for more details.9 [# t3 m y$ y' l- l
- */6 O5 [6 \% j$ P$ x7 r
& Z, V% l' Q/ S# @1 D- #include <linux/module.h>
( J. ~; `& E C$ S C! } - #include <linux/init.h># k2 r; K: P/ C2 _* Q) }
- #include <linux/errno.h>' ?$ X% j `0 m% I8 I e
- #include <linux/types.h>2 e0 ^1 @" {2 e0 V. y
- #include <linux/interrupt.h>
( J+ w. z# U$ N - #include <asm/io.h>
7 w8 B9 k2 G5 q" Q - #include <linux/moduleparam.h>
[8 H G+ C0 H8 g% N4 A& c5 z5 v B - #include <linux/sysctl.h>$ K2 i9 y5 }: h. ^/ t: k' ~
- #include <linux/mm.h>6 F/ X/ u/ `2 M4 G$ b
- #include <linux/dma-mapping.h>$ n5 x1 A4 ? i( _2 D9 e" w
- + G3 q% z( r5 Z* J
- #include <mach/memory.h>2 x2 e( l0 N3 y t8 T
- #include <mach/hardware.h>
y( F; F/ U: r+ A7 f& q - #include <mach/irqs.h>/ D4 f! [: ?& d. H1 M9 n! V
- #include <asm/hardware/edma.h>0 C; }3 X8 e: j7 l
- # R% Y! F2 z# u! Q1 f9 D
- #undef EDMA3_DEBUG$ B' C4 T7 m: }, r( `3 z
- /*#define EDMA3_DEBUG*/1 Y% j" K7 i# L% U; m5 v/ {# x' t1 l
- - i! E' ~! O4 ~4 R! K5 s
- #ifdef EDMA3_DEBUG
% {8 b* E) J* y6 C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 E' ]) V- K. I' d0 ?, h. W$ \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( V( a: b: a- Q! W" u% A: ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); [& V4 k9 ^+ Q
- #else
o+ A) q9 v) _+ o+ H, J5 U/ m# A$ c - #define DMA_PRINTK( x... )0 k1 u: ~. ?; ^9 c2 T% z
- #define DMA_FN_IN
3 ]' ^. _. _9 W6 x8 ]. h - #define DMA_FN_OUT; H/ | Z# X7 y1 z9 Y6 X
- #endif, u: F# Q* T6 i& ^7 O8 n, |
! w+ c) Q! w# G* @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 A. m: c8 b) @, h) p9 r - #define STATIC_SHIFT 3
' u) Z3 J1 z: O w: s - #define TCINTEN_SHIFT 20
1 ]2 b/ E) `1 t( W; A - #define ITCINTEN_SHIFT 21: G$ ]2 {+ }$ t2 j. Z5 I4 u; Y
- #define TCCHEN_SHIFT 229 {' f8 ?5 M% N. W2 q) n; p1 V% a2 H
- #define ITCCHEN_SHIFT 237 n, i4 m# h! K, H! _% T' m4 R
- & A/ {' }. z7 N5 D! s0 T. G/ k/ T
- static volatile int irqraised1 = 0;' j l3 q4 |- u1 I. A2 Z, f1 o. J
- static volatile int irqraised2 = 0;/ d2 e6 ]4 P& S; l# c
. E* x% b4 x4 N. ?7 @; t) [ S3 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ m: x5 H' s$ p1 [2 M) e( c& l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ R1 ^, \+ w4 m# |2 H2 o1 s9 B8 m) {5 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 W5 f' ?: x" Y) d; v% @3 N0 f - $ C& q" x% B( }# v* G$ r
- dma_addr_t dmaphyssrc1 = 0;# q) b1 ?/ O3 `& N# J+ F
- dma_addr_t dmaphyssrc2 = 0;
) F) M# B. m. i) j - dma_addr_t dmaphysdest1 = 0;
( b* Y/ W. B, u: [: X$ _ - dma_addr_t dmaphysdest2 = 0;0 Z8 `0 T& k K3 I( C. v5 u
- , ]1 n: h& s( ?9 C% C0 B8 c4 D, Q! M
- char *dmabufsrc1 = NULL;
; Y* j2 J! G& x) Q8 w; t - char *dmabufsrc2 = NULL;
. R) H/ e4 f: N+ X - char *dmabufdest1 = NULL;
7 g3 U% P% ~3 [; E L4 O Q - char *dmabufdest2 = NULL;; G" h# ^+ v! w1 S0 f
Z# U, ~) {1 T* g, p- static int acnt = 512;
8 e# V; F" r; T% A. L( f - static int bcnt = 8;
0 S1 m9 f1 R& b- I5 t - static int ccnt = 8;+ X5 Q- _0 x: Z" q8 F
+ |6 r* t; p+ j9 R" B7 D7 a+ a- module_param(acnt, int, S_IRUGO);* Y/ z+ U- y9 b
- module_param(bcnt, int, S_IRUGO);0 P9 c6 G4 H7 P5 q
- module_param(ccnt, int, S_IRUGO);
复制代码 - g$ `' @/ [# T0 F3 O
- i: `( M- M9 B3 D3 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 ^* {. @7 J2 ^- `% a2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# F7 {: V1 P/ w; l g/ y2 z4 b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ F. r+ V, Z% e$ g
8 U/ k: }! P3 O$ f5 r9 @3 V# a( T( ?* w3 m* C: _7 I, V) R# y
|
|