|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 K% i# c; b" C% ~
- [code]EDMA sample test application
5 [4 N" d9 V0 L8 @/ q - /*
- R/ n4 I8 T* Q6 ~' l - * edma_test.c
! \6 B0 b7 w T+ T# w% `3 s0 } - *
9 `& X- f2 G" a+ @: A2 e" X - * brief EDMA3 Test Application5 ~! G0 J' g; |
- *7 E- `5 l/ z: k' P
- * This file contains EDMA3 Test code.7 x1 S) p' O, Q7 l: H/ i
- *
% L* _0 y, D7 _/ I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! c, g7 w+ E' A9 p3 @3 s9 _1 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 B; c0 \ y! | - * TO CHANGE.
4 v8 u. B5 s% V - *0 u; Q! x" v9 c, z$ X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# |0 e% p# d: f' h# G - ** `7 }( d& g5 q
- * This program is free software; you can redistribute it and/or
. ]0 C0 \2 z! N. a [ D6 _3 l3 W6 ] - * modify it under the terms of the GNU General Public License as
- B6 f3 }0 V9 A7 ~& y' t - * published by the Free Software Foundation version 2.% T7 b# M) F% @+ W5 Z' i6 W- `
- *
! n; f7 N4 B" w; Z8 i3 g0 ~3 V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, z" m; b4 v: J, z - * kind, whether express or implied; without even the implied warranty* a+ v4 A+ d2 |- e% N0 U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' W! I8 d- [ B+ L' n, e9 S- {
- * GNU General Public License for more details.4 W F) [; J5 a& `. d/ o/ |9 F
- */
7 X! W% H, ?6 D
. ?9 n3 f* q# {: ^- #include <linux/module.h>. x, B, A' G7 W
- #include <linux/init.h>4 |* B$ V( X) @& h
- #include <linux/errno.h>
2 ^7 |" a& g( a4 k - #include <linux/types.h>
3 U: u: z6 ^0 t5 H - #include <linux/interrupt.h>
u# o8 H- I8 e9 \ o) U - #include <asm/io.h>
% S$ \5 Q$ ^% O" l; u* R. X b - #include <linux/moduleparam.h>
4 U+ L6 u8 K' Z% R - #include <linux/sysctl.h># `1 u( p y u3 E ^( ~
- #include <linux/mm.h>& j( _$ Y0 W- P8 t/ b4 ~
- #include <linux/dma-mapping.h>+ M% j: I) H( h4 k. z
$ K3 y3 Z$ m' d+ o% a6 {- #include <mach/memory.h>1 k0 v1 \9 k& P6 w$ x5 C; n$ }
- #include <mach/hardware.h>$ ]/ T) V D5 V* p; b5 x o
- #include <mach/irqs.h>
1 }4 Y0 l4 f! l6 a1 K5 H+ f7 E - #include <asm/hardware/edma.h>
+ H j5 \' _- e+ A6 m& q4 m7 `: o5 `3 H
; j9 P6 W/ U- Q' \1 }, q7 x- #undef EDMA3_DEBUG
9 T% p. _3 V3 U5 t - /*#define EDMA3_DEBUG*/8 \$ A0 O9 e% M, k5 W6 ~7 Y
- $ D. I4 \# D( Z9 {6 O2 V
- #ifdef EDMA3_DEBUG
$ W, L3 G) q2 b& i6 q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 W5 t* |: K# {/ F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' R* u% a F9 M* h, m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 o9 k E0 t4 h
- #else
: K4 W D- L ~' H2 ]5 f! d& |/ E - #define DMA_PRINTK( x... ), O* p: ^ F9 K% @' ^" Q: k, [
- #define DMA_FN_IN
) X+ p, T9 Z6 k/ T - #define DMA_FN_OUT
7 u/ _7 m: S0 g8 R - #endif$ M J& E4 v; B6 [
- % f% K+ o1 }! k/ M( Z( c2 s5 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 a$ e: Y& V2 K4 q' t# a5 N - #define STATIC_SHIFT 3+ [1 T# M2 A2 @8 }/ M1 A- d
- #define TCINTEN_SHIFT 20
* ^- J# _( Y6 A3 t! j1 g - #define ITCINTEN_SHIFT 21$ b8 j. ?1 I; d4 G t
- #define TCCHEN_SHIFT 22( G, t6 a d) F# L0 E
- #define ITCCHEN_SHIFT 23, D% J5 `" B6 Q7 d/ i: ?: D3 f
- 2 G1 K V: i7 N# }: n; D
- static volatile int irqraised1 = 0;
7 e2 \( F1 ~( U, v+ l - static volatile int irqraised2 = 0;) l8 v4 q/ g( K6 ~ t0 o
- 5 @* P3 @, j( T1 B ^0 \" l3 w. E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* y$ ?) {* {& o& A# X6 _$ n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" x k+ q m2 A: n& r; h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% @% y- j5 _4 B9 t/ j: X
; I" F- l- x p) V! I% p- dma_addr_t dmaphyssrc1 = 0;) k4 L" Q. G& J% k, Y
- dma_addr_t dmaphyssrc2 = 0;
# p8 b/ Q' t5 b) W - dma_addr_t dmaphysdest1 = 0;
4 v* y( Y2 v2 U) E' V - dma_addr_t dmaphysdest2 = 0;4 f* |+ m9 a, t) m1 c4 Z! e4 I8 O
: q% S, A. c! D; n( Y- char *dmabufsrc1 = NULL;
& X- r7 P) x2 H1 V; K" E - char *dmabufsrc2 = NULL;
( f- }$ y1 T. y" p0 X - char *dmabufdest1 = NULL;
G: ~* p! v/ y w - char *dmabufdest2 = NULL;# P& ~8 _' I" F! ]; z% l j
: G& R( S8 A" r0 U- static int acnt = 512;
7 z# M: J x3 w/ v - static int bcnt = 8;; y# @/ {4 `- l# c
- static int ccnt = 8;
9 {" s! q9 ~- R - ; x: @" L/ p' [3 g: s5 i
- module_param(acnt, int, S_IRUGO);
- ]4 ?9 {; G( d3 @! N+ a - module_param(bcnt, int, S_IRUGO);
+ s8 `3 u* a0 k( R5 e' K {% D$ K - module_param(ccnt, int, S_IRUGO);
复制代码
5 m8 b, p# f5 S4 E1 [
/ B3 {$ v& o! a7 v4 A$ T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) s" R* p% W( g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ?# `% Z& h i% |$ U+ N" k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 U$ j, I* j4 ~ L, Z& T( |6 |
8 P8 d, X7 b- t5 ?$ j0 \8 x
5 s1 B, s* Y- Y, n# G6 y |
|