|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / y5 p2 o* j f1 v8 Z& J
- [code]EDMA sample test application
8 F: ]( @$ F: r( g0 | - /*
/ p8 j9 W$ N4 K' D5 s% E - * edma_test.c
q8 X/ X, |# n- F7 V - *+ p2 t$ r; {6 t' c% r: j" z
- * brief EDMA3 Test Application
7 l- _. ~' q, K; ?3 D - *. n) D8 J0 b0 J
- * This file contains EDMA3 Test code.8 e4 }& T: @) V W
- * U9 E# Y' d/ @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 t1 }/ E( }3 ?1 i* E) l k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 q& E/ [5 Q8 X% G
- * TO CHANGE.! K' |; n8 N. r8 F6 c* Y) m
- *7 F+ q0 [, ?6 U! q3 \+ B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& { r* S( g3 z& p' T1 ^- y! A) g8 ` - *
2 F" y$ @1 c* w; m7 d: Q - * This program is free software; you can redistribute it and/or
! @& A/ r2 E8 K4 ?9 J% d' I+ O - * modify it under the terms of the GNU General Public License as" q( w0 _3 w$ l1 r) ?
- * published by the Free Software Foundation version 2.
9 b1 l! ?! f$ k7 F( e( D - *
5 ?' b0 c$ e: {6 e/ f" H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 E9 s4 @4 T' v) A" a - * kind, whether express or implied; without even the implied warranty: o$ a7 i' ]% ]' w! l$ l$ s5 |5 m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 m3 d* }. D) V1 m1 \4 o
- * GNU General Public License for more details.
9 w0 W! z, J! ?6 v6 M - */9 X6 |8 a0 r! Q1 L7 `' }
- 7 N% m. L2 A% c9 R6 V$ w
- #include <linux/module.h>
2 F9 l1 y$ i! x+ d C9 }8 ^ - #include <linux/init.h>5 c- D$ H; d5 \* W2 k
- #include <linux/errno.h>( ~) g( i* Q `" P1 c6 f- E. e9 G
- #include <linux/types.h>" e q& |& ]8 X' I* Y- \( m! p
- #include <linux/interrupt.h>& A" E2 W' K" J, o. }+ d Q3 X
- #include <asm/io.h>* ^0 q4 u7 P1 z
- #include <linux/moduleparam.h>% H2 ^7 j" o! E S) M) q
- #include <linux/sysctl.h>' z6 L4 k3 [; D8 j
- #include <linux/mm.h>
8 ^$ l/ _ A! Y% ?0 G - #include <linux/dma-mapping.h>
, E9 ]2 D8 P, Q - ; j) v% n/ \9 G; {
- #include <mach/memory.h>
& |7 S% [. f% p/ l0 t) J - #include <mach/hardware.h>1 b; H, e1 y/ c' b9 Q' J. r
- #include <mach/irqs.h>
" l: t g* R$ U: ^# n/ `4 _ - #include <asm/hardware/edma.h>
/ e$ D3 l- `3 E: X' o9 H1 `" s5 { - : q O7 H" a9 E+ g! j
- #undef EDMA3_DEBUG, W% U2 A F, y+ y& J, }( [
- /*#define EDMA3_DEBUG*/; b7 x4 @* e9 H8 S! c
- " D8 d3 w/ y i, d+ |6 }7 V
- #ifdef EDMA3_DEBUG
$ h6 w8 J3 H, z& k F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 N* i* M4 e* ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 `5 R% E' ~" R4 F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, @2 `4 ^! P l! g/ ]1 k; H - #else
- m: a! {7 Q! y V, I1 Y/ C$ c - #define DMA_PRINTK( x... )
& \6 j( r3 \0 z/ g - #define DMA_FN_IN
/ h5 I+ a1 k5 l: j& h% F0 `& J0 v. t - #define DMA_FN_OUT
1 O9 d, M- T6 R. k T1 f3 A - #endif
& F; S7 t4 d7 \" W
. f$ v4 h) X) u) N; X* Y7 T- #define MAX_DMA_TRANSFER_IN_BYTES (32768). d* S2 U- Y# }; D
- #define STATIC_SHIFT 36 f1 l, f( s9 j
- #define TCINTEN_SHIFT 200 N% P2 Y2 |. h- P) G& Q( q0 I
- #define ITCINTEN_SHIFT 21
+ } ~+ }$ r$ v+ ? - #define TCCHEN_SHIFT 22
. k) B1 L0 F! E7 S - #define ITCCHEN_SHIFT 232 O F" b3 V3 h" o+ m% q7 _
- $ y7 k C' r5 u( f4 v5 [
- static volatile int irqraised1 = 0;
4 ?) b) F/ `% F. e/ j: |! y - static volatile int irqraised2 = 0;
9 c4 P& ^9 z H. m% E - 8 J, q. Z7 u0 U ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s7 ~7 o# W A- o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* J) \ p" m: G8 t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% l. u8 X- V2 U. g& R# i
( _) e/ L3 @/ Q- c$ k; n& p6 ~- dma_addr_t dmaphyssrc1 = 0;9 l, L- ?- w6 Q! F8 W! ^- Z
- dma_addr_t dmaphyssrc2 = 0;
: p. ] W$ J- _4 d0 [ J/ K8 W - dma_addr_t dmaphysdest1 = 0;, \" t+ x: Y* Z* V' J! p
- dma_addr_t dmaphysdest2 = 0;
( P1 U# A6 {) U% o o& }: O
) z' `( d; p/ B3 P% k% ?- char *dmabufsrc1 = NULL;8 s3 s9 r9 X% h t- |
- char *dmabufsrc2 = NULL;, a( D2 B, C& g; L* O
- char *dmabufdest1 = NULL;
8 C' y0 b5 y& [/ M7 W( }6 x( ~+ c - char *dmabufdest2 = NULL;
8 G* `0 f* E% f' i/ l& R - " {; F& x3 [4 O9 z; `
- static int acnt = 512;
" @6 U* u! H6 o% {, }$ a - static int bcnt = 8;! C/ Y; c# C* Y% {
- static int ccnt = 8; }8 \8 Q% `. X& ^
- # M# M$ a: k( ~, i" ]3 x" \% \& L
- module_param(acnt, int, S_IRUGO);( o. @+ {8 y) O9 P
- module_param(bcnt, int, S_IRUGO);
& X- K x: e3 H4 O5 |6 `3 r3 r$ R% {& c - module_param(ccnt, int, S_IRUGO);
复制代码
# ~$ ?3 g: C& ?3 i( F3 W5 B( m6 ?" @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 @5 m4 j; s( E8 s" v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& @0 K' b: [0 N1 r! R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; i! B4 @! O8 m; O" Q: p. A( m
# T3 @9 k) D2 M: b3 [: p
8 }" e6 A* G% q: r: ?8 r
|
|