|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 h8 i- A$ ], Y# F/ u* }2 w0 w+ j
- [code]EDMA sample test application) _# d8 I P5 T+ b1 L
- /*
" i9 q: F/ u" r4 l - * edma_test.c
0 j4 _& |$ y# _7 O# L% T0 { - *) z4 M8 [) ]' o1 D# h( h# W
- * brief EDMA3 Test Application
( E) k& @, {! Q/ @$ z g - *, V) m/ ]& i. S2 i/ A0 N6 B
- * This file contains EDMA3 Test code.
7 R( X. G7 C9 b8 g' O" U- G/ ] - *" I* o! ^# S8 T0 J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 X3 i9 m5 G5 O9 [' m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 |' M% Z1 n5 W* [! w3 F8 b
- * TO CHANGE., x8 `% P' |; N/ M L
- *
( N* f; {$ t2 Q- V& c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% m4 m! @! g, H - *
' `$ T" B: Q6 j4 r) S. B - * This program is free software; you can redistribute it and/or- s1 _: o5 J: `2 d# @* P2 }; B
- * modify it under the terms of the GNU General Public License as4 G$ ^3 o1 V3 n: Z
- * published by the Free Software Foundation version 2.
4 A* e5 w' C( C* z0 H2 b1 |: d - *
! X K; K7 b# z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# x! n4 ]3 z% k2 S' @% A: z$ c - * kind, whether express or implied; without even the implied warranty
- ?, m: f6 e7 _- S* i# }% {1 T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; N; P+ z/ c1 }0 a- u0 z - * GNU General Public License for more details.. g2 E5 ~8 H( Z# f* h3 E
- */
. N7 |! O3 Z# Z( q
$ V7 ?# s2 v9 w8 n' }. z z8 G- #include <linux/module.h>
+ e/ c) l* c0 i' w A* e& Q# i3 P s - #include <linux/init.h>
' I' N% l$ Q; H6 P1 w - #include <linux/errno.h>
2 S. R, F0 W8 |9 u - #include <linux/types.h>
0 ^5 t! C& h f8 l3 A4 v% L1 x! v - #include <linux/interrupt.h>
! q5 N4 W# z$ X - #include <asm/io.h>0 e0 _4 I v! r' D
- #include <linux/moduleparam.h>
) }( A3 C9 `, D. N9 |3 p* o: t+ k - #include <linux/sysctl.h>
5 R) ~- x5 S2 [1 r5 T% t - #include <linux/mm.h>4 z5 K; k& I C( a& J( {
- #include <linux/dma-mapping.h>! N. B. |# [" Z ^6 J( s
+ Q( g/ ^! O' D) [; [. D( h- #include <mach/memory.h>
/ b* ^8 }0 _) H r) W: c - #include <mach/hardware.h>
+ X8 k: S* R$ X4 x% b& \6 C - #include <mach/irqs.h>
% u O N3 K% r4 b! X( s6 b - #include <asm/hardware/edma.h>2 J) r9 `* Z6 \
- ( \& n" X/ [% B l
- #undef EDMA3_DEBUG" G$ F, N% ]2 n: W9 s
- /*#define EDMA3_DEBUG*/
* e! o" f$ m4 N7 O" _3 t
7 b, |7 s% U! o- @5 _ d- #ifdef EDMA3_DEBUG: o2 S5 N: g! j" W, v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 c. v, G2 f% k6 f7 E4 E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 C! n6 |7 o) f% Q8 v# ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 |; I; }' M/ h% S1 y; c9 u% R6 S
- #else, } l$ ^4 B. R ]
- #define DMA_PRINTK( x... )
/ ?/ G1 G, F |5 m5 ]4 c' t - #define DMA_FN_IN
. w- p$ ?" O4 B - #define DMA_FN_OUT
! [# X* M7 ^: {1 U' |- d. Y - #endif
% x# [" b1 i7 Y$ V8 ~# \- j* ~ - 5 E$ m/ L9 w- T$ n2 G" a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) _7 {" {" H- c: [. I5 O& I
- #define STATIC_SHIFT 3% t7 k O5 b9 _" s1 l, ~( k
- #define TCINTEN_SHIFT 20
# g# X1 a, l3 J9 ^8 \# y0 i - #define ITCINTEN_SHIFT 21
3 j* O2 `; R5 y+ m - #define TCCHEN_SHIFT 220 y3 ~& A1 Q1 ?1 W* ^1 u
- #define ITCCHEN_SHIFT 23
8 J$ a. C+ J; ]" _" L$ @ - 3 K4 ~, z; t7 D, u# K( U5 j1 q' S
- static volatile int irqraised1 = 0;
4 e% Q5 {6 r$ q+ ?9 z - static volatile int irqraised2 = 0;! Q1 O8 V z/ B9 j5 E3 `) n
. c4 r' e) G G* n6 y5 S! M! O+ ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ^& ~. U: A0 T; d5 X* @! @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 i! U: j+ K3 n: Y% v9 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Z0 ^. E7 {! W2 p, e3 g
: b* }8 A. ^0 b3 Z# C( M1 U' N/ P. @- dma_addr_t dmaphyssrc1 = 0;& u7 l3 x1 e( D
- dma_addr_t dmaphyssrc2 = 0;
- ^7 c/ P( P6 Z" V6 c$ s - dma_addr_t dmaphysdest1 = 0; N# c: u% V9 T" u- k/ I( Z0 a
- dma_addr_t dmaphysdest2 = 0;* n3 [1 f2 m% g+ `
- # d' d4 o5 s9 L
- char *dmabufsrc1 = NULL;' B$ [" V& b( P6 } t& p: m
- char *dmabufsrc2 = NULL;, _$ e* V% B9 U. {' c; g
- char *dmabufdest1 = NULL;+ L! \& h& w/ ?8 H5 p" q0 V) |
- char *dmabufdest2 = NULL;
/ w6 @# {& Q9 q$ l - ; B q* q& F) D# J- m
- static int acnt = 512;
' l5 r3 z1 s V, n) U- R - static int bcnt = 8;4 G7 j4 L ~ }9 P' b
- static int ccnt = 8;
: P' d( u. }+ }$ K) s+ ^/ u" X5 o% t - $ C% s$ n2 t& g5 E. V; ~
- module_param(acnt, int, S_IRUGO);
* q' U9 h+ C3 h' k1 m2 w4 r - module_param(bcnt, int, S_IRUGO);9 [ o1 B1 \* \& Z/ _" i! E
- module_param(ccnt, int, S_IRUGO);
复制代码
8 y& a/ K0 N* j2 G0 |% c' A0 V. ^- u4 ~0 r, X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 q$ G) n# f# U5 r. b4 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 Y3 x& D$ p6 [3 U) O! x# a! X2 q0 g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: b. ~( g: M3 d9 y
7 U. o# S6 j [) E; P
: Y/ o7 ?5 M% o8 ? I4 H |
|