|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( O( d- J6 z* O& ?- H* d
- [code]EDMA sample test application: f6 Z4 N1 Y6 r! A# p; w2 Z
- /*
- Z7 M3 e. d. V2 A, ] - * edma_test.c5 _8 x; b2 y F' P: s( ~- F' a
- *
0 j. C, a. t& l# t) w) W - * brief EDMA3 Test Application7 R, R5 V+ ~' _/ t
- *$ I% b- h4 p, ^
- * This file contains EDMA3 Test code.
$ c: a; ]. m6 R8 p - *$ \& E2 Y% R5 d/ M, D6 n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" q5 s' V1 t8 L$ L V4 V( _5 G* i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 N- E( R K! G4 {( ]9 [0 U* F
- * TO CHANGE.4 X6 ^" h$ g7 a5 D- C
- *; w. D$ |% @ V3 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% v4 u T) k7 |1 ^! q) o+ z2 C - *
% B; L; c" U- |- z2 e - * This program is free software; you can redistribute it and/or
/ u! T+ y0 g8 V$ E! ` - * modify it under the terms of the GNU General Public License as
$ J% S/ J* y3 b4 A) O* Z: O - * published by the Free Software Foundation version 2.& I% p' y' i' m3 k4 R
- *% H4 V- q* @, f2 t. x8 z) I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any R7 q2 _% d5 s) F; ^$ H
- * kind, whether express or implied; without even the implied warranty. N/ p) Z- J7 e4 _, }. m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f3 c# V) [& O! Z% T+ _8 h$ D, h7 F - * GNU General Public License for more details.7 a4 u/ v/ B- z5 z2 W4 u
- */* K1 H% X; d; q% a' @) _8 a5 S* ^7 m
- 5 n; n p/ p5 t# M
- #include <linux/module.h>
! v" A4 ]! w/ [% _, C% H% ^6 r - #include <linux/init.h>2 K8 t# y6 a* i- l# I& O7 F
- #include <linux/errno.h>! c0 z. D7 d/ a/ v4 E7 T, D! K- }" p5 T
- #include <linux/types.h># b0 k8 Y) ?9 e$ q1 Z
- #include <linux/interrupt.h>
0 y( m3 I8 J0 Z% F! D$ X* \ - #include <asm/io.h>% p8 ^/ ?( B) e8 w
- #include <linux/moduleparam.h>
, R6 w0 `" Q. ~7 [. W - #include <linux/sysctl.h>
- j4 Y$ O \. m - #include <linux/mm.h>
( T; S1 R$ N1 l" l3 T; l" ^; J - #include <linux/dma-mapping.h>
! n# M5 f5 X% e. v4 `
, ~6 R- b4 b. {( F- ]- #include <mach/memory.h>
2 X" e3 r% D& P0 L7 O! E - #include <mach/hardware.h>% j6 @6 o! P9 M% t: X
- #include <mach/irqs.h>
: g! o9 M- N: _8 _6 r. L - #include <asm/hardware/edma.h>" u. j: o+ U. E# ~9 ^
- 0 ]9 t% t L5 k3 Q- e$ \
- #undef EDMA3_DEBUG
* d/ c) w# N* H, w f - /*#define EDMA3_DEBUG*/
n) {- `, ~* e& X7 U& w - / n6 I6 C5 z( H6 [5 H% e: _+ f
- #ifdef EDMA3_DEBUG
1 u! T" R1 q; l' u" D+ x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 Z! s% ?+ O6 \( t8 W# ?6 ~0 c- `8 b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 ]) J; u% k& ^7 G( y7 {* R' @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 P- g* K( l5 Y- ?' H# }' u+ @) u
- #else/ v6 a/ E$ O( I6 Z% E5 U* I8 Q
- #define DMA_PRINTK( x... )
) q$ l1 d8 s+ L5 n - #define DMA_FN_IN
' }+ u4 U. I' W4 U! Q - #define DMA_FN_OUT
3 j: N; k a+ ?" o- w+ {+ m - #endif
" L/ x% s- Q; w- Q - % r4 I. n' b5 Y# G0 n. }. s0 E; `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 x6 ^4 f+ Q1 K: g0 d
- #define STATIC_SHIFT 33 t9 g1 k; C* [+ A. y
- #define TCINTEN_SHIFT 20! g3 ^# n. K! @' w1 g" C
- #define ITCINTEN_SHIFT 21. s @. U% U; U9 ^; p. w
- #define TCCHEN_SHIFT 220 x" w( g$ H; l2 b' q
- #define ITCCHEN_SHIFT 23
* F. w5 E P r" Y/ z& ]7 o - ; J9 U7 J9 K7 w c& n+ e
- static volatile int irqraised1 = 0;4 O9 w4 m. p6 J; ?5 E4 S j! O
- static volatile int irqraised2 = 0;) P' X1 u; G9 U* N& D
- $ R7 ^ y, k; }* j6 o/ M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, e6 b1 }- b/ V/ N! X: L, Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 K% j0 b- G0 k4 Z% |) u5 h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 f) z/ v. y! ?" R9 l" n
, u+ s3 `8 B! w1 V% w q- dma_addr_t dmaphyssrc1 = 0;1 n3 ~1 V- F Z; Q
- dma_addr_t dmaphyssrc2 = 0;
+ ^) m& X/ u* R& k1 Y6 n - dma_addr_t dmaphysdest1 = 0;2 y& P4 P& L" c$ v8 \
- dma_addr_t dmaphysdest2 = 0;+ N) J0 E- e8 f O. e
- f# f+ E: g/ u$ A" x- char *dmabufsrc1 = NULL;
, s" D* b B7 Q8 S @7 ?' w# l4 u - char *dmabufsrc2 = NULL;! l* E/ a- u8 r9 V
- char *dmabufdest1 = NULL;1 Q1 B' {2 V. `; t! S' w
- char *dmabufdest2 = NULL;
8 y. \/ @0 y4 ^( R" K" A- {
, O/ s: ~/ K# N0 ?& D. A- static int acnt = 512;
# x0 O9 J; p, i - static int bcnt = 8;+ \: }: ]4 q w9 k8 {
- static int ccnt = 8;
4 t. v# E' e. ]% K1 j# a - 3 V' u* U& x7 y- s# |9 z8 s% E+ e2 j
- module_param(acnt, int, S_IRUGO);& c7 o: ? L `" X, N3 m1 E
- module_param(bcnt, int, S_IRUGO);
. f, x4 B, l- a; d+ q$ G) K - module_param(ccnt, int, S_IRUGO);
复制代码
/ ^# ?1 H4 ?6 t! Z
a. A" Q, D" ?6 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 e6 a. [. `; L+ X
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 O8 O& ?4 p. u0 m; j& [1 ~; r" x5 Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 E# R7 H8 m9 Q. d; o% [
4 Z! b. T7 [2 o/ Y0 `2 |+ g+ e0 n
: [" ^+ p7 ^, ^1 U/ ?6 E |
|