|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' z" P' p5 v6 g2 W. |' {" d* j0 |
- [code]EDMA sample test application
2 C- u' Q4 `# ]0 P0 j - /*
2 @3 N( [$ V4 A& \4 m, b- y4 ]8 } - * edma_test.c
. c5 k$ F2 t. v& [/ k9 E - *5 l h1 D; E) J1 [! c7 W. i* ?! X! Y
- * brief EDMA3 Test Application& l A5 p4 D' Z4 g/ C
- *) y- F0 O7 P+ c
- * This file contains EDMA3 Test code." Z% x3 _7 X/ |% Z1 g/ G* g/ U
- *
( B7 h( J2 c% F- h; r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 M$ }) g, m0 `+ k, \4 H1 m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 {: _# r) Y4 C$ G
- * TO CHANGE.
0 o `$ r w) `7 ^* E2 l3 b - ** |" T; t2 D+ N8 f' l+ c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// }/ z, R4 r) n. a$ R# ^6 _
- *
" x0 @4 q: S7 i x - * This program is free software; you can redistribute it and/or
" p" Y) u! A B1 P/ j0 U4 O - * modify it under the terms of the GNU General Public License as4 Y" @* z6 C* B/ w$ A
- * published by the Free Software Foundation version 2.+ j8 J) E& @! z- x7 Q. o. Z) M- W9 ^2 \2 `
- *, s) C( k" b* }' y6 a3 C' J; J3 ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) Y: h+ Q k+ b. w3 Z
- * kind, whether express or implied; without even the implied warranty
% {' ?2 E- _) n3 o( s0 x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 `( f+ u* ?1 k2 Q' s% S - * GNU General Public License for more details." d, u$ A( S/ z( @
- */9 Y8 \- }7 P- `2 B$ ` h4 `' i
- 6 ]) D/ K- Z% }- C# i. u) j9 f
- #include <linux/module.h>
% z1 E. {+ @7 w. }' A6 Y - #include <linux/init.h>
) L, g G1 q# E7 w- \ - #include <linux/errno.h>' n9 Z n! G5 _4 u
- #include <linux/types.h>8 E% L( o! H8 \8 m8 k
- #include <linux/interrupt.h>
7 g3 p1 m, A1 x0 D" ?9 ] - #include <asm/io.h>
R4 Y, g$ u# e$ h+ b7 g D - #include <linux/moduleparam.h>9 T; a! B- }; `1 c8 Q6 j) m: X
- #include <linux/sysctl.h>
; k/ G9 \ ?: ?6 Y - #include <linux/mm.h>! D6 N$ c7 l5 }: W6 ~; g* o1 j
- #include <linux/dma-mapping.h>
3 S) x |$ ^. X2 B! m- ~+ v
! s* y: t% F) V3 _$ u6 a- j: Y- #include <mach/memory.h>* j" w% H/ k% t- @ g ~; A9 F/ c
- #include <mach/hardware.h>
7 K, U6 u8 j% L. }# b! | - #include <mach/irqs.h>4 F: c' l* S% |: P
- #include <asm/hardware/edma.h>- Y. e' c7 v* w0 }9 G9 c+ E
% C4 X- \: \1 g7 a Q- #undef EDMA3_DEBUG
; v; F9 w5 L2 v( A1 c/ L - /*#define EDMA3_DEBUG*/" A$ Y4 `* V9 j4 R3 ^% K
% U5 g4 \: v9 c' j2 U0 |, o F7 q6 U- #ifdef EDMA3_DEBUG
; Q0 a* c2 n' Z9 g4 B8 p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" p$ p; ? c, c- }+ J6 b- Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 Z" v9 Z- }% u* R+ X! P/ M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ T5 c5 r$ R7 k4 @) Q u# O0 W" @. V
- #else2 }0 p6 X! H4 l+ M3 d" U* u! E
- #define DMA_PRINTK( x... )5 o! u* \8 V; U& G7 ~4 i# m! `6 `
- #define DMA_FN_IN# ], W; w* z( Y; k
- #define DMA_FN_OUT
4 n* n# `9 I( j, L, V - #endif
$ D# U5 q! G5 D( L2 M
- a* l3 v% ~; l8 J3 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" B# W0 X) }) J* P& F! s
- #define STATIC_SHIFT 3
; x* m# v- ~ Y1 G% y - #define TCINTEN_SHIFT 20. m* Q4 P; j) ~: n
- #define ITCINTEN_SHIFT 21
6 ?1 e- B: G) t) Q0 N - #define TCCHEN_SHIFT 22
# r6 e& d. |" e& m: t# k6 s7 I a - #define ITCCHEN_SHIFT 23
. ~% E) q5 T }8 |
& c0 g6 U# H5 j- static volatile int irqraised1 = 0; c! w' K" O% L& p8 e- p
- static volatile int irqraised2 = 0;3 Y$ c) B3 r1 m2 h% F* X8 G
% G) C( ~" z/ U8 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- U9 U' N' F# J) A7 Z0 m3 L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% a$ j# S, U: ]1 l' d1 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" h7 i3 h/ O: s( K, D& ]# N
6 P, n5 y! o& O9 g3 ^- dma_addr_t dmaphyssrc1 = 0;
+ o& k* c$ A) k: k; Z/ J! r" p - dma_addr_t dmaphyssrc2 = 0;7 o- c/ o" P8 h7 A
- dma_addr_t dmaphysdest1 = 0;
( q- L* w) |( d - dma_addr_t dmaphysdest2 = 0;
: N. N" X; ~/ b, e7 |" `
; N" A, i$ p/ v+ k! \) D- char *dmabufsrc1 = NULL;
6 l% T9 y4 w4 U9 d8 ?4 ]$ f - char *dmabufsrc2 = NULL;8 S5 z5 g C0 T% s3 r
- char *dmabufdest1 = NULL;
( Q9 R9 F6 V( _% W3 V8 T9 k) Q - char *dmabufdest2 = NULL;( v& ]( y& n( k) u { C
- % `: b2 L: X* s1 [/ Z" C0 z( A
- static int acnt = 512;& {" N. c2 j6 I2 G* A. v) e
- static int bcnt = 8;
% F; k( O* x! J5 C- ?2 w2 ~* G+ j - static int ccnt = 8;; d% P }) ]; i& e6 h* F! D
- : r t3 M5 x% H$ n6 Y, n, ]
- module_param(acnt, int, S_IRUGO);, c7 T2 k- B9 o2 l5 ]
- module_param(bcnt, int, S_IRUGO);! H! |8 O- W) @
- module_param(ccnt, int, S_IRUGO);
复制代码
6 w5 @$ v' {2 Q" n1 C9 X: D
4 W8 V) |2 z+ R' u8 t# H$ K$ G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; {, _4 r6 ]( Y) Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- n _- u) Z- l4 R g$ {2 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 S% A' j2 K# u; D7 D- g: |
8 d6 q! O5 m1 a- K1 o! d! l" {9 z2 {
0 Z* q, e ~3 ~9 Z# t9 G9 L- L# x |
|