|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * ^% p4 o* E0 _- b$ E
- [code]EDMA sample test application
% Z5 x8 c) A- \ - /*8 H9 S3 g8 w& S# @+ Z3 G( C6 l, x( h
- * edma_test.c
0 C! ], j# Z; X5 j* B7 w - *
, f" F/ ?0 m9 v1 t - * brief EDMA3 Test Application
2 e* I. I; {, t0 v q" K1 O! ~* l - *+ x/ i' ?) t2 O8 f1 ^$ `+ B- `
- * This file contains EDMA3 Test code.
f3 J* p7 N, n0 W% o3 j - *
, k! P- H9 y3 `$ o$ X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 A. m+ C, Q& M6 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, G; m0 E( B% n$ f% V - * TO CHANGE." u7 b! ^) C( r U+ H1 n
- *
" _# [9 h0 ]) A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# p9 e0 z3 _9 f. w
- *
( a: L- g/ G0 l) p0 c! m9 E: C" q - * This program is free software; you can redistribute it and/or% I ^8 z/ e$ r% W
- * modify it under the terms of the GNU General Public License as
1 K2 D1 c1 i9 j - * published by the Free Software Foundation version 2.
0 R4 _: g7 G* W/ J0 h - *
- C2 v4 O9 ?: a. Y4 y* k, S/ W: Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 O/ t5 k$ b( e/ E0 d1 W8 i0 Q - * kind, whether express or implied; without even the implied warranty! L; T! V9 b9 w9 z E. A$ Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 x" j; {) g; W6 F. m. E; b4 ~
- * GNU General Public License for more details.& a0 q0 q% V" j3 E
- */
0 ^& q( C# S! H. K5 l3 [
) K3 O8 V& I3 Q+ t- #include <linux/module.h>- h2 K% O* n+ G( g0 N/ W
- #include <linux/init.h>
; c9 Y8 h) X! ^0 D' T - #include <linux/errno.h>0 C* q, ~3 Q* s+ R1 W% d# ]
- #include <linux/types.h>
, V6 Z7 w# e+ g - #include <linux/interrupt.h>% { Q+ _- h$ q7 J$ C8 F& F. X
- #include <asm/io.h>
8 v p/ r: c4 q& U0 ^ - #include <linux/moduleparam.h>8 }4 {' E/ [( w& M, N' |
- #include <linux/sysctl.h>: n! v- |1 z- P! b% b- p6 B6 C! x
- #include <linux/mm.h>0 k1 b4 I& B3 g
- #include <linux/dma-mapping.h> x/ A+ y- ?- ?* u* u
- 5 j& _1 [# J h
- #include <mach/memory.h>9 q9 J0 X$ R* z, _4 Q& O& B! g
- #include <mach/hardware.h>
$ `' U8 |' n6 h% C; z9 V - #include <mach/irqs.h>1 K1 g9 B5 t" |- s0 m0 L1 l
- #include <asm/hardware/edma.h>2 H4 r; b9 K* \" v0 P! |
- + a- J w. ?5 Z. G* l j0 P
- #undef EDMA3_DEBUG. X% [+ l9 F& S' |/ g& N, b
- /*#define EDMA3_DEBUG*/2 |$ A& \' Z- W. L: `' V S w2 _
+ C8 E' j0 W7 Q9 [- #ifdef EDMA3_DEBUG
; E. h9 X9 I9 z5 f' s- n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), k& r9 @! z' K9 X( e7 Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ z1 f: g* Y7 c! F. M5 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 f2 O j! M) c$ H) W( N8 V+ T - #else
- F" S3 c9 h4 X2 a" T; S5 a/ ` - #define DMA_PRINTK( x... )
- K2 D3 Z, u$ M \; ^! T- ]8 p - #define DMA_FN_IN
Y" x. |8 M7 u: ^& \+ x2 f1 | - #define DMA_FN_OUT2 x, J* ]1 ~ Q$ s" A- x7 F7 ^ A
- #endif2 g- t" |- v, a- X
- / C6 Q3 {0 ^' h% `" _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! }& h$ o5 q, i: L: S0 f, K) x
- #define STATIC_SHIFT 3
$ r: d( `6 {, H' c - #define TCINTEN_SHIFT 20 l1 T1 e2 E+ {# a* K4 @* |
- #define ITCINTEN_SHIFT 21
( a! W" [; ]9 |8 n0 J - #define TCCHEN_SHIFT 223 A# n5 v8 \! r; \. J7 G, d
- #define ITCCHEN_SHIFT 23& E: J3 M4 B- ^! D1 v8 x" k) U d* C
- . U3 f' j( [9 l/ Q% f1 c6 R
- static volatile int irqraised1 = 0;7 W* J) K2 l- b( z; H3 w
- static volatile int irqraised2 = 0;
8 l& q# P0 Z- m3 E, l! q" s
! q- V9 [7 x: @& g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; m4 e: a5 A, p& |, b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ z4 {+ N9 d. Y1 {# r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); c/ [/ n, ?4 q; m* f
, h# O' e, ]* R' l. L- p- dma_addr_t dmaphyssrc1 = 0;1 o5 E9 h5 K1 O Z
- dma_addr_t dmaphyssrc2 = 0;7 g: v4 i) T# P9 t' t8 ^
- dma_addr_t dmaphysdest1 = 0;
1 a% _0 p; Z9 B$ K( n - dma_addr_t dmaphysdest2 = 0;
: r& a) p7 F& Q# x, F
% ?9 k, t" ^: }- char *dmabufsrc1 = NULL;
! Z, r2 ~- h8 r# o! s* F9 V - char *dmabufsrc2 = NULL;6 p/ i$ A7 P' Q
- char *dmabufdest1 = NULL;6 u, G6 @/ ^% o# p
- char *dmabufdest2 = NULL;6 ?) n4 k) `8 d: w0 V& [/ x
( ^+ `$ a% ^( A/ V& r% N' F- static int acnt = 512;) t/ F2 @4 Z. @/ x( M- O4 l
- static int bcnt = 8;
6 T. D, W- @2 {' r. o - static int ccnt = 8;6 X* ?# w) m" f; o" r
- + k& F' D) R4 c) V9 W8 ?* S
- module_param(acnt, int, S_IRUGO);
6 W/ x M Y3 r+ f - module_param(bcnt, int, S_IRUGO);: F& R7 @% z$ O, R$ e8 y
- module_param(ccnt, int, S_IRUGO);
复制代码
. N0 a3 x1 T+ Z- |3 h) Z% U2 C- o# ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ C5 { v0 P+ `5 i( varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) N6 @! y, ?" Q$ c6 X# N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! |' l& B- r0 h9 d0 h
( w5 N( d& ]7 u7 t" `9 ~8 D1 b$ `9 u v0 Y2 i) }" E& {1 p
|
|