|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / b6 U% p/ @. [
- [code]EDMA sample test application
" @4 ], C2 z2 Z' g' r* L% P, }" Z - /*
% m$ w" Q6 d3 ]0 s$ \& P) b - * edma_test.c! V I0 a8 K8 A @: g
- *" R8 k4 c% }, A6 P3 N3 M! a
- * brief EDMA3 Test Application
3 e5 Q* S5 |! C9 p - *$ }1 P1 R& S0 f5 H% A
- * This file contains EDMA3 Test code.! E9 w4 _4 X: g# H
- *% d9 `0 u4 i& |1 [* D9 ]6 m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; {" j) }% {, Y, h4 Z" O6 k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) O8 q6 k8 [, K1 M; Z
- * TO CHANGE.0 w8 C5 m" T' S/ t7 j, ?1 b
- *! N2 c( I, T! G3 b5 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( L/ g0 b" o$ [( C
- *
: [" p, }+ O! V3 j3 f6 G: b - * This program is free software; you can redistribute it and/or" A- O: }% h' O+ ?5 F2 Y, \
- * modify it under the terms of the GNU General Public License as2 \' C8 s9 m" X, Z2 Q1 ?
- * published by the Free Software Foundation version 2.1 n% J8 _2 L/ H! t2 e* C0 ~+ p
- *0 d/ B/ R% \5 h% Q) ]3 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; E2 {% D2 v6 a+ @ _2 j" p
- * kind, whether express or implied; without even the implied warranty/ Z$ E2 n0 i( O% C/ l0 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% G$ v2 y2 h, ]" @$ | - * GNU General Public License for more details.* `; D6 Z, R, e. Z& R y/ V: K% W
- */. V1 R0 k; y/ Q5 R9 k$ j* e
1 |0 M& h( w# S$ k5 K- #include <linux/module.h>
6 |9 R6 E7 i5 Q- h) d" F* {8 I - #include <linux/init.h>
0 c m0 {4 k) S& x+ {# F - #include <linux/errno.h>
+ e, V. V/ |; {2 K - #include <linux/types.h>
+ @" F, j: v! G& J - #include <linux/interrupt.h>
# ]- i0 V* ~; F4 x: k1 D- c9 i8 m - #include <asm/io.h>
7 {( {9 ^9 _& Y5 t3 n* C- e - #include <linux/moduleparam.h>; \) L+ n9 S' A; c5 {
- #include <linux/sysctl.h>6 V5 Z4 @: h4 d
- #include <linux/mm.h>, l7 N' `$ e' P' z+ U. f3 L' x
- #include <linux/dma-mapping.h>6 h3 n2 v) F8 e- \& P: M
- # F! D% O$ x$ E1 L- j
- #include <mach/memory.h>- A8 A% r5 `( ?: c
- #include <mach/hardware.h>
5 d* J+ A, i8 R - #include <mach/irqs.h>
5 t. Y! k$ I' u0 l K1 ? - #include <asm/hardware/edma.h>
- m) J( X! ]* o- ]
( @8 f9 q5 |2 L- #undef EDMA3_DEBUG$ U% H. r6 C! G1 A
- /*#define EDMA3_DEBUG*/
; T4 b8 y; X: S
9 ` {3 |) ^" o! T M; o- #ifdef EDMA3_DEBUG
# |7 V- R* i2 R, ^+ q$ l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; G, i6 p( k5 Z% Z1 R* k# j/ ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% A4 T2 ^# B9 O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 a. e+ P' Z2 d$ s - #else
- ?# R" {, U R% u; @. U - #define DMA_PRINTK( x... )$ E4 ?1 E5 l4 u Z" T
- #define DMA_FN_IN
% H; D) ~* j8 y/ o5 V - #define DMA_FN_OUT
6 i1 R ]' r: T; z$ c - #endif t8 p# V5 R: F6 s) y H
- ( G* B/ W0 [7 D; E- R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ w* G3 j' \/ w - #define STATIC_SHIFT 3
$ F4 W' S- B% _7 Y7 T$ T8 g - #define TCINTEN_SHIFT 20$ @1 L2 j6 ]/ T% k: S
- #define ITCINTEN_SHIFT 21
: L) O! b. R% R4 x, j - #define TCCHEN_SHIFT 22
/ w5 `+ t3 a" \8 { - #define ITCCHEN_SHIFT 23! a1 b6 r9 A4 o0 l" h
- . K7 A7 e" w) e* ?
- static volatile int irqraised1 = 0;. Z, w- E* S7 O3 J$ x
- static volatile int irqraised2 = 0;
& l* g% z0 g- z, t. h6 v" c: p! ` - ) E: s' v6 @7 p. L- |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- G4 Y; S+ q1 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 z* Z& Y' w. h/ M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 {( K, a7 q' V2 W
; ?; c2 N3 ]( a* g6 f) B- dma_addr_t dmaphyssrc1 = 0;: R+ n" a, S2 b; x2 x! K
- dma_addr_t dmaphyssrc2 = 0;; z6 S# X, K5 p/ \5 X
- dma_addr_t dmaphysdest1 = 0;6 S* j h2 t+ l
- dma_addr_t dmaphysdest2 = 0;
* K) u6 i- i; K& b& F - ( Q0 D3 W9 g! S3 k" e z
- char *dmabufsrc1 = NULL;/ i$ P( U' H0 S7 a2 @& d
- char *dmabufsrc2 = NULL;% B$ u4 V5 U( ^* @
- char *dmabufdest1 = NULL;/ }& \+ U' E R( Q& s
- char *dmabufdest2 = NULL;" `" ~8 N+ W" w( @5 p% a1 c
- 9 d- d$ n$ h% h
- static int acnt = 512;
! {. z0 _" {7 r5 y - static int bcnt = 8;5 i+ G8 x5 `1 ^8 }5 R
- static int ccnt = 8;
, p4 T" e9 I7 P
3 E/ \: l: [. p( U- module_param(acnt, int, S_IRUGO);5 R& O$ C0 p; B5 }, W' d2 n3 s
- module_param(bcnt, int, S_IRUGO);* O; m( K* y) u: m% V$ {1 s
- module_param(ccnt, int, S_IRUGO);
复制代码
% T) k+ `5 L, x4 ]! X* ^: [! Q$ V2 t+ `' l r: X% b! N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 |5 L5 n2 s3 U Y9 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ a8 R3 a v- U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# Z" w7 v5 r: @7 a( f9 h+ D T: C" t5 S; G9 ]( Q
& d& {5 \6 R) ~: l
|
|