|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' e3 e* T" z6 D9 [- [code]EDMA sample test application" K5 h( D0 j" H
- /*! }4 s7 X& i6 V
- * edma_test.c
- c c0 Q+ ]7 Z4 q& M! H - *' U0 k; d7 q0 k
- * brief EDMA3 Test Application
8 w! s( u8 k8 }% k3 ]9 |' _# e! I - *- v7 I$ X* ^$ [" A& n% Y
- * This file contains EDMA3 Test code.
9 q+ q+ E2 g9 z8 L) @! T2 L0 f - *, D8 X5 m4 Y7 w4 w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 {' |1 u3 ^, C( Q/ C; d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 A4 a, _1 [& `3 Y+ G
- * TO CHANGE.
0 H0 |2 ]1 e% g* }' c& \ - *
! v9 [5 K2 G3 h3 z$ K( U; a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 O L; t! u' z - *+ D. n# {! Z; {2 v* C
- * This program is free software; you can redistribute it and/or
1 O2 |! \% ^" k - * modify it under the terms of the GNU General Public License as
( ?, L$ u9 ?7 @! z' y - * published by the Free Software Foundation version 2." Y( }5 v& v7 m: ?: o0 d
- *$ K4 O# g7 g+ w- S3 y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) n) C, `4 A, Q' M$ r) p - * kind, whether express or implied; without even the implied warranty
) K- m' D# C+ \3 A! r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 R7 p7 l* P" m! y/ z* m - * GNU General Public License for more details.5 b8 K" b+ _0 q) ]7 y
- */* |! K1 z9 \. O1 F: Y9 w9 D! N- W
- + p7 N1 n' V6 D1 y+ e
- #include <linux/module.h>
& Z5 J* ~' ?4 f' z+ o9 J+ R+ M - #include <linux/init.h>
+ d U, Q4 P4 Z" P - #include <linux/errno.h>5 E* r: U. W) W U; C o% y. q
- #include <linux/types.h>- o L H$ I V D% l7 \! n1 \
- #include <linux/interrupt.h>
# n4 n+ r' U+ w( J) p% L& I" F2 }% b - #include <asm/io.h>
. n$ ~& L! i2 T8 G: p - #include <linux/moduleparam.h>
+ N% q+ H- f2 V! ?3 \+ b( w - #include <linux/sysctl.h>
5 w% C* I' |2 B- g( m# l - #include <linux/mm.h>
9 Z* B t0 \- x1 t - #include <linux/dma-mapping.h>3 b8 v* u& B Y* r; F4 @ Z
0 O2 \( U+ U2 c- #include <mach/memory.h>
" r; `: l4 Q# U - #include <mach/hardware.h>! h5 p# q* d; N5 c: @$ d
- #include <mach/irqs.h>
0 _# [. ~# x1 Q' C% W - #include <asm/hardware/edma.h>& Z" I/ z/ R& u/ K; ?
! R7 R ~( n0 Z) P3 w/ R- #undef EDMA3_DEBUG$ i* J" q4 \9 Z& P# n
- /*#define EDMA3_DEBUG*/% A, T9 i! ^' r) N# \8 }
( S4 u$ G+ H. g& r5 }4 i8 U6 }- #ifdef EDMA3_DEBUG- _ X, t1 ]4 }& M* O; B% Z D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 I, c# m8 u# n8 q6 _, G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ {0 P! v" ~7 o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ [/ o. w, `3 i8 y" Y
- #else
0 H/ U k; \/ \1 a - #define DMA_PRINTK( x... )
2 N K7 \" h" C5 C; T3 g _ - #define DMA_FN_IN' @/ u/ }0 U+ N
- #define DMA_FN_OUT
' `$ q2 f: G; j) ? - #endif
9 P3 l! h- j7 n3 s# r" y - , e" @+ O6 U2 p* v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); `# S z5 C& ^4 l) S1 E& z1 n
- #define STATIC_SHIFT 3
0 n7 o: x$ h# X2 J4 |* Q* ?+ Q/ w - #define TCINTEN_SHIFT 20
# }( H9 O/ a; p% i! L, [$ E/ c - #define ITCINTEN_SHIFT 21- F9 P5 k) h7 Y4 W+ p
- #define TCCHEN_SHIFT 22# i! X) N0 i$ J0 x) J( v
- #define ITCCHEN_SHIFT 23
6 r6 S2 G8 p2 _- I- ^7 `5 q" C: S - K3 r9 Y. m/ D+ d, R
- static volatile int irqraised1 = 0;
% u7 l: f) I; ]# D( I" j/ J - static volatile int irqraised2 = 0;
0 c& Q: H( l! o - ' H J* ?( E6 }8 T1 a, V: J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" y+ ]$ V- s+ E, F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* ^+ k, r# ^4 i, N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 n: s3 e/ V2 ^. m! s
- 0 e0 m3 G0 }! M
- dma_addr_t dmaphyssrc1 = 0;# h" V! X" P) i! _* v- |9 Q$ W: e
- dma_addr_t dmaphyssrc2 = 0;# v. y, A1 Y" c7 J0 v
- dma_addr_t dmaphysdest1 = 0;
) i& p: k1 _. x5 s5 j2 M0 t - dma_addr_t dmaphysdest2 = 0;
; S( I3 \5 X2 _9 T# M* ^, G - 3 {4 [0 g& }8 g! G
- char *dmabufsrc1 = NULL;
' i" [# D. B: }& R% v3 C - char *dmabufsrc2 = NULL;( Z1 {1 |( g) h) W, Q. @$ ^6 ^" o
- char *dmabufdest1 = NULL;! L( w; k7 k0 G; x% x- ]
- char *dmabufdest2 = NULL;$ E2 @/ i6 V1 J% O$ D
! \3 ` t% F- S: ?- static int acnt = 512;
9 D6 O4 P: G5 e% N3 l - static int bcnt = 8;9 `/ _3 P' T! ^6 D& g; R% X& G. e# l7 U
- static int ccnt = 8;
+ L3 z4 x( l, }3 G9 L2 w
5 }' U9 ~+ r4 k, w) t) r: g- module_param(acnt, int, S_IRUGO);( I9 S5 H3 J1 Z$ }7 Q: ]' q
- module_param(bcnt, int, S_IRUGO);/ W) q( t7 b, g; [7 E
- module_param(ccnt, int, S_IRUGO);
复制代码 3 x% ^' b: R0 t& ^9 T
% d' P! `/ @% r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 T% d# \2 y; D% D4 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: ~4 M- ]3 j$ S: O3 t* O& M" c; g5 S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# {2 d; }" c) p5 f' l2 Y
6 Y' j$ F F% M C% M' I
1 B, I, ~+ T! B0 s& I9 p |
|