|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# C- {- p! E* a3 Y' E- [code]EDMA sample test application \* Q5 n; Y% y9 t( o6 I! m5 K' n4 r* V
- /*2 H" M1 ~! f6 t* l: m3 E
- * edma_test.c
3 K3 ^& d% P; a4 i. H7 e - *0 `& Z" B7 `8 W6 n( W6 |( A- p
- * brief EDMA3 Test Application
7 ^ c! e6 [& f: i8 G- [6 x - *# u1 F1 p; K# Z" ?
- * This file contains EDMA3 Test code.) \8 @" K: i, J ~* N M
- *2 e4 R! g5 S; e) A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: f! c1 I, Z* Q& n" k% I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& J. w0 j: Y8 M1 `
- * TO CHANGE.6 U9 g5 h3 a. L/ j2 K
- *
, u$ |. q. Y& @7 [( }- j9 B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 h7 K. }7 g% D0 b8 S0 A0 B9 K& w
- *
9 n- a4 a) m" V9 _ - * This program is free software; you can redistribute it and/or* j" |. B0 y K7 k/ D6 `
- * modify it under the terms of the GNU General Public License as
4 ]4 f$ P$ T& J( S3 b q5 _ - * published by the Free Software Foundation version 2.
: V4 d( N2 u! Z) ^ - *
6 L g& d/ ^9 ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% D& q; f: d- r+ n# D# ?5 B; ?6 l7 G
- * kind, whether express or implied; without even the implied warranty/ o, d2 W5 h: w& P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the G# R3 I* C7 N$ N. h" D
- * GNU General Public License for more details.
9 {4 _4 N, Y* x, I; R - */5 A t+ p: o3 M
- O3 [- U9 E; x4 ~: v
- #include <linux/module.h>
. {2 r: c+ V! q5 ~; y1 D - #include <linux/init.h>
3 y4 @* |# I1 X! {4 M - #include <linux/errno.h>( o3 u6 I+ W, c4 r. J/ W, T
- #include <linux/types.h># ~6 U& S6 X3 r/ ~4 n! M, K
- #include <linux/interrupt.h>
. g+ c; s2 T3 t2 y2 z: [* G6 `+ @ - #include <asm/io.h>
4 U: ~5 O% t; r v1 S - #include <linux/moduleparam.h>
% ~; Z& T3 i% @) L$ F - #include <linux/sysctl.h>
4 O5 C% i9 ~0 y - #include <linux/mm.h>
3 l+ P: y" d0 ~$ ]% F - #include <linux/dma-mapping.h>
' h& I! [* R2 g4 U1 B7 l$ P
, _" ~; M" o- l" [' T- #include <mach/memory.h>
: c* C8 v; h& e( ? - #include <mach/hardware.h>
1 }, y6 D N `9 } o - #include <mach/irqs.h>
" i: l8 U- E6 X6 q - #include <asm/hardware/edma.h>
3 B" A& N2 S4 {3 ^ - # N' v5 p- o) G
- #undef EDMA3_DEBUG& o+ y5 a( p% g1 {' \( Q) J
- /*#define EDMA3_DEBUG*/# ]! q; k Q2 r# t" k" R( @ X) a" k8 y7 u
- ; ^. v& q+ L4 x2 g0 B# R
- #ifdef EDMA3_DEBUG
# S- [# ^& [1 g% N/ k K/ [9 k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& F t7 a; H3 { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ r& W% C1 }0 `2 Y% q' v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( v5 ?2 F+ Z$ s5 q; M7 m
- #else
) r) d& @8 M6 }% v8 D: D - #define DMA_PRINTK( x... )0 G7 |. v' U' ?
- #define DMA_FN_IN! G6 G8 P+ W: `8 O
- #define DMA_FN_OUT
# A, ~6 y4 G, @7 ^! B - #endif1 v% y: i2 I. f, h8 l& g# \
- * k. N7 `7 _8 v$ `! p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" u* `' S' o6 h
- #define STATIC_SHIFT 3- u' v6 m, z& D/ b/ f5 v3 K
- #define TCINTEN_SHIFT 20
2 \7 ?; F$ Y/ R& X5 j7 ]2 Z* W5 E - #define ITCINTEN_SHIFT 21
- n8 B' W9 }! j" w: F( m; S - #define TCCHEN_SHIFT 226 |4 J/ f$ B) u9 n( L0 I2 l
- #define ITCCHEN_SHIFT 23; x, U0 w4 ]$ P% U% C
2 X- o0 i5 A- a/ C3 W- static volatile int irqraised1 = 0;
: G& \4 {7 i1 ^9 w' ?8 N1 @3 L - static volatile int irqraised2 = 0;
) J0 _+ q& i/ U8 [$ ~
1 V! J/ \1 {2 [# \2 Z! l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ l4 x* m% ~0 I+ b& } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& `/ T8 z; n/ c6 A e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) t: n* b: s9 P' D4 z6 ?& Q6 D
- 1 S; h1 D# \2 H* \0 Z4 B) ^
- dma_addr_t dmaphyssrc1 = 0;6 j" Y5 k9 a8 a0 ^1 o& Q
- dma_addr_t dmaphyssrc2 = 0;9 A6 l0 f x2 {
- dma_addr_t dmaphysdest1 = 0;7 M, o& M j- t# e9 z# v4 e1 @
- dma_addr_t dmaphysdest2 = 0;
# X+ b9 n/ ^1 U& Y - 2 Z7 y5 U0 u% I5 _# m
- char *dmabufsrc1 = NULL;* R* g6 v# l# |" h2 U. d$ N/ m$ x
- char *dmabufsrc2 = NULL;4 t; A$ K5 X& D: M
- char *dmabufdest1 = NULL;
1 ]2 C' ~7 ?$ z1 `8 h H - char *dmabufdest2 = NULL;" [6 }4 ~3 ]) t* ^+ v! }& W
# ~* u9 C$ n6 n0 W- B& i- static int acnt = 512;
( {+ P& V- P% R6 T( M - static int bcnt = 8;
" i0 M. h$ D1 r" ` - static int ccnt = 8;
; \. I2 y" m& L8 `
' t% h3 E* d* y) y9 g" f) R- module_param(acnt, int, S_IRUGO);1 @# i3 E2 m0 i9 X9 t' E5 D
- module_param(bcnt, int, S_IRUGO);
1 x4 m L& \- _- [; Y - module_param(ccnt, int, S_IRUGO);
复制代码 3 z: I. S( c2 s# {% [3 g
; E) G! Q; @- v( F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 |1 d* O: ?1 g. B: w4 ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! C6 V2 O, l) P' ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ g( [: D' O! q6 [2 ~; [
: W0 N# C0 b* p% G/ H* n/ Q' t) Y! Y9 N/ _
|
|