|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 @" N8 V% w) d0 U0 p
- [code]EDMA sample test application1 b5 w! s! K9 t e: u, `
- /*
! y, ]$ @5 L, p$ x; A* i - * edma_test.c
+ U' u7 w3 j) U E' A( {2 O - *& Y0 a3 R+ C3 J" M' D* X
- * brief EDMA3 Test Application; [. e4 C+ y$ b& c* E& ^0 m: B
- * d5 }* r7 y0 i) g# w5 d
- * This file contains EDMA3 Test code.4 B: P" B% j4 D/ n5 M
- *
- Z+ ?1 f3 x% Z. _9 g+ O7 g+ M" i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# G8 G6 B* B6 a' C# `, b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 L" ~# o3 {) L) t+ r* y, E
- * TO CHANGE.9 B( L l. D6 p
- *
& ]9 _8 B/ d9 V2 J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 N( P: h4 `4 I. e - *" a) y6 T( u& W( H2 i' n' @' g
- * This program is free software; you can redistribute it and/or
$ o! \* t7 t8 g# j- m/ V) D4 T - * modify it under the terms of the GNU General Public License as
& a5 u* _7 g% y6 r& e - * published by the Free Software Foundation version 2.
( q% ^( P U# y! P* _ - *
. M, z }( p. O# B5 K6 j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 L) \% s. m/ c: x8 P" X
- * kind, whether express or implied; without even the implied warranty F# a4 X% Y. A8 y1 o/ b0 \& o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: ]. Q9 A% `7 e/ A: M8 K2 |2 _ - * GNU General Public License for more details.! v, }5 j2 k) F; [
- */
4 P. k& L+ N$ p8 I
/ L0 c" b, ^1 A4 [* q% E- #include <linux/module.h>
4 d3 |1 | M- c9 `5 ~ - #include <linux/init.h>, G6 m! N$ [8 p
- #include <linux/errno.h>: v0 C9 c# Z7 c
- #include <linux/types.h>8 |# }% F% Q# _6 N
- #include <linux/interrupt.h>
$ L8 F; g9 W. q: I - #include <asm/io.h>7 P( y$ o) K s) Z3 @
- #include <linux/moduleparam.h>
; }9 u5 S7 \ [; M - #include <linux/sysctl.h>
% [% { b1 u6 @ - #include <linux/mm.h>
( J" T: F$ a# W3 H - #include <linux/dma-mapping.h>; S" J$ B6 ?: ^; }$ I/ F
- . `( n5 @' ^4 R; x! r
- #include <mach/memory.h>
9 x" q2 [. n7 v! D& p8 N - #include <mach/hardware.h>* K0 i. u w$ M9 a4 f5 e' v
- #include <mach/irqs.h># v+ r! Q$ z% R' ?$ }
- #include <asm/hardware/edma.h>+ X0 R( {" `" `. n7 J+ [
2 E/ P: ?: k9 T; o- #undef EDMA3_DEBUG. R$ k& ]% x& r0 L0 e" ~/ K! I+ w, p
- /*#define EDMA3_DEBUG*/- z5 q: W" p4 c% ^& Z7 |( o
1 ?5 v! j. o# L- #ifdef EDMA3_DEBUG. c" }. x3 z0 C- c1 b6 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' M1 T V. W2 j( `* g0 M4 d1 s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 r+ S( f! v- M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ c" G" Z4 g$ a- J$ E - #else
2 U! w! d/ f, J* p( K* @! L - #define DMA_PRINTK( x... )$ i7 G+ Z9 {! v y# V
- #define DMA_FN_IN
# y' Y% q4 ~4 k; K' V - #define DMA_FN_OUT
; V4 h0 `8 ]( h0 u3 J: [ - #endif0 J0 O$ h! i7 Y8 s- f7 \
) q" x7 _7 d1 x3 ?$ V! N w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 z5 Z( q, X. Z% B" D
- #define STATIC_SHIFT 3
* S; K! H6 Z' g/ W - #define TCINTEN_SHIFT 20
3 R) n) ~- p! q* J X7 I; L- Z8 p - #define ITCINTEN_SHIFT 21
5 Z1 l$ Q7 {4 b; i - #define TCCHEN_SHIFT 228 r5 ?8 V' u/ [, A
- #define ITCCHEN_SHIFT 23. d! b# s& Y& m
- 4 B3 }. B) ~ j0 t5 C: r T
- static volatile int irqraised1 = 0;6 l' R& N% m8 j" \/ Y$ D+ B
- static volatile int irqraised2 = 0;
; c! B x1 c8 G7 C
# [ e# g- m0 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# G. f* i' o' P6 o. S& ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 V2 c! ~* |% `; w, S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u! ? i# \6 R) j8 F# ^7 W
1 f4 j. N8 U1 |- dma_addr_t dmaphyssrc1 = 0;! \1 F1 i* Q; _, g5 C' \* ?: d
- dma_addr_t dmaphyssrc2 = 0;
1 |8 j: a! M9 w4 p - dma_addr_t dmaphysdest1 = 0;
- j/ y- @% Z2 [# S8 g - dma_addr_t dmaphysdest2 = 0;: v' E# b5 ? x @( F
! h. K4 s' J1 o4 X- a0 R( L- char *dmabufsrc1 = NULL;" N; m0 t; T! U, T% {7 _8 |
- char *dmabufsrc2 = NULL;
" R$ r/ m& n7 }7 m. |+ B& }7 F" ^$ N - char *dmabufdest1 = NULL;6 F g. H U) j- u+ V9 e3 w5 H
- char *dmabufdest2 = NULL;# {/ N3 m' a. Y+ ]
% a7 ?, q: h6 Y- ]% D6 p- static int acnt = 512;
2 E0 x+ Z' t- j3 p - static int bcnt = 8;
0 j) u; m) R, ]% l( B. B$ N$ W - static int ccnt = 8;1 l. Q- p( W. {8 O% q
- $ x+ x4 w2 H/ C$ u& g5 N
- module_param(acnt, int, S_IRUGO);
7 n) T0 r9 T0 }; Y* q. r - module_param(bcnt, int, S_IRUGO);; ~& D# v% M& f
- module_param(ccnt, int, S_IRUGO);
复制代码
/ V9 ~5 b& J- k" c
Y3 n, X) V0 n0 i' M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: Y# N" | v9 V+ ~( Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ V4 L$ W3 G) c+ d. e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" M, p; H2 b& G
* \; b( I( R& q9 y* @5 C! B
- Z$ F( M/ m; J, q N0 T8 q
|
|