|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / V4 k6 o: ~3 U* f( j
- [code]EDMA sample test application( f! B% P& u* q
- /*: l0 {+ C d/ a, B6 s' e
- * edma_test.c Q4 J2 A" `8 C: e& B- f
- *
7 V8 w! e. I/ l% y- w4 ?, {$ X - * brief EDMA3 Test Application) w" k2 ]8 O3 C; F
- *0 W5 H2 \; U. r; c A0 ]
- * This file contains EDMA3 Test code.7 m) l: p( M! x N# l. {" F8 u
- *
7 h& b$ n3 s" j$ V$ }* I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. a$ {& y! s [: {. A) L3 R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 t( B( x: i* c+ b' F - * TO CHANGE.
D8 e( T# N; |! k" y! ^, k - *( A1 t+ R8 l9 X0 A$ [) h5 s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 J0 o% {* }; \4 f+ M; v - *: ]% {# g# D* W7 |" y
- * This program is free software; you can redistribute it and/or
0 u3 U1 C$ i0 a* f0 \ - * modify it under the terms of the GNU General Public License as$ A9 q& |' t2 k, N( m: I: G
- * published by the Free Software Foundation version 2.
! X# A! z, c8 p! R3 t' f+ P - *3 A( ]3 p h; ~$ u) F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; Z2 q5 o) w' M5 K8 J9 _. C
- * kind, whether express or implied; without even the implied warranty* Y2 H* v, W2 |4 N: q* Y. N9 J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- O/ W0 @5 p/ \$ }; Q' C$ Z - * GNU General Public License for more details.$ y% A! D& t I5 e0 u1 ?
- */
% u; H; ^2 r: u) V6 H9 F1 |
- M0 t0 x! x$ V' D/ a+ f3 X- #include <linux/module.h>7 o: H5 o9 x2 ]# Z) H6 J& b
- #include <linux/init.h>
, h% t* A1 b! g# ? - #include <linux/errno.h>
4 H3 D, ~( [; N8 [ - #include <linux/types.h>
7 d" P$ [1 k+ h0 u - #include <linux/interrupt.h>7 e7 d- ~. J* \; ~( V. @( ?: v9 l+ E. w
- #include <asm/io.h>
5 }( O3 N( u! j# E& S$ t! N* L - #include <linux/moduleparam.h>% A2 n7 I: h# Z" m' Q9 W1 o! f
- #include <linux/sysctl.h>
1 R. U+ A* L H$ @' ~( B, r. c - #include <linux/mm.h>0 u8 J% |4 ~, @. b
- #include <linux/dma-mapping.h>
% F; B& q& r8 b# `# r; P5 N$ v4 m6 G; B* c - 0 F4 i4 D+ b+ ]
- #include <mach/memory.h>
2 u0 u- C4 ]7 C2 a - #include <mach/hardware.h>
3 C0 I2 z i1 k* d: O4 b+ r - #include <mach/irqs.h># D: \0 q' N5 S. _
- #include <asm/hardware/edma.h>
0 U3 l p0 D, B
' s) e! v( I" ~9 [; U+ H- #undef EDMA3_DEBUG
9 |7 [5 ^' K/ T - /*#define EDMA3_DEBUG*/
# v. j* a- h9 u. c3 y - , o- M) S2 z% [+ j) D5 [. V
- #ifdef EDMA3_DEBUG! S/ m* x: E8 u6 e1 D. `" o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): z9 G* b3 x7 p+ H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 E/ l. q) A6 J# [+ X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 z- K, @3 r; J" h+ u' T1 @: ~
- #else& I- o/ {/ d; ~ O
- #define DMA_PRINTK( x... )( n! o. y: S8 C" n+ W
- #define DMA_FN_IN
% R! D5 m, M$ F& q9 S8 s1 X( ? - #define DMA_FN_OUT- e2 E4 @; t9 s/ U* ~
- #endif
# z! Z5 M3 p- |
/ L, s9 A, L6 o# P9 |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- `6 Q. C. |& p1 n" g - #define STATIC_SHIFT 3
5 l n* Z$ d8 D0 }5 F - #define TCINTEN_SHIFT 20
% n$ [# a- I5 k6 ^# T9 F+ b. U3 u - #define ITCINTEN_SHIFT 21! G" |% L8 R# f4 O& F) _9 n
- #define TCCHEN_SHIFT 22
, E; @% M% r9 ^2 K - #define ITCCHEN_SHIFT 23. j+ X+ ]$ Q" V; O+ G Z1 T/ m
- 8 j; L H+ r* w: u6 T
- static volatile int irqraised1 = 0;
" ]$ r" ]9 y1 @9 a7 H7 J/ w - static volatile int irqraised2 = 0;5 s7 ]9 Z4 M$ {6 ?
; [6 e& z C, a6 N1 A$ K7 l: [' p C4 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 B% [: p; E& B, x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ D9 U7 R) A$ V, C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# u9 ^; t; e0 F( o
- 0 [) n8 O2 p* L$ M( t
- dma_addr_t dmaphyssrc1 = 0;
7 ^ e$ a; z4 H8 t; q$ \1 Y9 C - dma_addr_t dmaphyssrc2 = 0;
) h9 C) z6 q* V8 N - dma_addr_t dmaphysdest1 = 0;
7 S2 u7 ~) d. }- T) a, C - dma_addr_t dmaphysdest2 = 0;% t. D/ f! K1 t; O( O Z
5 e8 j" Y/ F# h- char *dmabufsrc1 = NULL;0 a( G2 ?& R: E% c
- char *dmabufsrc2 = NULL;
7 y3 f5 i7 q0 `, s7 \8 N7 P: v - char *dmabufdest1 = NULL;1 Z0 `* |* {* V2 W$ Y
- char *dmabufdest2 = NULL;: J0 A- ?+ b( V2 q& O+ q
' E$ {! v, @* h L$ T/ J; p5 C- static int acnt = 512;
! u1 j! }: L; f7 \/ Q; t4 E - static int bcnt = 8;
! |. H3 ?% L; a# P# C5 \ - static int ccnt = 8;( ]% i5 m4 r2 u" H
' g$ r8 U) X5 f9 ~& }3 X# m6 l- module_param(acnt, int, S_IRUGO);7 P5 o8 i" Z( `$ T0 O
- module_param(bcnt, int, S_IRUGO);
: y5 f9 f% ^$ n2 d/ R - module_param(ccnt, int, S_IRUGO);
复制代码 - T2 I) l7 _) t
4 l0 K) x6 E, Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 L' G+ z( {+ k5 I/ y) g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; X# S& |2 n6 h) g) e" Z" o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 N [ g! w! K. _
# y+ [% o$ c: b6 k3 I
3 k4 t( k) _6 ^( h9 p |
|