|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: Y `0 R/ K8 Q5 q& c9 I# a/ z- [code]EDMA sample test application
4 |8 N& A' A$ u9 ]4 `# A+ t D - /*5 z$ i% R! Y$ L
- * edma_test.c
2 e# I7 w" H# j$ q: O - *4 s3 J% D3 I" P7 Q3 }6 K- |
- * brief EDMA3 Test Application
0 w7 Y" K7 h' C2 V - * |$ |6 d; i/ H& c5 S+ M* V, @2 e
- * This file contains EDMA3 Test code.
2 n7 y; s# b Y. |' ~: n5 r - *" R H- `2 U p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( v0 q- `' c6 V! y5 e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, e& B0 c C: N7 G/ f6 |/ |
- * TO CHANGE.
! B) R4 K" P' N1 O2 N0 t - *# |( c" |- }3 I( I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# a+ D* }( w# x* u/ M, L$ v E
- ** v% J0 l ^, ^
- * This program is free software; you can redistribute it and/or
4 Z# Q" T# t. V1 g$ W - * modify it under the terms of the GNU General Public License as; ]$ w8 y6 n' K* Z E
- * published by the Free Software Foundation version 2.# O) d7 J: ~1 Z+ ?$ `4 a
- *
) y" I8 k+ N- l, U- n3 G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ i1 u" n5 B9 n- R4 o - * kind, whether express or implied; without even the implied warranty
5 T1 s+ f. C& u4 E6 n( R$ k) G! c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& l% M* w% K" @& r! h
- * GNU General Public License for more details.
( [3 @9 q) ~ q3 R R1 w4 `' ` - */
. Z: G' |- e4 X6 V0 B& h
3 [4 N+ y$ f3 c( a8 H- #include <linux/module.h>* Y3 Z0 s" y6 t, j f, y) L
- #include <linux/init.h>
* S2 e# e( @3 U' a+ m) T b/ B - #include <linux/errno.h>
, ]' _/ G; _! y: h6 I - #include <linux/types.h>
3 _' }7 p h; \* J+ u3 b - #include <linux/interrupt.h> T' z1 z4 U$ Z/ p
- #include <asm/io.h>! [4 V) p) `5 h, \& x& t
- #include <linux/moduleparam.h>* Q. s* q" Y5 Q1 _' U
- #include <linux/sysctl.h># w4 t/ B/ o% c: a: e2 j/ o
- #include <linux/mm.h>& @6 c* R e( ?6 @5 @
- #include <linux/dma-mapping.h>
! O. \( [$ D3 d
) \; A. K, @, P3 a- #include <mach/memory.h>+ t* M/ E$ l# L5 [
- #include <mach/hardware.h>
/ ]" ]3 I) D, s. _# G: R% @ - #include <mach/irqs.h>
4 y" q7 F( O& W* m8 E3 r - #include <asm/hardware/edma.h>
c: \3 v* n3 Q) d& k
- H% s" v' |; g- #undef EDMA3_DEBUG
( J& `3 K4 c% N e - /*#define EDMA3_DEBUG*/
# g# \% x/ l* n' `8 ^0 H
( q+ H8 J# E# x* `6 s- #ifdef EDMA3_DEBUG
- z0 x& {3 N/ n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 _' l# q% t- t& P; i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 e9 E0 n* k* z: a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' L3 C/ N, ~' U3 f0 U - #else
f2 D* ?4 B1 V- j+ v6 P/ D6 f - #define DMA_PRINTK( x... )8 i8 }( e% Q, E$ R0 k' j y) a% ~
- #define DMA_FN_IN
9 |# |* W# T2 C0 d7 L - #define DMA_FN_OUT
6 y8 D. o! W' |+ k - #endif3 T0 I1 J( R# M' W4 x% x5 ~
- # c, W8 V1 A1 U+ A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; G5 `6 z! J& h1 g - #define STATIC_SHIFT 3
$ ~) O5 N8 l5 _9 x/ E1 l - #define TCINTEN_SHIFT 20
, H$ ^! P, M. g) k+ J6 Y- \ - #define ITCINTEN_SHIFT 21
1 D$ P7 G: w! R! ]+ C - #define TCCHEN_SHIFT 229 J4 t( x( L9 t* p' ?, x8 m
- #define ITCCHEN_SHIFT 23
8 N. \1 Z0 V$ l - + ~2 t+ @' D0 \0 B q" a
- static volatile int irqraised1 = 0;7 i4 w I) E6 ?6 z; w5 j8 ~
- static volatile int irqraised2 = 0;
% Y4 Z- k3 Y! {6 W. o - 0 L7 J0 r+ g$ k, h! N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ i: G2 n0 A; W3 {+ J8 U9 r, f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
n. r7 y" L! b+ e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ h: O9 T$ C) r, { - " D8 k0 F' t0 c
- dma_addr_t dmaphyssrc1 = 0;2 j* x2 }: K) m7 n p
- dma_addr_t dmaphyssrc2 = 0;- T' x u( A! t6 J
- dma_addr_t dmaphysdest1 = 0;. k$ v5 \. N( I4 Z% H1 X( q
- dma_addr_t dmaphysdest2 = 0;, K( c5 K8 r; Z& m# j+ C: G+ E
- 3 i/ ~$ r+ a# @( ?
- char *dmabufsrc1 = NULL;- U0 S5 j1 Z4 F, @& u0 M
- char *dmabufsrc2 = NULL;1 u& x+ z% M) d F- t
- char *dmabufdest1 = NULL;5 v2 m2 ^" d. U3 l& }
- char *dmabufdest2 = NULL;/ x) k) ]) X6 K: `2 u* r4 F" {, ^/ {
1 S# j& o) Z o% X1 p& B- static int acnt = 512;
K, R5 h5 C" M* ~# M: D# Q, ` - static int bcnt = 8;
2 c5 P0 \; X1 Q6 w- [ - static int ccnt = 8;
+ g; p- u; _5 D - & `- ]; S' V% O/ D: k/ q- i, X( }
- module_param(acnt, int, S_IRUGO);. S3 A; m0 g. S4 ]% g
- module_param(bcnt, int, S_IRUGO);
% d* M6 l+ E2 i x6 C7 v - module_param(ccnt, int, S_IRUGO);
复制代码
7 N$ h* v) n. n% v7 K- E% `
+ ]" J' [, I: y' p. i& |0 W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) Z$ y: Y7 y& w8 C- H4 w- Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% t4 b# p% n: v# a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 c$ h3 y. v( q, E o( ~) b; \8 n
3 V+ D, T# I8 C' Z& {7 A9 ], @. Z( _* V. g& r% w5 i6 I# @( s
|
|