|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 n/ N3 a" E+ y: q2 p
- [code]EDMA sample test application. |% j7 D. @, N( e# ]( H
- /*
1 N; h. u) A) G - * edma_test.c) @# T2 T! X( W" a! C
- *! s& R8 v' }' U1 o! x0 I, U
- * brief EDMA3 Test Application! q7 N7 _) Q9 d% f4 {2 U7 p
- *4 a1 E5 ^1 k) d5 S# F
- * This file contains EDMA3 Test code.
- L( f: P+ O! p! a! w; L$ ] - */ f. _2 e4 g; i$ |* r! \( Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 }/ v$ k2 q5 w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! K7 s2 `4 Q3 y7 e- j2 `) W0 | - * TO CHANGE.
6 B9 \7 {& I' J# c$ a - *
$ }& |, R) N$ } ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, ?5 v4 b0 J# f. u# ~ @8 [ - *
6 s1 J/ N$ ]6 K. i - * This program is free software; you can redistribute it and/or
0 G7 f* O+ P1 [; _- [. Q+ o - * modify it under the terms of the GNU General Public License as
( ?! x) A7 J, U - * published by the Free Software Foundation version 2.* l* d& @% |* G( [# Z5 _; |, q' y( G
- *: |, m( `- C# y: i5 I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
s& H- N5 k/ v" C - * kind, whether express or implied; without even the implied warranty) ]" t1 P6 O- ~+ H) [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 C6 |: i9 H* s Y9 A/ A; l, l1 z - * GNU General Public License for more details. b1 T$ u+ B; r0 m2 Y+ h n, i
- */
+ U; f9 ~, ^; p9 L" Z
# ^" ~7 r8 f X- r ^8 W8 O K+ S- #include <linux/module.h>! d) y: L5 M, e" C5 |1 ~
- #include <linux/init.h>0 B6 H0 |% c4 |) D3 O
- #include <linux/errno.h>% m; ]' ]3 [, A
- #include <linux/types.h>0 a/ ~6 z& D ?' q7 Y
- #include <linux/interrupt.h>0 f. x! T0 v8 Y2 h. A, T7 B2 i
- #include <asm/io.h>
1 B' D& S7 T) X/ s7 q" A4 S - #include <linux/moduleparam.h>3 R" n& @0 L5 g. u
- #include <linux/sysctl.h>& R* ]3 z3 n/ A! L- h$ x9 l9 R
- #include <linux/mm.h>. L* H4 Q5 J# f5 g/ W$ [
- #include <linux/dma-mapping.h>
# j0 |/ q+ ~& N% z: X
; m+ P! }# X( D- #include <mach/memory.h>
9 @$ L7 D" [1 F- A% a - #include <mach/hardware.h>; O4 k: ]- x* G6 ?2 _1 Y
- #include <mach/irqs.h>
! y" i" @! z1 T! z& d - #include <asm/hardware/edma.h>
+ H. e2 Y$ w# n$ [* Q, ?
, p2 _9 I4 w; r$ r- #undef EDMA3_DEBUG
# \6 E) h+ N5 P2 G" Y; H - /*#define EDMA3_DEBUG*/
/ x0 Q" n& g, G! A3 M
' a9 a7 N# a6 A; a- #ifdef EDMA3_DEBUG# H: Q9 q: a6 ~6 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& B! i- w, W8 T/ K/ h4 j* y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% j" A/ P9 w! [' A v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# c$ ~5 a% [2 V$ \1 e - #else& t4 ~. z' {+ p, @. Z- v: l
- #define DMA_PRINTK( x... )
) @0 y3 n( E3 T; @/ L) s - #define DMA_FN_IN
. O, G w: [. X' g - #define DMA_FN_OUT0 S5 X! i6 R+ c. L9 |! U/ j" S
- #endif
- d7 n5 t U% h t - 9 w4 q& g! U3 c \ m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: A/ }9 |2 D# [" o) ^% ?5 _ - #define STATIC_SHIFT 3
( m w3 n, V0 |! @- g" a - #define TCINTEN_SHIFT 20% Y6 b# J% H+ K* A5 H% H; d; k* n- D
- #define ITCINTEN_SHIFT 21
+ j4 a& F+ A% ]; _7 U h - #define TCCHEN_SHIFT 22- i9 S6 f: q' s, v J
- #define ITCCHEN_SHIFT 23
* g% u4 v- J) U& b |2 G5 ?* y2 |
4 s, G2 G0 N8 B0 L- static volatile int irqraised1 = 0;
* |, V8 ?2 m% V - static volatile int irqraised2 = 0;, w; M7 x C+ z$ D8 D% h% x8 |& _
9 L" A; ?/ O; _ u0 x8 {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* |2 U* I, }4 r# ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( Z K7 X5 \# S0 c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% s% b' D" E! r) ^8 |: w
9 i- G1 M, g, ^% z4 u- dma_addr_t dmaphyssrc1 = 0;( u: P7 ]( |& M, o; i/ ]( `
- dma_addr_t dmaphyssrc2 = 0;
( N0 F6 p2 S+ E1 _ - dma_addr_t dmaphysdest1 = 0;( s7 S: _, E/ y9 j& E$ }5 b. V
- dma_addr_t dmaphysdest2 = 0;
7 a) V" u7 q8 ]; U+ ` - 8 e( ]: R# X- P" | N% b
- char *dmabufsrc1 = NULL;
( n& D9 _) z) ]+ l/ i. Q/ E - char *dmabufsrc2 = NULL;
' r9 b' D3 I5 d. ^$ x/ A - char *dmabufdest1 = NULL;
, n3 ~+ n1 |) O; }5 ? - char *dmabufdest2 = NULL;& t% ?6 o4 c3 I( V1 i% h
: A# [/ B. D) p) q/ v8 ~9 X' ?- static int acnt = 512;
( {& g6 l0 C, u. b" v - static int bcnt = 8;
7 N5 b2 @: ^% D8 Q - static int ccnt = 8;
( ^, \3 m2 k% Z+ K
$ W( [ c8 P9 y, U/ n- module_param(acnt, int, S_IRUGO);0 f2 N! {+ P _# z" O
- module_param(bcnt, int, S_IRUGO);
6 L9 R0 |3 m Z, v - module_param(ccnt, int, S_IRUGO);
复制代码 / I& v# J8 c3 |; ^5 j
1 Z" d( C" @! F1 ]% k- u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% x8 e$ K* v) R- N' marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! X; |3 ]: |& ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, W6 n K1 x! Z, U, d; \$ v
4 e7 L8 {* y9 C* L0 [7 c* A) }3 S/ u' B3 e. {9 {
|
|