|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + z5 D7 }/ v; d$ q7 \
- [code]EDMA sample test application
4 k, x- o: v2 X; u4 k - /*
7 [1 Y5 t) y7 X4 D$ y - * edma_test.c1 C. H' e8 `/ Z7 l0 B! E
- *. B2 A6 z+ w5 Z3 H$ |% \
- * brief EDMA3 Test Application% O8 G2 d. O; e9 U
- *1 r* B- w0 L1 t
- * This file contains EDMA3 Test code./ A6 ^, ~' G6 y
- *
3 V4 v* `( r8 p# K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ t3 \. o) s8 Q7 v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 ?8 g6 Z7 j8 N8 x0 Z - * TO CHANGE.3 f- [+ A0 f1 |' F* @. B* f
- *; W }+ Q( ?* I6 l' k! B2 O, V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
A( ?1 f: J; n2 }. f+ v8 a9 d - *
) H" ^4 P# r% r. h - * This program is free software; you can redistribute it and/or
6 J+ A1 r) X( Q* Y/ V" \ - * modify it under the terms of the GNU General Public License as
% I3 h$ C v! i {1 z - * published by the Free Software Foundation version 2.7 G$ a2 t. j" a
- *6 N) D* y; f9 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 T y" \4 |6 }+ H - * kind, whether express or implied; without even the implied warranty- [7 y5 F/ N" x* j- S1 K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 g1 D0 d' J) T4 \" g
- * GNU General Public License for more details.
7 W& n* D" P- I: u/ H# E+ V - */ ]3 E) i9 G q9 h1 b' {2 k9 A4 L
- ' S+ r* I* X6 E* E6 |1 q
- #include <linux/module.h>
4 L( j; Q- ], @ - #include <linux/init.h>: s* O$ l/ I+ C3 H% G) p V
- #include <linux/errno.h>" E) y) ^+ C6 C
- #include <linux/types.h> L. P9 c( C* K5 Q! D( ^- F- w' \$ B
- #include <linux/interrupt.h>
9 a& p1 W/ i/ ^ g4 i- K - #include <asm/io.h>
& |5 m% s% P8 l& J - #include <linux/moduleparam.h>' a: O) w/ [) n- R; Q0 H: Q i
- #include <linux/sysctl.h>
1 W" s1 l% i h) } - #include <linux/mm.h>
7 e# ]7 }0 Z4 c9 K& q5 x# l9 _ - #include <linux/dma-mapping.h>; w: j5 A9 K5 b3 u* M
- + j8 |/ G5 e; i5 q9 @/ z" J
- #include <mach/memory.h>. _6 q% m, y4 B' R( |# T- i5 F
- #include <mach/hardware.h>
$ F( Q2 \! ~ U Y ?7 a% J) o1 M - #include <mach/irqs.h>
( R1 B6 r' O1 q2 F s1 M8 F7 i1 Q - #include <asm/hardware/edma.h>% r, U4 p4 T/ Y: _: M3 w
% f# N9 }* z& h2 l& \6 `- #undef EDMA3_DEBUG
/ v7 \" K# T4 y( P' ^% a; \ - /*#define EDMA3_DEBUG*/9 i# t9 e) K) I; O
- + E0 Q5 W- v* S+ R! y) P
- #ifdef EDMA3_DEBUG
; `! @5 H. }# [- S/ T3 j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' x: V3 o- F% Q& Y/ b; o: h7 S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 b5 l+ M4 c" `( n9 v0 d* j2 W& `1 Q* O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 w5 J0 z% L0 O$ n - #else5 [8 O2 c0 `0 ?* H: e( P
- #define DMA_PRINTK( x... )# `1 F/ Z/ |8 e7 D
- #define DMA_FN_IN7 V6 M; g2 {: g7 G
- #define DMA_FN_OUT
1 {3 Z2 K4 z" z3 s5 t4 M( v' F6 K - #endif5 H) E3 t2 ]9 a% Q4 O2 I ?3 E
- / t7 x" L& Z* u, e1 W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- ]& m0 W$ X* k+ b7 v - #define STATIC_SHIFT 3
& w4 d) R# y4 U$ [8 } - #define TCINTEN_SHIFT 20" I5 l) L4 h F) R6 ^
- #define ITCINTEN_SHIFT 21" h0 Q% v$ u2 ]2 |+ i3 H
- #define TCCHEN_SHIFT 22' k" J! @" `0 b& \+ g
- #define ITCCHEN_SHIFT 23) Q& `& q3 m! i' n, H& n
- 7 _# c; T2 o7 a/ S% V# V
- static volatile int irqraised1 = 0;9 b! I* H* L. C* \' ?
- static volatile int irqraised2 = 0;2 o: u- e- C* c! a3 h0 D+ s
$ D! `* t- A# Y( a' ?, |) \6 {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 j& q$ G [- o7 k K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) L% P' I+ O+ y8 I# H8 u6 \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) \& C' u+ G) D* M# y0 @+ V - % l. m) ?; b8 u' e% z" ~, M
- dma_addr_t dmaphyssrc1 = 0;
/ V9 t6 g$ {0 Q; e+ a- ~ - dma_addr_t dmaphyssrc2 = 0;- K; ]' k! L# F9 ^! t% e6 E
- dma_addr_t dmaphysdest1 = 0;
B% P' S k' e - dma_addr_t dmaphysdest2 = 0;7 \3 v1 t' _& K' t6 R/ S
- 7 M- u' L o) ^
- char *dmabufsrc1 = NULL;; p \! W% t5 C9 P( ~. E0 L
- char *dmabufsrc2 = NULL; y# V3 y5 g0 \3 B1 {/ w
- char *dmabufdest1 = NULL;# e" s# k6 e+ ^5 R
- char *dmabufdest2 = NULL;
$ h D# A/ }' D
% h/ W% R' N5 y1 ]4 \- static int acnt = 512;
0 h6 M* w9 E+ g$ H; } - static int bcnt = 8;
" Y# K' n# i4 }* ~# \9 P, y; r6 k - static int ccnt = 8;& \6 U" q9 P1 c" T5 P5 i& l$ O$ O
# }) f! y4 c# @& F5 D7 A- module_param(acnt, int, S_IRUGO);" N- g& K& X- G! _, M
- module_param(bcnt, int, S_IRUGO);6 t- X6 o# }, h2 h e8 p
- module_param(ccnt, int, S_IRUGO);
复制代码 ( U! F ]( R5 ?# R. C
5 d9 C; g5 ?( N0 y. E j3 y& o# S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) t, X% N, R6 |3 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 d6 s6 e. P2 \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& v. F& I2 |( w* n6 h5 a: O* H
3 `# H' k/ B7 O/ ]* r0 s* C+ n
4 g5 B% I2 _0 e. b1 m9 x2 ~ |
|