|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . Q& F$ d, C. d; R
- [code]EDMA sample test application; \* G# |! |. P6 k5 i# i9 l
- /*- X- E9 z) T* F3 F& I& k$ o
- * edma_test.c) C; O; |( p1 L, p, Z$ y- `7 h/ ^
- *
' f" u9 @2 m' w( C! k( p - * brief EDMA3 Test Application
5 C4 g: M2 }, ~6 U( w# r6 } - *$ e$ {1 q" ^4 }' N( U
- * This file contains EDMA3 Test code.
2 o+ n( r7 j# K8 w - *
( a& m4 o* j5 {9 d; o3 n( c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! t8 u. b4 V7 y) o/ A3 e: k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ a1 e# y. v! G0 W, i- X - * TO CHANGE.( I: ]- @& d* I( F, _+ V$ w' S
- *! K, S2 Z) b. Q3 P# h5 D2 n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// _2 d; F8 y* _+ Z8 s3 q& a8 t
- *
; a/ V4 G" ` _2 I, r7 g2 l9 M - * This program is free software; you can redistribute it and/or
' E% w, ^7 N% K& B! Y; S - * modify it under the terms of the GNU General Public License as$ A; G+ X0 i- F. Q# j' V6 ?5 S4 ^! _
- * published by the Free Software Foundation version 2.
) g9 q: @) ~; N: P& F - *
* @5 N( j1 ]) ^ C2 _/ |+ N, ^# J- J! b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ T& U* W$ a8 [) E3 \1 l) [
- * kind, whether express or implied; without even the implied warranty
5 C u9 s2 N* `! m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% C8 R. `6 T$ p% u1 ~1 ` - * GNU General Public License for more details." P6 k# o8 t+ b6 j
- */
1 l2 @, h, @3 ]8 G0 f8 T - W. i8 O U. d7 p
- #include <linux/module.h>. z7 d8 S" @& j% a9 E
- #include <linux/init.h>
5 f, B, g; Y# N* g - #include <linux/errno.h>
& W& V( ]: K9 Z& J1 m - #include <linux/types.h>
! | S; P8 \* ^$ s+ q - #include <linux/interrupt.h>
2 F5 K$ u0 i7 Z; Y7 L E# \; \ - #include <asm/io.h>* B& G, c7 e0 |% M
- #include <linux/moduleparam.h>. m" G5 T) z( o# ?( A
- #include <linux/sysctl.h>: R5 B/ q# i- H5 d8 n( l3 r5 \
- #include <linux/mm.h>4 l A' d) @) L. ~$ e+ E
- #include <linux/dma-mapping.h>
; W9 R1 d0 D; v* N4 \% d# F+ `. b4 X
& ^% a- @8 M/ D9 E- D* g/ D- #include <mach/memory.h>
7 x/ N1 ]. a+ Y+ E$ a* } - #include <mach/hardware.h>
+ h% {' W. Q# M" M - #include <mach/irqs.h>9 ?+ E' {5 z1 b& g! H4 ^6 N: M# S
- #include <asm/hardware/edma.h>* Z, B5 i/ i+ n
- 0 x, w9 [3 c$ f
- #undef EDMA3_DEBUG
% l1 H+ s$ b: u/ o' x! J' z l - /*#define EDMA3_DEBUG*/, i& e% H6 ^6 z! _2 l4 c
- - w6 [4 F% h$ C9 r, D; O
- #ifdef EDMA3_DEBUG: N( L: u+ O7 `) _' s. b$ Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ y, W* N. j' G0 B0 q# p; w5 }+ @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 v: L$ ~! `$ p& B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# }# y4 [7 {1 R
- #else9 o7 _! J4 L$ ]* V
- #define DMA_PRINTK( x... )
/ }) Y3 d7 E/ B @1 f9 h) N- y - #define DMA_FN_IN% K% @* u0 F( I9 I' v d J
- #define DMA_FN_OUT
; k2 {* J6 W* k - #endif; w; k8 n7 I0 Y+ a# J+ N3 i. I3 K
- + D+ X/ u- s# e5 i: H/ A( x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! u( ]# \- @5 w4 K' S
- #define STATIC_SHIFT 3
2 `6 [; K) V& s3 P. k( o - #define TCINTEN_SHIFT 206 O! P$ P! o0 g5 s8 w
- #define ITCINTEN_SHIFT 21
) T0 @0 F+ i9 A - #define TCCHEN_SHIFT 22
) C. E7 U: ?2 x0 ` p# J2 m5 c - #define ITCCHEN_SHIFT 23( g/ X5 ]. a* {+ ?6 I! a
- ) `+ W% @, F8 _' w
- static volatile int irqraised1 = 0;
7 \9 h& C, E. T* L$ _. x3 b" m - static volatile int irqraised2 = 0;
% q0 }- H* V: e+ b. ^ W; j; r& H6 a
$ S9 M0 U4 `/ j/ \% g( A0 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( i8 T; U& D! }7 m* _6 i# O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 S' R9 \6 R e6 g0 ^+ i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' t3 C/ h3 q' d
: S+ S* o2 }( s2 G' T7 S6 D- dma_addr_t dmaphyssrc1 = 0;
; _4 L. a7 `+ G% E" S - dma_addr_t dmaphyssrc2 = 0;. G4 X% H" N- [1 f$ |4 X
- dma_addr_t dmaphysdest1 = 0;$ ~/ ^" x3 a& b4 j* v m3 N5 ], M2 r
- dma_addr_t dmaphysdest2 = 0;+ R5 g1 {7 w+ b1 n) L
- ( m0 N0 W) ?* o0 h; z
- char *dmabufsrc1 = NULL;
! H* i& }9 E& N1 w - char *dmabufsrc2 = NULL;3 V- _" N5 `1 }9 [! t- h
- char *dmabufdest1 = NULL;
1 c0 H3 ~/ K0 b% y( d& ^ - char *dmabufdest2 = NULL;
; R, G1 E0 }1 l0 T0 B$ Z
+ _# @$ [2 D* s7 G. I# @. q! F' h- static int acnt = 512;
7 \; Z, }7 v0 r0 P - static int bcnt = 8;
0 y& p! y# z, E3 B. V+ ?" ? g - static int ccnt = 8;: X% o. ]' X7 r6 `
- 8 k3 W- B7 p- o8 o7 u4 ?
- module_param(acnt, int, S_IRUGO);
5 ?0 d$ ~' O% L; O - module_param(bcnt, int, S_IRUGO);
( k# K( y4 P; H9 g, X - module_param(ccnt, int, S_IRUGO);
复制代码 7 j! c8 j6 o4 l) [- y
) \ @# T: o- ? ]# o3 n3 ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 Y& n1 a3 n! `5 iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 T$ s( C- x3 \8 P% A: X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 K, }4 \3 y# C7 w: Y' }4 @8 L" h4 o- @/ O
) I9 z: G# [8 [ G# v( ]( B
|
|