|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: ^- ~% {+ | _/ F4 y- [code]EDMA sample test application1 S( H) f6 E2 Y8 B, l9 o! ^2 }
- /*
, \+ o; U; c; ]& ]0 a( k - * edma_test.c
/ P* c2 }# B' K0 G. \6 p0 }# i - *7 n) I& k: C4 U, Y+ G
- * brief EDMA3 Test Application
0 _/ R5 c" [, U - *6 ]) n- a- p2 U8 Q* ^
- * This file contains EDMA3 Test code.+ c+ y. A. y% }. K
- *2 [( e) x7 V1 @5 E& d1 }% W3 p2 K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) D/ I# r2 l. K! F/ }# g$ u4 T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ j! F7 j- i4 ]- c
- * TO CHANGE.
# S( r$ T o- s# c$ F+ }4 g5 i# A0 K! Y - *
3 B) o `3 F# `) l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 G/ t7 }' d& e2 {2 b* A
- *
3 d5 A6 P7 c- S" u+ G) u - * This program is free software; you can redistribute it and/or
3 L3 D8 B" r: J$ r5 d ^ - * modify it under the terms of the GNU General Public License as
6 L8 O8 ^+ b) [1 [% s - * published by the Free Software Foundation version 2.! n9 d5 c3 z" O& a% d( o9 p( W9 F) E
- * M; N% q( ~% ~: c* t- q" ?6 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 m3 ~' ^$ Y# ?" R1 U' V5 ~
- * kind, whether express or implied; without even the implied warranty
4 j* i* ~" p8 G) B8 g6 j4 b, P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! j2 r9 H/ O2 ^% ?
- * GNU General Public License for more details.
4 Z4 j/ _, r" J) M4 V - */
7 o9 }0 G: G, @3 t5 U' [/ A! z% J
# ]5 `9 y; Z' M% n9 A& n. B* T- #include <linux/module.h>) c+ v3 s0 z: d9 ~. \& y
- #include <linux/init.h>. H2 A- p* i% `& B# K- q
- #include <linux/errno.h>
1 X+ B3 H2 C4 T; Z( j( B - #include <linux/types.h>+ ^( [1 }. @1 Y2 _0 ~' [3 k
- #include <linux/interrupt.h>' p! T E; E/ n# L* q, l# p
- #include <asm/io.h>
/ k {, R% ? k0 r" U3 T( d - #include <linux/moduleparam.h>& I. }7 P$ K8 ?% \: r
- #include <linux/sysctl.h>" K! r& ~% R0 O$ j4 r+ J4 ?& Y
- #include <linux/mm.h>! U- [4 d6 K$ O" y9 b
- #include <linux/dma-mapping.h>! A+ p. X; g! B) e4 k
* h0 P, T) j9 i2 S- #include <mach/memory.h>
# \6 m l# R$ T, r9 u& {; l ^+ I - #include <mach/hardware.h>
( t3 r# n. {, P# t6 {! |" U! X0 B' k) E - #include <mach/irqs.h>9 n, N% g5 ^# s: L. [7 M
- #include <asm/hardware/edma.h>
3 n+ O& |0 k. ~' g$ p# N5 t1 c, N - 3 e# P# s+ L& m1 r) M# J0 w
- #undef EDMA3_DEBUG- e2 B4 i! ?- G" f, U0 p
- /*#define EDMA3_DEBUG*/6 t- R d. e' R4 @3 o! }$ y4 a
- : {! L7 p0 c3 L8 F# a
- #ifdef EDMA3_DEBUG
. m" |; M% P* [, H* o; Q8 A/ E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). d- D9 g* U9 u; Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& F4 q4 D5 d) l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& i( v; e) b1 d1 Z ^
- #else' C, O9 Q! Q. n, O7 S; m
- #define DMA_PRINTK( x... )3 e9 U# ~- D$ Q
- #define DMA_FN_IN
+ c7 L. x* ~: M; O3 F3 D6 q - #define DMA_FN_OUT) o& c3 U/ ]3 v& z3 O* `
- #endif5 o- v; B) q* f' Z5 X6 ~
( E: G6 v) u, D, E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 N* E: [# I0 m! {
- #define STATIC_SHIFT 3
9 k. o- T ]8 M7 d" W - #define TCINTEN_SHIFT 20/ E) T5 M2 |" o B. F2 i
- #define ITCINTEN_SHIFT 21
% f7 Z! B9 H4 ~ - #define TCCHEN_SHIFT 22
% ?1 B& F) f- e% M" W - #define ITCCHEN_SHIFT 23
0 b( l% c u! s4 s
T& g! _! V6 \; }- static volatile int irqraised1 = 0;0 D) P# e3 J2 k' L
- static volatile int irqraised2 = 0;
2 D/ q/ h' `# P - * ~9 f8 f3 ? y- ?! L! W$ Z* I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 r8 X% @; j3 n( X* l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ O! s+ ^) m# H7 W1 O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- o8 K7 {& ^7 W5 R, r5 K - 0 J- H: `$ o2 K, S! b: X
- dma_addr_t dmaphyssrc1 = 0;& L" |) r5 W$ R# X! r4 n
- dma_addr_t dmaphyssrc2 = 0;
# ?3 ~7 l5 y) l' O% g - dma_addr_t dmaphysdest1 = 0;
/ h+ k% S* B5 K, E. r - dma_addr_t dmaphysdest2 = 0;
9 ^3 J: U- o' S$ m& ]2 ? - : Y! L, q q6 c0 N: Q3 C
- char *dmabufsrc1 = NULL;* j8 x T" S* {$ h, l9 W& a
- char *dmabufsrc2 = NULL;
' _5 }; a# b0 `" b. s - char *dmabufdest1 = NULL;
% a# e* x/ ~# v9 S. ~ - char *dmabufdest2 = NULL;# v! i! p: t! B# ~
- 4 Z2 m; y! ~. V7 E+ j7 C
- static int acnt = 512;5 z; ~" s3 k+ n* A: b) J
- static int bcnt = 8;
7 k: U5 v1 }4 K: N Q1 t; N4 m - static int ccnt = 8;
; s9 t% ~) {5 n
" J( |- p' _' }2 c, Z# w! o8 V- module_param(acnt, int, S_IRUGO);
& }- R5 E' U' M! x; ]- \6 t - module_param(bcnt, int, S_IRUGO);9 w$ U7 r/ x2 R9 ~2 K5 Q
- module_param(ccnt, int, S_IRUGO);
复制代码 6 i- ]) w0 X! [. l. `* U
1 V9 y: W2 ]! g- `4 @# I: T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; y. f. z' X7 y* P/ P, qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 W/ Y- M, v3 i4 B2 t8 C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 ]; G0 e$ \# |9 Q! e. K% Z& b5 J5 U9 ?( z- ~3 @6 Z* X& t. @
5 {* f7 E# }% v1 I$ |9 n
|
|