|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ B+ v+ {" D9 u: [% M1 K6 |- [code]EDMA sample test application- L, y. ^2 V0 ~- `6 ~8 d6 Z) N
- /*
2 Q) x- ^: ~( E/ G0 o, m( n* W8 x - * edma_test.c
! p9 l$ \% y5 a+ m- n% U1 U" u; c - *
4 g, y4 o- J/ A: i$ m- I5 M - * brief EDMA3 Test Application9 j( H& F O3 ]# ^9 R
- *
- Y( r! X$ n6 q+ ?5 Q - * This file contains EDMA3 Test code.: P5 P: n% Y2 c0 m
- *
" T, Z, i! W* x, t5 v ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; u, a/ f/ O5 \* k% X" M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 }+ T" w' B7 S0 s: T3 r% Y! v - * TO CHANGE./ V( I k8 T. \. }+ g' A# |! c
- *
: ]1 _3 W( i6 D6 @& \$ ^0 Z, q' m( L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ A0 }% D2 |% y - *
{& R" `6 _3 \1 m' x& O - * This program is free software; you can redistribute it and/or
# J# f; v9 t4 k: c - * modify it under the terms of the GNU General Public License as
. |& m7 Q' M2 N7 W6 s/ X - * published by the Free Software Foundation version 2.4 x' ]$ Z! ^4 A# o P9 E
- *& X8 h( l: w* |5 n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ |9 Y* N7 k7 y7 a: p1 c% s
- * kind, whether express or implied; without even the implied warranty
) U( B* K: ]: E2 ^; b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- H2 ^/ T* h- b1 w
- * GNU General Public License for more details./ V; w5 x; [; u9 }5 p0 A2 H: M: W
- */2 o0 l* j' a7 x- o% z
- / b+ Y+ Z! c5 _# W P' F! K" R
- #include <linux/module.h>
7 \; {* n: K3 y - #include <linux/init.h>
0 ~/ G9 N* p) a5 T - #include <linux/errno.h>
" V1 o% P, W- n* d M - #include <linux/types.h>
# }" m. p; D5 p, U. j7 x: }8 d1 H - #include <linux/interrupt.h>+ {: z& x1 I2 d( Z0 E, J4 ^1 r! {
- #include <asm/io.h>: _. Q7 ^ O) E. m% ?
- #include <linux/moduleparam.h>
/ d* n5 z1 _2 M# T ~) j/ M - #include <linux/sysctl.h>
2 t. _" r# J i$ {* G - #include <linux/mm.h>% _+ |0 I. T& s- }
- #include <linux/dma-mapping.h>
+ e% U( g' h% W( i, j4 @: v - 7 ~# E9 Y+ i* U. Q
- #include <mach/memory.h>
1 [) S( e- t7 l$ K( Q. J - #include <mach/hardware.h>
6 Q0 ?3 q# o2 {, t - #include <mach/irqs.h>+ Y- `- U( y; B; F1 }: z
- #include <asm/hardware/edma.h>! c) n1 c: C" l4 h, O+ x# ?1 B
6 V- A- O$ C; N) v5 G- #undef EDMA3_DEBUG
: U3 A; f2 Y3 ]& I j8 N; x - /*#define EDMA3_DEBUG*/0 ?! l0 ~3 m5 ~: {
3 p5 j7 z ]. H% K4 }0 K4 ` ?! p- #ifdef EDMA3_DEBUG( t) X7 d3 K/ [$ k& _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% _1 l2 l! r$ h5 T, K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 w6 N$ c9 w9 J8 I+ j+ O# A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 G5 L ^2 ^- M4 ~8 Z - #else
5 x0 i7 F; `6 u7 o Y) t* w6 I - #define DMA_PRINTK( x... ). U* }0 u$ x8 M1 I- u/ ? t9 I
- #define DMA_FN_IN
5 F* |. e4 `3 x! ]% ~/ _ - #define DMA_FN_OUT
( _8 f% l5 q0 i6 D+ U9 v - #endif
2 M8 d/ l* v+ L4 b - 1 s. T. m8 K: V. b/ J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! J6 w7 {( G4 r5 \5 O+ }. F3 q+ @ - #define STATIC_SHIFT 3
0 \' K( U2 J. g$ u' _0 X' m - #define TCINTEN_SHIFT 20
5 i' V1 s J% x) A9 W - #define ITCINTEN_SHIFT 21& |6 p [: u: ~; a: w* l2 C' E1 e
- #define TCCHEN_SHIFT 22
. _ E$ i- b& f2 e - #define ITCCHEN_SHIFT 23
; s' o1 B1 }8 v) g5 h - & A# I7 Y5 W- k8 w) n' a* [1 J
- static volatile int irqraised1 = 0;
d/ O8 N+ ^/ N0 x5 v1 s* g - static volatile int irqraised2 = 0;
2 Z- s: Y/ |4 C( E2 H" P' F - 9 j( j0 d; r) G, r0 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 A2 A+ V5 S* p" W, E9 Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* k( M8 m, L6 N; B5 B4 E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( Y" G! f! r0 }1 w y( G
4 K( b7 |! T9 T4 \4 h( b2 p, u' r0 E; c7 W- dma_addr_t dmaphyssrc1 = 0;2 D# T" N1 t0 f" u4 h9 ^
- dma_addr_t dmaphyssrc2 = 0;4 Q, V: b' }' c
- dma_addr_t dmaphysdest1 = 0;- _ E6 ]/ R, C2 A& \' |
- dma_addr_t dmaphysdest2 = 0;
; {9 w) Q" `+ m9 k, V - # f; F: n) y& l# r) Q
- char *dmabufsrc1 = NULL;9 l; K- D: }) I7 W4 r
- char *dmabufsrc2 = NULL;0 R2 E" [) N, v: G. Y- |! S$ k4 R, F
- char *dmabufdest1 = NULL;: b0 u8 W" d0 B/ I% f+ Z* G
- char *dmabufdest2 = NULL;% A v3 s3 ^3 K- k+ ~9 L3 [
# o6 V& i2 z- t8 O% b- static int acnt = 512;
4 Q% R0 W- c j4 k - static int bcnt = 8;
; H) P2 f7 }* i2 \ - static int ccnt = 8;
' c' l: O8 X- G5 M - 7 G% R; c; o) O) q) u! ^
- module_param(acnt, int, S_IRUGO);5 l+ V3 V0 P8 M$ F; G
- module_param(bcnt, int, S_IRUGO);
* u$ V# E2 Z6 E N- ]% R' }: |( o - module_param(ccnt, int, S_IRUGO);
复制代码
. s* v5 p; U; M8 T( j6 I: [& C
% N) m- t2 I9 d: x$ b9 R6 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& F' J" \ \/ D9 `& I4 `/ i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 A! o) X( O+ z! h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ B0 r) U4 y, o- J
( i# e6 G" d0 s3 M
9 H, [& `& a* h4 |+ e6 S |
|