|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) B/ k. [9 K0 L* I
- [code]EDMA sample test application7 ]/ s; T/ L9 t; w% Q
- /*
9 \- w X" V" ?7 T; F: U4 F9 ?# s - * edma_test.c" c" V# R5 x1 h% S
- *
/ e& [0 T" T% @+ r) ^% i% G. j - * brief EDMA3 Test Application
% O1 f" y; ^4 x1 K - *- Z6 p2 A$ c- u. z9 u" ?4 e& ^
- * This file contains EDMA3 Test code.+ T- @9 T. E! D5 o
- *5 W: i# f6 u5 `& c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; k) [) J t, F+ A! ]( J3 c1 W. m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 C/ W3 q8 E8 W. N. R2 W5 E5 h
- * TO CHANGE.9 L* g% ^4 u+ s% p6 Z$ O* V% d' _
- *
6 u3 F/ q# J. ]: e8 l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! Z+ D8 e3 I7 g$ U - *
( l, v% D" D, w4 n2 ] - * This program is free software; you can redistribute it and/or
7 t/ B, ^: o% @ - * modify it under the terms of the GNU General Public License as0 R5 z8 F% S0 D
- * published by the Free Software Foundation version 2.5 `/ P* |0 ^. r- C- w
- *; {4 j7 Z$ S: I1 c5 ]2 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 m, ]3 n( r0 [8 J/ T' E
- * kind, whether express or implied; without even the implied warranty7 v" j) B5 _+ z9 W; C L3 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. K4 F! Y& p. w4 u: q6 q, }
- * GNU General Public License for more details.
: `" g+ L# \& a# t - */
& P0 f% c" z) [5 A, I+ m0 q6 z3 K - , O0 D9 b* }% }+ M' a4 |
- #include <linux/module.h>+ L% v& f8 P1 c! b( r: q
- #include <linux/init.h>9 N# J# n, d' _
- #include <linux/errno.h>
$ E/ Q+ I% q" h - #include <linux/types.h>
5 S2 i* b5 x6 e& y5 E) L$ A2 Y0 K - #include <linux/interrupt.h>2 g5 j% f1 d- Q0 a" Z
- #include <asm/io.h>, E4 u4 S( d- y* O7 o
- #include <linux/moduleparam.h>
) x1 n$ D( J/ n+ H9 @1 ? - #include <linux/sysctl.h>
' P" f# h9 q8 ` - #include <linux/mm.h>
: Z0 b4 O7 x9 D4 o/ Q* s f9 }+ t - #include <linux/dma-mapping.h>
9 \& H! @% V F" |7 }( i7 E, R* l$ d - ; q& c2 O2 v- C* j2 A; R; S
- #include <mach/memory.h>1 Y) u" f* ^$ S* y- Q6 @" S1 ]
- #include <mach/hardware.h>* x+ O% a% F7 W7 i' A8 ]
- #include <mach/irqs.h>
) l5 ?5 w9 j! n; E: l# u - #include <asm/hardware/edma.h>
9 i# U4 |9 j: K3 O, u- [3 z
& y6 l- K4 [7 X6 ^' s- #undef EDMA3_DEBUG
9 q6 ]2 s2 a* ~1 T S - /*#define EDMA3_DEBUG*/
2 m. W- m7 N7 l# B7 e1 R, x
0 `7 M/ d% U8 A! E- #ifdef EDMA3_DEBUG% b6 J u% ]7 A p* k& W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& V$ y* \% i$ }- B; K9 r3 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& @5 P& ?4 d/ h2 A. N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" z* v, {) J. s" J0 W - #else
+ H* e2 e- T* h2 P- V$ [+ q% Q2 O - #define DMA_PRINTK( x... )0 h p4 j( X# M1 {" Y& d( |; C
- #define DMA_FN_IN j8 J0 Y/ ~* F" f% h
- #define DMA_FN_OUT- _. g z% c% |- {! T) p" }
- #endif0 l+ a( S1 J& C' ^
- # K) \- L, x0 j! F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 ^6 X; D8 m# f W - #define STATIC_SHIFT 3 K9 {+ ]' n4 R/ S7 k
- #define TCINTEN_SHIFT 20
& g* J ?, }& e1 F$ [; o - #define ITCINTEN_SHIFT 21
' Z$ f4 D5 T$ D# f6 H9 I - #define TCCHEN_SHIFT 22
/ ]5 ]# ]4 d" X. k: Y - #define ITCCHEN_SHIFT 23( W2 u% U1 ]- I* _! j
5 |; G- I4 a- b* t- static volatile int irqraised1 = 0;$ \5 n) D8 a( A ^$ ?
- static volatile int irqraised2 = 0;+ U' b* C3 F' Q: m1 ^0 P2 n* E$ h
- ; A; {7 D& U* [+ _* l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& H& R1 h' S+ x! R. S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; K& s6 c5 \, o1 Q. B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- r. f7 V+ b8 A1 z7 {9 l
2 z! A, N# U* C9 K9 N9 I+ \- dma_addr_t dmaphyssrc1 = 0;, Q8 a8 [8 A; o- p4 Z! V. P
- dma_addr_t dmaphyssrc2 = 0;0 d; }; [" b. ]" G9 d5 R. y) x0 E3 R
- dma_addr_t dmaphysdest1 = 0;
( l' x" Q- d, b2 `2 i - dma_addr_t dmaphysdest2 = 0;
3 o; W9 W- Z0 Z- `0 t/ |; H/ y
3 O* `/ t# u [9 \9 X. V- char *dmabufsrc1 = NULL;( v( t* E1 `/ `' T4 ^ Z
- char *dmabufsrc2 = NULL;2 Y7 G9 c3 |) F7 P1 m) P6 g
- char *dmabufdest1 = NULL;0 g( |* F/ D" e" k L/ l; L1 \8 X* M
- char *dmabufdest2 = NULL;
8 Z" _& d* F! U. J& Y( ]$ Y - ( R( |, [8 V+ g2 V' j( z0 H
- static int acnt = 512;+ K: f0 v) |! Q8 O v# ~
- static int bcnt = 8;. P8 y2 G) G4 y4 ~9 N6 d9 K
- static int ccnt = 8;0 Z3 {* C8 A0 e$ } T& ?
3 c, N. [0 s' R* l0 d- module_param(acnt, int, S_IRUGO);- V/ ^5 }* T% h, b
- module_param(bcnt, int, S_IRUGO);7 H. x7 N4 {7 B9 C* ]1 q9 i
- module_param(ccnt, int, S_IRUGO);
复制代码
7 Y. Y, m5 l5 Y: V) `0 V+ T" m) d X/ H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' ~+ W6 M/ w: u' J. Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: k$ H: _ {9 [; V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ f" j- l2 a: z- [4 e6 Z
4 e2 b" ]; q. r7 P8 T8 P6 W# b" H
7 H" o, K1 J5 {3 [ |
|