|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + X* [4 m. Q8 w' J
- [code]EDMA sample test application: Z3 a: @# n+ O. E
- /* `( M9 _, L/ l5 C f5 @- k
- * edma_test.c7 Z9 E' {- c, d0 r4 W% m
- *' I M8 ]5 s: y, p' J; u h
- * brief EDMA3 Test Application
* {+ h- @1 X5 |% F# r - *
; A& w' K" R+ y% G2 f& Y - * This file contains EDMA3 Test code.; P2 l6 b, r" S% n
- *
# M- V7 E7 Y* h0 g' s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ^. v! {# r9 o/ ^: U4 T1 x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 q( D" T0 b o% A7 q) O - * TO CHANGE.
" U8 P) E; O. Z5 p+ T2 ~& p - *
5 ?8 q0 c! s, z6 c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 q9 j S2 y4 O) X4 ]; L - *
$ g, }) @0 o1 u' C - * This program is free software; you can redistribute it and/or
- |2 Z4 J( G" n) a - * modify it under the terms of the GNU General Public License as" C6 H, N& w2 a! k- C
- * published by the Free Software Foundation version 2.* b) B& ~/ O6 ]5 V1 o6 u1 Y
- *
8 t X. @" K: B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; C, e) i& ]3 Q9 C
- * kind, whether express or implied; without even the implied warranty
- i8 Z: V! f" [. o3 Q1 }) y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 t3 J2 Q. }0 g- [' V/ c u+ W - * GNU General Public License for more details.
( Q8 O5 m1 n. u0 P6 K - */
: k" Z6 U) l. ?; R! A3 n8 T
, P; |* l, y8 Y5 Q- B- #include <linux/module.h>+ T, k6 B/ y* X: U
- #include <linux/init.h>+ Y/ j: @ j7 G: u2 z9 x& \8 a
- #include <linux/errno.h>1 W& w( g/ o4 i1 \ O! [0 l5 I4 Y
- #include <linux/types.h>
6 m+ u: Q6 X# [9 K# V$ o - #include <linux/interrupt.h>
6 `4 P# V8 s: w - #include <asm/io.h>1 x" f$ `* }5 U1 P" Q1 G
- #include <linux/moduleparam.h>) N2 l+ v* [1 _" m/ A! _
- #include <linux/sysctl.h>5 F' G& D J' W7 j1 z
- #include <linux/mm.h>2 Z* \$ U% H- ]2 X6 @
- #include <linux/dma-mapping.h>
. J3 W6 k+ H. C( Q9 ^. y - - Z. |+ [* u- r& S% |0 E/ L
- #include <mach/memory.h>' s, a5 m+ d1 g# S+ [$ G
- #include <mach/hardware.h>. B$ w0 @4 s& l2 |
- #include <mach/irqs.h>% D% {3 g" m1 O
- #include <asm/hardware/edma.h>6 ~- d( b# Q# Z$ j
- / a/ U. l1 a1 I5 d; M7 }
- #undef EDMA3_DEBUG
, O5 |9 i8 i: ]6 F - /*#define EDMA3_DEBUG*/
, g! F) U3 ^/ G# E/ }
) F$ o* c$ K$ [: E* {- #ifdef EDMA3_DEBUG; r6 U4 [. b, A4 {" p2 w% t# Q7 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) i3 q3 G- _0 Y" f" D/ d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: @% }% f6 I; _7 F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* F. D* @( C1 \- X0 ~ - #else8 ^' Q3 X/ `6 G
- #define DMA_PRINTK( x... )/ X1 m+ T) ~ P+ p; D
- #define DMA_FN_IN- V1 a' j* }7 ^3 p
- #define DMA_FN_OUT
5 J1 J7 a0 H% E5 T# ~8 H - #endif6 q8 S% K8 ?7 I' s1 W
- 3 E2 s! R, F% [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. c Y: p# W+ r2 v9 } - #define STATIC_SHIFT 3) ^0 u: i5 k) T/ `
- #define TCINTEN_SHIFT 20
1 @7 S% l$ K; e6 j, p. U - #define ITCINTEN_SHIFT 215 V: c b7 i+ M' ?
- #define TCCHEN_SHIFT 22
0 e+ R7 @/ v+ s( B0 z6 } - #define ITCCHEN_SHIFT 23 @1 |* ?& \/ m1 G# `, R
- % [5 ?3 u5 O* |2 s) q4 R
- static volatile int irqraised1 = 0;9 B% D2 h- @4 p0 A/ F& p
- static volatile int irqraised2 = 0;
9 v8 p4 o1 E* \: F& d8 b7 J, K: Q - $ M% F( }5 g7 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 A& _7 `, F0 i" H6 I! O* ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 J/ h7 v6 w9 i3 O) _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Q9 d+ @9 q+ Y, a% O0 E) Z6 }5 {: R
2 f* k( _8 W0 C; F+ {% s- dma_addr_t dmaphyssrc1 = 0;
# G8 |7 f; @0 I w3 Y) m - dma_addr_t dmaphyssrc2 = 0;+ s0 k& z* E2 q
- dma_addr_t dmaphysdest1 = 0;5 G" `6 W7 R; c7 R1 |. w" V
- dma_addr_t dmaphysdest2 = 0;- @; B! w: {( p
- : w/ n3 n W; ?/ M
- char *dmabufsrc1 = NULL;
2 Q* K: g. ]! U- v/ ` - char *dmabufsrc2 = NULL;. V5 l+ s: I" y6 F8 j h
- char *dmabufdest1 = NULL;3 c# p* m" A1 e8 ?+ L" o r
- char *dmabufdest2 = NULL;: B7 s$ ?1 _& Q; g( N
* c( \) r% [- P$ K7 O- static int acnt = 512;
N/ `( \/ ^) C4 B. {" J" ^% F, J - static int bcnt = 8;
3 p. {" i7 V' t/ t+ K* h- Z& u - static int ccnt = 8;% N' O( C6 x; A5 Y9 R
- ) p) f7 l# z C6 q- s
- module_param(acnt, int, S_IRUGO);
1 z7 e" |& {5 P0 \( | - module_param(bcnt, int, S_IRUGO);
( s( b. Y& M5 d9 T4 z( ]8 } - module_param(ccnt, int, S_IRUGO);
复制代码 & a# t' \7 q2 [' o# O
1 N" o4 L, E2 o7 z8 R" t9 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- b" r7 c5 [4 J. V% ~& aarm-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+ U; f- ]$ B* n" C) N }9 M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 X# v- Y1 l5 d+ R$ V) r
$ t7 A8 k% E- ^5 s! P; y6 a9 u w3 H* p& m3 ^: @
|
|