|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: A* E# [9 s$ e- K4 D- [code]EDMA sample test application
) O6 J9 B+ I% O$ Q2 E4 [. _6 |% [ - /*, u! V' B5 ^( W& p5 R- D
- * edma_test.c
( p" i1 ^, H6 x; ?$ Y. j - *; }+ w g; ?" Q1 L- D- X/ \
- * brief EDMA3 Test Application
; _9 {' D! j" I& P - *9 J, a+ g4 o# H
- * This file contains EDMA3 Test code.
+ i- z% |. m/ C" p - *
5 p" C. d- [; d5 \) v3 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ Z2 Y/ M. i; |/ s O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ u# S- k* e% g
- * TO CHANGE.
+ T: k) `% N$ q- Z! B - *
: \& K c5 _% P$ w" P9 k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ _3 \3 z% y! F2 l3 P
- *
! n: l+ Y; e& w7 z" }0 d - * This program is free software; you can redistribute it and/or
. M- j) Y6 H* a* I6 D - * modify it under the terms of the GNU General Public License as
% L5 @9 f* n3 y - * published by the Free Software Foundation version 2.
2 L3 n9 e& L9 c5 v% `9 p; k# n - *5 ~% n2 k2 s4 o1 I; K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, J5 G/ P9 J2 d( J* H4 e
- * kind, whether express or implied; without even the implied warranty
9 k% }- ?9 h6 m/ j+ `; u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ Y. ~9 A4 X% L - * GNU General Public License for more details., U4 D8 \+ H. y8 O% ?7 l
- */! C; ?6 t3 l5 b5 y
$ [. G. Y" q$ Y7 T! ^( t7 R- #include <linux/module.h>6 a! P t/ S. v7 D
- #include <linux/init.h>+ ?2 G) y- r/ r/ Z- o# g
- #include <linux/errno.h>4 K; Q" L" j- k+ m
- #include <linux/types.h>! |% y8 A( H8 P3 w
- #include <linux/interrupt.h>
& x/ J. }! X7 W, |! P# o# k& l - #include <asm/io.h>
% w, Q5 w8 [. k" L2 j - #include <linux/moduleparam.h>* i/ o1 ?8 H4 `, s4 d* f
- #include <linux/sysctl.h>
% v! Q0 N& o6 }* p, h - #include <linux/mm.h>
3 x6 |% U* I; }! J5 K8 c/ G8 w - #include <linux/dma-mapping.h>
J9 w- |0 v( L" l# `2 t - . [9 J2 f$ A2 s4 H8 w" R
- #include <mach/memory.h>& ~1 R1 O6 o% t; A; M9 [, ?
- #include <mach/hardware.h># W% M, p/ V; ?5 q/ v" f4 Z
- #include <mach/irqs.h>
8 {0 n2 I5 \* X! |: n& N1 M3 e - #include <asm/hardware/edma.h>
7 J! W( K1 f4 G
g" O0 W" Z; l7 k- #undef EDMA3_DEBUG
4 B, J: Z. q! K - /*#define EDMA3_DEBUG*/
" ]7 Z# O$ s9 f; K' G - 2 [9 J7 s7 z8 A; Y5 d2 Z" q
- #ifdef EDMA3_DEBUG
! n( E% ]2 Q1 a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( s+ S; b( G i, j) D4 [% T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 A) V9 _% I4 T8 L$ V( o( a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- |% `; c6 B9 o S
- #else
. N3 x; f# E: _* P - #define DMA_PRINTK( x... )
; X2 p: |( `3 [ s9 C8 ] - #define DMA_FN_IN' ]; l1 [+ p# [
- #define DMA_FN_OUT" H" \8 T w: s) F8 h1 k
- #endif& ~9 o9 \' ]5 F \ m9 }
- # f; I+ X, L4 m- b* T: u( c: U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 O5 G5 b3 a" h/ ^6 U. a3 ] - #define STATIC_SHIFT 3& |! Y+ q M: l4 t9 c
- #define TCINTEN_SHIFT 204 ~! L, F& ^+ i+ L2 U
- #define ITCINTEN_SHIFT 219 w; m. m% w- `, b
- #define TCCHEN_SHIFT 22
$ ]1 U7 R" h) C# {6 t8 | - #define ITCCHEN_SHIFT 23
- |) ]% W# ^6 d0 y N* g+ | - ' K! ^2 K- A8 a7 L3 r- F( s6 F; W
- static volatile int irqraised1 = 0;4 `% g; j |8 Z$ \) i% z8 G
- static volatile int irqraised2 = 0;9 a% C/ S: y& s' Z, Q( Y2 i
- : U! `* K6 C1 T* O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' {4 @+ g$ N$ K+ a) V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! o Z5 t7 S! x/ ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o$ K7 H b1 {: F! r' R
: I. B& Y i: ]" ^- dma_addr_t dmaphyssrc1 = 0;
% @+ g8 ^( j& U( b - dma_addr_t dmaphyssrc2 = 0;
9 G# e4 R" K( V( A - dma_addr_t dmaphysdest1 = 0;& H; R) H, `. q' Z" P1 L& z' Q
- dma_addr_t dmaphysdest2 = 0;
$ T- }2 t% `/ s5 m6 A: x
9 }& R" M# i; X" Q% u- char *dmabufsrc1 = NULL;
6 A+ Z) ]7 i- y' g6 k3 X - char *dmabufsrc2 = NULL;
1 E1 Q8 m, \$ E, @( u; D - char *dmabufdest1 = NULL;
# l8 M$ a W% c# L# [! ] - char *dmabufdest2 = NULL;+ [% b b3 G3 X# x; u, R
- 1 z1 A% L6 F4 u! r- w! V
- static int acnt = 512;4 E; L5 W: g9 R: W
- static int bcnt = 8;
6 _2 S+ Q* W9 N. y; U _$ E - static int ccnt = 8;, p3 x3 C* s3 y. M# R8 U8 T+ \4 B
- & z& X+ I: b) L ~$ r2 |% p9 W
- module_param(acnt, int, S_IRUGO);/ p4 M$ x- n2 m8 B6 l7 f Z# V
- module_param(bcnt, int, S_IRUGO);8 n. K' M! q% H7 |7 W% E/ L7 S
- module_param(ccnt, int, S_IRUGO);
复制代码
" `8 `' }0 n/ p8 ?9 `# i
7 \5 H) h4 E7 c U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 \! e5 D) h7 ^0 O1 k; tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. {, @4 s4 r* d g6 I4 h3 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' [; X( |) ~+ O6 @: u/ m5 I1 b9 A" ]: E& H$ \% V' ?% y2 K6 t
; ]/ ~$ X/ {3 J0 m0 Z+ [" @" F* u; a |
|