|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + X; M5 ~6 |3 E$ s
- [code]EDMA sample test application' e, U9 d I" ]2 D, j3 J" q6 k6 H
- /*
5 D) m& n1 _* t3 e9 g$ A1 z - * edma_test.c4 }! I: d7 }8 ]3 s* O. ]* l
- *
5 a8 ~% ^$ b# d9 o9 Y( E! a8 ~) i - * brief EDMA3 Test Application) ], g2 m+ v" a/ i5 F# g1 L0 B9 T
- *
4 k6 H, W9 D/ t2 |# X1 i - * This file contains EDMA3 Test code.
( M; Y5 {$ d) t$ ^# K. g g! g' e - *
$ r9 C% Z/ b: M- q: |' @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 E: K! U- O( r) X: _' w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 j3 W% k. w* f s1 [& f( M
- * TO CHANGE.' K9 j% }! k4 @7 }8 O7 U
- *5 O' _ Y) a9 s* c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 K( k: i; Q+ V8 } - *4 ^- E' ^0 y6 A0 N* z0 m
- * This program is free software; you can redistribute it and/or# ?9 L3 M+ a- Y+ j
- * modify it under the terms of the GNU General Public License as
3 v) | z2 g' ]$ ?* z3 W# w) s - * published by the Free Software Foundation version 2.* L: {2 r7 Q. [* u5 U& R% E
- ** F1 i' M1 h8 S. w# q+ W) A$ J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' l( F) |8 z, p. E
- * kind, whether express or implied; without even the implied warranty
. i' m) z3 f5 Y F( K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 P0 K$ ~* H' l: k/ F6 O3 j" d - * GNU General Public License for more details.- _0 ~9 r8 F5 u( w: z/ p/ W
- */
* Z3 V! ^9 i) T - ! S6 l5 X( Y1 s" f+ r; }) y
- #include <linux/module.h>
9 D& v" F. z% t% @( g9 ^ - #include <linux/init.h>
. t. ~* m; @5 x( V% c( W - #include <linux/errno.h>6 j) q* P( y5 W5 ^' h
- #include <linux/types.h>
" X5 l4 S- I* Y* k - #include <linux/interrupt.h>
, b6 Q+ X* u4 v$ x; z+ U! A - #include <asm/io.h>8 h) f: k, s$ l4 k: a& D
- #include <linux/moduleparam.h>
' w6 g9 z; P& N- q$ e, `# G - #include <linux/sysctl.h>! s/ P2 Q; q0 L8 U6 z& J
- #include <linux/mm.h>
1 u) Y) g. W* c. z- X - #include <linux/dma-mapping.h>5 P: i$ J; Y6 j6 i
- D2 D; z! W2 X% h! O1 t- #include <mach/memory.h>
) n$ ] B; R; Y) p3 Y9 ? - #include <mach/hardware.h>1 S2 D m" Q& J9 N% J3 M! H
- #include <mach/irqs.h>
3 l! [, U* f* c9 @# X - #include <asm/hardware/edma.h>
& U Y6 t/ Q! j! O7 j$ H1 X
2 P4 ?, b' v. P- #undef EDMA3_DEBUG
* S+ e D. X+ L# U' G4 ` - /*#define EDMA3_DEBUG*/
' a- b1 \& D! v8 X1 U; Q8 i# E
" g% J: { c1 V) N! @- #ifdef EDMA3_DEBUG* h$ l2 X" ]# F0 G: b0 |; C% }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- z P2 C( N, |! {, D# M8 P& q5 s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 k V$ z: P3 Z6 G7 f. G0 i3 ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ T7 k& t; L" \ - #else/ P2 {6 O4 G' b5 p
- #define DMA_PRINTK( x... )* z5 y0 f' V+ b1 S0 Y- x
- #define DMA_FN_IN
5 j- Z+ h% u m% n( T - #define DMA_FN_OUT! A E! k& h( H% j
- #endif( v) s" e% r) a# P9 ~
' i' W/ q& ^6 @; c# m! A- #define MAX_DMA_TRANSFER_IN_BYTES (32768) R7 z% R6 o A* Q6 O! s
- #define STATIC_SHIFT 3
# s6 J: R2 t6 D, E, X% n& v - #define TCINTEN_SHIFT 20
' r! B- e( Q$ s& c - #define ITCINTEN_SHIFT 21
3 j3 U) e; S4 t `* B0 N4 l3 q - #define TCCHEN_SHIFT 22
4 c0 n( Y4 P4 J1 Q. B# K u - #define ITCCHEN_SHIFT 23
* r9 i6 d2 M* ^& s( R0 E+ j' ]
3 z8 d9 C8 R5 W E4 E y- static volatile int irqraised1 = 0;
) J g$ |& O: { w& d - static volatile int irqraised2 = 0;
% |/ H0 j8 p* S1 f% w/ j9 J+ o - ) Y3 n @- ]. H/ J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 T2 r' {! H: X/ { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* ^7 r( O" r' t* J* b h( [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) f' N: N0 y* a4 u- d
- + W$ E$ A$ _4 M1 S8 Y1 [8 j
- dma_addr_t dmaphyssrc1 = 0;$ m5 T6 H: H6 p9 \1 M: l- n% p
- dma_addr_t dmaphyssrc2 = 0;( J d# _! S3 _/ D: o6 D5 r
- dma_addr_t dmaphysdest1 = 0;$ T$ E, \: g2 a% l& U1 a0 l
- dma_addr_t dmaphysdest2 = 0;
% I/ Y2 i2 M6 O" j - & X7 K% D# [" N' ?- S# s9 J8 P! P3 T
- char *dmabufsrc1 = NULL;/ b3 ]% [( E" f9 p0 _8 q) Y1 y1 }
- char *dmabufsrc2 = NULL;
' d3 |( }+ U4 h - char *dmabufdest1 = NULL;
`& Y a, L, Y6 K: X - char *dmabufdest2 = NULL;
* A1 d( j$ j8 Y( C9 T - 2 q; e1 Z9 S$ K& \3 x
- static int acnt = 512;, u% k) l8 z& m7 l
- static int bcnt = 8;- T3 g: h! C: g3 w5 ]
- static int ccnt = 8;2 y9 z S! \, J' _4 l
- 8 {7 y0 e7 [5 M, z: ?. T
- module_param(acnt, int, S_IRUGO);9 G A- K& \8 J
- module_param(bcnt, int, S_IRUGO);+ a. R' O# X7 }2 h( o
- module_param(ccnt, int, S_IRUGO);
复制代码
3 z& B+ \9 y6 [- I: g- {: ]3 ~
4 b) w% I/ X# W3 ] f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" U- I/ o0 v; v' z6 P9 H 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 y. u9 @& R" H$ M. O. @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& S% }9 S+ P# z* l R7 E7 w4 h# A* d9 `$ D1 X
+ k6 T# u' q; I/ m0 w |
|