|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 w6 f/ S" f3 i; O4 @ D' G- [code]EDMA sample test application9 X' \3 |1 {! {5 h a& f. w
- /*
/ p2 [1 t2 c- K) K( }3 O/ h - * edma_test.c+ Y6 W3 P& u9 W; K8 N" _2 s' z
- *
! k# o9 ~% |; a/ {; ]# h) D0 x& y - * brief EDMA3 Test Application
* I% E! [3 R6 k) ]: x' z+ k - *+ V2 P" V; v; _0 H0 k% s- t
- * This file contains EDMA3 Test code.8 T: M/ N+ X2 N1 k# T
- *" g5 k2 w: w; p O( ^. _6 d( s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 n5 [' U5 v. s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 i* u, ^/ j8 s& B" n - * TO CHANGE.1 f- y% C. j# a7 ?9 ^" C
- *; x* C% e2 z/ T5 b, F; b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 i" m: p2 ~: X7 o4 e4 m
- *2 r6 I9 X% Z2 Z) R
- * This program is free software; you can redistribute it and/or
6 a2 ~# P( e8 ~6 M3 y - * modify it under the terms of the GNU General Public License as& I0 n4 q& S, B0 ]
- * published by the Free Software Foundation version 2.
3 k) H( u. L$ h( E6 u3 b/ v. S - *
- F: ~7 A4 L3 M) N. v0 j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 s) f1 b& s9 F, _* R# l7 d - * kind, whether express or implied; without even the implied warranty
4 d% [5 q/ |# O7 i& s9 q9 P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ S+ n. i& l$ l* M - * GNU General Public License for more details.& e7 P1 x' G7 n# N" B3 z
- */
( {& m! Z; Q8 q) c% t& [- z
- [. j! i* `2 L7 R1 b0 m- P- #include <linux/module.h>
4 t7 t! n0 q& i! K - #include <linux/init.h>( T b) j: j) T4 v6 L5 @9 J
- #include <linux/errno.h>: p& T5 s5 u& n$ K* `
- #include <linux/types.h>' ]+ L# n8 m& y/ e0 k
- #include <linux/interrupt.h>6 [+ u* @' ~" x3 V3 S4 _8 ^' k
- #include <asm/io.h>
) A& L* |" g0 w# w- B - #include <linux/moduleparam.h>
( t) T+ l% ]- ]( K3 r - #include <linux/sysctl.h>
/ j& J7 r' R7 a# r - #include <linux/mm.h>" u; l, S, m" j" e
- #include <linux/dma-mapping.h>7 X% f& Y9 s# g; L
5 l; F! F, [5 n3 i- #include <mach/memory.h>( j8 c4 A' G6 g* G+ S4 Q, f3 X
- #include <mach/hardware.h>' s X' \, [1 h' Y( {6 Z9 r
- #include <mach/irqs.h>6 R# H7 [3 m( I; o
- #include <asm/hardware/edma.h>
! q+ U$ ?. R. j+ d& I) V9 Y - " d& g: E# b3 A! F; s" d$ m
- #undef EDMA3_DEBUG
R- f+ T, F% e- {) O - /*#define EDMA3_DEBUG*/3 g7 t2 ^7 ]: R' J: i M
- ( A, j: `: ^) y: Q+ c
- #ifdef EDMA3_DEBUG
# f. j/ `/ h5 e2 S! }3 P6 [6 T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ T j8 Z4 H9 n7 e* O* S9 X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% `& {6 I2 J' W5 M& s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 x2 {# D, n2 }+ T - #else
2 O. T/ I5 g) N - #define DMA_PRINTK( x... ); a! W% m ~) V2 Z) D% \! A, g- X
- #define DMA_FN_IN
2 M& z3 R; V* i2 [/ y; Z - #define DMA_FN_OUT1 R$ u* H8 V5 x5 T
- #endif
0 s1 n# ]) e. h! b
* F) B4 G$ l7 N( S2 Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 k) u6 Z) y! V3 p+ b - #define STATIC_SHIFT 3
( s! f8 n1 S: B - #define TCINTEN_SHIFT 20. C& a0 Z' p" D+ g1 I2 o9 s& f
- #define ITCINTEN_SHIFT 21& b) z' l4 F, f/ I" c6 Z0 H
- #define TCCHEN_SHIFT 228 m* T; s i. Y1 F: |1 S* C
- #define ITCCHEN_SHIFT 23$ F, Y. |8 g; r' k; L
- 1 D1 w: O- i2 g/ q7 b
- static volatile int irqraised1 = 0;3 V' M2 A4 I6 Z. i1 H0 r
- static volatile int irqraised2 = 0;( l8 z2 |. \/ j" N& o% B( |- f2 u
- " `) [( v1 f) J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( l, _& {( X& E1 n! z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! h& `6 ]" i6 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 C1 a# J7 b" t! a/ O/ \9 \* W1 R
0 } [# F/ ?; j: `6 F' X- dma_addr_t dmaphyssrc1 = 0;2 m; [+ H, {* T9 u4 m. R1 Y, p: W) i
- dma_addr_t dmaphyssrc2 = 0;
8 Y8 a& Z$ t# z! }4 D* H. { - dma_addr_t dmaphysdest1 = 0;# {1 @1 X6 @* _9 L7 l
- dma_addr_t dmaphysdest2 = 0;
# l/ p+ ?& ?( B6 _( R7 y, } - ' o+ _2 Z4 H9 R4 p
- char *dmabufsrc1 = NULL;) P, P4 u2 T; _" h' j+ H( c. h
- char *dmabufsrc2 = NULL;( ] w% s6 h1 a
- char *dmabufdest1 = NULL;- {! m& T8 h6 \
- char *dmabufdest2 = NULL;2 e% j0 i% B) S) H# G; B4 v
- 9 p3 d. E5 J V& }. x
- static int acnt = 512;5 I; s r4 w) q' }
- static int bcnt = 8;
! p8 Q& Q+ m$ S4 j2 H+ ~* m - static int ccnt = 8;/ Y! y6 g# }3 p. b
5 A( Q3 O/ C: `/ h- module_param(acnt, int, S_IRUGO);' d' [2 _; z, x2 L, u/ ^" j' P
- module_param(bcnt, int, S_IRUGO);/ Q/ a0 c B5 z: M; f
- module_param(ccnt, int, S_IRUGO);
复制代码 & O* H: l5 W; h* I- p2 s; R$ u
$ ^$ W1 O$ {8 r$ }+ K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 d$ D ]( b# P- Y) x# Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 g7 p! F, g- m& L* u/ v% a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: }8 E, |! Q! _" _% M
: J3 V" \- E2 y# Z4 i8 e
& x y# `0 s' x3 X. M6 x9 o" ~( i: V |
|