|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. }; |. e1 T; F4 _+ F1 S- [code]EDMA sample test application$ n. e( b, c9 _' V# {# D
- /*
5 a4 M# l t Z4 y( Z$ B4 p% N; T - * edma_test.c7 e) y9 V/ Y, m2 P- g
- * M a) r+ ^( f, E$ J) L) k/ a
- * brief EDMA3 Test Application+ H+ A! H. w& x6 b, V) Y
- *4 C3 d- }8 }# A2 u; [& L! r5 F
- * This file contains EDMA3 Test code.
- L" B: _/ y$ r# H/ `6 a7 b6 p% c - *, S9 j7 w/ S$ l& m( A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ \) Y9 ^$ I# ]( P% a8 @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 C: O' C0 h/ Y' O+ r2 | - * TO CHANGE./ m; r; E0 M$ v
- *0 R/ _: J0 X: d# f+ m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 _/ M6 z; L* M/ z/ _
- *2 \$ U, R( C" U/ J
- * This program is free software; you can redistribute it and/or. o% m! I7 C* P; I9 ?, A/ H1 M9 e7 K% Q6 D
- * modify it under the terms of the GNU General Public License as
( |# x# r& L, f- I7 H W1 m+ U - * published by the Free Software Foundation version 2.
8 E( [, A& T3 l: n$ l' ] - *6 G1 N0 s S( B( w( I, G! W5 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: y; N+ g8 G/ D4 l - * kind, whether express or implied; without even the implied warranty
Z) r+ ~ ?! i# v8 ?6 D0 c( V6 a' ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: J6 Z7 v# \( a- Y( I - * GNU General Public License for more details.
: ]: e' w# V4 n% {5 Y3 K - */1 Z0 F* E8 k! A. H8 Q! g9 [
- 8 u. N, m# t7 K( Y8 H
- #include <linux/module.h>
# I$ W, H& |3 O& w( K - #include <linux/init.h>0 A! d f* Q/ W. g& C
- #include <linux/errno.h>
+ ?6 O8 @$ i. n; r0 z - #include <linux/types.h>
) J' l8 s; P" j7 p5 j2 i - #include <linux/interrupt.h>/ R3 i6 S8 M) Z$ F: v
- #include <asm/io.h>
5 R& u( t. a: ~' N' c - #include <linux/moduleparam.h>; G" }, P0 b# [
- #include <linux/sysctl.h>7 L( \! t" \ o
- #include <linux/mm.h>
0 t9 Y. V2 I! B! C# |$ q0 f3 S/ Y9 m - #include <linux/dma-mapping.h>. l( h( ] l4 N! b
- 5 a( G7 K! F# h5 @( [
- #include <mach/memory.h>
, `* E M+ T- p2 z5 g& z7 v( P - #include <mach/hardware.h>
2 f+ j& T* g4 _1 U - #include <mach/irqs.h>
+ U8 Z A3 c. Y! l2 O7 k: Q3 b - #include <asm/hardware/edma.h>
1 ]6 o1 T/ Y! t7 b' W: u7 X) f
8 h: U$ G v4 h6 {' L( j8 S- #undef EDMA3_DEBUG7 g% _$ D; I, l3 `- X- n8 c2 [
- /*#define EDMA3_DEBUG*/5 o0 x( r0 l1 }. J3 _( `9 ^
- & s2 x& `. {" B1 U7 l, K# y. r
- #ifdef EDMA3_DEBUG. {8 f6 `7 E1 e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ U# O0 [ X- W: Q+ s4 [. b- m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 _) x6 B4 v2 h( b3 h6 x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! f4 V6 T3 l: { q2 l
- #else' Z# j/ @: e$ D+ X* H0 B/ g
- #define DMA_PRINTK( x... )5 m9 f4 I) K) p F3 w+ c7 D
- #define DMA_FN_IN+ v% s, c6 t* m
- #define DMA_FN_OUT1 u0 D8 {7 f" K& u/ v: m0 A
- #endif% R/ `2 y: A. }* q( h& r5 H
7 d" w2 \1 C8 a: B, L. E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; R* z! u- e/ m+ g2 M - #define STATIC_SHIFT 32 @: z: l' G k6 V& ]/ U
- #define TCINTEN_SHIFT 20
; U& j& L$ g$ H0 _8 M. ?" e2 Y' t - #define ITCINTEN_SHIFT 21
M: s' e5 |/ y4 u! h3 I7 p - #define TCCHEN_SHIFT 22
7 U* O, Q! M% M" [" e; Q$ j% e - #define ITCCHEN_SHIFT 23
& z) s9 K3 k( T$ W, G. h
, W F6 [, v6 N1 {) @! f% z4 z" a- static volatile int irqraised1 = 0;# A5 I- Q% N4 p: g9 W
- static volatile int irqraised2 = 0;7 I" X7 z- U" I/ o6 s% K9 }0 p( Q
- # b* I; ~* ?' Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. @0 b" |, O1 Y3 g) q5 X+ k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" w2 |2 J: q; Q& Q) A/ B% b7 m: F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ^' L i/ c E0 G" U
- . s- W* z' b6 w8 g' L
- dma_addr_t dmaphyssrc1 = 0;
- U( C/ K1 P" B, O5 s9 a - dma_addr_t dmaphyssrc2 = 0;
7 a, l+ w- c2 V1 e" B# ` - dma_addr_t dmaphysdest1 = 0;
' z0 Z* W# F/ }" y4 j - dma_addr_t dmaphysdest2 = 0;6 I. E d( l2 D: w. D. {: a0 K
. _+ J5 [7 A; _: O- char *dmabufsrc1 = NULL;8 @9 i Y' X6 u3 N6 x. u
- char *dmabufsrc2 = NULL;$ I+ `8 M( K% }
- char *dmabufdest1 = NULL;
* x+ m0 Z* Y* i# e# U) e, A - char *dmabufdest2 = NULL;
4 |' G5 q- a- m5 e. p - ! ?( z# r( r8 O* _$ R( Q0 h+ x1 e
- static int acnt = 512;
. X/ J# @/ f7 ^+ ?$ I - static int bcnt = 8;6 e/ X' h% D- u9 Q! |8 Q9 K
- static int ccnt = 8;' c4 ^/ q$ g$ p: Z, d
- ; _6 h# u: w& N6 g
- module_param(acnt, int, S_IRUGO);- N1 B; t( O% g& g$ ^. _
- module_param(bcnt, int, S_IRUGO);
! Z# z: D8 f b' _ - module_param(ccnt, int, S_IRUGO);
复制代码 1 E, w( i$ }# f4 e6 |, I
8 e% u6 g/ j2 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ M% ?8 i- B9 u- u varm-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# S1 j/ {, V3 {5 j# W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 @$ e; k( c: C1 X. Y* K/ M( @8 Z
& w' F( L0 h- i3 O7 r( t
! D- g- w: o; h4 b+ M2 s |
|