|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 |% b4 a' g3 \$ m/ n3 u- [code]EDMA sample test application* @2 R# x5 O" K' H
- /*" b; w+ B( X. k# V+ \2 e( T
- * edma_test.c3 o4 `0 ?$ {' D
- *. h1 Q! b+ u- ]; S
- * brief EDMA3 Test Application
- |1 e0 w& u2 T9 ?; N - *8 o( K. b! u( k2 U0 F+ g
- * This file contains EDMA3 Test code.) s ~: d" J+ Z+ ~
- *- m& B! z( m2 m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! x+ `! W2 P* r L' ?9 X- m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, I+ a1 j2 ?* R/ h9 k9 X - * TO CHANGE.7 k& E/ h" a7 q, a. W+ f; Y
- ** ~ B$ g8 R& l( n9 t* n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Y, I' ~ E2 v) T5 V
- *! y5 k+ Q, R9 P3 X
- * This program is free software; you can redistribute it and/or
R( K. p2 i/ {7 V8 V! f8 e6 ` - * modify it under the terms of the GNU General Public License as8 B: ^& W5 n0 o/ U
- * published by the Free Software Foundation version 2.
* O6 j% u8 E; l5 M" X0 g - ** c5 q# g+ p% \/ e/ \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 B2 V' D8 F' }0 V - * kind, whether express or implied; without even the implied warranty
' Z; ]- T$ [& t1 o* P! [$ l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 G: o6 I! I p w
- * GNU General Public License for more details.
# |- z- N7 [2 I* v - */
- J) \: _$ j% g) i# c& e - 5 l2 O1 S- U; q9 t. n8 |4 v
- #include <linux/module.h>1 h: ]7 M5 B- x1 \
- #include <linux/init.h>1 _4 i) C, s9 R) y, }7 p7 \3 C
- #include <linux/errno.h>! D3 a5 |; v4 B) ^ j2 v; q. l5 Y
- #include <linux/types.h>( Q- S" }+ F: V8 w. g
- #include <linux/interrupt.h>
: L" v% d4 g% d" @8 v9 L9 z# M# b0 k - #include <asm/io.h>3 N. p1 j* L" |( K; l
- #include <linux/moduleparam.h>0 _& l; L+ t, |: x5 g7 n* O# f
- #include <linux/sysctl.h>
4 e5 F1 r- U3 ?. e - #include <linux/mm.h>
" F+ ?+ z) F+ c. |6 O! ~, T4 v - #include <linux/dma-mapping.h>+ _8 D% O3 t# J6 S i
9 n# j1 x. Z! ^! H) E- #include <mach/memory.h>
! X2 U7 Q; [5 M5 I0 i0 ~ p - #include <mach/hardware.h>) V3 Y2 R: k0 H& w
- #include <mach/irqs.h>
9 B( m1 p5 x" {5 ?& q% s - #include <asm/hardware/edma.h>+ s+ R8 `$ t2 u1 M7 P( R% R
% z5 b3 ?6 a( R, c7 J4 M/ u- #undef EDMA3_DEBUG
5 A1 q# g1 r3 M9 N& d - /*#define EDMA3_DEBUG*/) c* T$ g1 }. _) C+ L* o# ~' F$ h
- 3 d* z+ l, d3 o0 l- E
- #ifdef EDMA3_DEBUG3 _8 E4 S( a7 n& |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); P6 k; Q- m. S$ f0 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 I6 m6 r# h- Y* g% ^( ^3 t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" B! E+ A5 A/ G2 T
- #else
' f5 q% k( e+ W: L - #define DMA_PRINTK( x... )
$ V c+ x4 s8 d! z8 u - #define DMA_FN_IN
\- c4 z, Q: c! c: n - #define DMA_FN_OUT
N% I4 k* k4 x# s - #endif" J2 C9 V7 F) F4 B' o4 T& ^4 {3 l+ H
- w' R$ e: {* s7 d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
l" J8 {8 R% u: g - #define STATIC_SHIFT 3
: k' N0 I7 j% j4 n# B2 D7 H - #define TCINTEN_SHIFT 20. R4 t9 Y' A/ g* d
- #define ITCINTEN_SHIFT 21
* h: \! m' f3 } - #define TCCHEN_SHIFT 225 t2 B; Z2 m J" b1 m. I7 Y/ M) k, P
- #define ITCCHEN_SHIFT 23
4 S9 E* x5 q# N5 {: B$ p% L - 0 c4 ?1 k$ L# t- m) P0 H3 T/ X
- static volatile int irqraised1 = 0;7 ]( H Z* m; p/ j) X
- static volatile int irqraised2 = 0;
- K3 `2 f- f- Q* {
7 b* y2 P) V6 s D9 S4 A C1 a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M# p8 u( p' g% p% T M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); w% q+ l: h! z& r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ C a7 K3 a* o9 I
: a8 J- ?& O% j7 n9 g( L7 a- dma_addr_t dmaphyssrc1 = 0;! z! r" Y/ K/ p8 ?4 K3 _) o2 k
- dma_addr_t dmaphyssrc2 = 0;
' r6 c/ _5 f8 g/ k, f; H9 b - dma_addr_t dmaphysdest1 = 0;# n9 a: C; q" B1 K* Y& E# C
- dma_addr_t dmaphysdest2 = 0;: @% W; J9 @2 M0 \
- n3 ]4 C6 I! k, V) f8 D8 Y( Z# X
- char *dmabufsrc1 = NULL;! X6 u5 C+ b& Z+ ]- {
- char *dmabufsrc2 = NULL;& L; n6 {- X7 T* T3 h+ H
- char *dmabufdest1 = NULL;
7 L p) S* |, ], J J - char *dmabufdest2 = NULL;" i3 T" M# M9 U$ K1 o j
. N6 P" K _' O& q* T1 C- static int acnt = 512;6 m4 T" D: K. N) y- p. K% p
- static int bcnt = 8;
( r+ P8 w# J! o5 [( ^; ]/ h2 w; h - static int ccnt = 8;
' g% Y9 ?# Y3 g) g2 V" q7 R; H. \ - ! }1 R4 s* O7 J+ d/ N- g* \$ ^+ H
- module_param(acnt, int, S_IRUGO);
, b$ h9 C' n0 p$ @6 o9 @ - module_param(bcnt, int, S_IRUGO);
$ u# r/ F, ^& _3 z c4 L9 U4 I1 H' R& J - module_param(ccnt, int, S_IRUGO);
复制代码
! T Q4 a4 G+ P+ }/ L) ]9 y7 S J8 P& K! X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 S/ G9 D1 A9 |* X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: D, h% f2 s9 `# B, L+ {3 P! q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 W/ G6 r' Q# z/ Q) v2 a, s2 W! |; _) B; N
- P0 \' _3 ] j# K% k" S% R |
|