|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 J4 Y! @- g5 Q2 W- [code]EDMA sample test application
: W9 J" b# K( t5 I0 G4 E" n - /*
9 i# |2 u( Y# ], q: B - * edma_test.c, d# ^) w$ Y' { A# m* Z
- *
; @$ U$ O% d$ J9 e# V" F# I - * brief EDMA3 Test Application
$ R3 r, }9 F6 @4 t - *
e, [/ V0 W, v% _& B( \; b2 x - * This file contains EDMA3 Test code.$ S! m) p$ i, n$ L
- *; p" M( {5 g9 _ j4 g) q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. F/ o9 {+ z- Q6 k" s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: k& h( }+ r) R" X' G6 m! u - * TO CHANGE.
) h( b: t2 L5 c! i, f. o0 F* k - *
, ^& U0 n" e- {/ U i5 G6 d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. k, T& w9 x& u5 i, ]( m$ s
- *
( R" b1 ?0 | D$ | - * This program is free software; you can redistribute it and/or9 A9 K. b7 ~6 T# j
- * modify it under the terms of the GNU General Public License as
7 G% A% ^# e2 s! p7 X - * published by the Free Software Foundation version 2.
4 ^2 T# P1 W! s2 |: M: k; w& i - */ ~' ^5 u: }( {% }" i& L$ t$ \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( {' u; f2 {& E5 l; ~& |
- * kind, whether express or implied; without even the implied warranty# r0 X) U; V, Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ j2 W- m2 A0 F0 ^; t5 y
- * GNU General Public License for more details.
* T9 o3 n8 Z; V$ r; k e! w - */4 y) t" e" P0 B
- O4 b) a6 m6 \ R B
- #include <linux/module.h>
) x4 o1 j" V9 K/ t+ Q6 P* s# V - #include <linux/init.h>4 X1 _6 ~. Q9 h
- #include <linux/errno.h>
- e5 J8 C3 z$ B" O& b) U - #include <linux/types.h>
0 I5 Z, \8 Y2 ?- o7 n2 d - #include <linux/interrupt.h>6 l: H5 F& g& y& r
- #include <asm/io.h>
+ l- A- G! L0 l* a- q; G - #include <linux/moduleparam.h>! P2 u5 ?. O8 C6 \' q4 v$ x
- #include <linux/sysctl.h>( T1 I- k* w# n4 p$ e6 O
- #include <linux/mm.h>
. d0 e" m" c7 U9 h& y! c2 C - #include <linux/dma-mapping.h>
/ I6 B8 O# u* h5 B9 W6 B
! K& P, M0 f1 e9 K! V, p- #include <mach/memory.h>
! K% k5 J7 ~* u# C7 k - #include <mach/hardware.h>6 _7 h( L) n, Z" _2 ~) N ]
- #include <mach/irqs.h>
! A+ M7 U8 ]$ a# B - #include <asm/hardware/edma.h>
* @1 X( X& u e- v% f3 z* I - # V5 M5 t4 j" _, Z, u r
- #undef EDMA3_DEBUG
+ b" B# T+ n+ L& F2 R* w - /*#define EDMA3_DEBUG*/( Y, P8 s% W) @4 ~7 N
- % h0 @5 `& _( L( c, ~
- #ifdef EDMA3_DEBUG
" Y9 {* u2 X5 K z7 Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 t- r) R1 x4 j' H0 U* s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 o9 T% [- n4 g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' P& |. Y K0 o2 |- ] - #else6 ]- P! Y. x$ U
- #define DMA_PRINTK( x... ); A, i3 o. w3 e5 d8 U& Y, l6 ]* r
- #define DMA_FN_IN
) R D& v3 ]5 U7 M# \ - #define DMA_FN_OUT
/ H( a, M+ a( U; H' u: V9 q7 V- _ - #endif2 ~( u: b! W/ t
8 M H8 u) D1 _! t0 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 F; z3 L' P$ f9 ]( }: i% [
- #define STATIC_SHIFT 3
; V. \! Z8 U4 D+ j' e - #define TCINTEN_SHIFT 20) r; j' a$ f) i9 u( y' S* W5 o
- #define ITCINTEN_SHIFT 21. V1 I3 }/ l# A' t, p7 H
- #define TCCHEN_SHIFT 22; `- f. J" Q; z# v' p. R, l( D7 U3 k
- #define ITCCHEN_SHIFT 235 M* m0 Q r! y$ Y. E3 K
- $ D ^( K: o. \3 k
- static volatile int irqraised1 = 0;
- U D, E0 L9 t# v+ b0 f$ e- o* N8 X - static volatile int irqraised2 = 0;
2 ~. H& P5 R3 g$ u+ x - , d( e3 |, @' ]+ V- s! O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& S5 `: O) u6 r3 f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. E1 z2 U* O3 |7 W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 b2 M1 T9 P' s, [- Y - , u2 @# ~7 W% O8 S4 o
- dma_addr_t dmaphyssrc1 = 0;6 O, }# S: k! X/ B- g7 }/ |
- dma_addr_t dmaphyssrc2 = 0; t4 s3 X- W6 U2 @1 _9 ]" C
- dma_addr_t dmaphysdest1 = 0;
$ h1 C- E$ y# N7 g& ^ - dma_addr_t dmaphysdest2 = 0;% @$ z& u0 |0 ? E/ f7 ^
- - l! J! |3 i0 _
- char *dmabufsrc1 = NULL;
( E7 p* N0 m8 [/ q - char *dmabufsrc2 = NULL;
2 h M% b6 Q% @5 p6 M- u/ H - char *dmabufdest1 = NULL;
3 D1 ?3 c! m4 }# | - char *dmabufdest2 = NULL;
' C( |& o1 K3 |8 T Z' x! J
" K% F- h2 Q: I! R j. _6 v6 ?6 Y- static int acnt = 512;
; b% m1 G' v' p6 o' M. O ]% H - static int bcnt = 8;: `6 c# H5 V$ G- |9 c
- static int ccnt = 8;
7 u- G0 l/ R/ Z4 W7 a: k( f
+ ]0 G ^: N( H- ?* @" W- module_param(acnt, int, S_IRUGO);. o# w& O# ]/ |' f# |! W) N
- module_param(bcnt, int, S_IRUGO);
8 |5 Y3 s& B! u( @0 w9 B5 P& p( \! A - module_param(ccnt, int, S_IRUGO);
复制代码 ; T. m, C" N2 v9 O! h
" p% a) p; Y. i/ B3 H, J# f% e S4 E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 D. k2 z& S2 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% k! ~+ l! |6 u' o- r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ E: q o/ ^5 f' G! x1 l
7 J: Y/ h# x# N. M2 N$ G% B/ e# H: C9 H: t7 G
|
|