|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! c$ _% O8 J; i* c; ^: ]! n5 C- [code]EDMA sample test application& F1 ]) d8 W R: w$ L3 Z& J' `
- /*- `5 K: z$ O5 T. B0 n. f4 o
- * edma_test.c
8 O- P3 O S# {/ n% ^9 L& R, i - *' K0 `4 d* M& f: `4 O/ @8 A5 d
- * brief EDMA3 Test Application
6 E) g4 ^: Y+ v z: r5 n - *( K$ `! n% ?$ Y* N, n7 e
- * This file contains EDMA3 Test code.
' c+ p9 D9 s9 j - *0 n' \" I1 d5 x( m. @0 U' h* X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- m2 B9 L# p; n. ?7 m+ X' h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& R! ^3 j* E0 e - * TO CHANGE.) g; M" J; v+ Z8 h; u7 q( Y1 [5 F6 @. b
- ** ?. \7 Q2 `6 f% u& O" C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; {( g- s: o+ W - *
7 ~" l8 f4 G* j8 Y- F# ]2 I" ] - * This program is free software; you can redistribute it and/or
5 Y* Q) k4 o0 T) P1 x+ ^; i0 | - * modify it under the terms of the GNU General Public License as# @% Q% A) c, U. u1 X5 n% |; ?$ s3 e
- * published by the Free Software Foundation version 2.3 R2 r8 y6 G( K, X- [: \, D5 |0 p0 w \
- *1 m V! C* d) Q, R! d$ Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) d3 u0 w# f+ x: f! [
- * kind, whether express or implied; without even the implied warranty+ |7 q* A+ G4 e0 f9 E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* d0 x# H7 n1 _9 Y - * GNU General Public License for more details.
6 Y2 I3 |/ _9 ^3 n, k - */
' {& X$ K3 G5 ? I" u5 e( B) R7 x - ' r) t# |1 e8 `4 f. i- x" \
- #include <linux/module.h>
9 k8 M$ R8 p( o' `' Q/ ^ - #include <linux/init.h>
& _. g+ e/ m3 r' L# Z5 @ - #include <linux/errno.h>
) ]2 j: Q2 h. e# H( ? - #include <linux/types.h>
- I5 M& l0 y1 a) U8 ?3 F - #include <linux/interrupt.h>( R! x; u- T, p& U& O
- #include <asm/io.h>5 M- `5 x+ ~9 i7 i
- #include <linux/moduleparam.h>5 ~) B' `8 G0 L* j0 n2 f a0 r
- #include <linux/sysctl.h>
3 L" t# G% e l# j. f) e; a - #include <linux/mm.h>
. ]) l3 p5 c$ `; S0 F - #include <linux/dma-mapping.h>
; B+ l1 l$ u0 D9 K2 M' k! ~: |
- l" O2 q, Y& k% f; T2 w- #include <mach/memory.h>
6 n, b5 _8 d1 v# E6 l; N& t - #include <mach/hardware.h>
! s h( ]4 Q2 J - #include <mach/irqs.h>
1 Y% {+ k% \+ m - #include <asm/hardware/edma.h>
1 C% u; w# [3 b, i - $ r5 x9 X- p. g, T& H
- #undef EDMA3_DEBUG
( S! R4 Z$ c- \- J/ `. ?$ u9 K - /*#define EDMA3_DEBUG*/: H8 Z2 y* i0 J
- 7 k' _2 ]% o' l0 @1 D
- #ifdef EDMA3_DEBUG
% Y; U$ m5 i2 [8 E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& U* ~. s1 S7 p- g% L) Y: L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- Q- N5 v$ ~+ `1 z# |: z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; s5 y7 d9 f" U4 J' H: w - #else
6 {/ e: k1 X* l; ~ - #define DMA_PRINTK( x... ) R, f" T2 _# Z8 O
- #define DMA_FN_IN
: _. r' S# z# Z4 r - #define DMA_FN_OUT
( t9 ?6 T+ R y: y( ] - #endif
% A/ w3 m+ u# `: n0 K4 n! y
$ Q3 h5 k, N) v2 ~2 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 l/ y/ U8 d( Q; B - #define STATIC_SHIFT 3
5 d. q4 e* N, V/ V/ s- e* p - #define TCINTEN_SHIFT 20
. @, }( ] ?0 S - #define ITCINTEN_SHIFT 21# g1 V* h3 [ E$ Q9 i
- #define TCCHEN_SHIFT 22$ k/ c$ I2 i: D; F
- #define ITCCHEN_SHIFT 23
+ R' [9 }9 A6 Q
" ^! u" e0 v$ O, v& o- static volatile int irqraised1 = 0;0 q( `; e0 b4 Y, e7 b4 S! G/ \' f
- static volatile int irqraised2 = 0;
9 T& ?1 v* Q: a; ] - " n" q8 Q* y7 \/ c; T; L. h, B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 a* `' ]* h. W0 g) P0 r4 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: A G+ A3 }, x$ {3 j+ i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! R9 C+ h: w& j* T i3 |5 A
- W& V# ^0 W- b( \- dma_addr_t dmaphyssrc1 = 0;$ s3 t" ?9 O; }5 a2 R B9 H
- dma_addr_t dmaphyssrc2 = 0;
1 e) \2 F6 \9 R* u6 M- b [ - dma_addr_t dmaphysdest1 = 0; x/ U, O5 o* y* l- H5 z. {
- dma_addr_t dmaphysdest2 = 0;* m* E7 P- @% [8 W: W# U+ g
- ( w: s# q. V$ u
- char *dmabufsrc1 = NULL;; B( \; ^6 p# N# l# |# F
- char *dmabufsrc2 = NULL;
8 N- N' k, y- A& X - char *dmabufdest1 = NULL;
% e1 e3 M- w' U( A8 G$ U - char *dmabufdest2 = NULL;
0 P( @5 F: Z$ ~ - ! r& n) c1 k8 Y [& m
- static int acnt = 512;
4 n N3 k6 l; w# y. v4 L# ]+ Q - static int bcnt = 8;
" S! ~) x- r1 Q+ h4 ~ t - static int ccnt = 8;; ~% p# e: C; q2 G% w
* \$ _; j1 v& N, H5 T% P* b, s- module_param(acnt, int, S_IRUGO);
- \( ]8 b$ ]9 e - module_param(bcnt, int, S_IRUGO);! U1 V8 a1 ~' X' g, T. J' O
- module_param(ccnt, int, S_IRUGO);
复制代码 " U% n; k' [9 M1 j9 t
3 K6 V2 x/ t" O% d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 w% M. s: k) L: r- Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 O) [& C" m( V. _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 ^3 C- d8 B2 V5 n1 `
3 ?* l( Z* s1 v& o8 r5 I; ~7 a4 k/ w
|
|