|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 L6 J3 W" B) O: f* ]- [code]EDMA sample test application
, [; x5 Y9 z$ z& r - /*/ r7 u8 o+ K) x$ U: y6 h5 _
- * edma_test.c
, y/ A7 r( o, p& Y" J- d9 S - *4 m! u( S+ u3 H- A' C
- * brief EDMA3 Test Application
8 ]& J9 ` ~9 \8 ?' }2 B - *7 K- z$ c$ i- i
- * This file contains EDMA3 Test code.7 O% v) c6 B/ ]5 P- k8 B
- *
( M+ ^% z+ E# @7 x: B& k1 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& J' {" R4 V, T( U& v. {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 q+ N ]: x$ g9 {
- * TO CHANGE.
* R8 v: U1 V& ] - *0 h0 W, |9 i5 o6 Y: q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% J: D6 z7 P9 [# D0 G1 V. q) k
- *- c: ^5 K1 P! ^3 |" s9 ^
- * This program is free software; you can redistribute it and/or
0 a8 T# o7 L( m9 `8 r5 o$ } - * modify it under the terms of the GNU General Public License as. N2 ]: S7 B$ l9 P
- * published by the Free Software Foundation version 2.: _- z! `. N$ e. r
- *, F* x! q2 V. P2 W. b! `8 W0 J5 |; W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 ]+ ~ L3 I, n7 \+ g
- * kind, whether express or implied; without even the implied warranty# J: g1 R/ z7 N5 p# C4 t! g) p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, n+ K" ^1 ?' U' }
- * GNU General Public License for more details.
- _' R5 _7 B$ O5 S% U/ `9 r - */$ s% |7 ^8 G9 b; C" A+ m) N
5 \* R& C: W( }! \% A0 {- #include <linux/module.h>
) v9 r( x( f. q - #include <linux/init.h>
! \) A7 w8 S( | - #include <linux/errno.h>
9 x/ |/ y* d* i4 T( _& c3 q) w, u, p, q& O, P - #include <linux/types.h>
$ m! T+ i: w# x$ Q) l - #include <linux/interrupt.h>' m- j1 Y) I; `0 b5 S, z- c1 V* h
- #include <asm/io.h>* c) h! T0 @& M3 [! X/ a: @
- #include <linux/moduleparam.h>5 r \5 q* V _& i* A o; _1 y
- #include <linux/sysctl.h>
0 n. F& o. l* e! Q4 e8 D) G - #include <linux/mm.h>) @* s* z# W. O- C/ b( c n
- #include <linux/dma-mapping.h>
) D! P3 R( W, Q/ g4 G- K - 5 e' y% P; G* ]% P9 h8 V
- #include <mach/memory.h>" H& K6 M5 K8 C( `1 G4 C1 h% ?
- #include <mach/hardware.h>
8 q; K$ E# \7 ^ P1 q1 g- q. _ - #include <mach/irqs.h>
8 }+ j3 l: e9 ^9 g, S" | - #include <asm/hardware/edma.h>
8 c7 f( R( F4 J U
4 x/ A9 v p, T. _- #undef EDMA3_DEBUG9 f$ B2 Y! w' j) X. U! v/ ^! }" \
- /*#define EDMA3_DEBUG*/
, M) D% E5 s' Y; j* m
! i: _$ v |6 E5 V; N/ l) ` m7 \- #ifdef EDMA3_DEBUG E2 M: D6 C$ [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- k+ x/ e( E2 G- L$ Q1 G3 }; Q1 S6 s3 d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 m$ W. ?: O/ F3 Q4 {& R: Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 e8 e, s7 q: }3 H- Q% g
- #else
8 d, V* K! f( R" a - #define DMA_PRINTK( x... )
3 ~; ]$ \5 G0 P+ i - #define DMA_FN_IN: N3 u5 l+ v, i& n4 _7 I
- #define DMA_FN_OUT
/ n* b @$ N G( r - #endif& L4 s6 N" f' h Q
( e( g1 u/ q) L. g* F- #define MAX_DMA_TRANSFER_IN_BYTES (32768). J/ v3 u. z7 H+ e2 ]2 Y
- #define STATIC_SHIFT 3' F* y$ l F. K' l9 }
- #define TCINTEN_SHIFT 20% X6 Z0 X3 o% Y% N# V2 P. o- A
- #define ITCINTEN_SHIFT 215 e& F% K( R: x$ |: f
- #define TCCHEN_SHIFT 22
& B( X5 m9 B2 T2 ], E - #define ITCCHEN_SHIFT 23# E) c: O. {9 K0 v, I# ^0 U6 x$ F
- 9 ^+ h- @& E: d6 i/ M6 T
- static volatile int irqraised1 = 0;
& [# u+ Q/ j3 u2 g; [+ Z9 w - static volatile int irqraised2 = 0;
6 S4 b, m& q8 q$ _ P" | - " m. y J/ z* j+ K5 @4 y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% N( _6 B x6 x8 N3 E ^8 s4 u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; O# B& B1 X* y- a5 o% Q( P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% t' z! {. J* }( |0 y7 K, m& [
- # J: I, k( u- p5 ~1 ^
- dma_addr_t dmaphyssrc1 = 0;
1 Y* A5 ]8 i* F - dma_addr_t dmaphyssrc2 = 0;
2 E2 d6 P: z/ l& Z7 l$ u - dma_addr_t dmaphysdest1 = 0; N" ^/ P) _4 S
- dma_addr_t dmaphysdest2 = 0;# E& x. a G/ U L0 G
. w Z! T" B! I1 s* Z$ }3 B% i- char *dmabufsrc1 = NULL;
- D8 g- ^* k( I - char *dmabufsrc2 = NULL;
" {: i b9 Q2 A% _; ?/ ^1 T$ F1 m3 h - char *dmabufdest1 = NULL;
7 m: P9 z/ m9 v8 `7 S - char *dmabufdest2 = NULL;/ ~' b2 F1 f" B7 a& s/ _
! c; o* l: e: g1 G) E! T9 r# ?- static int acnt = 512;# H1 F3 R ~$ y. T' `/ S
- static int bcnt = 8;
0 I# B0 K4 Q5 M9 u) C - static int ccnt = 8;& Y" L" J6 X3 O. y. C4 w
/ l2 H1 G" v2 O+ d- module_param(acnt, int, S_IRUGO);( ^+ G) w7 w' m" G
- module_param(bcnt, int, S_IRUGO);! c. S* @+ u& G) g3 G6 e0 u
- module_param(ccnt, int, S_IRUGO);
复制代码 4 g% U% B* g" F0 U1 j
4 e X6 ]/ W' _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& x5 g0 q$ a9 q3 z/ x( Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 J# ~) X6 g: v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ _! k3 F# T/ ?6 t) n
5 T0 G: p' ^) a9 o9 }. y; k
6 d! {+ F! ~/ L: |. E3 W# ? |
|