|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + R1 `% @$ Z$ J2 k: c0 E7 ]( B
- [code]EDMA sample test application
5 e6 S9 g8 I' ^ - /*" g) J7 n2 i7 t
- * edma_test.c
: I# P f7 N& m - *
% _5 F3 y* z7 E `8 h# C - * brief EDMA3 Test Application
* G L2 i) @$ {4 k - *
" U+ x: l+ a3 T0 B Q% K' V. Z - * This file contains EDMA3 Test code.8 C4 f* q6 h/ V
- *
# W3 k" b% K8 ^- g: z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( s! ~8 T) ^" c+ v K! M& A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT f' B' n, X4 u4 e6 y
- * TO CHANGE.
+ `5 |% K$ J8 V; e2 _ - *
; A" G9 a: A# ?+ q6 B- F6 u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 u/ B, e0 o1 ?# W6 x - *
+ h7 f0 S- `$ }3 V5 N# [3 S - * This program is free software; you can redistribute it and/or
% C6 E3 C* r/ @ l" P' D' ^ - * modify it under the terms of the GNU General Public License as
$ q/ \# n! o- y, c - * published by the Free Software Foundation version 2.
$ `9 u4 g2 y' u: V - *4 Q* n) k% ` m& g7 v$ G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; s% G$ {8 w; w5 d! ]/ M - * kind, whether express or implied; without even the implied warranty
6 P& w4 @$ U2 z r& Z2 n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( H8 R7 a7 x% l
- * GNU General Public License for more details./ C6 U. f C) _ V2 @" C$ u8 |
- */
, R; k# w9 t7 ^4 N. Q& P - 4 \ z+ k+ z Q
- #include <linux/module.h>2 V: @+ N8 `0 O, z
- #include <linux/init.h>3 S& Y C4 b" s _2 ]1 P1 h1 y: B
- #include <linux/errno.h>0 }5 }% |- R5 Q6 J( W0 y
- #include <linux/types.h>4 m/ `9 b" w* s) i
- #include <linux/interrupt.h>
! Y. \, p: h8 M0 O - #include <asm/io.h>0 N2 X6 T' u O
- #include <linux/moduleparam.h>
+ q1 F( Z' z2 |; d( `& f7 f - #include <linux/sysctl.h>
0 h1 R4 C. k: `" Q# ` - #include <linux/mm.h>
9 g+ x, u$ ^9 Z* I/ m - #include <linux/dma-mapping.h>
* J' {! `% v g8 e5 G, E& f - 4 H- `( `( }) e$ |$ Z G
- #include <mach/memory.h>) `1 X! F4 ?1 U! b6 v4 e
- #include <mach/hardware.h>
9 F8 \" z3 D2 F T/ Z - #include <mach/irqs.h>
& N" Z1 R" O8 | - #include <asm/hardware/edma.h>: N, \% U* `) f( G
- + D: b+ I8 H# C' v) f: {/ x" E
- #undef EDMA3_DEBUG
2 V) v" L/ K8 \/ U- _ - /*#define EDMA3_DEBUG*/
8 r3 W* ?5 p8 @7 x. Z9 ^* o" Z - 2 T- N, c# a4 Z; F" u3 w& \
- #ifdef EDMA3_DEBUG
* @2 j, F1 f; ~$ S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ [7 k* K! n( k; [4 t3 s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' |4 w6 y0 V- p$ r- q* | i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
J0 k" T3 U1 Z$ B! J; |2 L - #else
( d/ c1 u5 X0 M% l# E - #define DMA_PRINTK( x... )* o) J0 h& O- B% C* S5 k7 I* q
- #define DMA_FN_IN
: E8 ]7 `% j! I4 e7 S( u - #define DMA_FN_OUT7 t0 s- _) Y+ h3 [- Z" r
- #endif
9 B1 Y' u' x' H D, c7 _
/ k6 U& }1 o! q# ^2 c( q& s |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
_4 C" ?8 [1 q% V) I - #define STATIC_SHIFT 3
/ Q6 s3 \ }, w" X7 ~# ~' O - #define TCINTEN_SHIFT 20. O& [; D+ e: A1 g5 ^+ f
- #define ITCINTEN_SHIFT 21
0 ?- S: A; I/ e/ }2 \ - #define TCCHEN_SHIFT 22
/ d8 T% B2 Y$ z% f. n9 N3 ] - #define ITCCHEN_SHIFT 23
1 P: |1 y# X. q/ N: F - 6 u3 | b0 X* W3 i. u
- static volatile int irqraised1 = 0;5 `: a. F, U7 k" s
- static volatile int irqraised2 = 0;' i' I) y0 y3 b& t' r5 \
- - B- f" {8 Q' U& r f2 J+ c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ O! y$ D) T/ J2 S5 N* |. V) g. J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N6 T" f' k6 ]' f: `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ d" O! @6 ^7 s9 C1 x
- ) v; g7 n) b, {/ Q
- dma_addr_t dmaphyssrc1 = 0;1 E' J- z" D0 a2 s4 G3 j
- dma_addr_t dmaphyssrc2 = 0;! [2 d3 Z2 R. k0 B& C' X
- dma_addr_t dmaphysdest1 = 0;8 K! Y- T" O; V+ E
- dma_addr_t dmaphysdest2 = 0;# o Q! B' `, S; r. i2 y3 ^1 f
8 t2 f W4 N# V0 V7 E- char *dmabufsrc1 = NULL;- ]6 z" z. e; P+ p7 ^
- char *dmabufsrc2 = NULL;! X( v7 e- ]3 M0 u% r& r
- char *dmabufdest1 = NULL;1 p" o ?0 r1 R0 I
- char *dmabufdest2 = NULL;
: g1 E& q% g5 |: ^" j4 L - " }9 ]6 B* J' @
- static int acnt = 512;
8 ? y3 J. i i - static int bcnt = 8;$ j1 w0 p6 P0 V4 u3 S; t4 b
- static int ccnt = 8;
4 @( x0 {. W/ j. J - 0 _- [3 o' r& k
- module_param(acnt, int, S_IRUGO);3 x0 K7 @9 m% p9 _- h
- module_param(bcnt, int, S_IRUGO);2 y+ w4 ~; Q; o J
- module_param(ccnt, int, S_IRUGO);
复制代码
0 U9 M/ K& y' q( x2 y8 U j
! `6 R& j" `4 z! }3 Q7 U/ K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 q+ u7 D8 q4 e0 M& F- B& f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 a. j. G* `! h/ U3 I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' K a5 N6 Z/ i9 B; X% Q( ]% W% d' \) V' Z3 j+ X$ m7 N$ L
! Q- d, c1 W: }: G# z
|
|