|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 Q2 O; h: s7 E- {. k, o- [code]EDMA sample test application+ I# Y3 a( L8 T* ?6 g
- /*
" R1 b+ }" H$ ` z' n0 A - * edma_test.c; |4 A6 ?' M6 [# B$ B& k. `
- *
, V& j, ^; y& Q$ T% l S- |% N - * brief EDMA3 Test Application; T' S6 B( D6 S# k' ~3 y7 ]: Y
- *4 t' A/ W! k! k: G4 O- }- ?" i
- * This file contains EDMA3 Test code.' p0 O% `9 B1 j/ e8 }0 H1 L
- *: F+ c- Q& N9 F" i1 A- S! m j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 @ Q2 K9 W c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" ~0 Q; p4 S" Z+ @+ N+ e1 r- M, R: N - * TO CHANGE.
+ _2 b1 o+ ^ v( X- m - ** d: a, ~9 k6 x. }! h+ C$ K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 e- B, m4 d" U* j2 G - *
8 r7 \# O7 t* x f( B - * This program is free software; you can redistribute it and/or
2 E0 X) J' @. K Q( F5 i - * modify it under the terms of the GNU General Public License as. D+ t I3 h: }7 O/ |
- * published by the Free Software Foundation version 2.
" F. ]% g; d+ d& F1 {# w( W - *
( p o3 M( s2 G, O5 m @0 U0 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 h+ @8 R+ |0 A) e$ t2 O: ^/ ] - * kind, whether express or implied; without even the implied warranty: }0 p% e+ l2 r% r% t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 o V# y2 k2 Z" c3 A5 A
- * GNU General Public License for more details.
2 ~/ y2 {! m! B8 x0 E - */' a/ Q( j7 m( ~% ^2 ]5 U2 ]# y! ?) c
% C3 V3 l0 V/ z- #include <linux/module.h>' o3 c: i% f3 {
- #include <linux/init.h>" Q! v' t# @1 m' p5 m% y
- #include <linux/errno.h>
( C$ _7 R$ R6 W; v6 a8 N8 R - #include <linux/types.h>
" [! `5 G. K" r8 j - #include <linux/interrupt.h>- q# b7 O/ ^& J
- #include <asm/io.h>
( o7 N1 _5 b/ S/ j) u# {6 t: w. Y" h - #include <linux/moduleparam.h>. ?; K8 g; S4 x9 u$ {
- #include <linux/sysctl.h>
- M2 R1 [6 {# a# T. ]/ P B1 I( T* X' k - #include <linux/mm.h>
' j0 l: {; r. G" S) E& Y - #include <linux/dma-mapping.h>
7 @# m, w* r( m! D4 z; w
; f( [& X* v8 F- #include <mach/memory.h>
0 v8 G. ?5 B* r9 W - #include <mach/hardware.h>% c1 v9 E' U9 R7 F: _. K
- #include <mach/irqs.h> G! b9 _( ~8 L0 y
- #include <asm/hardware/edma.h>4 t& h: u1 j! ]7 n# H
- 4 r P! m& k' H+ [4 i, X/ s
- #undef EDMA3_DEBUG' h. K/ D+ L4 i
- /*#define EDMA3_DEBUG*/
. U2 S' h1 R/ n/ r, X7 ^
6 W* i3 P \5 V" m9 F! K3 T- #ifdef EDMA3_DEBUG. W9 u- ~. o7 i0 n& V& G, }' E( l" D; D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& k9 u+ \" w# J5 j0 P7 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" l- c) s) j, A5 `. |7 u1 f& J) F* n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 j ?+ E# o: K - #else
b0 |; P- G9 S3 w d: ?# o - #define DMA_PRINTK( x... )& B' D" Q1 O0 E, Q
- #define DMA_FN_IN
2 O$ G6 T) o: y - #define DMA_FN_OUT
! _/ d2 \5 f$ H ]6 m. K - #endif
* b' N. M" |' T2 S9 p - " O; K) F/ _3 r& Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% J/ }$ h0 W1 u' k- ] - #define STATIC_SHIFT 3+ ~. M# o) y9 _; [
- #define TCINTEN_SHIFT 209 c, C$ E( [. k' d/ f. P& U, z) m' K
- #define ITCINTEN_SHIFT 212 t9 v6 h0 h) Z- _+ T- t! J6 }) R
- #define TCCHEN_SHIFT 22
f2 g1 x5 J& g( D - #define ITCCHEN_SHIFT 23( _& k! S" h7 K" I" n
- 8 _; u/ w" R% y% N5 l& d
- static volatile int irqraised1 = 0;
6 C I2 y& [9 r2 }. _) E - static volatile int irqraised2 = 0;
; {, G( A( x8 q
5 j6 h# \% J( x0 T m: [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 s5 e9 G0 Q2 _# G) U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 h4 ?3 G6 [# P$ ]/ d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' w2 ]9 j3 p& Y" }
/ ?4 @% e% Q* L4 c1 u$ `- dma_addr_t dmaphyssrc1 = 0;
# m. `9 P" M8 K; z - dma_addr_t dmaphyssrc2 = 0;- _$ q. T( g: \7 i4 l( w
- dma_addr_t dmaphysdest1 = 0;+ {/ g9 F4 H7 k+ z
- dma_addr_t dmaphysdest2 = 0;
" x8 A8 C5 g; x% e1 P g
9 O7 p+ m5 ^' s- char *dmabufsrc1 = NULL;
8 P1 H1 Q, v6 \+ d: A - char *dmabufsrc2 = NULL;9 L: \% X) E* M' B
- char *dmabufdest1 = NULL;/ j+ k+ g$ o4 ? f
- char *dmabufdest2 = NULL;
. t0 e: N) H2 q4 t ^3 N) c
3 \8 \6 U0 A2 c; {- static int acnt = 512;6 T# d* J/ v" V
- static int bcnt = 8;8 N! D% H) m' H7 \
- static int ccnt = 8;' W. E: C& {2 s* O0 d' ~/ d: c9 q4 O" @
- w2 ~. r% @/ B; {- module_param(acnt, int, S_IRUGO);
) k3 _/ O$ d7 b1 x! T7 y- ^/ H - module_param(bcnt, int, S_IRUGO);; U) ~3 h( y* t4 R4 i/ u* @1 b9 k( d
- module_param(ccnt, int, S_IRUGO);
复制代码 8 {% b+ \0 {( f/ y
8 s- n' U( g* k8 h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, @2 Z* b. R: ]. i* k1 m# ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' P- z$ F9 B' o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ O- F9 F3 A4 B$ S8 x1 z, m, ^# W3 h! ]7 R2 v5 s
. M$ O) U+ ]/ r; ~0 u8 e( [; K# p |
|