|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & D: r# G" ]4 ?
- [code]EDMA sample test application
6 r. A, c/ y3 q1 R6 h' F - /*4 M- }& y' {5 c
- * edma_test.c
% _% t# b" e) m5 S2 S$ ?$ p! M - *4 P/ Z" a8 u3 a7 y
- * brief EDMA3 Test Application5 |+ E% F# g7 C+ _. P2 x% W
- *' L' w2 X3 f1 E' o
- * This file contains EDMA3 Test code.
- x% y8 j* I# ^" M( |9 _ - *
9 z) ^; m8 N1 A T: L: q- z! g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ w& a* o% a0 w8 E* ]7 Z8 l' k T) D* ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* x9 X- B) N3 ~2 Q& ]
- * TO CHANGE.2 X9 F( `! v$ r# a) V3 M7 E
- *
4 P8 e8 h; d2 L& A* U* o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" A% `' H% [& n& ~) a5 I! i1 C
- *
p% {- o( y/ u! r- ^ - * This program is free software; you can redistribute it and/or
* L: e' i7 g2 F! X% Z4 ]7 e9 \ - * modify it under the terms of the GNU General Public License as
, n2 f- A+ y: ?! T! c - * published by the Free Software Foundation version 2.
' g/ }: [8 u. o2 k% r6 k - *
% s: q# Q6 a8 l; f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% g: r9 [# ?7 S5 c
- * kind, whether express or implied; without even the implied warranty
& L; `% a: m- r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ B# Z; p& t- X+ Y# g
- * GNU General Public License for more details.6 J7 h2 d& F5 u3 V
- */( H, d5 L& P$ T. g+ o: }' M
- # K: O9 ?/ {2 o8 F& w& x5 T Y% u
- #include <linux/module.h>
& \$ ?( V% Z* r! X; c: x - #include <linux/init.h>3 b. M8 a9 a2 n* m p+ B
- #include <linux/errno.h>* P1 Q8 X) L7 e. `. ~
- #include <linux/types.h>
" f0 q( M+ p2 n - #include <linux/interrupt.h>
+ ~4 \) ?" p4 a# G. y - #include <asm/io.h>5 Z/ @. B0 c- \2 b
- #include <linux/moduleparam.h>
: G% V( Y' \! ?, l' T- X2 {! g8 Q - #include <linux/sysctl.h>
" B/ ^' O0 K2 I; j9 t - #include <linux/mm.h>
m% M4 N/ r# k* q. n5 \ - #include <linux/dma-mapping.h>" I! n" {! n" ? n7 D; T) F2 y7 k
- " ~& Z: k$ n5 j) b# C
- #include <mach/memory.h>
1 N$ \+ H1 W$ ?/ M% h) h( D - #include <mach/hardware.h>1 O2 z' b) C5 y. V/ B$ e; k" Y
- #include <mach/irqs.h>$ z( Z% K. P* |) h1 L
- #include <asm/hardware/edma.h>7 u# x1 ~9 S! A9 U8 I4 o% n/ e
- # e! U' P9 d' s/ T; ^5 z- |, o
- #undef EDMA3_DEBUG
/ z) q7 ^5 y" E$ g y3 ` - /*#define EDMA3_DEBUG*/, q- j) Y5 h; u" J& C' X+ C
$ @: e @; @8 R8 _- #ifdef EDMA3_DEBUG p7 H" d8 ~- A1 f4 V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- A) V! C0 {' b0 W4 w0 w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! f# k! t. A2 R' R6 x5 f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# Q, c- g" y- D5 Q7 b4 S - #else$ b5 C2 G- _' f7 t' Q b2 L
- #define DMA_PRINTK( x... )
% I9 e% T; J1 B# Z0 P5 f6 H+ r9 T; g - #define DMA_FN_IN
* ?! r& @8 v3 s& a - #define DMA_FN_OUT
* K# J6 l1 V) _# ?( ? - #endif/ s; D- `& F' s5 n5 t% z
- 0 w4 N+ G7 u9 x+ K. G; v( \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& I+ Y7 i6 h9 s) j3 T
- #define STATIC_SHIFT 3
) S, f+ U$ t! K0 ~' f8 p% ~ - #define TCINTEN_SHIFT 200 z3 e% f# T1 B9 _- g5 }- D
- #define ITCINTEN_SHIFT 21
1 {' O2 W, U2 n' I# o% `; K - #define TCCHEN_SHIFT 22
( J5 Y3 B0 P7 i/ b9 |4 e$ o - #define ITCCHEN_SHIFT 233 L$ x1 N. W O
! e9 f# ^ @1 }9 \- M+ M- static volatile int irqraised1 = 0;
7 b1 r* \: [5 _* X - static volatile int irqraised2 = 0;+ J" R; _) h. [" j0 a0 {' \9 _/ c$ h
- . M0 V9 @$ P! p" p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ n# z* E" Z. ?2 R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 G7 i4 B. C$ h8 `# w# U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" @% l" T0 Q; V8 G; @
- 8 H- n, Q2 {7 K0 R8 l/ Z& Z
- dma_addr_t dmaphyssrc1 = 0;; Z9 v" {& A, X4 p0 f' J+ ~% ^
- dma_addr_t dmaphyssrc2 = 0;
, a' N9 F3 b5 M+ X# @ - dma_addr_t dmaphysdest1 = 0;6 a5 `$ f$ e# a+ J
- dma_addr_t dmaphysdest2 = 0;
! D. O+ _/ g% E; x6 s; U9 H - $ {- _2 i* r% M4 ~2 U
- char *dmabufsrc1 = NULL;' `, R' c2 B- K0 L4 T$ _
- char *dmabufsrc2 = NULL;2 U/ u7 J/ |9 B: x% A2 l0 o( Q
- char *dmabufdest1 = NULL;
3 y p4 }& v4 y3 S - char *dmabufdest2 = NULL;
; k, X+ d4 Z* D: L5 ~4 j; |5 y
' F% o9 Q* p; Q$ P+ q- static int acnt = 512;
' i- F f: Z( n' K3 S: ?* b. W - static int bcnt = 8;5 b6 w( x# ]9 _* `
- static int ccnt = 8;1 `6 f7 c( u0 K5 d# r( f
- % B1 ~# C% V. B# Z4 f0 H/ w1 y
- module_param(acnt, int, S_IRUGO);
9 G* T- T# L3 b% \5 \! s9 N- G0 K - module_param(bcnt, int, S_IRUGO);
) ?* g+ ^ y# a7 I - module_param(ccnt, int, S_IRUGO);
复制代码 * O U) J2 ?7 l$ n- g
7 I0 g+ \9 Z" F$ A7 Y2 g$ M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* x* M, L0 `1 t/ Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 E- G$ O1 o4 {2 I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: \3 N. U9 |+ L6 t
1 P* q1 ^: q7 A/ D* a6 h0 c% Q3 M+ `" P
|
|