|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) `$ X. X& A, ~. K0 s/ Q- [code]EDMA sample test application
6 F. f& @+ Y. l/ W9 g5 k - /*, A$ M$ B R+ S! v- ]
- * edma_test.c
' `4 K5 i7 R( k+ b# a. N5 B - *% T: L8 n H5 a$ ?& i
- * brief EDMA3 Test Application" h/ {0 y- W6 H# B/ Z3 o) v
- *
( l9 \+ n9 S. o - * This file contains EDMA3 Test code.
1 ?: N% m" y( p0 u \ - *4 x n, Y. O) q# j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 q8 f0 N7 l; C: q6 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ P) k0 X I% E0 ~. B" Q
- * TO CHANGE.- J7 h3 [ t7 u: l Q8 M. Z# T2 k
- *( H( [8 l& d6 V) V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 v& K5 |0 A' e( q; B4 x/ i4 M0 w - *
; h& @8 b& F5 Q - * This program is free software; you can redistribute it and/or4 ?7 J9 U8 H& j3 e6 s {
- * modify it under the terms of the GNU General Public License as, g; s) k; l2 z' V6 @ U2 m5 y
- * published by the Free Software Foundation version 2.* K0 M+ I- z5 P' a# t' \+ {
- *
+ |9 w% L7 L. A1 N/ E- S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- `7 Q+ U( A c% T U# C4 ]
- * kind, whether express or implied; without even the implied warranty4 ^ w' A/ `" J% f$ b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. Q6 x% `1 Y& l9 A9 T# s5 W - * GNU General Public License for more details.
' _" X3 |+ V* K" H% S - */
- v# e) w" o! o8 x, ~' A8 ]. m% ] M, b
# n t8 r' M9 I6 d$ V5 S, F- _- #include <linux/module.h>
/ D+ A0 R1 X* ~3 n- I - #include <linux/init.h>
: P, O* k% U4 X; f( W - #include <linux/errno.h>
0 ]4 Q) D) N8 x. H8 F$ ^3 t1 j$ k - #include <linux/types.h>9 f. B" r6 Z* e& R
- #include <linux/interrupt.h>
0 ?" M% m' g5 D6 n - #include <asm/io.h>; {) s# D* Y: t+ F2 H5 T k
- #include <linux/moduleparam.h>; y% E. @6 ~/ D4 B( Q7 o J
- #include <linux/sysctl.h>
' z, N3 [* D9 D$ K% l - #include <linux/mm.h>
8 `& ?4 Q1 Q3 ~) V8 ~* P - #include <linux/dma-mapping.h>4 q8 B3 x4 W0 b0 a5 ?2 v1 c
8 ?5 c" c: ?6 F+ ]8 z- #include <mach/memory.h>
8 n+ D& C* k, K; M! H - #include <mach/hardware.h>
% @$ F- Y+ _: H0 l" ~ - #include <mach/irqs.h>0 T |1 n% G5 H
- #include <asm/hardware/edma.h>
0 b% W# @. ]8 K* C# N. Q2 z
. p, |- O9 M4 @; G, _" w: k- #undef EDMA3_DEBUG
4 e& l5 c' M( X2 _. Z, q) Q - /*#define EDMA3_DEBUG*/
. f+ L6 k9 o) ~
& J' u7 @! w" p0 K& A1 n' q- #ifdef EDMA3_DEBUG
- ~3 |0 T% U G% m- n$ W3 }$ Y0 j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( a% m- D, V3 f! w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 I) Z- R& b% ?2 }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 G0 e5 B% a! Z! N# U! L7 A
- #else. k5 z4 b# G5 O- e; S
- #define DMA_PRINTK( x... )3 h. F9 C3 I$ [, v9 N9 o2 p
- #define DMA_FN_IN
9 F. G, k9 z& k - #define DMA_FN_OUT) g3 h: _6 {. a2 B4 i
- #endif# k( A8 n2 B6 V$ I
- . |4 k/ V% y: N9 m" Y( A! N: r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 i! m4 v7 Y3 T7 ]- B. {
- #define STATIC_SHIFT 3
& {) a- B, h @7 z9 Q" L - #define TCINTEN_SHIFT 20
7 A& a& M+ E2 v3 }4 K - #define ITCINTEN_SHIFT 21' K. e2 B# t4 h+ T+ c4 l$ S0 u3 o/ A
- #define TCCHEN_SHIFT 22* o, v* I' c2 ^) Q! J/ Q3 I
- #define ITCCHEN_SHIFT 23
( E# X! y1 s5 E# s# v
I4 U3 a; Z! @: N- static volatile int irqraised1 = 0;
7 s$ M& j. N- @ - static volatile int irqraised2 = 0;8 [- |1 m" G2 E6 V7 x
- 7 m& Y4 j6 ]" N0 o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 y& U* N, P2 l" p5 T' B3 f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 W2 H) ^% i& Z( | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; T) d# W8 X2 W
1 H1 ?: @1 F# _4 K- dma_addr_t dmaphyssrc1 = 0;/ r+ y8 K5 K- U5 I2 w/ k+ @
- dma_addr_t dmaphyssrc2 = 0;
7 u) r0 ~* o+ ^2 c: b6 N1 a( W7 a - dma_addr_t dmaphysdest1 = 0;
8 L ~: f( G9 f; W - dma_addr_t dmaphysdest2 = 0;
7 q9 i1 c O! D) H - % @5 N5 o. }8 c
- char *dmabufsrc1 = NULL;
# U# e" b5 r. Z2 ` - char *dmabufsrc2 = NULL;" q6 ]1 F, K9 n0 F% j
- char *dmabufdest1 = NULL;. E5 M! @' j$ g. I% E4 E: _+ U
- char *dmabufdest2 = NULL;8 U- I, j1 y5 b# X
- 4 B4 A* K' e; L9 E/ N* ^" ?. Q7 C$ R9 X
- static int acnt = 512;/ ^2 b2 O- S+ v! H
- static int bcnt = 8;
* ~! k' G. g6 {& q* ~, v - static int ccnt = 8;
* h+ p3 f1 G l# y; z. F; a - % V6 g+ T. j' X$ h- u! d
- module_param(acnt, int, S_IRUGO);
6 k5 D6 K1 G) ?% j - module_param(bcnt, int, S_IRUGO);
0 ?/ d1 p- d' R - module_param(ccnt, int, S_IRUGO);
复制代码 $ Y& P& F! p9 p+ Z0 @* d
1 y0 y) R- W( d/ H" G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 Y8 C A- C4 q) o1 b( `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( n2 e8 x8 x8 {6 s8 w. `( v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- J, o$ H O4 r3 q7 G
8 a; f% A6 e: X- i: J: r/ F
+ u E% y, j/ T, @3 B% ~
|
|