|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) M8 P7 @6 }3 p8 X4 X5 w& @- [code]EDMA sample test application( D7 B% M; `: t: E' N
- /*
* \& X' Y2 |7 ^) U/ c3 n - * edma_test.c# M/ [) }& L. K9 h6 u4 z8 F
- *
; X2 l( j# f9 ?: Z4 e4 Y* { - * brief EDMA3 Test Application
! y- Q* j Z* z* ^* d4 \ - *! y* F2 x5 B% Y8 f
- * This file contains EDMA3 Test code.
- k9 e) {1 j7 x; `7 Q, U - *6 F: A7 @$ V, p5 q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# I' u6 _5 R+ h; q5 ?) V( j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: L2 E) N2 @! [* H/ R% D - * TO CHANGE.
1 d$ k4 \3 ~3 r; D1 i4 I* F; C2 z - *
( r# a, U/ ?( `, C% r* O8 \# i9 H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 G' M+ S/ j2 |5 Z9 R. C, \ - *
g1 M3 _* l4 I s: O) d; b - * This program is free software; you can redistribute it and/or" }- E* f/ F% M# P8 f5 [# m9 F" w
- * modify it under the terms of the GNU General Public License as( ~0 A: b) S6 R- Z
- * published by the Free Software Foundation version 2.
; o. X: [+ m% @% F8 X* Q - *4 g0 x7 N3 G; k6 n- `+ W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ u* p% a4 Y( j& u, }2 y - * kind, whether express or implied; without even the implied warranty
$ D+ x! l; i4 ^+ Q5 k1 E: G, X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# r5 Q% e0 P+ q8 U) H# k8 E. c - * GNU General Public License for more details.
# v: p5 D! R# }. x( _+ s4 | - */
8 }5 d4 b) J- U N
2 Q& `% `1 [0 a/ n. N- #include <linux/module.h>
/ s' n# H% y2 G5 p& {% K2 H% b - #include <linux/init.h>
% y$ o. C2 W" o- o8 m* n+ l+ ^% ~ - #include <linux/errno.h>& ^5 Z9 D( z- j) @5 L
- #include <linux/types.h>9 R6 q; E2 h6 k* ]6 Q( y
- #include <linux/interrupt.h>" D7 z- S" v( T# Z! t4 d: g/ z+ j
- #include <asm/io.h>
7 S8 x7 R+ n/ V0 u. T6 F# v) e7 O - #include <linux/moduleparam.h> n; p3 O! n6 O7 C8 F& z: C, ]
- #include <linux/sysctl.h>
! B e6 I4 F2 [( L - #include <linux/mm.h>
3 H6 V3 j% G& N+ N0 R/ X - #include <linux/dma-mapping.h>8 y4 ~: ^9 Y6 D" g
: o. d* n* i' `- #include <mach/memory.h>
# C. }, Y* o2 z" [' ^4 d) n0 S - #include <mach/hardware.h>
& m# A! }3 ~# ]% N. S: ^1 C - #include <mach/irqs.h>
) b9 F( y2 Y1 e2 H# e - #include <asm/hardware/edma.h>/ w1 y/ d1 i! l% P
- 7 ?& ~- ]7 c- w2 f. P
- #undef EDMA3_DEBUG0 K8 S" c3 G9 O
- /*#define EDMA3_DEBUG*/1 L3 |3 ^ a: p+ t2 L; i4 ?) m9 j
3 s0 b8 D6 Q* _4 d& b! T r3 s- #ifdef EDMA3_DEBUG' c- H d, h; C8 c9 m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 A) ]# d3 W4 s, C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 }7 [/ e" x. `6 ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 _) N# [9 w+ p* h
- #else
# u% b$ g6 T. @1 d+ W - #define DMA_PRINTK( x... )
1 K) K; _" j: G& E% b7 d - #define DMA_FN_IN J$ r. W5 F4 m) b1 X* Y
- #define DMA_FN_OUT; f3 p1 v* Z* q
- #endif
' z' m' s0 {) L$ O5 J - , a; W5 N* O0 ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 Y( T2 y2 ]! Q" g7 o6 d) g
- #define STATIC_SHIFT 3
0 [- i" _/ n1 m9 E5 ] - #define TCINTEN_SHIFT 20" t7 v& }7 H+ J4 y
- #define ITCINTEN_SHIFT 21
" m! H( }6 \( s7 L/ b( `7 ~ - #define TCCHEN_SHIFT 22& d! Y) E% n, B1 `- U' C1 z8 M/ L
- #define ITCCHEN_SHIFT 23
& a* a* G' Q7 g7 p+ X- T
+ z/ {% R m/ n& B- static volatile int irqraised1 = 0;
! ^2 p2 L- g% }, F: D+ ^ - static volatile int irqraised2 = 0;
* V; ]+ g8 {& m2 y
- G i( J) S+ g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ^# w) z, F: Z3 u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ J( W' k m) [8 n# G( J5 y( \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); J5 V* {5 z, z! b5 d+ `: }
- , F9 k: ?8 l( s
- dma_addr_t dmaphyssrc1 = 0;
: R: l8 S7 W! S) f# g' R0 f! u - dma_addr_t dmaphyssrc2 = 0;' Q' w' P+ v+ `' D5 K; r" I
- dma_addr_t dmaphysdest1 = 0;1 ~3 S& g a" I Z( f
- dma_addr_t dmaphysdest2 = 0;
1 A) ]9 p) t, ^4 ] - ( k+ ^. O! X( W. y. k' C1 Y) C. t& N
- char *dmabufsrc1 = NULL;
- Z: b9 n! f( S# j9 D9 F - char *dmabufsrc2 = NULL;% b3 }! f: j2 q1 U
- char *dmabufdest1 = NULL;
* D' v& h; Q# e$ p+ W: L - char *dmabufdest2 = NULL;
0 \) }# t2 R) Z) J# G
; m2 ], z' j- W3 [* S+ T/ D- static int acnt = 512;/ ]3 r2 j* y1 I# A, m
- static int bcnt = 8;
) z; h" c* ~+ o - static int ccnt = 8;
* ?, l# b& i Z2 B
% T* w2 { {$ q; q/ u' S6 \ q- module_param(acnt, int, S_IRUGO);6 E( B$ T5 K1 M1 S( w$ n
- module_param(bcnt, int, S_IRUGO);
}' B- R; ?% i5 v: Z4 }/ i; U# u7 \ - module_param(ccnt, int, S_IRUGO);
复制代码 : d) q7 m- X+ d7 U! u0 F3 N A
. i/ T: { J9 ?' G" P! y2 `' \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, v( r9 V$ N; O# earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! E9 N7 Q1 p U% n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" i& f$ ~% e+ n0 o+ o S
' t% r1 Y# T% `
~" X( z- ^* c' S4 o. i$ E
|
|