|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 K( U' x5 J) e0 u7 n, [- [code]EDMA sample test application/ x5 g: @) k- z( e+ A# l. z: P
- /*
6 [9 y4 {9 x0 h - * edma_test.c
5 G* w/ X5 Q0 c5 @ | - *
) W4 `4 i' y! s. q - * brief EDMA3 Test Application
% R9 \' ~. E2 [$ R" H( b# P) {' ^6 q - *3 {8 n& @) `' B) Y* }
- * This file contains EDMA3 Test code.# M6 t" z( y: o
- *- Y/ v4 T) c' I2 t; O% i% {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 X( d6 F/ Q ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% T8 c) g# d7 `( m4 r4 J6 q
- * TO CHANGE.7 L1 \- r7 v3 t, R# J. g
- *
6 c" M7 N9 y" \7 P) x! T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- q1 o3 ^5 M0 ] - *
$ D. @. k, f- Z3 p. d! W( ]4 w - * This program is free software; you can redistribute it and/or
4 y7 D: k$ _2 M5 H4 R1 {* ]+ P - * modify it under the terms of the GNU General Public License as
5 R0 P4 {2 |" i- G- h, } - * published by the Free Software Foundation version 2.
?% m& h+ P' E) j- M9 W8 Z* {/ { - *
9 A! ^% p2 S2 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 ]+ f/ }! h h. W/ \& Z
- * kind, whether express or implied; without even the implied warranty
4 T" n4 K7 [* p+ G! O- S/ z/ Z+ Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) U/ }+ l# C; F+ x0 I3 @4 F - * GNU General Public License for more details.6 W+ M3 H& P3 u. o" V5 b- l
- */
/ t( [4 @6 y9 k" g. E; s+ R - 6 a9 g% X) i/ k) S$ R' c% j
- #include <linux/module.h>
& a7 f$ m& V' o. f5 j - #include <linux/init.h>
) @, k5 M2 d% M7 q& f4 r5 E - #include <linux/errno.h>0 ]) R# c! L# H2 S+ `' r- a
- #include <linux/types.h>
. e! y3 ^9 T! d x - #include <linux/interrupt.h>, @5 M0 t3 s: @& r9 R7 t, B
- #include <asm/io.h>- C# y Y$ \" O4 ^% C6 Z5 ]
- #include <linux/moduleparam.h>8 \( D2 Z: M) G* x$ M& @5 v& U
- #include <linux/sysctl.h>
' N8 j6 P- h2 Q& v( m+ U+ u- n - #include <linux/mm.h>
- O% p+ t5 u: c - #include <linux/dma-mapping.h>. {4 O- P. i: g& L) D
- ( Q# O- W5 O0 N1 |
- #include <mach/memory.h>
% b: ~. B. i* r0 F% ~ - #include <mach/hardware.h>1 L" L+ _' R- Z" p9 h
- #include <mach/irqs.h>
" E3 V" a2 ~) B( M+ A. K - #include <asm/hardware/edma.h>. @) r$ y8 X7 j
, M3 m( D* `7 ?% J- A; f- #undef EDMA3_DEBUG# I: E- b) p7 m8 t7 k
- /*#define EDMA3_DEBUG*/( B$ `& t/ V6 P9 S: E
: [; {- ^) L& f" ~, Z2 j- J6 E- #ifdef EDMA3_DEBUG! d& g( `/ G0 q+ [! b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 W+ j2 D5 a% g+ I, P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. l: A& U% B( n+ \! H' U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# I+ J# M) Z. a( y
- #else$ q. b5 g, f+ `1 G1 `
- #define DMA_PRINTK( x... )
4 s0 {- j7 R5 w& F - #define DMA_FN_IN, v6 u4 V4 J, o% [8 Q
- #define DMA_FN_OUT
! l4 w4 n7 W- d, a3 ?# D& z& U: y( l - #endif
9 W {: `" e% ~7 J
1 l( `7 {. n, A R% _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" j2 M3 z1 N/ r
- #define STATIC_SHIFT 3: u$ U& O& |. |
- #define TCINTEN_SHIFT 200 a1 z- f! }0 a& D. P* E
- #define ITCINTEN_SHIFT 21
6 x1 `/ f1 Z, A J1 o, c) U/ f - #define TCCHEN_SHIFT 22) n& h4 k+ m8 b
- #define ITCCHEN_SHIFT 23% ?# P* f+ p! `5 j- M" ~
- 2 F0 @5 ~0 d: W6 l
- static volatile int irqraised1 = 0;
5 f/ U8 A6 ?$ k/ c+ X - static volatile int irqraised2 = 0; m* ?' x6 [; t& R" U9 k
/ f6 j' s+ ]; e' g( w% }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 b% b$ E S0 X4 @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' K# F6 P0 _" ^& f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 s, ?4 z6 _7 [, }; w
$ g; j! |; m W3 r! N- dma_addr_t dmaphyssrc1 = 0;
, u$ r" J& y7 d7 C' d+ o - dma_addr_t dmaphyssrc2 = 0;
8 B6 |, R/ u0 R - dma_addr_t dmaphysdest1 = 0;+ u6 O$ P/ s) j3 E
- dma_addr_t dmaphysdest2 = 0;
/ r2 t( S9 U* g' w" A5 Z# t9 f8 { - 7 Q% E" R# j: U5 |% k) A8 i
- char *dmabufsrc1 = NULL;
& f% Y! g# G# r! Y }1 d - char *dmabufsrc2 = NULL;1 L0 O( v% E1 }* O
- char *dmabufdest1 = NULL;* \. d4 T' O. q- q0 ?' I
- char *dmabufdest2 = NULL;
0 c8 D6 W2 ?2 g- I) @% K& Y; X - - y% o, ]( f* u' R- F# B" n
- static int acnt = 512;
; c' h6 S$ Y1 V; }4 A# o- i0 p - static int bcnt = 8;, Z! V+ R) \4 k! m" ~" b# n! l
- static int ccnt = 8;$ [! a) y; \% \; X7 w
- i* C& p2 z3 n* t
- module_param(acnt, int, S_IRUGO);1 \- A# T# t5 X4 u& ]8 I8 A8 R& e$ V% {
- module_param(bcnt, int, S_IRUGO);
# O/ E/ I4 L2 o! X- o# F0 i - module_param(ccnt, int, S_IRUGO);
复制代码
7 u4 f/ a* [7 N. A8 j3 _$ b1 R/ g" u( A' t- b, V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 a6 L9 B0 l' \( K; p5 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ]% O+ K) e- s- X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: J% b9 x; v8 b2 J5 o4 X; Q* K
1 F, ^: X' O. G- ~4 t* L$ b. ]2 g+ a; H5 Q
|
|