|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 w6 p: l1 ?. _2 G
- [code]EDMA sample test application* {2 H( e3 a5 U3 I+ e- R% o0 M$ l; t
- /*% _: ?& `) G: u+ A/ n$ `
- * edma_test.c
/ [" V# k p: E; ]5 A - *
F L- r/ O W/ L - * brief EDMA3 Test Application/ T+ s6 w$ p) C* W. G) [
- *& j0 O7 G0 x7 h& F
- * This file contains EDMA3 Test code.
# Y. Z- X3 m9 s8 n. D/ ?- `+ s2 {+ H - *) g X7 m2 v/ c: `/ o1 W! O. y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! P3 q0 c, k1 j: o( W6 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ s( F- l6 Q2 W; c% U+ u. w
- * TO CHANGE.
+ d* g7 _- `* L - *1 h+ q% w' k, L0 L/ C/ p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 Y5 f: \9 z; T/ w( j. a
- *' z" J! s- u9 F! q, a2 e
- * This program is free software; you can redistribute it and/or2 T, K7 p- W4 t% M
- * modify it under the terms of the GNU General Public License as+ r, J1 |4 C& C7 \/ Y
- * published by the Free Software Foundation version 2.- \3 a. S9 T k8 L/ n
- *
4 H: u, P) G# |- z: S/ p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ a0 L0 n5 w/ s" A/ ` - * kind, whether express or implied; without even the implied warranty/ H" J* \* \3 Z) @7 o) m( D$ i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 U( q, U* T2 C4 Y! N4 D& z
- * GNU General Public License for more details.
, `% w5 f9 ~$ X K- ^# s# W: j - */; I5 F9 V0 ]+ Z1 M
) v9 o* M- O# u) f- #include <linux/module.h>2 r; G E5 O' Y- Q
- #include <linux/init.h>
- z% a4 P8 M9 t4 N5 Q2 g' Y1 p* H - #include <linux/errno.h>
8 n2 U! b2 g' [1 i6 m3 _8 p - #include <linux/types.h>2 s" o) R2 t- N" n: @. g$ M
- #include <linux/interrupt.h>6 x# @ W8 i9 b! H1 f
- #include <asm/io.h>$ T+ }2 [% w; p& D; c5 u
- #include <linux/moduleparam.h>
7 A r! S1 R5 t) x5 x# j/ I2 I - #include <linux/sysctl.h>( k7 R) W% t z3 {5 y
- #include <linux/mm.h>
% J$ P5 P$ n6 R - #include <linux/dma-mapping.h>$ `0 A, j" G2 x
- 6 g/ b6 j3 I; S7 U0 E9 Q
- #include <mach/memory.h>
' W: w) @( c# _6 i; a# p7 n1 n1 g4 o - #include <mach/hardware.h>, i( J) r; k* }$ }: r% u
- #include <mach/irqs.h>' I3 F% E% @) J! y& ^- A R4 Q
- #include <asm/hardware/edma.h>
f* O! `- \1 l8 k
# N- R$ R) A" h& m9 H7 u n9 R- #undef EDMA3_DEBUG
0 n5 ^- ~1 t" @4 u3 `4 j0 S - /*#define EDMA3_DEBUG*/$ Q* ]! q: v3 i! U2 o; |+ P: ?
8 ^& n4 S" Q4 l! l: m9 H- #ifdef EDMA3_DEBUG: x3 I. w6 ]5 ]# _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
k7 h$ ~# _- I1 ]0 E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ K9 ] s5 {% X! F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ n- P8 ]3 y/ P/ A
- #else g3 b7 U2 S. T2 G
- #define DMA_PRINTK( x... )
7 {1 @, S' s" u! O - #define DMA_FN_IN/ a" Y+ w/ f( B/ z, a6 o! M
- #define DMA_FN_OUT5 b3 Y5 `! v- |) z4 x q0 U' I4 r
- #endif' _+ K5 X, M; ?, N
7 Z# c2 b+ n( F+ |+ m e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 a" w$ H( t/ Z - #define STATIC_SHIFT 3+ s* U% D3 E( m+ P3 l$ }
- #define TCINTEN_SHIFT 206 n1 a2 G8 d$ f, F: t
- #define ITCINTEN_SHIFT 21
6 y8 f/ v$ E8 R/ F4 F# |7 B# l - #define TCCHEN_SHIFT 229 {: f$ b( E* b) s7 N
- #define ITCCHEN_SHIFT 23" N! r. u6 `* F! `2 U; ?
6 b) E9 D3 X) _( T+ W5 P7 G1 E0 t8 K- static volatile int irqraised1 = 0;
8 M1 z8 E3 r1 V2 V6 h& t - static volatile int irqraised2 = 0;
$ T" H$ C. ~- ^0 {; M! ^2 L
3 K' {2 {, t( d3 m/ Z6 {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Q/ E7 o% ^$ {! Q4 t2 z7 O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 f6 k9 l7 Q! f9 Y6 I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& u1 l* U& S1 y% X; c. V/ B8 C - 9 v1 L+ |" H8 ~4 k, N9 \, C
- dma_addr_t dmaphyssrc1 = 0;2 n4 }7 n* J, {3 n
- dma_addr_t dmaphyssrc2 = 0;
& R/ a9 Y* @: c1 a( H$ z& \6 l - dma_addr_t dmaphysdest1 = 0;8 e6 @1 V, j1 V
- dma_addr_t dmaphysdest2 = 0;
1 p0 s* r# H! T! A9 a. p" q
( r+ J$ P; D U7 I& [2 w- char *dmabufsrc1 = NULL;$ N, k( V3 B. s
- char *dmabufsrc2 = NULL;
' [& U9 {5 _! A& u - char *dmabufdest1 = NULL;1 k S9 y) i! \9 ]
- char *dmabufdest2 = NULL;, Z$ \5 O2 i, E1 ~) ]
- 1 Q* s9 D4 x( l
- static int acnt = 512;
) q& b0 W+ Y! S - static int bcnt = 8;- ]- Z3 g& r' X" X1 ]
- static int ccnt = 8;
& ?3 S, Z* U7 w6 \9 G - ( ~) v0 Y+ G# [& n% [) l
- module_param(acnt, int, S_IRUGO);+ a8 X; R8 o, q6 R3 i
- module_param(bcnt, int, S_IRUGO);
+ k- l9 `4 F9 ], |" E, K, ^! M. [; w - module_param(ccnt, int, S_IRUGO);
复制代码 : K9 u" H% ^0 `( |/ n- ]7 f. s
) C7 u( E; n- ]/ ~, \* W1 ]; _7 | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( N! m2 f0 S' t* d6 `arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ }! M% Y7 n# w( d3 z8 L! m2 }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 q! N/ C8 t. J6 F
; y/ Z* _: X( O& Q9 \+ c8 V( K
A7 G7 R- H# ~3 M4 A2 |
|
|