|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' E& D; c" h3 v, }: h. F0 a- [code]EDMA sample test application# i6 r/ f" W3 G2 i
- /*
$ S/ T# e! W8 Y# Z+ H# j' u' q - * edma_test.c
" y1 e! }+ R2 z6 ^" H - *
% M7 j+ `( o$ j2 X2 | - * brief EDMA3 Test Application
2 Y6 y. {4 V, l& ^9 o - *( D* t/ x2 s: h5 b$ {
- * This file contains EDMA3 Test code.( F9 y7 C4 `1 L
- *4 q# d" Z8 y3 W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ L( p2 T/ A" T0 T) A- M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ C3 B' b4 M0 L1 m0 W& j' X1 x# Q" l1 o
- * TO CHANGE.
6 H' c4 \- s# I - *
7 H9 Z! Y& `: n. a9 C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: g6 p! K# T9 N" n. P6 F
- *" n0 X, N2 ^/ S$ `; v
- * This program is free software; you can redistribute it and/or
) }7 A# |2 a5 U - * modify it under the terms of the GNU General Public License as. g+ j; z y% K* S6 H- i- O* p
- * published by the Free Software Foundation version 2.
/ J* ~, x6 K7 u - */ A2 O: i, ^6 P ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! X: k7 c" S9 I1 n# C2 U3 G) _ - * kind, whether express or implied; without even the implied warranty# @+ d4 g. Z. m+ X: w$ D/ j N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 @) w. U- r9 t - * GNU General Public License for more details.- o2 D8 z" U7 M! r8 |/ N
- */" V& B0 F2 C/ F1 M
- 5 m5 p. r% P( B' U9 Y; l
- #include <linux/module.h>
: F7 k+ q; p. X - #include <linux/init.h>
) X8 D( k& h$ R - #include <linux/errno.h>
9 b- J! T) A1 R1 r0 Q8 h7 x - #include <linux/types.h>9 f+ h# q |; L
- #include <linux/interrupt.h>( {) f* [; t, `& i: E- y% ^
- #include <asm/io.h>9 h0 H+ Q8 S, b: [( O
- #include <linux/moduleparam.h>' ^, ]& `5 \( H
- #include <linux/sysctl.h>% x, l: M0 D; M
- #include <linux/mm.h>
' ^1 u: L3 d9 D3 @1 N/ V1 c7 N- T& ^ - #include <linux/dma-mapping.h>
6 ?: h$ p: ?6 J - 0 v4 i, o# X+ v
- #include <mach/memory.h>
8 ?+ Z9 ~+ G2 y+ _9 u - #include <mach/hardware.h>
. B V9 Z& y0 N9 @3 L - #include <mach/irqs.h>
3 [& {0 l) `7 H7 _. F- A3 P$ j - #include <asm/hardware/edma.h>5 F& }) N# _ L, q4 K
! z' T3 H9 C3 r- #undef EDMA3_DEBUG; k- D# O# Q4 C3 D, P2 |* X. v& P
- /*#define EDMA3_DEBUG*/
. r4 ] ? L+ Z5 g) Y+ {: w# b3 C - 3 L& q$ B: O" X
- #ifdef EDMA3_DEBUG
3 Y7 M' Q# E2 q) W# U2 U7 W+ y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 B: t% ~4 Z3 C$ F% ^! @# p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 f+ k6 G% i+ Y! f' I5 r* a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Z0 a6 E! b3 W* Q
- #else
( L1 c: d$ f5 k. `4 s; E" m( W3 n - #define DMA_PRINTK( x... )
: ?& ~) K9 J! L' x' a3 o - #define DMA_FN_IN) n' G& T$ G/ m6 r8 C& _
- #define DMA_FN_OUT; l5 q5 _- I4 Y. S) g
- #endif
6 I* e3 T8 g% |1 R) c* }/ S - |; [5 z8 [& z: p# \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 L F/ R0 }" P/ p4 s, X0 K( I( G - #define STATIC_SHIFT 3
% Y Y7 ]' Q1 l; F/ H1 u+ e - #define TCINTEN_SHIFT 20/ |$ D3 N1 Y/ b: ]
- #define ITCINTEN_SHIFT 21
( b e2 B% n- ?0 D7 q - #define TCCHEN_SHIFT 22
. ^& R' Y! e7 M6 R: J - #define ITCCHEN_SHIFT 23+ r2 \. m- Y; Z# I$ {$ W9 J7 c
- . e5 l3 N. y9 l' l9 r
- static volatile int irqraised1 = 0;% `4 ]* p7 h% r: y! W/ {
- static volatile int irqraised2 = 0;
r" V0 p5 B: ~! z/ o( ` - 4 p T5 F* O8 r$ w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( s- c5 a( L1 f- |2 z, c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ E9 @3 C, U" U8 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' o5 U- A i0 |; L3 i5 ^ - % B: } f0 M7 f) A) `7 }
- dma_addr_t dmaphyssrc1 = 0;
5 b; P. r' f$ p: }+ D. k" l - dma_addr_t dmaphyssrc2 = 0;) I' f+ d+ G2 E
- dma_addr_t dmaphysdest1 = 0;
, U3 r# i) q& u$ l9 I% h - dma_addr_t dmaphysdest2 = 0;
3 ?4 l0 U$ h6 \
# }0 R: {! G4 X7 W) Y- char *dmabufsrc1 = NULL;2 d) q z5 h' r$ {# ]1 w b
- char *dmabufsrc2 = NULL;' _" ~0 ?& u$ o7 w
- char *dmabufdest1 = NULL;
0 G8 @5 ]! T6 `+ n, V# m4 @% m - char *dmabufdest2 = NULL;- M# z; {; U4 S8 J/ \1 D
8 `! v U t7 q, T% y' z) b ]* E. J- static int acnt = 512;4 R) G; m- B* O
- static int bcnt = 8;
( _4 p& R0 d6 O/ I3 p S, R - static int ccnt = 8;2 z& o7 U, E3 L7 s. k/ S" g
- , s4 }, M- {3 n( I4 w/ ^
- module_param(acnt, int, S_IRUGO);9 A: ]* T1 u$ Q3 P- F2 h6 N5 H& Q1 B! q/ n
- module_param(bcnt, int, S_IRUGO);+ {+ K8 [- |' `' x/ d) j
- module_param(ccnt, int, S_IRUGO);
复制代码 # O* u. U2 q" W
0 ]5 n% L7 c. Y1 u2 c8 b( S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 O* n: ]! c l0 }% f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: ^! [, b7 C$ F$ T: P5 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- O2 D# P6 b/ E. b$ [
$ ]$ y. b2 z0 c% G) ^: K+ h" r9 w0 d( p, ^
|
|