|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! ?9 Z$ f# R) R, t- [code]EDMA sample test application6 R, r& a8 [; M& H- l
- /*6 p" M+ E. O4 s$ j
- * edma_test.c
, u, w& y4 ]* j: ^8 | - *
$ y- A( [) A3 R% K+ y/ O - * brief EDMA3 Test Application: C: @; Y3 z; `- {6 S0 [
- *7 u! [9 \7 a* K
- * This file contains EDMA3 Test code.
* i# U2 r6 x& H5 B; R5 F$ U - *
" j+ Y' F0 h; c e D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 ?$ g4 Q0 r! V0 [+ y) j. Y/ F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ o) c% I# T9 Y5 K3 Z- ~& S
- * TO CHANGE.
. W5 B: O. | U! ]; K. R8 b - *
( l9 m& Z1 H% S! b) d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 r7 i6 C* u; R2 \8 L - *) _0 g; @" t9 T2 B E% D
- * This program is free software; you can redistribute it and/or6 Y7 n( p* ^# J$ i; L
- * modify it under the terms of the GNU General Public License as8 H/ M. p" W( P u
- * published by the Free Software Foundation version 2.2 G; W& Y- W& v& M4 J
- *
9 _ O8 p0 G/ q7 R# ]# Y4 G9 j! t% c2 R, H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
a8 h4 c; @# {1 n# n7 z - * kind, whether express or implied; without even the implied warranty
/ b: X1 N; ?2 c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 m o" V' l# R, e7 d8 X" G
- * GNU General Public License for more details.) \- M# L; |- \, V* y
- */ s" s; \9 h1 O% c. z
; h0 _! |8 \' w3 B5 E6 X- #include <linux/module.h>
1 O) Q4 g' y3 S - #include <linux/init.h>
0 t/ C+ a2 |; a# G - #include <linux/errno.h>
$ ^7 [1 \: }( A5 V% T - #include <linux/types.h>" j0 s$ a) X' U# c% m: w7 |
- #include <linux/interrupt.h>
* Q; @* V c( v; w6 r Z( M* j" |) B7 q - #include <asm/io.h>
9 d0 f2 _ X( I" _ P4 F# r s - #include <linux/moduleparam.h>
+ X- a' h O5 {5 I( y - #include <linux/sysctl.h>
% m! V5 P) ]& ^+ K. L5 S, D& M) | - #include <linux/mm.h>
: D( O& a( {! ^2 h+ L - #include <linux/dma-mapping.h>: w$ Z) c L+ ]. q4 ]( N
8 h, R3 M$ Z5 V3 }- #include <mach/memory.h>
. p- t, T" F& `9 p) \ - #include <mach/hardware.h>
0 ^2 d! r; I6 R% {2 Z - #include <mach/irqs.h>9 m( \5 N5 P3 z+ ^) C
- #include <asm/hardware/edma.h>
. }+ r# f7 S U& U - ! M0 c) H0 b. M9 {
- #undef EDMA3_DEBUG
+ S7 n6 N0 C4 G J& Z - /*#define EDMA3_DEBUG*/" i" @$ O, f' h1 K2 V
- 3 | z9 U. }$ P) m9 N# x. @
- #ifdef EDMA3_DEBUG
D4 ?9 u3 f/ s( X R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 p8 N. W/ n3 V+ v8 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 s! A1 k6 @! A/ d6 B. Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" V& p$ G: y x9 c* D. R. b& Z
- #else4 M; k, c' h7 a$ H! [
- #define DMA_PRINTK( x... )
9 m, I+ @3 X7 n+ P4 k) A - #define DMA_FN_IN
, t& a! g& w& W7 \ - #define DMA_FN_OUT
3 |3 p( g8 G. \) c. O - #endif G. z. z# ?4 [9 |
R' \+ {- U& a' K. M3 g$ f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, T/ ]; g, {0 J* Z: |; } - #define STATIC_SHIFT 3
4 C( [; B B$ y& X! f( n4 { - #define TCINTEN_SHIFT 20% i- f) z0 x$ c/ V+ g! w4 E
- #define ITCINTEN_SHIFT 21
5 H+ V/ p, H6 d3 R! l2 i - #define TCCHEN_SHIFT 22
8 R0 I! x9 Y" u0 O - #define ITCCHEN_SHIFT 235 V( `9 ?5 \, c2 H3 B1 g2 s
- / N: O7 ^0 F. C0 `5 t- |
- static volatile int irqraised1 = 0;
( l2 [3 ^6 _- f - static volatile int irqraised2 = 0;
- s! s" I4 |: K* V% G8 r _! X - : W) u5 R x% b" p3 j( | y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, T+ t+ @4 B; C0 N5 x! k- r6 p2 o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% [4 u( s n/ A! o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. a* e6 l0 t8 T; X$ {4 W
r8 X9 y! r2 |# \/ a- dma_addr_t dmaphyssrc1 = 0;
3 l3 ?4 g' h9 @" X" W8 b4 m) Y/ R - dma_addr_t dmaphyssrc2 = 0;
4 Y2 a, P$ P+ ^# e4 N! ]# h1 o - dma_addr_t dmaphysdest1 = 0;
# T2 N4 f Y' G' l. |: | - dma_addr_t dmaphysdest2 = 0;
9 t' V. x: d. j2 D. W
+ {" t3 O6 q r4 k9 ]* N: N- char *dmabufsrc1 = NULL;9 E8 e7 e) ]# l9 |9 Y1 d: y
- char *dmabufsrc2 = NULL;& R# B% R) q7 G' o0 u) S
- char *dmabufdest1 = NULL;# \4 Z9 H( W# _; r% b
- char *dmabufdest2 = NULL;' j6 q* x( Z3 q: g1 B7 A! ~& w
- 4 Y! j. k+ b( ~( u, B, A2 T
- static int acnt = 512;
2 y8 z7 y3 W0 f9 ` `, { - static int bcnt = 8;1 N' D; M ~8 f% i, i
- static int ccnt = 8;
7 |, V$ u2 y/ M* s& ] - 3 J5 B5 m+ ?% P% o1 L1 u
- module_param(acnt, int, S_IRUGO);
5 c; c1 v2 u0 p8 g. B, e - module_param(bcnt, int, S_IRUGO);
% r4 J1 [: C( u1 P7 }, h. c1 x - module_param(ccnt, int, S_IRUGO);
复制代码
: v8 O) D! C H& l
: T$ W- \7 J3 g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 l* s# G/ a6 Y6 u- _/ y3 L* N- e! l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 ~0 e. i \9 T' f& E; f1 Z4 |2 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) O3 Y% h5 K& k8 h+ v5 x
3 ^1 F4 r# l8 r- I: D2 L
& h b( E$ Q; F6 x1 L8 J$ I |
|