|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 `! V& x2 h! ?, A. f+ u% `5 N
- [code]EDMA sample test application! C, N# i: v( b) @! k; g# ^! s
- /*9 y T% ^. J# u4 |; ^( n9 h
- * edma_test.c
9 \8 p/ S; Z% J1 @. E - *7 y% n+ i, H! I
- * brief EDMA3 Test Application$ |+ G3 `2 c' Z0 Y$ |7 S, x
- *
* ~) O4 p; L( ^* g) E* [ - * This file contains EDMA3 Test code.
1 l! W. W G* A* h* A - *
8 M- k* U% \# Y; i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE F! F6 X4 }& C$ ^# B* @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# v1 [/ ^2 M) u - * TO CHANGE.1 s4 E3 a" D" h S6 v
- *3 D5 _$ V& L2 a% {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 x8 m' v* ^: v+ ^1 T
- *
- A. ~' j" t% z - * This program is free software; you can redistribute it and/or
2 E* k1 }7 E( z- ~/ l - * modify it under the terms of the GNU General Public License as+ M' @2 `8 H8 ^' D+ n- K( k
- * published by the Free Software Foundation version 2.
$ x- l+ G* D: l) S* R) L/ W - *
! U5 ?4 D5 `, u# ?2 L* L+ ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ Q4 Y' \: {, F
- * kind, whether express or implied; without even the implied warranty% f; U( ]0 h' E2 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ d7 P0 a4 ~7 U; k) p/ h- u - * GNU General Public License for more details.+ O% m3 L2 q5 v, \
- */- k% L9 D1 r+ c6 L9 D2 q5 U
- ! _7 d7 U# L8 d# ^
- #include <linux/module.h>
. ?6 G4 t, f/ u4 P - #include <linux/init.h>" Y' I& ^1 i' l+ f' e7 ^
- #include <linux/errno.h>
& `3 |0 @$ a6 T( T- e0 v - #include <linux/types.h>) t1 a) K9 {, k8 v
- #include <linux/interrupt.h>
* K5 B' t1 e. e2 `. L - #include <asm/io.h>
k% J) h' E- l7 |% X D0 L - #include <linux/moduleparam.h>" m1 l; t1 m6 P9 k+ [. F6 w
- #include <linux/sysctl.h>- U/ B9 f, e7 s/ g5 {
- #include <linux/mm.h>
& P1 M! f- E" R - #include <linux/dma-mapping.h>
( Y2 U" f- a( J6 L2 L - : b/ I0 Z( z# z& x; X' Y
- #include <mach/memory.h>
. D) W! Q! ]0 q - #include <mach/hardware.h>
' q, s& o# \$ D4 O w4 ^ - #include <mach/irqs.h>
% Q0 B( O/ {; v8 |. O( b - #include <asm/hardware/edma.h>
V: j1 M& T' _5 C/ q
8 g1 d) i0 M' g1 t- v0 u- #undef EDMA3_DEBUG) \# R3 T$ O& N, V% u7 z
- /*#define EDMA3_DEBUG*/
# |, b- `+ @8 v) p' g% D
7 y$ i7 q/ O5 P5 o8 {3 N- #ifdef EDMA3_DEBUG( L) ~0 D( s; ? `+ U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! T/ X2 y9 b4 N: g7 i7 s. P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ D; K; K. ?1 S* @5 `& X( h% j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 O+ K5 w* J3 ~ U4 J6 Z% F - #else
5 T" G# O$ w+ N; X1 e2 h6 K - #define DMA_PRINTK( x... )4 X! H+ p3 v8 E* C+ T1 j
- #define DMA_FN_IN: D' P$ n3 i$ c% U+ @8 T" c4 P3 c
- #define DMA_FN_OUT
3 a: A5 R1 T+ e* T - #endif. f7 Q7 T8 _: @9 ?( {# j, z
' g- }9 V( G* d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# z& q# W9 L3 D - #define STATIC_SHIFT 3* s4 }# G7 b5 s$ K% [
- #define TCINTEN_SHIFT 20
^2 L2 w9 k$ X - #define ITCINTEN_SHIFT 21" p* D1 {) }- ?1 P h9 g% Z
- #define TCCHEN_SHIFT 22
+ N+ V1 V, ?* z2 I* P) ^/ W - #define ITCCHEN_SHIFT 23
5 b9 K8 j3 r+ m2 l1 j+ ^
% T9 m5 e2 ]1 b1 }3 S- static volatile int irqraised1 = 0;
& y' B0 j/ Y& x9 H! w s - static volatile int irqraised2 = 0;
5 P* C; z; t6 l0 x% A0 e
, L/ Y6 \0 X* d" j( B# J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 h; y7 w4 h: a9 ]' h) N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 @/ D( r9 ^ S% s8 l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% s5 [2 \8 k: I4 O4 Y4 p/ e
- u) Z) o3 x+ X: `- dma_addr_t dmaphyssrc1 = 0;
6 O1 d" \' _3 h$ _0 g3 P - dma_addr_t dmaphyssrc2 = 0;
% c( v+ s4 h4 b! K+ G - dma_addr_t dmaphysdest1 = 0;
2 h9 M- t2 j/ K5 m! c* w/ k - dma_addr_t dmaphysdest2 = 0;
4 v" ?8 ]. ?8 A& v; C% | - : [$ { V7 V) W% A# [: y& W
- char *dmabufsrc1 = NULL;5 V* Y: s6 k8 Q/ Q4 e: F( e
- char *dmabufsrc2 = NULL;' ? v) M/ }4 g6 W0 V
- char *dmabufdest1 = NULL;
- {4 r" z' B* p' L, j; t - char *dmabufdest2 = NULL;- l2 I0 I5 w) J+ b% m* n& a# M
- 7 O9 j) y# W0 a% ]1 Q- m- b
- static int acnt = 512;0 G( }- {: X% V% v- ]
- static int bcnt = 8;
- m8 e* j3 d3 r* v - static int ccnt = 8;/ S# E% { j. q9 B: E9 B1 v. T
+ c+ _) |7 ]4 @4 H, }- module_param(acnt, int, S_IRUGO);1 a. H a3 D _% z) [
- module_param(bcnt, int, S_IRUGO);
+ y+ X) O o3 m5 x - module_param(ccnt, int, S_IRUGO);
复制代码
: j. l. N7 d, a$ J6 F5 X7 W9 J" l. g$ q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( J3 ^( g5 Y9 {7 o0 A2 a5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 f% }5 L+ ~* H: }7 S' U4 I8 x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ f$ Z; S5 \0 Y4 {6 t* K& N1 u. P7 @3 a5 E
8 d4 u7 x! n& w& ~1 u+ q7 O |
|