|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; n4 V/ t$ Y0 b, R! [* l- [code]EDMA sample test application
, {( w! |" `, y) l, r& b* A3 E - /*
U0 V, L$ x1 `' D - * edma_test.c
; E+ a( x" }- I% `0 I - *5 D D6 M& y6 l# [" h2 f/ M. v
- * brief EDMA3 Test Application7 k) U* _( @2 y
- *( E Y/ P+ L' D5 g9 U" A6 E& R
- * This file contains EDMA3 Test code.
9 z+ h1 T3 ^. `% B1 V2 \+ Z - *7 U9 n% V: e4 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' ?& K. u6 Z4 y5 A* ~( ^7 `5 d# X' t7 ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: t3 j& i' Q* A' i* G/ z - * TO CHANGE.
! ]) I( |1 ~+ Q* ~: @) _ - *# L5 m! D2 M% J6 z8 y+ H) ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: z* S# x! i& Z) x& N) t/ l - *
1 S1 k; c- s1 ~$ F6 R* u8 `# A - * This program is free software; you can redistribute it and/or: e& E5 S9 F! ^8 a+ w) Q5 ]7 S' {
- * modify it under the terms of the GNU General Public License as5 W" |& D$ l* z2 ?. X+ Z/ z( T
- * published by the Free Software Foundation version 2.; B1 Z! h7 D( A5 m5 W' D
- *
2 p# ]( t6 ^8 T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 f* o% o3 B3 P- |. @6 H - * kind, whether express or implied; without even the implied warranty
! j9 j8 T) w9 j( H9 ~" r% g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; r. k# Z* K& N0 E6 ~ - * GNU General Public License for more details.2 z- V3 M+ W( H' u: l/ b, C
- */
* n0 p# z# [* ^5 t/ {; ` - ! |! Z7 x9 y4 W/ A, w, X9 m7 }* G
- #include <linux/module.h>5 t4 o/ s O7 x' h
- #include <linux/init.h>- c) c. h- }; q& _$ N9 U& V
- #include <linux/errno.h>" j1 H/ S! `; @# E( d
- #include <linux/types.h>: U( C: @+ J, N4 o
- #include <linux/interrupt.h>& d* q1 z& B5 |* {/ M# L% e4 Q
- #include <asm/io.h>
1 }5 c+ g4 n) I: W M - #include <linux/moduleparam.h>
% r5 H' e. |* h8 j! }1 a& t( q. J8 @ - #include <linux/sysctl.h>
2 O& D: T2 l- s: Y - #include <linux/mm.h>
( z% g3 `% @# ] - #include <linux/dma-mapping.h>
7 p w% W$ a- Y! A! [
) a& k8 p+ p7 c; j4 |& _. o' n- #include <mach/memory.h>
& \1 H: A, }% z1 s- k% U5 R: q - #include <mach/hardware.h>
5 {9 Y+ r- d0 x/ o1 b: r - #include <mach/irqs.h>1 ?6 C* b+ p% J+ g4 w( E
- #include <asm/hardware/edma.h>
; g0 y. y* A! E - ; O- A, D+ e3 a, a: ?% t
- #undef EDMA3_DEBUG
2 f: W, U) D0 j& o - /*#define EDMA3_DEBUG*/ i6 ^! d p; ], {1 Q- N o, D
- * q( c- Y. H! c+ e& Y% G/ c* [
- #ifdef EDMA3_DEBUG
M s" |$ w* z4 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), B2 ?7 i4 Z7 M; Q: p" u* r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% V3 j: ^+ M9 L, E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% _6 k* R7 A- n; C+ f- i
- #else
1 f3 \: z+ P2 B) L1 ` - #define DMA_PRINTK( x... )* Q4 U1 l9 }' V: L# U/ T
- #define DMA_FN_IN
! i; Q9 k- ^+ ^; P - #define DMA_FN_OUT0 O/ W* F3 P, D9 G3 S/ A/ o( J
- #endif
4 F' j( q, o3 R; R8 h' m2 g ^0 D - ' H3 l& p! _: G0 G4 e6 ?7 w) M5 w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 U; H- ~" h: ~( B% B: {
- #define STATIC_SHIFT 35 d1 o, M* z; _; C$ _: o
- #define TCINTEN_SHIFT 20! l) J8 H3 `0 ` Q0 X o. L+ q4 b
- #define ITCINTEN_SHIFT 21; y; S- q; @1 \( ]0 f
- #define TCCHEN_SHIFT 229 G( u& D9 x8 ~$ S$ Q
- #define ITCCHEN_SHIFT 23. g& V3 g) X6 l# E3 c
- 3 X4 s2 B. D$ V5 C6 G
- static volatile int irqraised1 = 0;; d1 f9 T$ `) g# a6 z
- static volatile int irqraised2 = 0;
, ~$ l% E* [1 }2 D, I* c
- ?( R) I) l7 W& k' U4 x, L& Z: ^) m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 I3 L6 A( A6 P9 q4 A6 N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 M2 @6 w0 V! j; [% _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# r/ n7 e5 J. @( O1 p; `) K - ) L) n( ^% j0 ~4 r) {9 V9 }8 X1 L
- dma_addr_t dmaphyssrc1 = 0;
" h2 H6 _4 l: v, p# l8 y" r - dma_addr_t dmaphyssrc2 = 0;
8 Z4 H4 c# l/ h; _: q/ z - dma_addr_t dmaphysdest1 = 0;
7 s8 I/ {/ E V2 q7 k. D% E - dma_addr_t dmaphysdest2 = 0;
& B S# k7 Q2 o' F- k8 {
! M" `$ E6 Z2 d5 v; P- char *dmabufsrc1 = NULL; x' Q4 g$ w/ Q3 b4 \' U" E4 ^7 C
- char *dmabufsrc2 = NULL;: L/ R3 H. P1 q, l! r& s
- char *dmabufdest1 = NULL;
$ P6 z2 {' C# `; Y( v% O - char *dmabufdest2 = NULL;' P) S: j& q( Q& I- l h0 `+ H' `) {
1 i* w8 m2 ~2 { V. p. b- static int acnt = 512; ?! u4 f: S4 M
- static int bcnt = 8;7 ?8 {8 Z& P* J$ S, C0 Z! _
- static int ccnt = 8;' o. u0 i0 ]6 A, k: r
' f3 c( d% Q% D1 C+ L- module_param(acnt, int, S_IRUGO);
# C- P; t" ~) q' {4 \3 t7 V - module_param(bcnt, int, S_IRUGO);
q0 C' n& b+ d5 A7 `( \ - module_param(ccnt, int, S_IRUGO);
复制代码 6 e3 l. { L# j# s6 D2 p7 L# Y
( M2 S! T* C+ p# S- O. _. r8 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ `0 u% K: o l1 w7 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ p% F, y0 [$ F8 I' f$ |8 G+ ?, c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% N" s# g! }0 u2 I# l% r' Z
& T8 Q( x% H' Z& Z- S! M5 @% c" f* G
$ G: u6 j( S* Z: @6 z |
|