|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - g; b2 N8 b/ @8 K2 g
- [code]EDMA sample test application9 D! l. g) y% S/ [$ I
- /*4 ]. _* Q2 `" H
- * edma_test.c
% U) ^+ h/ r* t; p( J - *
9 R" h. P* v& u1 F - * brief EDMA3 Test Application" x( z6 V5 m+ {: @6 S$ Z8 L r
- *
5 y5 G; m B3 c& f2 C! F - * This file contains EDMA3 Test code.
1 |$ I z& L7 r F: P - *
! W9 S' o- \& X+ Q* t, N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! A) S4 l. J+ u* p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% L) I9 x5 m, W/ z% N `: U - * TO CHANGE.5 i E0 d; y; [9 u4 g# n; E8 B. ]
- *$ e( k/ v2 `4 m- h$ i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 k) J2 K. _- c3 c x2 y" ?
- *
6 [. r. G2 q6 z- F+ h# Y" E - * This program is free software; you can redistribute it and/or
* t+ V9 o: H6 D8 U/ ~ @# q0 y" t) e - * modify it under the terms of the GNU General Public License as
t P r5 p; [4 F; F }0 g - * published by the Free Software Foundation version 2.
7 C& t; Z; X' l% S' B - *# s4 Y& g1 a9 l; [" ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; g% f8 w. L' y" R5 m7 w* z5 i
- * kind, whether express or implied; without even the implied warranty
% k7 H ~2 Y' [2 S2 p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the l" y# e4 ^( X* `
- * GNU General Public License for more details." F- q3 u) u( I2 Y
- */
; u( L2 M+ t) F/ X% l - / k6 e0 u o4 s/ ~2 w! f: [
- #include <linux/module.h>
6 l% I7 {- S1 c! C8 p! O - #include <linux/init.h>
3 ~/ Z0 W" \& h; _ - #include <linux/errno.h>
- e) @+ g5 v, w1 K/ H - #include <linux/types.h>
" _9 g8 _# G# q' \( A7 O/ Z - #include <linux/interrupt.h>
+ \- z! c' S+ d1 Q4 T1 l - #include <asm/io.h>3 Q( s2 T9 [5 ], o- V* C, a- d
- #include <linux/moduleparam.h>
$ \$ \/ m/ L9 P* g& X4 p H - #include <linux/sysctl.h>- v( W% l' z5 r
- #include <linux/mm.h>+ l8 ?# H9 }% k3 |) I/ b
- #include <linux/dma-mapping.h>7 l2 ] E8 r' R2 U# @) ]' K, g4 {
0 f2 u$ O+ I- a1 }( [! c- #include <mach/memory.h>
. H( n. L# p6 c2 n6 s - #include <mach/hardware.h>3 A5 R( r% C5 g7 d
- #include <mach/irqs.h>6 j2 S1 F1 Z3 f! B' I
- #include <asm/hardware/edma.h>
) ~! E, {; R; d) W2 d - 2 s$ o1 L! ?+ e% d& J" |
- #undef EDMA3_DEBUG$ @# Q' R& h3 A+ R/ A$ @7 o
- /*#define EDMA3_DEBUG*/
" O7 m* |- _7 Y- R
, A% M' I3 W/ d5 Y. a- #ifdef EDMA3_DEBUG
6 Z' {% @$ U! T2 Z6 @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 S6 ]9 n2 L9 u; F2 n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% X/ f% V5 p& K9 l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% S& o, V1 h- E# ?2 F( ?
- #else1 w6 d- c1 \) t8 ?* i7 u$ Z
- #define DMA_PRINTK( x... )
# Z" n2 Y5 S) d. O& j# i: d - #define DMA_FN_IN3 Y; m/ L( |: I; K1 l: H8 F$ h/ o
- #define DMA_FN_OUT
6 b3 b! `6 C" R0 w, d8 L5 ? - #endif0 o3 o1 M' \' ~7 j0 w7 s# K
- # r) K2 y' v% d5 L" J7 q% w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
p8 H3 P5 a4 N5 c6 r - #define STATIC_SHIFT 3
3 x7 w* [ t5 ]8 X! K! U% `, U8 M2 Q6 X - #define TCINTEN_SHIFT 20
1 {& [8 {4 l$ P1 ?7 D& ]3 \. u+ \ - #define ITCINTEN_SHIFT 21* }# I) C. m1 x/ a0 h
- #define TCCHEN_SHIFT 225 t: }- e' m# }5 C4 [+ E
- #define ITCCHEN_SHIFT 23' d5 x4 p6 x/ a9 ]% f6 }
- / B) M+ k" [% \# q) b7 B
- static volatile int irqraised1 = 0;
+ F8 H4 N9 C W1 Y: }# O - static volatile int irqraised2 = 0;
, h3 N( B0 `$ ]: t
7 p( \% ? f/ Z+ |; J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 {2 [2 m6 x& r5 U+ A& D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 j ^6 |: u" x; f$ m! g* `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 M2 Y" x5 [5 L G2 K' @
* m# p; A6 R. m) @( d% S0 x- dma_addr_t dmaphyssrc1 = 0;
9 Q* L1 S2 [. g" j* ] - dma_addr_t dmaphyssrc2 = 0;
& F8 k8 V' \/ A - dma_addr_t dmaphysdest1 = 0;2 |3 j6 m* v3 a0 t
- dma_addr_t dmaphysdest2 = 0;
3 M3 S$ A3 @5 T: u8 u" O
$ r" I7 W) t6 R# j z0 `- char *dmabufsrc1 = NULL;; C2 t9 @6 f" h! m
- char *dmabufsrc2 = NULL;# C8 n$ }6 R3 W( ?& U& b2 Y
- char *dmabufdest1 = NULL;2 M' U8 _2 k6 f5 L' G7 \2 H
- char *dmabufdest2 = NULL;
5 R4 X" `, C7 Q3 J0 G( Q H2 z
$ l+ |1 Z4 A2 m3 \7 T4 F- static int acnt = 512;
6 z: D# H- @! t4 b - static int bcnt = 8;
3 A9 O3 b* B+ a. M - static int ccnt = 8;
4 G) z" P- Q( z' N) l$ K0 r7 ]3 i - / e$ i& t: Z3 b" A( o+ n) t/ q
- module_param(acnt, int, S_IRUGO);
1 T9 v. F+ X9 A - module_param(bcnt, int, S_IRUGO);! h2 k8 ^; t% Z0 S1 U9 D
- module_param(ccnt, int, S_IRUGO);
复制代码 , C" S! k0 R/ k( X2 P$ g0 h
) j) P7 ~4 {$ V. ^. k" _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( ~& [1 Q g( j# e' [" J$ S0 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" b. \" H' y- p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 R5 N9 f* R7 n1 i, R* |. I) u/ F4 G, b! W# R
+ H% a( N$ O2 e9 n S }
|
|