|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; C) Q3 [; E1 k) e6 L9 d; L- [code]EDMA sample test application' j5 Z% K+ ~, J8 D" h
- /*
0 C' v e$ F& b3 q- i - * edma_test.c" e. y6 h" h4 M3 v+ B( @. r+ c
- *. k4 }, x/ l7 }+ U* f; l
- * brief EDMA3 Test Application
* J$ @# i6 e( A( _/ n( H* t - *
/ U& n% l. W0 @. x8 \0 D/ Q( X( Z - * This file contains EDMA3 Test code.
; e7 a( t% d& p K4 o% U- u - *
5 F" P' ]) M; }0 w& D* Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# O9 a7 Z* p; D7 N( |3 j+ B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: v- x. Y5 @# t) M5 H# ^5 I - * TO CHANGE.
. e0 ?5 g! w Y4 e) _6 F0 u - *2 S" G% u# E; u% n/ `6 S5 `+ P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ |5 I) ?0 u0 V& c3 k' n) Z7 O4 T
- *
$ ~, B- v* ]% U - * This program is free software; you can redistribute it and/or
/ a* c. d" f# T2 M( O8 o9 H - * modify it under the terms of the GNU General Public License as- e( x* E; e6 ], N, }
- * published by the Free Software Foundation version 2.7 ?: G; W7 U) {3 j0 X
- *. {$ e2 O! b4 b7 r/ }" e2 s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; n! S- g5 ], h" Q* W
- * kind, whether express or implied; without even the implied warranty
# S/ z d5 m4 m( f6 T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- n4 x6 v: \# z - * GNU General Public License for more details.
! @0 k+ V; e# u* @3 j* Z5 q - */
/ n- Z4 y+ C4 s |4 n Z6 p - " r5 }* o9 e2 C' U
- #include <linux/module.h>
$ `# q- m3 t @2 L! f2 m) r - #include <linux/init.h>6 T2 q' k7 N, _- z$ |
- #include <linux/errno.h>: O# L" G3 J8 w* g
- #include <linux/types.h>
& X; L- U# A9 N - #include <linux/interrupt.h>) _2 o) I$ m5 C# |( e3 B
- #include <asm/io.h>! R% t" A! C- |/ _4 c7 P3 a/ j
- #include <linux/moduleparam.h>: i* W; b* r4 t/ F) d4 R* U& u
- #include <linux/sysctl.h>
% |- i6 p9 Z a' _" h" w% O( b - #include <linux/mm.h>1 j+ n2 j0 ~/ T
- #include <linux/dma-mapping.h>! a) D; Y3 e; _( k4 K5 k
- 0 G0 Z: r: n5 K
- #include <mach/memory.h>1 z; M) f0 q, I' k7 `9 E
- #include <mach/hardware.h>
% P% w D; |8 g( s8 J - #include <mach/irqs.h>
# y6 J2 _! s3 t* c( D# H( V - #include <asm/hardware/edma.h>
3 n, \3 x( ?7 x; W: X
P* m, v3 @* r7 o6 k- #undef EDMA3_DEBUG, `$ N* T% H) O4 r' T
- /*#define EDMA3_DEBUG*/
" B6 V9 @8 q* a- [
2 ]4 A% k9 b6 i9 B- #ifdef EDMA3_DEBUG
5 Z* m% b6 z" v) Y, ?& k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& O7 I+ I; v4 ~2 r6 R) C& p! k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); k( v' M! i: f1 E# |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 i3 T& c6 Q5 c
- #else" {7 o% M8 s/ R- a
- #define DMA_PRINTK( x... )
+ \# {8 _- i" m- H - #define DMA_FN_IN* m* a4 l" x! d3 t0 `9 X! g( m& M$ O
- #define DMA_FN_OUT
/ I4 n2 W" P7 d6 ` - #endif
9 n j X0 H' R& w- K
+ L A' ?6 u. W' r- ]: r1 o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: K# U7 `# m- T - #define STATIC_SHIFT 3: W$ d7 h l1 g f
- #define TCINTEN_SHIFT 206 W v# d) X. I) ~8 E3 M
- #define ITCINTEN_SHIFT 218 V, W1 h$ n9 i" l
- #define TCCHEN_SHIFT 22
% y- L& q; P' c r I3 ] - #define ITCCHEN_SHIFT 237 U$ T/ r/ B0 {$ c: [
9 }# c6 [) R5 j) @$ l- static volatile int irqraised1 = 0;
6 M* u: q, m# D& R; ? - static volatile int irqraised2 = 0;% E1 y% P# r/ G7 I2 D
# K6 h% `9 h3 K: Z5 }7 M: M8 J/ e5 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- x! c# g& r: i4 H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, ^% C# v' `' E8 l/ ?. T5 T2 I' t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* m8 g- @6 J( E2 M' E/ q - 7 S- {3 x5 A7 u: z& z
- dma_addr_t dmaphyssrc1 = 0;
- h5 a6 Z7 T! p - dma_addr_t dmaphyssrc2 = 0;
5 F; o; |* |8 q- c$ F7 F - dma_addr_t dmaphysdest1 = 0;1 s# Y% j& u' R4 w7 n% a* N$ c( D' S
- dma_addr_t dmaphysdest2 = 0;
% x; |5 r* G+ D2 q2 [
" ]: Z t8 _& I0 n' v8 M2 N- char *dmabufsrc1 = NULL;
& W% f# j$ Q% Y' M7 _- Q - char *dmabufsrc2 = NULL;% u/ x+ U& b) A5 [. c% d
- char *dmabufdest1 = NULL;
# {8 Y! z% q5 e3 O1 W: l& ^ - char *dmabufdest2 = NULL;8 Q" j9 P8 t* a& `$ t! h
' B% @6 H Z- i- static int acnt = 512;
+ ]6 W! w0 D; [8 p3 h - static int bcnt = 8;
& X: o7 e) g/ g$ c( x - static int ccnt = 8;. Z: n y$ v9 O" h: Q
2 x: O1 z! Y# l5 r6 z2 g- module_param(acnt, int, S_IRUGO);
3 R/ c) D3 k% \ `& V( D - module_param(bcnt, int, S_IRUGO);
3 r# _* B" O! B7 b - module_param(ccnt, int, S_IRUGO);
复制代码
% R* b: g5 L7 E0 z- f
3 m$ f/ R8 W3 [* }3 F/ I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, E/ o, S- [+ q9 C, n( a' w) Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ }" F O! @8 e# N+ n; p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( Q* u! e0 T$ z+ M1 U2 e6 v
: e) I; W" R i6 b2 E
3 B( f7 u+ {& P2 e4 I: |. ~
|
|