|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- D, U4 k2 |& v6 u: y Y7 e- [code]EDMA sample test application6 t6 O: _6 \) f; c3 j
- /*9 [0 v$ D/ x& i3 s
- * edma_test.c
& V8 x' g X+ b5 Z - *: v) [0 P/ L" H, K! G6 K
- * brief EDMA3 Test Application
3 ?3 k2 [( y( Y8 N# q/ {9 X, f - *+ c! n. d8 n# L" E- u4 |8 B
- * This file contains EDMA3 Test code.
$ X! b( H% Z, ^2 `. B9 i/ T - *! n! O* U# |; o2 Z4 d* C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 n9 {4 w: y% ~; O _ J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( K _. U) m- D9 S; U& Y - * TO CHANGE.' f5 I3 @ a/ f: K5 v* ~
- *- y! @- [% m2 V5 y! ^8 i- Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% I; N% p3 O1 P* U$ L- t* @9 T - *' Y0 Q* r! E8 ?) Z6 |$ }
- * This program is free software; you can redistribute it and/or# a& T" b: e4 T9 r3 J
- * modify it under the terms of the GNU General Public License as+ ^% n; V: Y' L9 Q1 S
- * published by the Free Software Foundation version 2.) T( X6 G$ F; J8 o* n
- ** I7 c8 a, a! a6 t0 F% I/ D+ b+ C; ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 p: w$ j t. x. I4 N" j - * kind, whether express or implied; without even the implied warranty
4 H. ]- I2 P* W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" [2 m4 C" e/ c - * GNU General Public License for more details./ \: Z* @0 B- t8 I/ s) h
- */! m! e( ]) O5 W5 C; f$ R
- 0 J3 J9 x6 M5 W1 _4 `7 g( k
- #include <linux/module.h>6 j+ x8 N3 P2 C q/ I& e6 a
- #include <linux/init.h>7 X& f. j- f% N7 H
- #include <linux/errno.h>( M2 l4 e* E7 M% [ m& n$ h7 c
- #include <linux/types.h>
6 S9 M, E1 ]7 F$ R: _* | - #include <linux/interrupt.h>
( m7 [8 p$ p4 d - #include <asm/io.h>
, W3 \) w" L6 S- n" c1 ]. y - #include <linux/moduleparam.h>; a* x5 K; D- H3 b1 d1 _/ ~8 e6 _
- #include <linux/sysctl.h>
& U: V Z }4 @- W, x7 l - #include <linux/mm.h>
: c" l& N( g) J- A7 o - #include <linux/dma-mapping.h>* ` M& B6 `4 ]
- - b" n) E+ K" A: t/ M
- #include <mach/memory.h>
8 F0 K8 W, `, O7 y- A# _* D2 q - #include <mach/hardware.h>
% n$ o! Z9 H! o! f - #include <mach/irqs.h>% q" b" \. S7 M$ S& [$ G' e) `
- #include <asm/hardware/edma.h>
2 N# r& ^6 O$ `& g3 a
* }) v4 ]+ C6 v. o* U8 k3 p- #undef EDMA3_DEBUG
8 r$ j& u) [/ d- p" Z - /*#define EDMA3_DEBUG*/
# V0 A, e( ?7 T, l; Q
" ~. K0 |: |* O/ r9 V- #ifdef EDMA3_DEBUG
9 w; t T `3 m% R( @ t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* Q8 U) ^6 w" u. H: m6 K/ g8 { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 N. w, w9 T P) P3 z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" a2 ^9 {6 ]2 |! ^% d ?+ |
- #else
# ^. v9 d! g( t% ^ - #define DMA_PRINTK( x... )
6 T; T% h0 s) v6 k1 k* k - #define DMA_FN_IN
9 W: I, e D6 f/ \. K4 ^7 P) ` - #define DMA_FN_OUT
8 m2 q+ E& I5 `: a! w+ ~7 `$ @ - #endif+ G5 V7 X% L. P& M9 Q. i/ z6 r! N
- l4 M3 G$ F! b! p/ x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# _3 ]5 ^3 @2 B3 s7 o( K/ h7 b - #define STATIC_SHIFT 3
, m5 \5 a. s2 b - #define TCINTEN_SHIFT 20
$ {- R8 m# v4 h3 R$ n - #define ITCINTEN_SHIFT 21
) v, g! y9 z8 I( H& r Q - #define TCCHEN_SHIFT 22
4 [) H( p/ I& q, K5 M k - #define ITCCHEN_SHIFT 231 d2 z. _5 h: Z: r: d2 P" c% k3 B$ x
6 i$ s0 F7 y% _# `- static volatile int irqraised1 = 0;4 \6 {/ A0 A7 h4 n( y
- static volatile int irqraised2 = 0; c; ^; p2 D! M- z$ v
- * Y9 H! s0 H8 ~# R, J$ T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* V; M7 q) S8 _- E& @2 Y. Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
u" j4 P" _/ I2 V# S2 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ R7 i2 S( k9 N- ^# v - * Z( q* O2 n ?. ~
- dma_addr_t dmaphyssrc1 = 0;
. M3 w4 L( W H - dma_addr_t dmaphyssrc2 = 0;2 ?9 e" A8 ^5 X) q* p/ Y
- dma_addr_t dmaphysdest1 = 0;! d, e: d" a! z; u
- dma_addr_t dmaphysdest2 = 0;
: J+ s- Q% n5 i9 d( @+ J# ]; q
9 j% V% } u7 k* X6 r; E& R/ q; N2 V- char *dmabufsrc1 = NULL;
+ t3 Q" [) j3 S' T; T8 F - char *dmabufsrc2 = NULL;
4 X/ \) v' h8 r" c - char *dmabufdest1 = NULL;
: k# ^; L7 s" v7 {6 [ - char *dmabufdest2 = NULL;
7 I0 ]% t% z; L/ H) O# E3 G
9 I1 J1 R5 V- W$ `3 @. a- static int acnt = 512;
: `3 ^, n( m& V0 C - static int bcnt = 8;
) ?8 ]( f- O. e# \# j* T. v7 v - static int ccnt = 8;
2 O; W+ X, a% G - m3 X4 D8 \6 R& c
- module_param(acnt, int, S_IRUGO);7 C8 K* {5 w6 c; y8 B2 v% w
- module_param(bcnt, int, S_IRUGO);
; M- ], N, j$ i0 x7 R - module_param(ccnt, int, S_IRUGO);
复制代码 / X8 a5 U/ f, r/ `
% m! D8 _: Q/ w1 g! P5 T% H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 Q* Q+ Y% a" B/ f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, R) z# i" `6 N& N/ g0 J) ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# s- h. J# R8 [
5 [& E6 w4 Z8 E, i; Y, E+ w
, k1 c- m2 M0 L; j6 W6 w |
|