|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 X: p) W0 P$ ]8 `/ w0 p- [code]EDMA sample test application- K( X4 W4 a6 N! t/ k
- /*: {4 d/ V" l; Q" P
- * edma_test.c6 G7 b6 [' ?$ g( e% C2 f0 ?
- *
1 _2 q6 p; F, P* `$ l; u - * brief EDMA3 Test Application
, |9 C( x' B j+ H# G. e* O - *0 {% \" @7 f7 \/ y
- * This file contains EDMA3 Test code.. D; |2 f# A6 b
- */ H! Q& T- ]) U/ |. T; \+ W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: H, V- y7 D4 c+ n6 h9 T: b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 k; r3 m% V1 W/ T - * TO CHANGE.$ F' ~! \$ E; G! s1 W
- *- i9 [) f) t0 t' Q, u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! Q8 s, I7 p& ]3 H- c - *
. l" w* w0 ^. o6 E# r' d2 A* A K - * This program is free software; you can redistribute it and/or+ N8 B7 `# [0 s H0 r' O
- * modify it under the terms of the GNU General Public License as
v8 W; }6 ?& l! x - * published by the Free Software Foundation version 2.5 {9 |1 g1 K* E; O/ N& Z. o4 v
- *# C V I% n& I% k1 u. E3 |6 s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 }1 y1 o9 T8 g+ s: X3 n" [( ` - * kind, whether express or implied; without even the implied warranty; @7 G, _! d, ?; @5 W! F2 Z" z2 E+ ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' p' |4 Y# b' \7 [ - * GNU General Public License for more details.7 ?* T9 I, j: V6 t+ s9 V
- */4 ] }. h, V: R- q, O& U3 B
: w. H' ^) \. d) n- r- #include <linux/module.h> n7 `6 k6 T% A7 C6 j- U
- #include <linux/init.h>
6 F3 K W5 |- V& {% J - #include <linux/errno.h>5 A6 J0 g1 Y0 ] c3 u8 h& X! D
- #include <linux/types.h>; W, `- `$ S7 E, D& P. V( Z
- #include <linux/interrupt.h>
0 o# o5 U# N$ z2 x, x9 J P2 K- J - #include <asm/io.h>) f3 W1 O x+ _0 ]3 i
- #include <linux/moduleparam.h>: H8 |' k1 i& Z% |3 J. m
- #include <linux/sysctl.h>" R3 q( m" s4 r6 I
- #include <linux/mm.h>6 T& y% l( P) ]5 }& u8 F
- #include <linux/dma-mapping.h>4 {, w2 m* i0 u/ Z B) y* F" K
. z8 q! m( A. u9 P' w% k- #include <mach/memory.h>4 n. S' @. N0 V
- #include <mach/hardware.h>
& J7 g% | E2 x9 Q0 V2 q- e - #include <mach/irqs.h>
8 v" C! |) X* K4 n - #include <asm/hardware/edma.h>
8 i% i- |: x3 ]( I' c - $ b4 a! v: o( ~+ i+ X
- #undef EDMA3_DEBUG2 V$ l/ R$ r' ^, s, w
- /*#define EDMA3_DEBUG*// X1 O! R! e- e( K; S' |2 U) U/ }
+ I# K* n* q/ N9 K- #ifdef EDMA3_DEBUG& i: l3 F& }3 K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 p' I* D7 H# e& |4 P5 w$ E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 U& |! I: m! d, r- y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 f) v5 y& |9 B: |3 Z - #else
4 }1 |# V5 J7 p/ g - #define DMA_PRINTK( x... )
) o9 C+ k, c/ j2 B! N - #define DMA_FN_IN. Q; G2 y$ H) |; Z" o. |* g
- #define DMA_FN_OUT6 r5 q! |+ i; i3 B o( X" e- P( {5 [
- #endif
5 M. G7 r& \% w7 i1 W2 ] - 9 V- e/ u4 s4 P2 y! R7 A- }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# a0 f& Z& V) p1 S3 b: G2 } - #define STATIC_SHIFT 3
, t* ]5 ^2 A+ `3 C& Q w2 ] - #define TCINTEN_SHIFT 20! O& k3 ~, ~( F, L1 c v+ R
- #define ITCINTEN_SHIFT 21) E M$ N) ~$ W5 r3 v
- #define TCCHEN_SHIFT 22
4 W0 k5 q& W7 T3 k - #define ITCCHEN_SHIFT 236 L, ^) E' ?' {6 }
- ; E4 }% U. p" z
- static volatile int irqraised1 = 0;8 m/ Z/ b- ]0 S
- static volatile int irqraised2 = 0;
8 R* H" U* K# S* ~! K
: o2 Q v. L# s9 X' R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' m- U) }# Z: K W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! E- ]3 P- D# E" k) F9 E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! x; d. P. w1 H4 ~) v. ~3 A - 6 { L. ?& k0 U6 I
- dma_addr_t dmaphyssrc1 = 0;" ^/ F9 X7 z y6 w
- dma_addr_t dmaphyssrc2 = 0;5 n! W$ U5 V8 y( t& @, k8 A* {
- dma_addr_t dmaphysdest1 = 0;
! Z: C( j* i2 p% ^ - dma_addr_t dmaphysdest2 = 0;
4 S3 w- q5 H* X% v2 \
- b6 V3 J* {& c- char *dmabufsrc1 = NULL;/ W( t @5 D5 V! c* t: h2 `% Q2 m
- char *dmabufsrc2 = NULL;
2 I. J5 y& Y }* c- t - char *dmabufdest1 = NULL;1 x* Z" \6 p: j8 J
- char *dmabufdest2 = NULL;: D7 | Y8 G/ _) q- A9 ^0 g" Z
$ `0 \9 Y2 a0 U' M9 ^) Y# B- static int acnt = 512;" |) g7 w8 t' Q2 V
- static int bcnt = 8;
" F3 M/ X8 a7 p+ K - static int ccnt = 8;7 E! _- I% K1 a! e* B! I2 q
4 e5 [! G3 S* X" u' z- module_param(acnt, int, S_IRUGO);
1 N( ?/ L- y3 i! r6 G& b% i - module_param(bcnt, int, S_IRUGO);3 Y) J! j, L! \" |+ u3 Y
- module_param(ccnt, int, S_IRUGO);
复制代码
' X3 ^* Y+ n& q0 K9 C5 t! B, j0 z0 d9 Z" z$ T( A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 D& c& _! J$ i6 o' x; Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! [6 F! V6 t& U/ e C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 |7 E& B" E: {5 P' _. } @- ^# v# u
/ y4 x0 L2 q' N! d
|
|