|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - Z* ]4 W2 @& s. L x N/ O# K! Y
- [code]EDMA sample test application
! V* | h0 D7 H* f - /*
0 ^' u3 s9 h% E+ M( [ - * edma_test.c9 m( z1 U2 y: w3 A! e; K2 c
- *, D- k& g8 N, l/ A% d+ ^4 j/ [, m
- * brief EDMA3 Test Application* b9 W: Y( C6 c+ D7 a
- *
# B' L$ z$ J- c, t - * This file contains EDMA3 Test code.- T& v% v' l% ]' V5 f" _* P/ Z
- *
! v5 T/ F. e$ i5 j( ^/ { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& G+ g8 {3 M" E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, ^0 [+ U3 W T1 j
- * TO CHANGE.$ u! s; n5 x3 X: ^, h
- *( R% `1 r$ ^0 A$ [/ y g' h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! j* Q+ G6 ?- {, ]( H - *- G7 r* n; O. d! ?; t! c: k" t9 C
- * This program is free software; you can redistribute it and/or& A) n- e4 ]1 F; w* u2 C6 A# Y
- * modify it under the terms of the GNU General Public License as
! ^% S k" \( }; B- [1 E9 `+ m - * published by the Free Software Foundation version 2." J: i) a. C7 _+ M
- *
& T9 P3 d% y: D5 P+ Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 ?# `/ K3 K% B
- * kind, whether express or implied; without even the implied warranty
" { j( v4 I8 |9 v% f- Y1 w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 r) d$ A" N* S( [) ? - * GNU General Public License for more details.
1 W b& a' l$ u2 P5 U) r - */
0 r7 o4 m/ y/ s3 ^) M
0 T0 t4 W2 P4 O5 H, e- A- F- #include <linux/module.h>
! E1 v! E2 L$ C - #include <linux/init.h>
* A4 G8 r: G+ }$ f6 A3 [ - #include <linux/errno.h>( c& G' N5 o9 ?4 o
- #include <linux/types.h>
" w! J9 C a, w: R& S; x - #include <linux/interrupt.h># v* F: Q# r% z2 U6 b3 e4 N
- #include <asm/io.h>
$ e- X8 Q3 J; T: v' C - #include <linux/moduleparam.h>4 F' Z) Q) ]& k& R" R C. ~, z
- #include <linux/sysctl.h>
" y- `4 J0 m b) b: i - #include <linux/mm.h> h: w* z8 v/ ~* [3 i6 t
- #include <linux/dma-mapping.h>
7 V; a4 ? ~. y; c) E: |
) k( S Z. T* G! ~- #include <mach/memory.h>
* |2 J8 t5 C2 O. [ - #include <mach/hardware.h>1 X' C$ W2 R' x9 O/ |! s
- #include <mach/irqs.h> E$ a' U. }0 s2 A# d/ N
- #include <asm/hardware/edma.h>% q, u$ k* _5 X$ J
- 9 f9 W' n3 e3 S0 V
- #undef EDMA3_DEBUG
; `1 _/ U+ b7 `6 k5 A$ K - /*#define EDMA3_DEBUG*/4 G& f% c, U: A! S; ?
- - J! }2 e3 m- R: l3 H
- #ifdef EDMA3_DEBUG5 V/ Y( B) i' B2 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" f6 P3 \! L+ C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 _* ?% `3 V3 C9 K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& n1 E `2 U8 G4 v
- #else9 v& f" b- h8 o! H T% X
- #define DMA_PRINTK( x... )
- `, ~. I6 @1 ]% q - #define DMA_FN_IN! D6 ~- v0 a, A1 n
- #define DMA_FN_OUT! ^# @, k! C7 D) Z
- #endif
0 [9 ~5 Y: ~/ k( _0 b/ J) H - " H) A9 }: T1 ]0 a& j7 E0 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ W3 E# ]8 M* S, c+ M- Q; U$ p
- #define STATIC_SHIFT 35 J) k- u3 B- t/ y9 Y, U
- #define TCINTEN_SHIFT 20" N7 ~4 S7 ]/ Y) s/ s3 v# {
- #define ITCINTEN_SHIFT 21
& n, b' M: E4 g - #define TCCHEN_SHIFT 22
; d6 P. P5 p, e7 F - #define ITCCHEN_SHIFT 23
" o( x+ K" M( }) d' d0 z. l$ R( @ - 2 @! P7 c+ @( M% e( m/ d: j& ~
- static volatile int irqraised1 = 0;" W9 w2 V3 m8 h; j; H
- static volatile int irqraised2 = 0;( a9 e5 O5 A/ {% J5 y4 v
" _6 P, u7 r. C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% |: u8 Y! ^' h) T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 o) m+ n/ v1 D5 Q6 R2 I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g q! n3 o4 F$ U5 Z$ u. f& t9 N
- * S3 [9 _' h7 U! r; I! W
- dma_addr_t dmaphyssrc1 = 0;
1 F1 W# u* c+ K) W8 R! O - dma_addr_t dmaphyssrc2 = 0;: c; g3 i* ], {" {9 W! o8 a4 C2 z, y
- dma_addr_t dmaphysdest1 = 0;
! |9 l, c! s) E" w& t) X - dma_addr_t dmaphysdest2 = 0;
8 W; N, {8 Y4 V$ ~' o" ?; ? k& _
^+ A( {/ l/ O! |* z' W- char *dmabufsrc1 = NULL;
f' ^( B. x, ?3 Y - char *dmabufsrc2 = NULL;& F& F$ t2 n2 g
- char *dmabufdest1 = NULL;
# w8 K; m4 _5 [3 v7 q - char *dmabufdest2 = NULL;
2 h- Z% D0 G: J9 w& G1 e- o
4 ^2 c5 D9 I) f- static int acnt = 512;
/ j4 H( h& J0 S+ H' x' q5 W w2 m - static int bcnt = 8;& r4 q7 t5 m4 L: q
- static int ccnt = 8;
1 U0 E6 S, Y: |; s+ f, x - 5 O$ S H0 Z2 \
- module_param(acnt, int, S_IRUGO);9 G4 E( u. v' v' _$ K: F0 h$ I S
- module_param(bcnt, int, S_IRUGO);
4 j- C! ?; r7 ] - module_param(ccnt, int, S_IRUGO);
复制代码
# e9 Z8 C3 l4 Q* H+ ? r) R! s9 Z/ k2 X" S+ Q! u' t% d5 M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ C3 F' Y# [/ u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 i" E9 o3 k" h9 Y* J: L9 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- X% B* D @8 p* [. l& l3 {
& j' a, x' z9 o) e
# y) ?4 p2 v) M2 o% g |
|