|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* \- H1 |; i9 O/ `% b- [code]EDMA sample test application' l' V) c' n2 ^% i$ E
- /*& Z H: v3 ]% g
- * edma_test.c
1 l! ~: J8 t6 Y) j, } - *, N0 f# k5 f( n& |/ u# U
- * brief EDMA3 Test Application
. l5 H; Z5 X/ g. M% ~ - *5 _9 P2 C2 a+ [# k) m
- * This file contains EDMA3 Test code.
# D5 q; T: ?7 _7 [2 ~ - *
/ O& l% v$ _$ c# u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 \; d! R) w9 w0 |& T! ]6 Y9 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% m. l- I1 G4 r) F' Y$ _ - * TO CHANGE.% `' {. [, K6 w/ P7 ]0 |
- *
: ?9 |9 G, B. d2 f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) ~! ]) m0 X, ?/ p# G5 G8 a: n - *! L. o2 W' L/ \- h5 V
- * This program is free software; you can redistribute it and/or
) i8 l& I9 O. C6 g6 i; g" ~ - * modify it under the terms of the GNU General Public License as5 j! _ l& Y0 e$ |2 g
- * published by the Free Software Foundation version 2./ }% U$ o b7 [
- *# B& y& \7 r, x+ ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! O) q4 C3 G& z0 R7 [ - * kind, whether express or implied; without even the implied warranty: ^, N- a- ~1 l+ `- O9 h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 t% W v9 _" H7 F
- * GNU General Public License for more details.: M6 ^, ]3 z: {
- */
' N5 J5 d5 u/ @3 d* R
/ j0 k# p Y& p" v( V _4 r: A- #include <linux/module.h>
1 ~' P" B/ ~6 T - #include <linux/init.h>
7 T- G) A( K9 o( X5 L: L+ a- Q - #include <linux/errno.h>/ E! ^' k$ W& K- l
- #include <linux/types.h>
0 b3 w9 c6 R* g0 W( D - #include <linux/interrupt.h>/ V3 J7 l3 v- w) o- \; f/ Z
- #include <asm/io.h>0 G; v% W8 G9 U
- #include <linux/moduleparam.h>, M6 z8 v+ B' b1 t$ J& M' F, x
- #include <linux/sysctl.h>- M4 B, |# o( R1 v, e% h) t
- #include <linux/mm.h>
, A3 X& C( j0 m) a! \2 n* a& z - #include <linux/dma-mapping.h>
* o) P0 u3 C# Q8 i8 V: g4 m
3 _8 u E# Q- M2 a- #include <mach/memory.h>3 G5 l; y9 i2 {; X W% u+ i# O0 a
- #include <mach/hardware.h>
+ y! H+ I. V7 a/ y, N: g" F - #include <mach/irqs.h>
; q' Q3 d# l0 o d" V# X2 E: ] - #include <asm/hardware/edma.h>. D6 @! U" F E1 [8 D# x" `$ y5 p
- * I7 [3 b5 f. |" }* n: D8 L1 c
- #undef EDMA3_DEBUG
7 d ~+ b6 s; X9 S$ p( j' l$ D - /*#define EDMA3_DEBUG*/
, v- E! I9 P: j" Y; w
% m/ C* \- e! m$ [( Q- #ifdef EDMA3_DEBUG
5 R2 t" q S; q8 P* X& U1 G# ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ B1 b% G" ?3 Y z4 o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" P6 b% Z9 o1 Q3 C3 @- c) `9 ~! G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 t* m, Z' T. K" T& p+ u8 z5 @6 g
- #else9 c( Q. [4 h* p/ q
- #define DMA_PRINTK( x... )
1 T% k# N0 X8 o2 z# r - #define DMA_FN_IN4 U# g2 s4 ^) E9 V/ I: ^
- #define DMA_FN_OUT4 A2 R# }- p5 t4 [
- #endif
6 m, ]% h5 f, p3 J0 D2 a; c: A
5 A6 n& T% r2 ~. e5 r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; G: S8 r) A' h8 j - #define STATIC_SHIFT 39 y' g/ v5 _$ Q2 `
- #define TCINTEN_SHIFT 20
3 Q6 g( V0 |$ B$ | - #define ITCINTEN_SHIFT 21
( A; X6 E8 A; E0 N- p8 n8 R - #define TCCHEN_SHIFT 22
7 H0 q; L6 x( s, @5 ~7 \ - #define ITCCHEN_SHIFT 23( z, C6 O. C0 q% \2 z
- + J- q2 @/ n1 B( S
- static volatile int irqraised1 = 0;
$ ]3 C) w: g5 q - static volatile int irqraised2 = 0;
9 k9 s% P" V+ b$ j
: W- P$ Q# o3 z' t, e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, F) _0 a& G C' Y$ w8 K- A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! S: [' Y+ M1 Z; a% I% R7 Z' U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 B& _/ w6 c3 }# v5 _6 @
" k9 | A' t& G4 V- dma_addr_t dmaphyssrc1 = 0;2 t1 f. k7 O6 k- m+ @8 p- A
- dma_addr_t dmaphyssrc2 = 0;% b% g2 D2 Z# K- G. J+ D+ _
- dma_addr_t dmaphysdest1 = 0;: l2 v/ j* W- F" C% }
- dma_addr_t dmaphysdest2 = 0;
K1 @. |$ G9 w, F# H! r( A
1 O; {3 S% G& `3 g' t4 g- char *dmabufsrc1 = NULL;
( J, \6 E6 T# U+ J q7 T! X0 D2 M - char *dmabufsrc2 = NULL;
! y1 o, j" M6 b1 C/ g% v - char *dmabufdest1 = NULL;
1 o+ Y) _( B0 H$ l: Y2 X - char *dmabufdest2 = NULL;- y: Q" p6 B" w/ j' W- X
7 U' |+ Y t2 ]- A- static int acnt = 512;
) c H: p) L0 t4 v - static int bcnt = 8;2 |: `" ?# T5 y
- static int ccnt = 8;* O6 g: s8 x& y/ L0 y- ]% S, d
# a3 j5 ~# i& z3 H1 F- module_param(acnt, int, S_IRUGO);% I. L6 e5 G$ R; |2 t7 P1 Y9 j r
- module_param(bcnt, int, S_IRUGO);5 a3 V, S$ x: a5 t {
- module_param(ccnt, int, S_IRUGO);
复制代码 2 `9 A8 W E6 _$ y
4 O, V! d8 R j( B/ I+ ?" g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. y# w! I" u0 O) y& v1 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 s0 |3 C" {# y% j* ?! p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! _: b+ w$ |- m, Z+ S
" X7 z5 X% U7 @+ n3 T/ f
2 V. h1 R6 \% Z. M
|
|