|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / l* {; M' ^$ k W
- [code]EDMA sample test application
/ r; L( H. j8 H- s# j4 l5 L - /*7 k: a+ w& j& r" t1 F
- * edma_test.c1 |8 ]+ h* o1 W1 W i0 u3 Z: G6 m
- *
2 c8 X- {+ T6 \5 D2 k3 u - * brief EDMA3 Test Application3 t7 v7 m' r( @
- *) M' E, ?& l4 P" O/ ~% K
- * This file contains EDMA3 Test code.
& P! L2 @7 ]1 s, C2 a* F; q - *8 W3 `8 v2 T( y6 Y* {. x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# U% ~* Y5 o. Q' n2 X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 o* R2 h* w+ r3 } f - * TO CHANGE.2 c5 v! Z+ s5 v9 S, O p' C
- *. J& ~7 Z0 m# o$ g" A4 N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 {8 h" f, B$ j# j$ L - *
9 N- d7 Z0 Q8 s$ B1 Q+ A - * This program is free software; you can redistribute it and/or4 l1 @, F7 x7 j, ]; G2 m
- * modify it under the terms of the GNU General Public License as
! |- ~7 }5 O1 D& r' t( C - * published by the Free Software Foundation version 2.
- k& Y' h& p/ b; g" N, N6 F+ x1 H3 b - *) y9 M) q$ h9 S* ?5 E+ X5 F8 _ H& M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ {* p- _, R( Y6 A" H3 C
- * kind, whether express or implied; without even the implied warranty
3 s% A4 j* L, F4 b `: {8 w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' C. M+ F3 g: O" Z @+ m
- * GNU General Public License for more details.
( ^: ^7 K/ o* w0 T - */
: Z9 N5 y3 r) k - 6 Y1 E: }, ^5 p8 Z! O: v7 w3 @
- #include <linux/module.h>: q; j) Y# q0 r3 Y. s- Q7 {: Q
- #include <linux/init.h>
( ~+ F4 I4 d! I: a - #include <linux/errno.h>
' X# j( |8 B3 q, h2 B& | - #include <linux/types.h>
* ~" J [% `) `1 O" Y( q - #include <linux/interrupt.h>5 g1 |& \; d5 y
- #include <asm/io.h> Q! [9 h0 D& U: P' y
- #include <linux/moduleparam.h>
/ r) E T7 T n* ?5 s( F - #include <linux/sysctl.h>' `1 z: G& @( e6 F- V# U
- #include <linux/mm.h>$ B' v9 D1 e6 i% Q3 A# x& l
- #include <linux/dma-mapping.h>* d3 R3 A, t3 {9 _) l; r* S
, v) `; h# `1 D$ ^: o) I- #include <mach/memory.h>
, ^0 I7 l: o6 O - #include <mach/hardware.h>
% h- ]4 \/ h6 ]& X) @, h, g - #include <mach/irqs.h>
( S# ? ^0 t; D @( s - #include <asm/hardware/edma.h>
( h8 n0 F% [$ i2 C0 u - 5 |5 G* N; x' g' Q, i
- #undef EDMA3_DEBUG f- Y0 k" J, g
- /*#define EDMA3_DEBUG*/: U( F, M: Y3 f; l4 z
- 5 M g9 r3 w) ?% P
- #ifdef EDMA3_DEBUG; d" v# [; R! R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& I* `" e3 ?, U5 D# r4 E6 E7 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 z& {# c. A0 \! W2 a* Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% [! z, q5 S, e$ A0 D8 m# l - #else5 C6 u! D( K# I. @+ f, J, G2 J
- #define DMA_PRINTK( x... )
7 t2 R% x& h9 F- v6 E - #define DMA_FN_IN. {& \1 A$ m! b& a9 i$ n
- #define DMA_FN_OUT
( N( r( ~* {+ Q% B+ o - #endif
" A4 l8 c- y9 l: N( U+ C
' r' P/ ^/ ~) {' {# q6 A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" x$ q" o( t. q! ]0 a) [: {" P
- #define STATIC_SHIFT 3" T# {& y3 @2 |4 n
- #define TCINTEN_SHIFT 20* K6 S6 c( p4 ?# e
- #define ITCINTEN_SHIFT 21+ a+ B- t9 q# D8 y: {/ Z
- #define TCCHEN_SHIFT 22. l, S b, E# }2 t; _9 q8 Z
- #define ITCCHEN_SHIFT 23+ x" Q0 L3 t0 Y5 s% b' M1 O
" |& t" i& o2 V- static volatile int irqraised1 = 0;
8 D* t& M1 b% V) D7 h9 G - static volatile int irqraised2 = 0;
# p# c O# p6 _3 F4 z% D0 a5 R: w - ) d0 _# N9 p* ^! i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. K! q, L. U5 h) M8 [% t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 s8 k. i( w- H+ L% V' _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! P5 _" s* V7 S0 m) c4 b- O
- # a2 F! Y. Q% X9 U6 v& z
- dma_addr_t dmaphyssrc1 = 0;
' J$ s- _6 N/ O1 j* _5 g y - dma_addr_t dmaphyssrc2 = 0;# r& H& Q& r( }9 K9 Z5 I
- dma_addr_t dmaphysdest1 = 0;; g( \/ J9 F1 @0 I6 A" ^
- dma_addr_t dmaphysdest2 = 0;
8 w6 e+ F- i% C" @+ ]4 V- B - ! u: j2 w: p0 f" Z* ?8 f- ?
- char *dmabufsrc1 = NULL;, j8 p% l/ r0 X6 Q
- char *dmabufsrc2 = NULL;7 J/ e& c( m& K4 H3 U; L$ k2 g% v
- char *dmabufdest1 = NULL;' E7 |* {) B; k# j- ~( _
- char *dmabufdest2 = NULL;1 s: |' j. q- q+ W$ ^" Y+ f
- ! `. N) h- O" _. h. N+ \9 j7 T
- static int acnt = 512;/ [- C, u3 k; n Z, G* A
- static int bcnt = 8;
5 ~3 M8 s/ y3 W* b; j6 M6 {/ F - static int ccnt = 8;
) M1 @1 p: L) m0 `! b - 8 H' s$ F) n: d& r3 @
- module_param(acnt, int, S_IRUGO);: c: r& J, K3 U# ~5 |% N
- module_param(bcnt, int, S_IRUGO);( {5 l* x- P# W; k- h
- module_param(ccnt, int, S_IRUGO);
复制代码
& y" A+ ~+ w: ~. E
* \4 y; N6 @( B6 J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
r6 f2 V( K1 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& \& m5 |/ c# Y! z; n m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& C- ^2 }1 A u
8 `' N( U& G) a8 `9 G, O
$ t( t: r% l: w! G6 |; d2 f9 Z$ u |
|