|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 }! F8 i! i6 @8 L" B- {* _9 `
- [code]EDMA sample test application4 ]6 j! D+ Q6 K2 u
- /*
) r% r& f/ Z$ L) @4 v! @$ p+ j - * edma_test.c
: R% y7 e+ \5 T' {, |) h - *
) p2 P* H- r* X2 A6 _# ~ - * brief EDMA3 Test Application
4 X6 ~8 z6 e, o* B - *
" X( _- I5 V; u% b6 o - * This file contains EDMA3 Test code.. M" G8 o7 F y! D3 P( T4 h
- *
; ~+ t7 h G7 W" h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 o" H1 s5 N/ P* C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. L3 E) O1 \4 o - * TO CHANGE.* Z2 R# o" V0 H8 l# M
- *
: G% n2 Q2 W9 ]) p) k! t' x+ ~$ } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% t @: w8 F! f* M - *
3 b9 m0 d6 v0 \$ F6 J - * This program is free software; you can redistribute it and/or
. u& {2 F3 T0 R; @$ j% k - * modify it under the terms of the GNU General Public License as+ [5 M9 D3 Z% J5 K' k/ W ^
- * published by the Free Software Foundation version 2.* r1 U/ U3 Z) w, |) l3 O
- *
' [% _5 r5 |. q" u% j4 Y ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 I# A( w- J4 @6 n* K1 o G
- * kind, whether express or implied; without even the implied warranty& j& M3 c8 U- S6 a/ y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! N4 T( Q) i3 l6 ~! F
- * GNU General Public License for more details.
: f1 a# d) w: a- c" w7 U& R - */" j+ Y: y) W" X# J
- : G7 n- y+ z( o; v' J
- #include <linux/module.h>
% s y6 w" R( R! G6 f - #include <linux/init.h>
% J# p" b2 t( Y( O1 | - #include <linux/errno.h>
5 G( }8 o, A& P* C _. ~' j" Q - #include <linux/types.h>
" N& H4 d& O! _ z! `: X# l: b - #include <linux/interrupt.h>; I& k: M1 X* m- [1 s: E% {
- #include <asm/io.h>
" k+ Q* j/ ?/ ?1 W: r - #include <linux/moduleparam.h>, l& k" w! ?, ^1 {: K* Q
- #include <linux/sysctl.h>
+ A' P2 U4 Q+ `# w$ a5 S - #include <linux/mm.h>
a, \5 J3 Q" L- N0 c# y' [& C, O - #include <linux/dma-mapping.h>: a/ I6 r4 Y r0 `3 C+ Q, l
- 6 O' A+ q; e, E& V8 B |1 B6 r- B% Y
- #include <mach/memory.h>: ]; d B8 v0 R+ k' ^' e; ]
- #include <mach/hardware.h>3 }* s& y, \( i5 |1 f# e
- #include <mach/irqs.h>
9 ?; Z2 n) W2 f; l) N+ l" k8 F; v - #include <asm/hardware/edma.h>
2 a, r" Q. D* O: }/ a
4 l4 k2 L! S* X6 {% s9 }- #undef EDMA3_DEBUG
. I0 c& P6 {5 m$ c - /*#define EDMA3_DEBUG*/0 \3 |' D: R0 a' S, p
1 z9 P9 U8 h- r2 X. @5 _/ b# V- #ifdef EDMA3_DEBUG
! p9 M4 `$ z9 O" J6 V7 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): P! u" m: J2 Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) I" y# k6 [4 E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# x) X2 w3 P% Y: Y - #else
$ y. r7 ^& w4 { - #define DMA_PRINTK( x... )
- q6 |1 E9 v+ f' S - #define DMA_FN_IN% O& H: w3 F( w% C/ `
- #define DMA_FN_OUT
, u0 M; d' W5 J, w# J - #endif
6 }" Z4 C. ?" f" F - ) b$ e% S$ r' i7 \4 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# z, Z) f9 l2 r+ W
- #define STATIC_SHIFT 3
; ?5 P( ?# X% B& _# s - #define TCINTEN_SHIFT 20* F. O6 u2 k' B
- #define ITCINTEN_SHIFT 21
5 `# E# d# [! K7 w+ g+ d! E% h - #define TCCHEN_SHIFT 22
U! D. p& P1 m - #define ITCCHEN_SHIFT 23
% V4 \! N4 N; z+ F3 G7 ^/ i0 P - $ K4 k, s! B5 a7 v# U% X2 Z
- static volatile int irqraised1 = 0;& c2 z$ |/ @& W- K u# H
- static volatile int irqraised2 = 0;
$ X; R, K( Z( R8 t! T- t( a' Y
1 T3 ?2 Y: n7 a1 N0 k$ @3 L: U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- _* V7 x' d) Q, B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- V% x0 y" m! b8 f/ P( c5 s" R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 c, z/ a3 D7 i# S' R, v
- 8 A$ z4 f- Y9 C* J
- dma_addr_t dmaphyssrc1 = 0;1 F- l/ a8 T% ^/ u4 L' F+ \. D
- dma_addr_t dmaphyssrc2 = 0;
& Z1 x J0 ^7 r' |/ O! f4 l - dma_addr_t dmaphysdest1 = 0;
5 L1 q: R; m8 i# h+ }0 L - dma_addr_t dmaphysdest2 = 0;
4 D" h" N) c7 ~+ H; B6 h1 _7 I h. f
$ U0 E& l! R4 ]& T- char *dmabufsrc1 = NULL;
( r7 A4 F) X5 ^& B8 ^+ b4 _5 A$ _ - char *dmabufsrc2 = NULL;' f6 k+ K# C* N) r
- char *dmabufdest1 = NULL;
8 E; t4 |& ~0 h6 n - char *dmabufdest2 = NULL;
5 |7 Z; q% `) {- k" q
# v) D% } ]* s% l1 {- static int acnt = 512;. l4 a) N! X1 Z
- static int bcnt = 8;
) v$ t3 b$ b$ |' F! Y4 V0 T - static int ccnt = 8;" b3 J- {% ]0 h* n/ s
- 2 |$ t# V/ u. k: N3 g0 z7 I7 j
- module_param(acnt, int, S_IRUGO);! s/ g0 t! r. l* T3 g1 z* S7 s
- module_param(bcnt, int, S_IRUGO);
+ O5 i! R/ Z& L2 T - module_param(ccnt, int, S_IRUGO);
复制代码
6 R; @2 t/ K2 e5 w' z, h8 R9 k4 q" S9 m3 b0 Y& R6 l3 n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; _- z4 |2 a7 |6 X. o. q. p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 [* s6 ?' |5 w/ E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 G! R7 Q, G2 I! ]
8 H4 H% [9 I' a4 w8 w" _
, d: x0 [* p( S; w |
|