|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 j" K U, ~ l% `: G
- [code]EDMA sample test application
' V# U& v% K [& T. h! S6 f/ x - /*
" ]) p2 {/ d: G$ f" U0 G% w- R - * edma_test.c) [% a, I# G4 |/ @& c4 U
- *
5 m* ]7 @! ^" K" p' s3 Q - * brief EDMA3 Test Application
4 H' S P L4 W# s* V! }0 ~ - *
3 d2 d2 |- X" f! R - * This file contains EDMA3 Test code.1 h. I. S1 m7 `
- *6 W- _- N* E! a ~ Z* I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 c; g; h$ k0 `' ]/ Q! J, X1 B5 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- v; G& X, h" ?1 V( J4 q
- * TO CHANGE.
; v9 f+ E4 |4 ]8 |& D - *
; f+ w# C3 b0 T! M. b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" u2 d f6 I0 R* P7 ~+ o - *
3 T4 ]6 r# f' a. b* M - * This program is free software; you can redistribute it and/or
5 Z& r, E- V+ x/ M2 R3 Q1 Q- X - * modify it under the terms of the GNU General Public License as: L+ D: a- X+ P; i& m9 ?
- * published by the Free Software Foundation version 2.
- v0 y0 g9 o) \: p6 H - *' L1 S9 L2 Z1 }( h9 T' S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 _3 q; S5 W2 o q! A1 u - * kind, whether express or implied; without even the implied warranty' f- R9 P& x' @' ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, O* S$ A( h1 ?& ` I9 A# @) D - * GNU General Public License for more details.
0 Z3 N6 f, f5 j6 @& C1 n+ w - */( c, Q) D4 m' ?2 o; l
- 2 R$ T9 E. D) S7 z1 [
- #include <linux/module.h>5 T4 M# l5 \/ @ E3 t! @
- #include <linux/init.h>
% I' `& ^9 m8 b& M, R. _7 Q3 L - #include <linux/errno.h>
- Y3 {& j5 x& \ - #include <linux/types.h>6 L' b; Y5 y' s0 p! w
- #include <linux/interrupt.h>
* I7 A$ o( P4 m( B - #include <asm/io.h>
- I) R0 Z+ _$ r5 y - #include <linux/moduleparam.h>
9 D' {, `' k( \( C - #include <linux/sysctl.h>
8 L: t" h; Y, E' _' t4 j1 c - #include <linux/mm.h>' `2 v4 {0 p9 d1 i- B2 P
- #include <linux/dma-mapping.h>
' L u4 r! k: `& H4 t7 O+ a
- ~! |% }9 P7 W- #include <mach/memory.h>
8 p2 [# V2 G9 C - #include <mach/hardware.h>. }" E6 B: G' P4 y
- #include <mach/irqs.h>: Z% J r/ T% B5 e" e6 J/ J) e! S
- #include <asm/hardware/edma.h>
2 D! L2 ^ g6 {3 `$ l! ?( {2 L - 5 o, ~- V* l, z0 O, g. F# f5 D& ]6 g5 k
- #undef EDMA3_DEBUG( M# N5 s6 o; ^! {( q6 L
- /*#define EDMA3_DEBUG*/
0 S7 k# d- ^5 Y: G+ O - 7 ?2 T7 y& w0 }
- #ifdef EDMA3_DEBUG
# l# t3 @7 I- _% a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 s# `' N5 U. j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ M" {) n9 n. N' s# p" {& v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 p3 {/ ~' J8 e1 E8 z% ~5 h
- #else: d* ]9 ^; u* [( f% m5 w$ v
- #define DMA_PRINTK( x... )+ P/ @. }! e" |
- #define DMA_FN_IN
% l; y8 G, N/ p `- [7 u - #define DMA_FN_OUT
& G6 u& a3 G% y - #endif$ S# i$ j( y" w, o3 A3 s
- - v' d+ U) @4 K+ i i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% Q9 ?8 l/ `; f4 o, x" A9 D
- #define STATIC_SHIFT 3" Y5 P- k4 }0 }) R$ d) F* g
- #define TCINTEN_SHIFT 20' x( {. U- O0 z
- #define ITCINTEN_SHIFT 212 z& X: O- V$ w% Y; [
- #define TCCHEN_SHIFT 22
7 k* q6 V ^$ D6 M - #define ITCCHEN_SHIFT 23
, u0 c- A2 q- L/ \9 E# V* [
4 e% x; [% a0 W; A5 k- i+ e- static volatile int irqraised1 = 0;1 H; C8 M% M% z
- static volatile int irqraised2 = 0;6 r5 L3 P# c, h: ~
% Z6 n; ]! a: p/ ?. _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% P% U" a: o% m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M# W" @: L, j* D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 |" [; i& g l& Z: v2 E
9 [1 @4 r2 {- P" t: U. N- dma_addr_t dmaphyssrc1 = 0;
7 G& `: R: M5 I! y' @$ B6 l: n - dma_addr_t dmaphyssrc2 = 0;
; K i, D4 p2 q6 m% W8 g o" c9 Y, ` - dma_addr_t dmaphysdest1 = 0;6 p! ?/ }/ ]) B: x8 @
- dma_addr_t dmaphysdest2 = 0;4 F, ?6 v# {6 G/ J. ?" G
- + T( n& V8 r. O( |: {' H5 n- x7 D
- char *dmabufsrc1 = NULL;
. `, v) J5 T) S& `3 X - char *dmabufsrc2 = NULL;
) A; E/ p& C2 ]; q - char *dmabufdest1 = NULL;- z4 c! j: i( p5 g/ t9 w# q
- char *dmabufdest2 = NULL;0 d, O; l( E) W
8 y9 [2 B7 A8 C# D! k9 H- static int acnt = 512;# a3 V1 X/ m4 |1 d9 p& v/ o; O j
- static int bcnt = 8;; B0 I" _+ `% ]
- static int ccnt = 8;$ d0 \% _& E4 c+ |' i) w9 O$ B
, L. `: d: k( w' \. Q2 }- [" c3 ]- module_param(acnt, int, S_IRUGO);4 f) ^* e' {, t# X3 I) }
- module_param(bcnt, int, S_IRUGO);7 k. [" n; X1 M: w1 t6 G
- module_param(ccnt, int, S_IRUGO);
复制代码
4 ^" K! z: p, U \
+ Q$ x! t. n! ~; S. h& v( l' { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 A6 g7 E; @! @3 v6 l" b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 Q* h5 x& h0 w2 R$ ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: h7 e5 ~! o+ [! B$ R7 n( `
4 _" i3 n7 i+ e8 y+ @# p" C8 P
4 z1 I. ^* M- O3 A! w5 m# R# L- }1 r
|
|