|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 Y- b9 K6 H# s2 A7 K5 {% s) g1 k
- [code]EDMA sample test application
5 Y, I/ Y' B9 V& x4 {) l - /*+ y8 o! H8 K \% w' r' Y
- * edma_test.c
1 @& B4 W- O/ a- O - *
2 e1 X; A/ j g; V( D& D - * brief EDMA3 Test Application L4 O) m& h0 v9 \- c8 G
- *
$ W' _: Q. ^2 R: N( [3 m) _ - * This file contains EDMA3 Test code.$ X, a/ F7 b* t, w& q. j; `: I$ V
- *$ Z) a4 V- D, O% I% ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 G: d7 T4 g* X* n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 A: W3 ?$ j0 C* i - * TO CHANGE." r! v9 N- w+ v
- *3 J& V! g3 C6 d7 p$ A# R0 e( ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' x0 N9 H$ m" F! ~1 V4 \
- *
% z7 @" W8 u) r9 `* j# I3 P8 W7 y - * This program is free software; you can redistribute it and/or7 ~ _1 x7 F7 E1 g2 {: W: u7 B
- * modify it under the terms of the GNU General Public License as
1 Z( O6 W7 Z! z7 Y - * published by the Free Software Foundation version 2." A9 J6 j) R) P3 I; J( F
- *
5 m8 F, |; t+ I! q8 B" Z6 V4 I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any |( i" H; B$ w# \' l5 D |
- * kind, whether express or implied; without even the implied warranty0 N* r! X1 R1 R: B. N4 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, \, [6 R5 F9 N, i" P - * GNU General Public License for more details.3 H5 i6 b N+ J( Q8 i
- */% r& F9 C9 m3 M$ P
- - r X2 J# R6 p R [7 i: ]. y2 i
- #include <linux/module.h>8 `* Y8 _; E: u0 j4 r$ t( _; B3 W
- #include <linux/init.h>
, K1 s9 X% o1 {1 j0 U - #include <linux/errno.h>
! Y' P9 B; G6 i# R - #include <linux/types.h>
7 @% E/ R3 A( }4 c. ` - #include <linux/interrupt.h>7 u) O) J9 R/ ?$ x: X
- #include <asm/io.h>
) z/ u S+ C6 A1 M9 p. x$ m+ n - #include <linux/moduleparam.h>2 N! \8 @0 h7 b2 V$ _1 F: x
- #include <linux/sysctl.h> W: @( | \) }9 ]
- #include <linux/mm.h>
8 E$ Z5 Y+ ~1 S) b - #include <linux/dma-mapping.h>6 K/ P. G3 o3 _9 _+ W& t- T7 P
- ! N7 A" y+ e$ o- U
- #include <mach/memory.h>
w4 W1 u' K3 c3 F1 _; W$ `' m - #include <mach/hardware.h>1 P' k3 {$ m3 B# X
- #include <mach/irqs.h>0 O g7 X) ^' T+ ?
- #include <asm/hardware/edma.h>! G5 e6 l9 D1 f. j$ f
- 7 j' H& w- T# u& q7 i$ P
- #undef EDMA3_DEBUG; ^. \# |4 W/ l1 K0 _
- /*#define EDMA3_DEBUG*/" r0 ^# M# W8 E: e5 l2 g1 S9 L
- : N1 O8 y0 `3 P: c
- #ifdef EDMA3_DEBUG
8 ~2 s+ M; M. Q7 u0 Q/ n3 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( g- S& [8 z% i5 Z& U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. T/ d( _" c( g; { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# X. I. X% Q- R% h" g) e - #else, Q C! u9 U7 Z+ d- y: R- @" c
- #define DMA_PRINTK( x... )
" W/ I/ d4 X% n, J8 [7 K - #define DMA_FN_IN, `) O$ u7 h2 s" h
- #define DMA_FN_OUT5 r2 c7 W1 X. C& g
- #endif. l9 D% ~% O- u1 h3 X: }
: H' y+ D# t7 @# `& p' W9 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 r7 C, C& M/ s" i% V9 a3 A9 T
- #define STATIC_SHIFT 3
9 G W$ O- ]; V1 j - #define TCINTEN_SHIFT 20) [8 l s0 ]( h4 W; ~/ Z7 g2 G
- #define ITCINTEN_SHIFT 21" P. i4 b" j' B6 L! T j1 g* m: `1 d& h
- #define TCCHEN_SHIFT 22 c! o2 Y6 ~5 T6 U* @
- #define ITCCHEN_SHIFT 23
" u8 R4 m5 r& o* w; | - + @0 b B' }$ L* c5 b; h9 ^
- static volatile int irqraised1 = 0;
7 G- C# p8 D5 o/ l9 |6 u - static volatile int irqraised2 = 0;4 L: h/ a8 M( L9 T* [, z/ @( A% D Q
' y) U9 w5 P ^$ W' p S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 x' i. f. S+ F* k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ a+ \. {& i( s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 v2 c' m( I/ \( M
- {7 {: S+ V5 G \- E- dma_addr_t dmaphyssrc1 = 0;5 C8 n: ]# k% T7 i+ d! Z7 W
- dma_addr_t dmaphyssrc2 = 0;
4 B# D2 [. W3 i& _ K. l - dma_addr_t dmaphysdest1 = 0;
2 ` w% c, a7 f2 p# v$ S - dma_addr_t dmaphysdest2 = 0;/ G M: \7 I. o, t. \
- $ |3 a" u- o g. b, l1 _/ I" B
- char *dmabufsrc1 = NULL;
8 S1 D7 O4 c6 v - char *dmabufsrc2 = NULL;5 q9 a, I* M9 v8 a- k# Q6 o
- char *dmabufdest1 = NULL;
2 i9 b% e0 N+ C# K# w+ Q4 b. @% P - char *dmabufdest2 = NULL;: {. o% \3 T4 g9 e6 ?( h! B% E
- 4 N1 }' z5 S! r! b
- static int acnt = 512;
7 q0 k! J' ~4 C0 H - static int bcnt = 8;
; k8 Q2 c4 m6 R6 ? - static int ccnt = 8;
" t- U% X& H4 f/ o
5 B4 f9 I4 H6 ?* V1 E, o' `7 V% R# Y- module_param(acnt, int, S_IRUGO);# N% O0 M: j9 Z' ]5 V3 P5 L$ |
- module_param(bcnt, int, S_IRUGO);
. G/ r1 v, r. J _- ?: b - module_param(ccnt, int, S_IRUGO);
复制代码
7 G" \" S, M6 c: b
- i/ K( C9 s* H! v Q% E# ]' M( X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ^% r& N: u& v/ u; r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 `" D. q. I8 [; ]" ]6 q, H/ p1 }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) `5 }2 f/ G7 v _2 O& R$ h! P6 \+ N
$ u6 v! ]! _7 s9 Z
|
|