|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! H* ]% }" t" r- [code]EDMA sample test application
# R1 b. I) [+ b" R - /*
9 C. H5 v i6 ]# T8 w - * edma_test.c
5 O* J% X1 m% n" m - *
( ~* g* g# O& h: ]! j - * brief EDMA3 Test Application
+ c' A3 i- |" U - *
8 Z" X% e* C$ y. i - * This file contains EDMA3 Test code.
( D/ q, Q0 p9 p: o' u# ^ - *
% a, E3 p( k# e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% X1 p0 ?( e2 E: p) w% J% d: s' F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: V3 p, s& c* b - * TO CHANGE.* g$ J+ |5 j( i4 t
- *
: d2 j9 h, _$ U2 @+ w4 ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& Y q, Y N- S0 u$ k - *
6 {0 o9 H* A% S! s. ?( w! N* A - * This program is free software; you can redistribute it and/or
3 ~& T% H, O# }7 t - * modify it under the terms of the GNU General Public License as5 H; |/ Q: G8 t7 R
- * published by the Free Software Foundation version 2.. \" c% h4 y8 A& S9 ]: M5 l) O4 B
- *
! t( V: @. h q' D( ^; ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) L+ D+ i$ d8 N* @; w - * kind, whether express or implied; without even the implied warranty
1 F7 H. S: d& T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ S# a( D' d0 q+ ]* b4 h6 X - * GNU General Public License for more details.
0 Y- u. I( u' z - */
5 N9 }' X9 @. ]$ n
" [/ Z! g4 @8 K' n5 L- #include <linux/module.h>
* E" D& K- M" L* c/ Y - #include <linux/init.h>: w, r( q! k' K, x5 y. P
- #include <linux/errno.h>& G* c' K$ B! Q3 x% ~$ k$ d
- #include <linux/types.h>
" X, g4 {' @" @; H; l2 ?# e - #include <linux/interrupt.h>
0 O" e* x& w0 B- W; V - #include <asm/io.h>" m' o8 ]0 S6 k( N4 p6 i9 p
- #include <linux/moduleparam.h>- K S+ i2 Z+ t
- #include <linux/sysctl.h>
# A+ S& V5 p% }' K4 {9 v. d - #include <linux/mm.h>8 b- @: K3 ?/ ~( }# T7 g: M
- #include <linux/dma-mapping.h>
6 i q$ }' a! R: e" D% z3 o
4 s$ z. j; w. S4 s6 R- #include <mach/memory.h>
/ g- Z# S( ~/ G! V; E# I- P* h9 W3 A2 { - #include <mach/hardware.h>/ K+ s0 ~) ^* D5 x6 s- b& d& B
- #include <mach/irqs.h>
. b2 p, ?7 }) v - #include <asm/hardware/edma.h>
; p2 @* M/ X# \: U+ i% D
% Y: Q7 e( ?+ `" I8 t; _- #undef EDMA3_DEBUG" {* Q9 s1 @7 l, d. o' c2 p/ f3 T) [# `
- /*#define EDMA3_DEBUG*// D6 N# W% W: l! L& X% \9 V
- ) G; U% \1 f1 U5 |/ Q
- #ifdef EDMA3_DEBUG/ g/ w: Q* }$ G9 A4 c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 a2 I+ X) f% Z; ~2 U6 U& S# w; @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 s6 D0 V$ P( F8 C- G: B" f2 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- r: k% u q' i3 x - #else
% R- i- k: a! n; e" O - #define DMA_PRINTK( x... ). X" H' v3 s9 m" L1 a; _8 f
- #define DMA_FN_IN/ L& y* m( t. }3 v- m/ S
- #define DMA_FN_OUT, R. B6 V- x! K" ]5 X
- #endif9 m2 y' a& J- R# s
; [, y# {# W, c4 P4 c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" }7 m( @$ g S
- #define STATIC_SHIFT 3$ o/ a' ~* o! C% U
- #define TCINTEN_SHIFT 20
8 z- U6 M: G$ R1 x6 k - #define ITCINTEN_SHIFT 21
2 L8 o3 M2 q# x( z - #define TCCHEN_SHIFT 224 L; M9 j1 S: [$ z w1 _
- #define ITCCHEN_SHIFT 236 ?# a8 t: H+ _
, i% s# Q0 x) N- static volatile int irqraised1 = 0;1 h% d, q% L9 @* v
- static volatile int irqraised2 = 0;
+ `+ B- @$ a( b) u! i
1 D8 J% f0 a% v) u" |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% {4 t+ h/ A4 ]* F/ x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 r; j- B5 [, N: k- n; K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* H: g+ q, Q) c5 g
; G, G' _7 q E! [- dma_addr_t dmaphyssrc1 = 0;
7 L9 y2 g1 T/ R6 A+ V - dma_addr_t dmaphyssrc2 = 0;9 u C# k! z$ p" C8 J1 j
- dma_addr_t dmaphysdest1 = 0;4 e2 G, m8 V1 z; d+ @9 \
- dma_addr_t dmaphysdest2 = 0;
, u' {) G" a% d0 Z' `- [1 Q6 M" L
# a8 e6 u# q" I( h3 H( i. x- char *dmabufsrc1 = NULL;+ `5 s$ N. y! A4 E1 ?) l! T% D
- char *dmabufsrc2 = NULL;; C& J1 K% {: ^( N7 W
- char *dmabufdest1 = NULL;
9 |! ]! v0 t* `: w; S2 y9 l - char *dmabufdest2 = NULL;
5 t1 u1 Q2 `6 |+ p
0 N" I2 v% B- z- static int acnt = 512;
5 G2 K: n% e% n- r - static int bcnt = 8;, S$ D' G: B( R3 j9 I& a% v0 Y& D
- static int ccnt = 8;, k1 S0 G" f. A8 R4 z' W' W
- * Z7 e6 P0 p/ [5 y# C1 K3 B
- module_param(acnt, int, S_IRUGO);' J+ u3 _6 F7 A
- module_param(bcnt, int, S_IRUGO);
3 ]5 E# C. J$ V* u5 y: k - module_param(ccnt, int, S_IRUGO);
复制代码
3 M( n! n0 J) G+ ]; U- a
" ]9 w: {/ \, x" s! w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ `6 l" c; k8 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 ]" @1 |( z5 H3 H* }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; R# K( F- I% z5 {
8 [; E3 l* q( m4 V
A: |, @2 O0 A* r3 \ |
|