|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * M7 d% \% r! c4 O+ @8 ]8 }. v/ j
- [code]EDMA sample test application
" Z. ^9 f7 V0 F% _, O4 K - /*0 Y6 z8 Q! T; M) {! y. f- L
- * edma_test.c' M q) n/ l k! V9 d8 e
- *
5 A% K7 ]$ y, q - * brief EDMA3 Test Application5 y* H9 y2 q& @( M x8 Y9 V
- *
0 }. F/ F9 F' m/ Q. a - * This file contains EDMA3 Test code.2 V& n. S; n ?9 e5 \2 b4 Q) O3 M
- *
3 K& k7 w5 u; C0 ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( R/ d/ F0 a) _" | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! ?" q/ U3 V* a) G, J9 m - * TO CHANGE.
0 \% v+ r& Y' g' A! B1 l# ` }6 l0 S6 t4 D - *
$ b5 b0 }5 l' w+ A0 Z1 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 L& c) G3 a9 z# b) H$ S2 b l% B8 E - *1 m% }" Q/ u* G6 K1 A) y$ X
- * This program is free software; you can redistribute it and/or
5 C3 }. [! X' k! C5 g - * modify it under the terms of the GNU General Public License as6 @# L |- l6 h& b9 r( s7 Z5 }$ L/ y3 Q
- * published by the Free Software Foundation version 2.
/ F0 k' k& r+ t* v) C8 Y, G - *
0 k! s8 ?4 @2 b* c; n0 C* H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% X5 f8 D9 i( ~
- * kind, whether express or implied; without even the implied warranty4 e% r0 O/ u$ D" C7 ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 R( S% a: ]+ }: X I8 c
- * GNU General Public License for more details.$ m$ i6 V; B$ z9 J' J
- */
7 o* s4 ^. c, e; r+ X9 c* G
( H: M( K! O- @' T6 E- #include <linux/module.h>% }- _( v" J# Z: Z8 o% G
- #include <linux/init.h>
- V1 k3 @2 T8 a* { E$ m) d - #include <linux/errno.h># }0 g; ]2 o# o% B6 o
- #include <linux/types.h>
3 R B% @ ~. y/ o( e% c1 { - #include <linux/interrupt.h># D! C% E9 y9 S$ F+ }6 J. j
- #include <asm/io.h>
1 O r, c4 b5 g! O - #include <linux/moduleparam.h>( U; g/ _( Z; W$ H j
- #include <linux/sysctl.h>
2 C! X" U( O7 a4 x8 v. r. @ - #include <linux/mm.h>
9 I$ t, @2 B' \, J7 e/ G: \ - #include <linux/dma-mapping.h>
% P" t s( Z5 }3 F$ ~2 B; n$ s6 ] - 2 |4 A' m0 s/ c6 u- j' |
- #include <mach/memory.h>
* F8 `, D3 R% x - #include <mach/hardware.h>) ]9 [6 f% }0 \# T# z
- #include <mach/irqs.h>& s& h/ U. H) A0 n! J
- #include <asm/hardware/edma.h>6 ]# {$ }+ ]1 D$ G- W3 M6 U/ l e
0 C8 R1 X! o' A- #undef EDMA3_DEBUG
" l" \; g" I/ F3 { - /*#define EDMA3_DEBUG*/- Z" o8 m# @+ {2 ?$ _& b, W8 B/ P
- 5 E1 }( u, E9 k3 B3 v
- #ifdef EDMA3_DEBUG& e% c+ D/ P$ d5 p( p" ^$ g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: G5 g8 u( G, m/ n# y0 K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 _3 L/ t. f0 E2 n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& W9 a9 B0 o, W' i3 o - #else7 ^% W7 X$ B. ?1 i2 C/ C
- #define DMA_PRINTK( x... )
8 a7 Z. |' Y3 h8 F - #define DMA_FN_IN
$ c e T( X S' o8 X - #define DMA_FN_OUT: A& b4 u+ c5 J9 B( |! C& L
- #endif
9 x" \; K! ]7 N- @7 f* O! t
4 l) C! `0 z/ d% E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 q* Q! n3 O% L) u# U2 \ - #define STATIC_SHIFT 3
. D1 r$ h) w# H/ F - #define TCINTEN_SHIFT 20: c$ v: n+ |. d0 }( O, t4 z$ y' U% f
- #define ITCINTEN_SHIFT 21% x( i! O7 D7 n c% ~ v$ o' P- X
- #define TCCHEN_SHIFT 22; E& U1 D' j7 h' F
- #define ITCCHEN_SHIFT 23/ | v$ M* r+ z- X" b3 m
b4 G) V2 k+ o+ j" G& }- static volatile int irqraised1 = 0;
. |( u: ~4 r" M |: C0 ^ - static volatile int irqraised2 = 0;
' \0 ?& r) w" l - 1 K& l: p1 B% r9 f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ~5 v- y& C: q6 u/ Z1 w! i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( Q7 b8 _/ L2 d- M$ c' @. m) y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ h8 U- z( P' W8 u; T- B
- ' F4 f5 N* }/ s
- dma_addr_t dmaphyssrc1 = 0;) w& ?: r' Y% Z- L# P5 M7 P9 w- m' V
- dma_addr_t dmaphyssrc2 = 0;
: p/ q2 D( k5 i- l0 k - dma_addr_t dmaphysdest1 = 0;
. T# D' z7 ^5 l, X% y; d8 A - dma_addr_t dmaphysdest2 = 0;2 d) u3 m, a6 c `% z6 ~5 n* i3 Y
+ t1 D6 M7 Z8 M% B0 B- char *dmabufsrc1 = NULL;+ U3 d( W" g, O, K
- char *dmabufsrc2 = NULL;0 _2 c' Z, m V* ?
- char *dmabufdest1 = NULL;: U. f9 |: g# G1 P, Y3 h4 Z/ C# d m
- char *dmabufdest2 = NULL;
6 r6 V; Q$ T7 f1 j5 R
7 A4 U1 G, t. F- static int acnt = 512;
; K# J: Z, ^* C7 v) L) j1 Y# k - static int bcnt = 8;3 W% T8 A6 D- `5 ?( j* \% h! s
- static int ccnt = 8;
4 O- d4 J3 ?' I; Y) t9 r2 R# O9 c: i
C/ f* C% @* b; O9 s/ U5 y- module_param(acnt, int, S_IRUGO);' L! m* p) H# g# w
- module_param(bcnt, int, S_IRUGO);, @( c8 J% W- g1 k
- module_param(ccnt, int, S_IRUGO);
复制代码
, _5 ]0 ]- x4 a+ t% N
/ o1 G0 }# B1 Q; E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 B$ e$ q! v' J% @# n& v! d$ o
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 l$ N$ ]% M8 a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: Q8 g1 e$ b! o2 F& F
/ S& O& ^1 S$ F8 q3 w' ~% N( V+ F
) s: O9 u, J/ f, x |
|