|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ Y N& P$ |& _- [code]EDMA sample test application! [1 n, e& ` k, d E( D
- /*8 w m! X6 R% `5 I
- * edma_test.c
2 [( G$ n6 D! O& H. c - *& V. X7 k" `; E3 B+ i% T+ Y
- * brief EDMA3 Test Application+ }' e c# n, Q2 z; h G! T9 {
- *# u: S# e, r) U. e5 E- ]9 ]
- * This file contains EDMA3 Test code.2 r) K' @8 N/ ~+ ]' q* c
- *# Y7 {' s2 S' k9 j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ Q: A& D+ j: |1 u6 K* j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ U) g; n3 C4 _. g9 S$ G( J - * TO CHANGE.
- c: A4 @! E; U3 X$ `8 j - *
2 {9 U7 I& A2 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 z g! K0 O, }4 \$ q+ F6 v
- *
$ k: G' m# i. p - * This program is free software; you can redistribute it and/or
6 G8 K3 c: X) d. q d2 g - * modify it under the terms of the GNU General Public License as2 A, K7 w8 H" I# X- I5 l) h
- * published by the Free Software Foundation version 2.2 q0 h4 ]' |) h, K5 @+ x
- *0 i2 k; w; t% H+ y" q5 l. p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) Q/ F. E# T8 i0 n& n) F+ V
- * kind, whether express or implied; without even the implied warranty- ]9 }$ X; l% ]2 r" X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; o+ |5 q1 @) L
- * GNU General Public License for more details.3 a+ `8 o8 {" `" E5 c
- */
$ \/ x+ l; G, z1 _' M" ` {; n, S - 0 H" B& t9 A$ U6 J ]) G) z
- #include <linux/module.h>
- b% ?4 x1 h2 q, I5 _ - #include <linux/init.h>$ X/ ~7 @# j0 d+ @
- #include <linux/errno.h>9 C# B; m8 ~# H" \! F/ W
- #include <linux/types.h>% t6 I' r4 M o. K1 }
- #include <linux/interrupt.h>
" V( }% x% b; w9 Q! y9 S - #include <asm/io.h>8 V( ^2 g3 W" p, [
- #include <linux/moduleparam.h>7 k" f9 g# W& n% S
- #include <linux/sysctl.h>' j, n% U/ w! ]2 p5 A6 c
- #include <linux/mm.h>; \$ [ B3 H: {( Y' M
- #include <linux/dma-mapping.h>
- R% I) \. u5 h - ' ] E# j3 A( K' G9 d' A
- #include <mach/memory.h>
' m3 c- v) ^+ ]3 Z" h5 X& } - #include <mach/hardware.h>' Y1 D8 G% L$ [0 M0 y; H
- #include <mach/irqs.h>' a% e! o* o" \. m
- #include <asm/hardware/edma.h>3 |! ` _( @1 h0 ?5 M/ I
- ! d' ]1 N* s- C7 E2 \- D
- #undef EDMA3_DEBUG/ M& l A k7 r7 }( a) r" M
- /*#define EDMA3_DEBUG*/1 L. v& A- H' U. P
: j2 r/ L6 b$ W9 e* C- @ D- #ifdef EDMA3_DEBUG. U9 {, \1 H9 M8 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" F4 P: v5 c4 O/ Z8 ]$ W2 b, S! H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; A: X- `9 f! M. ^2 [( U$ z2 k5 s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! l# s6 I) \/ @/ \2 `! [& ` - #else
! g6 ? H& @/ O% m) O" o - #define DMA_PRINTK( x... )& { o; G X$ z
- #define DMA_FN_IN
% p; ^) n2 b; w/ M - #define DMA_FN_OUT
! w, ] ~2 ] T4 ~8 }3 T8 N - #endif8 ~4 X8 y3 c+ D, K
0 `$ Q S S/ R+ K7 |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ i% ~. j. ?6 y% x3 r4 V7 \
- #define STATIC_SHIFT 3
" T! }& K& ?+ n, Q6 T/ H1 A - #define TCINTEN_SHIFT 200 B5 h2 F+ W, e3 |) ]1 j1 G. W
- #define ITCINTEN_SHIFT 21
8 m! }" y, j( R. ~. w# w - #define TCCHEN_SHIFT 22
( q, h( T0 |1 }! X2 e+ Y7 ^* N - #define ITCCHEN_SHIFT 23 }; r4 u" g- h4 {5 `, [3 ~6 u; g
- 0 M; e8 z' P/ V# r' T
- static volatile int irqraised1 = 0;( [7 d/ k- _6 w4 \3 S
- static volatile int irqraised2 = 0;0 h! P2 O( j' J- n- A
- 0 f6 f- z* W" e( U7 J7 N# {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; z9 Z" q, n0 X% l; w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Y5 O0 P) `7 e& r9 C* c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 L+ j% e1 P1 U% J - 7 P: S2 E6 h+ B% Y7 A
- dma_addr_t dmaphyssrc1 = 0;
, F- p& L* i5 Z - dma_addr_t dmaphyssrc2 = 0;
" e7 j Z3 `% F8 E. R1 J# E - dma_addr_t dmaphysdest1 = 0;
# p: t* I& d6 ]( h+ x& u3 L4 t - dma_addr_t dmaphysdest2 = 0;$ n/ B' O3 F0 h, h1 S: {2 Q8 z
- O: u, W) Z* Z# q0 F
- char *dmabufsrc1 = NULL;
d ]% p* M' P$ E$ o4 a9 `. u* s - char *dmabufsrc2 = NULL;
, ~5 x' b9 S* \& g) l& E. G - char *dmabufdest1 = NULL;3 n( x1 a& s' B8 W
- char *dmabufdest2 = NULL;
7 g C' o* T8 w- _ - - Y( Z6 ?! R9 G# E
- static int acnt = 512;- _3 r: s7 a' f; O5 t: W, N
- static int bcnt = 8;0 ~9 g( g2 }, E( l$ z* o+ x
- static int ccnt = 8;
9 i" b0 a4 T# ` - : n, s# I7 C2 C# E* k. d
- module_param(acnt, int, S_IRUGO);
; j) j, r5 W8 q4 a - module_param(bcnt, int, S_IRUGO);
/ _5 m$ r1 F% q - module_param(ccnt, int, S_IRUGO);
复制代码
: g( {8 v+ c% Z. j k Y9 W
7 @" L/ p- h9 R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( n. u+ E" ]( H6 P, H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' m- N' r! W# ~5 m1 k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; t" s+ R. k+ L/ { e
$ g3 g. U1 X7 D& y* J0 n" a y: z4 B B
|
|