|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# a* y! z9 O' h+ \- [code]EDMA sample test application4 y/ o5 W! k; {' F8 e) r) e
- /*
% G4 o; F& n$ c% ` - * edma_test.c" K/ l! P% N) n- M! S m# j3 P
- *" X5 V0 b& O, F) _) O, u# ~) I
- * brief EDMA3 Test Application
9 ]+ m: \8 P) `! U. y - *
2 E) U% ~, u& L' ?8 H$ k' Q - * This file contains EDMA3 Test code.
' u" g3 }) y1 U - *0 b/ l$ H6 q% e v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 Q9 L/ _2 F; `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- a2 ^3 d2 v/ N; y3 P
- * TO CHANGE.7 U, x$ i5 c& z& e# ~0 F& a
- ** ^% d; a0 C% d+ Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) `' e6 l$ d' t% [% L" a - ** I6 b- z s8 c2 ?7 o
- * This program is free software; you can redistribute it and/or" j; T1 G- x) Y g8 d4 R8 k
- * modify it under the terms of the GNU General Public License as3 w2 P" n4 b' o5 {' }$ w5 ^& |1 n0 Z
- * published by the Free Software Foundation version 2.- B, L" p3 b: ^( P5 B2 Q) J
- *. r$ _" C7 s6 U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 A& L7 _2 s2 z$ D5 b
- * kind, whether express or implied; without even the implied warranty; Y7 R1 I$ P% q, I5 ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 o' T9 C/ D) H1 l/ k: Y S - * GNU General Public License for more details.
. d- n Y' s# ]% k2 H" c( U- ] - */
0 y# G. P$ B; N8 n7 ?+ @" { - 3 t+ S7 d; _3 s# |
- #include <linux/module.h>* k+ X/ S0 M( w3 x
- #include <linux/init.h>4 t7 q& Q$ E( z" W& Z5 q& x) o
- #include <linux/errno.h>" H1 u4 F2 y0 ] [) x
- #include <linux/types.h>
' U( S& {# J1 X, m$ W- b7 w - #include <linux/interrupt.h>& l7 {6 n/ A c7 `! t
- #include <asm/io.h>
" D; A: Q+ k4 d+ o - #include <linux/moduleparam.h>4 o9 z( r' f# [# n) w- {
- #include <linux/sysctl.h>
. S, j7 _; f( X; r* D6 g4 h8 C - #include <linux/mm.h>" O% b$ w K5 e) G# ]
- #include <linux/dma-mapping.h>2 {- S6 D. M9 h9 M2 u6 e6 q
- ! a4 l! c5 h/ x* i! B6 t+ c
- #include <mach/memory.h>
3 Z* {. V: M( o4 _2 | - #include <mach/hardware.h>5 ]! a( j3 ]- k: o; R
- #include <mach/irqs.h>, c0 \: @, W4 d* c( u D0 E
- #include <asm/hardware/edma.h>! ]1 J$ I% L$ i1 t H7 s
/ _, S* N5 b5 p( }. q/ G- #undef EDMA3_DEBUG
5 \5 ?' |7 H: f) m( E - /*#define EDMA3_DEBUG*/, i5 o$ N1 I% u% R* `& \
- 3 v2 t% O& k( t+ F3 x* b8 p+ `
- #ifdef EDMA3_DEBUG) ?$ q- |" J Q9 i. }2 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" v! R$ h3 o% N4 X% }1 Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 H" ~) ?- X3 v% j' F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 X3 I6 n0 L+ x _8 Q# ` F5 V
- #else0 X' n6 n" v$ a n
- #define DMA_PRINTK( x... )
1 n7 {. ^% ?3 V* } - #define DMA_FN_IN, E! k: s) U2 ]# C& t: @
- #define DMA_FN_OUT9 @' u; w/ x# e7 p
- #endif; m2 K9 h* \6 |3 e# N3 _- Q/ \* a
- 5 G* P$ }, r, H( ]: T& a( g1 ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) S' S1 z% p# w' V
- #define STATIC_SHIFT 32 H1 G; I, N$ F* U
- #define TCINTEN_SHIFT 200 q- r% X) S1 P& ?& _
- #define ITCINTEN_SHIFT 21
) p& `0 m7 Z" c- D - #define TCCHEN_SHIFT 22
+ J' h G0 e* V4 o - #define ITCCHEN_SHIFT 23
, x- ~& ]: ?! q4 G0 `5 R2 _" t - ) I9 g/ o1 u. N) E
- static volatile int irqraised1 = 0;
: `$ H' N/ d7 ]! J - static volatile int irqraised2 = 0;
. T+ v" D- E' `% [* m - 5 d/ p4 z0 J& X6 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# \" k+ k8 P" f1 h* |$ g! H1 X6 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 n) L: b+ c) z- Z6 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); Y; q z+ _1 H" T
- 0 Q, Q) X1 W0 t) z' f9 k& a
- dma_addr_t dmaphyssrc1 = 0;
3 R Y' i/ T8 ~. n6 l" w - dma_addr_t dmaphyssrc2 = 0;
2 W+ N" \' U+ L1 m: C5 O' P - dma_addr_t dmaphysdest1 = 0;8 d8 u Q1 k& X
- dma_addr_t dmaphysdest2 = 0;
% \' ^+ }. ^# b4 p( I4 w - 2 t* [9 H4 t$ f9 b9 G5 ~
- char *dmabufsrc1 = NULL;! h: u3 T, ?8 x w. H# X1 i
- char *dmabufsrc2 = NULL;+ T( M9 y/ s x. y' w
- char *dmabufdest1 = NULL;
4 |8 w4 l% g" ^& a- R - char *dmabufdest2 = NULL;4 u" F ^: [/ N8 z h( u, Q
K3 v" v: \' b, E& c$ A- C1 [: G- static int acnt = 512;
- D; _; b5 X0 T* ]8 d$ H( E - static int bcnt = 8;; q1 M u$ j9 j l1 O0 \3 \
- static int ccnt = 8;
* G" R9 x3 _' G7 f: G+ i1 k6 m
5 j# x$ K, z; r9 J% F x- module_param(acnt, int, S_IRUGO);9 T4 o4 H" [2 u* }
- module_param(bcnt, int, S_IRUGO);5 O0 r1 d2 U& ~) U. H
- module_param(ccnt, int, S_IRUGO);
复制代码 ' K( h( L, Q) G" `- i
) ~: X4 G' z8 B1 L" D- O1 a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 W1 ?- u' C- j& e: O3 L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: W* E% H+ H) Q9 t( V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. F- G: j. k' k0 M+ Y7 e
# |$ e5 y. J9 h' B* E7 t5 |: U* A/ _ ]5 l A6 P. k) z& w( S2 t& x
|
|