|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ Y2 N0 {. [- J- [code]EDMA sample test application
3 C8 [( N- ?: M3 k; @ - /*8 W: z( k+ Q2 \% X' t
- * edma_test.c: N# a: W6 T* ?( Y5 W9 u
- *
3 w2 X M( y1 q4 c8 h% V, P: A. } - * brief EDMA3 Test Application
0 P1 j" h1 L4 H' u8 \" c& k6 ~4 U - ** O8 |1 t2 J. x6 {
- * This file contains EDMA3 Test code.
" X4 S( \% C: l - *
4 O% D6 H& m U1 c9 n" f1 a8 ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ L: w$ ]8 ^- N: ]% |) k! @1 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 m* J8 {2 j. Q) q% B3 N
- * TO CHANGE.3 I# ^1 `- D( [9 j: Q, x" R9 t' b* m
- *
, L% ]8 _' k! w3 g7 [% M8 j7 E8 {5 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- u7 f1 Q, C" u8 U: S+ K. n) e1 X* k - *
" r- y c' U" o' F/ I- J7 u4 K% ?4 L7 d h - * This program is free software; you can redistribute it and/or
- d$ S0 V1 m( q! R- Y, _ - * modify it under the terms of the GNU General Public License as
* y" z# J8 G3 x3 }& z4 P3 B - * published by the Free Software Foundation version 2.9 f9 m0 h% ?% I# ^
- *, `' B3 ?" ]6 c, R; G- q) i; `7 n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 G/ q- A# f# R/ _. S
- * kind, whether express or implied; without even the implied warranty. c3 @* K I3 F- a" t) z+ C n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# g: _$ L: [" B# q* u8 l; k - * GNU General Public License for more details.: d) F9 a9 e& e- [2 \* y+ o
- */
8 b$ t6 i$ D$ N2 X. z
! D, b ]( L5 A) l) a4 I- #include <linux/module.h>" j+ u; L8 s+ w4 z- r
- #include <linux/init.h>
. P1 W9 f4 N0 q' |% o - #include <linux/errno.h>9 L% _, t2 _3 N- x: s
- #include <linux/types.h>
0 |& d$ a/ Y2 q8 Y) |1 a4 u - #include <linux/interrupt.h>
& ]' s/ F1 G/ C6 v9 {0 R - #include <asm/io.h>
! ~/ E8 g8 a7 _+ p' u - #include <linux/moduleparam.h>; F2 u9 \, }% i2 v- P; T
- #include <linux/sysctl.h>
/ ^3 Y2 p1 H# S5 n) f7 i - #include <linux/mm.h>
/ `" C1 f9 L6 T1 ~2 ~+ q' { - #include <linux/dma-mapping.h>' Y" z5 L0 b1 H; a
2 O7 c/ N7 u8 b E0 O- #include <mach/memory.h>% C! G' {& ^3 ?5 ]* K/ |
- #include <mach/hardware.h>5 `* Y! e! t Y0 M! X2 ^% b
- #include <mach/irqs.h>
2 w) {2 p0 P Z# l - #include <asm/hardware/edma.h>
" T& S2 P9 {, c, S! R; T1 |' O - 5 b* ]7 _0 Q' C; J0 _
- #undef EDMA3_DEBUG
) T6 u+ t, o' J - /*#define EDMA3_DEBUG*/$ m( O4 p* Q+ [1 m# C ^6 n
- 9 @7 }2 |% e3 J4 Y$ J+ S
- #ifdef EDMA3_DEBUG( M+ m" Y) t( u6 w/ J' [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). Y* b; v; t s) m) N* p7 g( H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). ?0 c) o6 Q/ B- Q" D: r8 F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) {% v- k0 }! U7 ~
- #else
9 A3 u( q% U0 o5 t( [5 ^2 R - #define DMA_PRINTK( x... )
* }& c D- X: P" c$ v& X h - #define DMA_FN_IN
2 `# M' f$ S# Q3 t. u. h - #define DMA_FN_OUT
; j+ \7 j4 N2 l2 F0 p5 |! `9 q - #endif
5 _" K9 n$ t9 ~! g1 [0 n
, u& @- w5 C- Y: t9 m0 m( y# F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 |7 z* H8 g( W0 M, n! C/ U- v, X- q
- #define STATIC_SHIFT 3
5 K* f* N+ p7 f: @$ I - #define TCINTEN_SHIFT 20
5 k) `: t9 _1 t4 N) u9 n - #define ITCINTEN_SHIFT 21
/ I' V+ j2 k y+ N! Y) s5 x - #define TCCHEN_SHIFT 22
8 ]. B# _# w9 o2 { - #define ITCCHEN_SHIFT 23
6 J: V& D6 n' s8 E1 U M
3 ?; H- W) l: f0 a* G2 b- static volatile int irqraised1 = 0;
. `4 l' O$ m: L7 S - static volatile int irqraised2 = 0;
- n) |' K" W% \- d4 E3 X - ! ~% X* s- q2 }: z" _2 d2 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r+ b7 j7 |0 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m/ _. B$ l! b4 P/ g. C5 ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; b% V: X9 H( k6 t - * g; y6 r8 ]2 G2 t9 B2 u
- dma_addr_t dmaphyssrc1 = 0;5 h% ?. A6 B& o- V& |0 ^* K, {
- dma_addr_t dmaphyssrc2 = 0;
# E8 O2 I6 P$ p3 v% n* N3 b. k - dma_addr_t dmaphysdest1 = 0;
+ v# S* S0 [$ H( S# G4 |2 w* A - dma_addr_t dmaphysdest2 = 0;
5 E) {0 o) B ^$ y2 Z5 ~. }5 I
+ Y& s) |5 N2 T+ H, l- char *dmabufsrc1 = NULL;, h& v1 M* B; b% i$ o3 D7 u% K
- char *dmabufsrc2 = NULL;5 g% @3 G$ M5 Z
- char *dmabufdest1 = NULL;
* w1 {! `4 B1 X- U2 z7 G - char *dmabufdest2 = NULL;' V, i+ {7 b1 y+ I- E# x9 O2 {
- 0 z0 Z9 W- D" ^" K
- static int acnt = 512;
, A: f' X2 u, ^) }( }' w9 F - static int bcnt = 8;3 z8 R) Y# A0 ~+ C. P' q
- static int ccnt = 8;" c& ]# A% |& q8 D4 G
* @ U& F+ M4 h. D6 I- module_param(acnt, int, S_IRUGO);
. s( x5 A4 n; O, @, z1 H - module_param(bcnt, int, S_IRUGO);5 S& K: w; x0 I( [1 A. N
- module_param(ccnt, int, S_IRUGO);
复制代码 5 B" E! b- a6 Q Q& ^* V b
: T9 k2 V( \' e% r, G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* Y% y( z# p$ r# n) b+ P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& m( G) O1 ~( ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' X9 A) s+ u. O6 ?/ [0 \+ x* T* j
1 ?9 ]- e' v: [! l5 b' \2 ^6 D
* n# [& [, T8 q% x6 q7 N l |
|