|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : W0 `. t. J7 y6 g+ q
- [code]EDMA sample test application
) i: s/ F* _ N9 f - /*
! o1 G# }" ]7 K/ S! Q2 C - * edma_test.c; Y6 A0 l2 z9 S% x1 z" r
- *
! R+ |$ O' D6 Z$ [ - * brief EDMA3 Test Application
! b2 e+ u% q/ M$ w - *; b6 D1 Z" f h5 D
- * This file contains EDMA3 Test code.
8 _: V6 I8 O/ \+ n+ J i - *
9 j M' C2 ?% r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. `6 z8 z0 j# s2 N+ Z8 x& R! i6 ~2 q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ^6 x- | R1 }9 c+ e- g8 I. R
- * TO CHANGE.; N6 b9 w: b( {# R
- *
0 s6 o# t: s) N f: _$ q) W, ]) o+ j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 V, b' B8 X1 |4 k - * v% f Z3 Y- Q, H+ n0 \: U
- * This program is free software; you can redistribute it and/or4 h, m/ A% ^7 \7 p0 x
- * modify it under the terms of the GNU General Public License as( N7 {3 K3 e+ `
- * published by the Free Software Foundation version 2. i0 W; Z3 H) \1 ^- U
- *
' h8 y9 N; |/ x+ K8 N0 _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) u9 {1 _4 L' H6 x1 ]9 Y% f - * kind, whether express or implied; without even the implied warranty1 T( C( c' |1 j1 g" i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! b. ?* [' m# o( ~' a# o& }
- * GNU General Public License for more details.
) q) o/ p/ k. s2 ~8 a* c' ^ - */5 z B! C, \2 N3 D- ?1 Z
5 `7 S" J* M; R% W- #include <linux/module.h>
$ ^1 \+ R5 c( ~( `2 p$ @( [/ ^ - #include <linux/init.h>
3 A' c* J1 R# J- X8 E& t+ U - #include <linux/errno.h>
, O M1 y( i2 X. ]3 ~( u# K- o# y - #include <linux/types.h>7 Z$ k' N) C% T' k3 n7 j8 j' \
- #include <linux/interrupt.h>
/ `2 n1 ~) g5 W! @* T: j2 T - #include <asm/io.h>
- z3 ?1 K% p! o7 Q2 ?6 p7 u7 D - #include <linux/moduleparam.h>
( }( ?) V! ~ V E% I t z' v - #include <linux/sysctl.h>' V/ O% n* ^8 B M D* E p& p
- #include <linux/mm.h>
: a, J" ~; H5 ?* ~" [ - #include <linux/dma-mapping.h>) p; v+ J9 r8 T ~' Y
- - [5 Z' P4 a8 F0 w1 Q/ B
- #include <mach/memory.h>
8 p3 l+ l+ `: r7 s' |% N B0 R1 c2 m - #include <mach/hardware.h>, g. M1 d* V2 f3 x! K/ }* X
- #include <mach/irqs.h>
3 s2 n8 T# D8 f5 `& Q$ O1 ~9 H9 J - #include <asm/hardware/edma.h>
P6 E+ g+ {. n. G- N! U/ f/ @2 i
+ G6 }3 \* ~2 q6 P- #undef EDMA3_DEBUG
. U9 C- Y6 j+ A/ d: D, H - /*#define EDMA3_DEBUG*/
$ ?' l2 r; g G' J* p4 L* f4 r - % s/ l' v) l& o8 c* H9 E) g# L8 L+ F
- #ifdef EDMA3_DEBUG
! A$ x; H8 w' E$ z/ F$ y' d1 d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 O' M( D& }. o# u9 o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; S2 V* L+ A( r3 P$ L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 a; ]0 w% O8 J( E" h) R% E
- #else; C$ F, @7 ^+ B& d9 r% q
- #define DMA_PRINTK( x... )
5 N) S% L* r7 Q& X( d - #define DMA_FN_IN
) r7 z1 r. Y$ p# f! r: V - #define DMA_FN_OUT% m0 w8 F' c% i
- #endif
u. J& ]4 Z- d/ F
2 ^! {! w) D+ m% M1 K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 o0 l7 r& I8 D/ I0 ?
- #define STATIC_SHIFT 3! y* U2 W b- J% C/ \) ?) G
- #define TCINTEN_SHIFT 20
& m2 p$ H" Y$ @( a& O8 h - #define ITCINTEN_SHIFT 21$ W [3 f9 p0 `7 ~ [' f1 b
- #define TCCHEN_SHIFT 221 b; v: H# Y8 a
- #define ITCCHEN_SHIFT 235 |& w5 n# k8 Y _2 ^6 _! s& A. S5 J
. m( `8 |& k6 g- static volatile int irqraised1 = 0;
5 D* P8 S3 [9 V' [% D. w' Q7 Y - static volatile int irqraised2 = 0;
) n1 h( }6 U- ^
+ Z# j _( y5 q/ C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 W; A& Q& c' m$ E8 ^- _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); c- r: }5 a( A! z; D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ^3 [3 x z* I0 G1 M
9 K# [$ ^9 f% ^; z6 ^- dma_addr_t dmaphyssrc1 = 0;* H# f' a/ e. t7 {; F
- dma_addr_t dmaphyssrc2 = 0;
$ B. E% ?8 |7 w* E, p2 O! {/ e l- m - dma_addr_t dmaphysdest1 = 0;. \, R, T3 T: H j
- dma_addr_t dmaphysdest2 = 0;
; n" E+ ~0 g- e# Y6 ^/ P1 a* O
6 p5 h! u/ a9 W7 N# F- char *dmabufsrc1 = NULL;, c' ?6 V2 c% n: w e1 T1 E7 o2 ~
- char *dmabufsrc2 = NULL;
- Z( n- T( S' T: f# D4 a* H - char *dmabufdest1 = NULL;
% N% M1 O, b- M6 F4 U! k( i - char *dmabufdest2 = NULL;
# N; ^0 s' P6 g+ r; P& p( q7 ?1 X6 T
" o; E' q% i6 l$ D$ t! S- static int acnt = 512;
- {, g" J4 i4 w - static int bcnt = 8;7 V6 B: l- o) Z
- static int ccnt = 8;. R* ~7 N- h+ {) F7 l$ C+ u6 ?4 w4 L
- . @9 G7 \ }4 d( _1 E4 S7 I2 H1 ^
- module_param(acnt, int, S_IRUGO);
5 _) ?% x* t7 w- |! k& } - module_param(bcnt, int, S_IRUGO);
5 L: z0 l' R% [( C - module_param(ccnt, int, S_IRUGO);
复制代码
3 U* g+ ?" _. @
2 O+ O! h! n$ t, ]- O- S9 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! w5 o9 P/ d6 F8 X' Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 A8 B* g, t; s1 m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ O4 ]) G/ D9 n9 ^* u- \
! |+ m9 \0 @8 D
+ `: X/ o/ J: R- U9 ^6 X |
|