|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , }7 Z9 T. s, Z' V. [# S
- [code]EDMA sample test application# @1 q- p1 h) u
- /*
* S) m" `2 P( P( ` - * edma_test.c
: t6 E; D3 _* ?' l7 T9 e+ k q6 M - *8 Z) W) R9 `" R9 A
- * brief EDMA3 Test Application$ v: E/ Y" g8 Q
- *) v9 G. p8 O7 X
- * This file contains EDMA3 Test code.4 O! Q, @* p& p6 k* m) e
- *
1 X1 H8 b5 I: h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. z$ p. x9 q: R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* I( h& H0 n# ]$ Y5 g
- * TO CHANGE.! c6 T, j8 n* }! i4 C
- *5 j o4 J; [7 q: F' S6 R9 D# I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 _1 [1 |) j. @2 Q- I7 w) X Z
- *
; j5 ^! a3 e: @# o - * This program is free software; you can redistribute it and/or
" p! {: ~0 A- A; Q1 g - * modify it under the terms of the GNU General Public License as
) Y) j: w! j0 m# v5 W/ K - * published by the Free Software Foundation version 2.0 a( f6 F8 c8 e) f
- *5 _/ E. d% z* r, p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 n b8 ~, g0 E4 E8 }6 g! j% q
- * kind, whether express or implied; without even the implied warranty @0 _" g- S1 v4 O* X% s( {+ y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( r5 B7 m' _8 D$ k
- * GNU General Public License for more details.
5 }$ G* @( G7 Q - */8 F% N2 Y/ N9 ~
% P& F, H* |& w- #include <linux/module.h>/ [1 G" r' X1 a) A' H( n; u) C4 e
- #include <linux/init.h>
: X8 G5 i- Y" L1 l2 ?5 i - #include <linux/errno.h>: Q2 W+ H1 d/ V6 I7 v5 _+ ?
- #include <linux/types.h>% F: ?( q8 G) d& r
- #include <linux/interrupt.h>
$ q1 B9 T! f* t6 | - #include <asm/io.h>( s% ~0 H' w$ J) A
- #include <linux/moduleparam.h>+ \* ~4 \' F( Q, ]' x& q6 q7 `4 T
- #include <linux/sysctl.h>
( Z* `! E! S! t& V; r# H* S# \% I - #include <linux/mm.h>
, U$ f8 r; V* C2 M _0 C5 }% x1 c( Z8 R - #include <linux/dma-mapping.h># o, M* Z* g- B2 ~& S
- 3 P: D1 j; P# @/ Q% _- d0 c
- #include <mach/memory.h>
. J% O# m5 k1 n% l2 T - #include <mach/hardware.h>1 k) ?) C- ]. J( e( z
- #include <mach/irqs.h>3 q. k" ?! C% b
- #include <asm/hardware/edma.h>
0 Q+ M$ C: p( p+ D0 t6 B
; @& u) C5 I3 ^1 }- #undef EDMA3_DEBUG
6 F4 }# Q8 o- ^8 j+ w* P - /*#define EDMA3_DEBUG*/. ^4 I' g) L+ C
- % j/ ?4 J" d* w& a
- #ifdef EDMA3_DEBUG
3 j* S! p6 F, Z1 v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' _. y3 M1 X i9 Z8 d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
g0 z; m& X/ c% h8 y4 l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 g; K- B5 A5 }3 v" `1 [! @) H - #else7 d& \0 E- p" b8 x0 ~! c# p5 n
- #define DMA_PRINTK( x... )
4 |1 F/ s1 {% G3 `7 ~ \ - #define DMA_FN_IN. X+ Z) [0 z8 w! T; Q' y9 K0 z% e$ i
- #define DMA_FN_OUT
/ L8 [8 w4 v' W. G: J - #endif
+ e2 }5 a+ ?7 `/ M# o - 9 Z; f) R+ n. @; J8 s3 P3 c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 j. K6 I1 U, w. E' m, ]; x) W - #define STATIC_SHIFT 3- a! Y( X4 p1 W
- #define TCINTEN_SHIFT 20
8 l" l3 h, f. m% D - #define ITCINTEN_SHIFT 21! K3 X( w& c6 P' C
- #define TCCHEN_SHIFT 22+ {0 g% p- s! k+ R0 N, r* |( M
- #define ITCCHEN_SHIFT 23
3 Q$ j+ h! U5 E N& ^
7 y$ z' [- a2 e6 O* {3 q$ F- static volatile int irqraised1 = 0;
& [$ X8 J% P7 Y; y - static volatile int irqraised2 = 0;6 J, t3 Y5 `' Q
$ G8 ]6 O! \* `, B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& r. O! [& H3 x6 B6 l% Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 O9 E L3 c% W- N5 Y8 E7 L6 l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Y G$ [- F* M V. U
" f3 H. k$ p$ ^4 l- dma_addr_t dmaphyssrc1 = 0;5 ]5 v k: ]4 t' V
- dma_addr_t dmaphyssrc2 = 0;4 Y- s9 C8 z8 p( P T( M* @+ h0 n
- dma_addr_t dmaphysdest1 = 0;
, h# J7 ]/ {; y, @ - dma_addr_t dmaphysdest2 = 0;: ?2 z Z" J; @. S7 I9 e
5 V% f, q1 v `! }! _- char *dmabufsrc1 = NULL;
3 h- w8 _( {4 r; s4 h, I - char *dmabufsrc2 = NULL;
8 \7 c- O5 J1 q. u- {9 D" {1 P - char *dmabufdest1 = NULL;
4 U8 v. R0 a. W- n( _ - char *dmabufdest2 = NULL;$ Y; F& a) R7 H4 C
- 9 p. t6 _: [! @* K
- static int acnt = 512;# A4 }% _' z7 V' E( V+ V# o
- static int bcnt = 8;
/ W3 ^4 A9 l f1 a8 p7 u& b - static int ccnt = 8;: z9 O, A% @4 a* m
- 4 R* K. w5 \- f. u$ Y9 w
- module_param(acnt, int, S_IRUGO);, ^) K! [( L6 d/ C
- module_param(bcnt, int, S_IRUGO);# s- ^5 i4 _: G& P M) U
- module_param(ccnt, int, S_IRUGO);
复制代码
: G1 m/ R2 t j$ |! }6 o8 S
( c9 D6 S4 J: _$ [! B9 B7 ~: _7 w; l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 W0 }/ q, }& U) y4 A! Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" }, Y' U8 f5 F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 A9 C, d, G2 t' ~
0 u# M! R3 {( J
8 E- `2 }$ q2 t1 v7 |% R% x |
|