|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 A) [$ T2 t2 H3 E& b
- [code]EDMA sample test application1 T5 ?% Z: K1 F
- /*
8 @& h7 p* A, B - * edma_test.c
3 j. D, X, o) {$ e/ w - *1 L8 q7 f0 l( r2 H
- * brief EDMA3 Test Application) J$ \! ~' P% r4 Y( w
- *
5 X9 v L) R# M4 J7 r* ` - * This file contains EDMA3 Test code.7 N g: m% z) D. c( [
- *
: _8 }$ [" u9 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! L0 Q9 |/ Q3 x u, L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT y! D! V/ N/ A% o& L% B, u
- * TO CHANGE.
( J8 ~6 v4 r9 z6 k( q" o - *( M- ^% [( X2 I @. t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 i0 s5 w+ C9 j' w) k - *7 h( P7 D9 H; `# x- a" k
- * This program is free software; you can redistribute it and/or! `2 W2 T; Q0 z/ K, D+ ]/ y1 G
- * modify it under the terms of the GNU General Public License as
7 [9 p' {9 Y2 _( s - * published by the Free Software Foundation version 2.- T; f. o7 H% B* d# E3 N
- *
8 A0 J7 q+ G' f: x) ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' o! T" i8 S5 w- T8 L
- * kind, whether express or implied; without even the implied warranty
7 g) F5 ]) ^$ P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 W2 k) Y" Q. d% X; G8 L/ l
- * GNU General Public License for more details.
" t+ V S. h% Y8 u! R! l( J# M - */0 J w0 i$ m* z' C# |
3 X9 f- u, c$ y2 }- #include <linux/module.h>3 i, x5 o8 m! t7 Q# S
- #include <linux/init.h>4 E' {/ h: f$ D4 s) b- m
- #include <linux/errno.h>% ?, T+ b# N" w+ u
- #include <linux/types.h>
( t, K9 `6 x) ^6 P% ~5 h - #include <linux/interrupt.h>
0 e( S8 L7 A( j) \7 _( `, e% [! }- J - #include <asm/io.h>$ H9 m' @7 C: A! J, \ g
- #include <linux/moduleparam.h>
! r) P/ C; f( Z - #include <linux/sysctl.h>& F# F; @* w& \: z# |! H
- #include <linux/mm.h>: [9 I" e* q) P: G5 Q) n
- #include <linux/dma-mapping.h>
4 x" Q( l5 w0 b
5 X* q8 u* i/ V8 [5 ?- #include <mach/memory.h>
$ m, L, N- z4 |4 Q/ m4 [ - #include <mach/hardware.h>+ j& @/ V6 Q3 f
- #include <mach/irqs.h>
: ]- z3 O( J% g. a3 g - #include <asm/hardware/edma.h>
; N) O) u* C) m6 Y2 y$ m+ E
' G; P9 }( l9 U+ ?* l2 r- #undef EDMA3_DEBUG
+ U( ^3 X3 R, j2 X; r! ]4 ^ - /*#define EDMA3_DEBUG*/2 d; w) w# c/ L9 h
- . h* @* h" u4 h5 j+ q* }
- #ifdef EDMA3_DEBUG
3 C, l6 B* J8 t; H' B5 [* ]* N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 {# Y* t3 v- r9 F5 I4 w. [0 z) `4 e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 W5 F+ ?. e. H4 ^3 t. z# s: x& [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
t; P1 P/ t: K - #else( B( I# _; v! P/ A' r
- #define DMA_PRINTK( x... )2 V1 `$ w* C( \" H0 M; R
- #define DMA_FN_IN x# k3 b- J$ _5 ]7 F
- #define DMA_FN_OUT
! G! ?' u! Y, Q - #endif' ^) V4 ?3 g _) a1 R8 [% H* l
- 2 A9 c* c5 O1 d" P4 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 N# {$ g, M: Y - #define STATIC_SHIFT 3
, z9 j1 o6 {" W- ~: L3 r6 P - #define TCINTEN_SHIFT 20
5 k: j3 x( c( _2 Y - #define ITCINTEN_SHIFT 21* I; G! `; M7 p% `2 g C. H
- #define TCCHEN_SHIFT 22/ r/ ~! `$ M+ O
- #define ITCCHEN_SHIFT 23; j! P& l- l6 Y
- 6 Y( z7 [/ L' o/ N8 F2 x4 D9 v
- static volatile int irqraised1 = 0;7 V% p8 i1 _" p. K3 W8 V
- static volatile int irqraised2 = 0;6 a6 _/ r1 ]. Q* j
" }- |- L# k2 B, r" m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ V* U. M5 t6 f( Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Q( A# n, \2 E# v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 p" P7 ^8 | b5 t
& k& H' [0 h* D" E- m2 s" o+ K- dma_addr_t dmaphyssrc1 = 0;
0 C1 b! E3 b- g! @+ o - dma_addr_t dmaphyssrc2 = 0;5 ^5 t2 M. n% W
- dma_addr_t dmaphysdest1 = 0;
+ z; A, G! ]( e7 u/ b. v/ \' K - dma_addr_t dmaphysdest2 = 0;
" z% L/ R( J; o$ j7 o5 h% D3 Q - " F# a0 ~2 o* { F; g0 h! }. z
- char *dmabufsrc1 = NULL; D5 O% g3 X; C. H; A
- char *dmabufsrc2 = NULL;* U/ f6 w# o& s$ F2 P
- char *dmabufdest1 = NULL;
0 h( i: i! u( L! Q7 C F - char *dmabufdest2 = NULL;
' h: {/ d! z& J2 N
4 o; I" V/ j% h0 _1 X- static int acnt = 512;/ z4 j1 f: b8 y8 j6 F- q: Q
- static int bcnt = 8;
, k4 R0 ^' C# _/ [ - static int ccnt = 8;$ j. ]$ x# h( ?0 H* }! c4 _7 P
- U6 h; A3 ^* e8 H9 d- module_param(acnt, int, S_IRUGO);' h, P8 w; T2 W, H- ~
- module_param(bcnt, int, S_IRUGO);$ X' }: G, x6 k) ~2 }' h% k( ~; E
- module_param(ccnt, int, S_IRUGO);
复制代码
) H9 R1 t7 E5 J" {
7 K. m3 P# J! I- P- G4 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- i7 `6 s' `/ v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% S) w/ L; `% K/ d: M' Y6 l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% Z9 E: b/ O/ j/ P G) W
, b2 ?( T: l% C; c) f+ Y3 d( L0 i6 o- a
|
|