|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 @7 d9 T1 h5 ^8 T& t+ d; ]- B7 w- [code]EDMA sample test application: u. p ^* h! r9 Q; V# ]+ C& O
- /*- Y, r- G7 F" L1 P
- * edma_test.c
3 |7 y6 {# I6 m# Y8 K - *
/ i/ J' W. d4 ]$ O5 O - * brief EDMA3 Test Application; j6 V2 m. K8 g7 h3 g. C) q
- *
4 A: q; c$ A5 K! v7 H% y% |9 c - * This file contains EDMA3 Test code.
; H$ Y+ h4 ^8 d% y# [& \ - *
. K# u) J) }# u7 a: f# t0 ]4 i3 i& I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) |4 e: }5 z- s6 t; K, G" @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) [1 G4 @* o7 \3 h3 M$ I - * TO CHANGE.! S7 i2 l, u3 j0 Y3 p' {+ P9 a
- *
/ ]! }" T' l$ J2 b- _7 \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) Y' u( m4 J3 U - *! a$ K3 p* m# u2 q, H
- * This program is free software; you can redistribute it and/or
3 `5 x) ~6 }8 ^3 }! n! G - * modify it under the terms of the GNU General Public License as
8 U9 D4 f) `# p! R- J - * published by the Free Software Foundation version 2.5 z& ~1 P H: s- m+ e- T# T4 J
- *
* d! N& c, d9 _/ D3 D N) V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! m3 `$ m' A% T$ F$ Y& ]8 g( B: S - * kind, whether express or implied; without even the implied warranty: A4 P1 c8 Q+ b$ y: o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 [0 [! S/ z) X$ ?' ~( X1 k5 o& K - * GNU General Public License for more details.4 w Y% X/ H' _( `3 t
- */
8 D0 Q2 I; ~- j( M; B9 O/ t - 2 A' r( R P+ O0 U1 e: \
- #include <linux/module.h>
- p0 ~0 }3 z+ b% V h& ^ - #include <linux/init.h>
+ F8 Q. v6 ?% u& l. E# { - #include <linux/errno.h>
. T- @: E5 A, H9 s - #include <linux/types.h>
+ X) \- } b/ ~& I - #include <linux/interrupt.h>
; H8 j6 _- V3 N H' \- O# r* a - #include <asm/io.h>/ E- D0 u+ h3 {6 ~3 w7 _1 r# w
- #include <linux/moduleparam.h>
) |2 s, M' y8 |' ?* Y - #include <linux/sysctl.h>3 }. P* O$ q) V2 u/ V9 f2 k, `, t
- #include <linux/mm.h>2 w+ u- w2 A+ j7 u8 v# T6 | {
- #include <linux/dma-mapping.h>7 `+ Y# `5 ]9 Q- q8 s7 U' u
! B% A1 b, {9 P5 X0 e- #include <mach/memory.h>
" C8 C5 `5 o' c' }' e4 _& S - #include <mach/hardware.h>
5 u0 Q4 S+ t0 }, G+ ^" u/ p - #include <mach/irqs.h>
3 {( r7 K3 C4 F, F9 D - #include <asm/hardware/edma.h>
) m; E P) Z; F1 O6 N
# e( b6 U# W4 L7 Q- s- #undef EDMA3_DEBUG4 d7 k! s" p8 i- {8 ]( D9 u
- /*#define EDMA3_DEBUG*/
3 M7 f8 T2 ^7 j, r - 6 c. `" Z% D! i" `3 N
- #ifdef EDMA3_DEBUG; U( B& ?# e, F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). ]8 b' }: S" A7 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 f1 H n, v+ f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 }6 g% r; ? k; U* e: k5 E
- #else7 c1 T4 W+ I; x3 g% {
- #define DMA_PRINTK( x... ). ?! V/ \3 U. `: U
- #define DMA_FN_IN
+ _( X' c& h' A( o& e5 } - #define DMA_FN_OUT; }4 t/ ^* \: p7 A
- #endif0 y: u& K- x; O. Y
- 5 ~3 ~" S& B2 P$ A- B2 G6 z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 S; y0 S& N. {4 A3 P
- #define STATIC_SHIFT 30 w) V8 k" p: t* k0 g
- #define TCINTEN_SHIFT 20 b( K4 d. U- r8 n
- #define ITCINTEN_SHIFT 21
5 r5 V" k; E! S# V4 Z0 w0 B6 n - #define TCCHEN_SHIFT 22) D2 C3 u$ Q! C; I# D+ O
- #define ITCCHEN_SHIFT 23& ~& W2 Y1 W* Z j5 u; r3 a* K1 g
/ ^7 p3 L4 U( Y6 d' B% v# `- static volatile int irqraised1 = 0;
1 e* ]( _/ O) l$ A% ^ - static volatile int irqraised2 = 0;4 ~: a7 V! k* E3 y9 }2 Y6 P
- q/ q* }: Q( e, F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* P; ?! r0 ?# S$ }: h2 D0 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l, @1 n( Z$ S& T/ R9 o$ D9 P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- C. q) C, B. a. R9 d. [7 {
! t. ~3 P3 \7 w# [6 u1 Q' j, e- dma_addr_t dmaphyssrc1 = 0;. }) A o3 g' c& ~) W8 E
- dma_addr_t dmaphyssrc2 = 0;
+ t: L% U) S* }; F9 `9 | - dma_addr_t dmaphysdest1 = 0;; s7 h, I/ ~% U3 g5 i: A
- dma_addr_t dmaphysdest2 = 0;
" Q N! o: K0 @, e& C7 I
2 W: t( G- h1 K, A7 b9 ]" t- char *dmabufsrc1 = NULL;; X C% l- s f9 Q/ t `( y
- char *dmabufsrc2 = NULL;
1 W1 R. _2 E @# K - char *dmabufdest1 = NULL;
# A1 y* a5 D9 q0 ^# X" k/ Y - char *dmabufdest2 = NULL;# d+ L( N% f- a) h( K' {
! ~; {( O# u& N8 x! Q7 x* s* q- static int acnt = 512;: Y" r) g, T" H9 e3 u) D( m# ]0 ^
- static int bcnt = 8;
* v, F- b/ \; r L0 \( E - static int ccnt = 8;- s" @" A: G3 b1 O
- e9 f, f& k! `- module_param(acnt, int, S_IRUGO);5 W) M2 N* A8 c# v
- module_param(bcnt, int, S_IRUGO);
. `1 }- y8 i# U- [ q8 m3 K - module_param(ccnt, int, S_IRUGO);
复制代码 : _; L. ~& A% [+ S) A/ j9 I
( j- V! L8 H( O# L& E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" U, W$ W8 }% X& w1 Q3 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ n9 Q% q/ D) c/ X2 |$ f2 B m( ?7 u5 J6 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ f. }1 U4 a/ S; o
% h! P D4 {; a4 } O& W/ h8 V* t* T. O- o. Q1 ?* h7 J0 t, [/ H
|
|