|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 J6 H/ R$ B" v2 A$ ?) ~8 _- [code]EDMA sample test application( ]! H5 p7 ]+ T
- /*
4 l6 V1 o7 e# J" \1 z5 l! x - * edma_test.c
: ?% Q& c# N. M, r - *
; o+ D/ ^% R( I3 u5 U - * brief EDMA3 Test Application
( C- [ S: z, h- p - *
# X2 o4 E5 |0 z* x - * This file contains EDMA3 Test code.
7 z& t, S4 M( Z1 B1 | - *
* d* @, Q; \/ }+ Z3 u5 [4 }8 P, `( T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, ?7 ~3 ]+ b; M. L0 z6 L& y; v6 e1 @, D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 k7 Q% l9 D/ E
- * TO CHANGE.
- P# w; W7 z2 n1 ~" {* q, Y+ v v - *. I% C8 F7 c1 O$ {9 D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ T2 u0 G/ O1 s7 I' Q
- *! H7 i- ~ }- V
- * This program is free software; you can redistribute it and/or
/ E" O+ a+ U I, q3 z1 E - * modify it under the terms of the GNU General Public License as/ A$ ^% Y3 x" c; ?8 k
- * published by the Free Software Foundation version 2.
0 U8 J. [' k8 T: t+ o. c1 ^ - *
. s# k( Q' h; `+ g' R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ x8 d8 }2 S' Y: A/ S - * kind, whether express or implied; without even the implied warranty3 ^3 u$ y. c. ]6 n4 Q3 ~9 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( ]- s5 M. \. o+ C- u$ m4 B0 q4 W! G - * GNU General Public License for more details.
: m; h; l$ L4 [$ R" S+ G9 _& T - */
; f7 `$ q8 J+ E/ k" u* b
! G' r9 p1 Z& z1 Q. s d- #include <linux/module.h> D1 N2 p; ]3 S# F
- #include <linux/init.h>* U6 o5 @$ o- h) b
- #include <linux/errno.h>0 {" n) h' M( ?
- #include <linux/types.h>( u3 u; ?: s2 m# \- ?
- #include <linux/interrupt.h>" y8 i& k9 [$ w/ `3 Z2 I; ]
- #include <asm/io.h>
( Y7 ]0 p! j3 `/ O6 Z7 `0 n# O - #include <linux/moduleparam.h>
, {; g( e, B/ x6 j - #include <linux/sysctl.h>/ a* [: @1 Y6 a' E1 x$ o, L% E
- #include <linux/mm.h>
0 H& f5 ~; {. G6 w% Z/ C9 I - #include <linux/dma-mapping.h>6 G& H# T( [) ]' Q) D0 y
# s. \- ?2 X% }. a" ]. D! x- #include <mach/memory.h>
+ _. \+ b4 z. R$ G' N' N* m - #include <mach/hardware.h>
# c& Y) ]% v( c - #include <mach/irqs.h>
9 t0 a- f: {' l1 x - #include <asm/hardware/edma.h>
4 S' w0 a8 Y$ w, k9 \ - 7 J J4 }/ t/ j1 h; ]0 N1 ~# j
- #undef EDMA3_DEBUG# Z5 O8 L6 `' y: B
- /*#define EDMA3_DEBUG*/
- {3 u. l) Z9 P$ W5 Z - / \- M* v4 A+ s2 I+ |& P3 `# A& A
- #ifdef EDMA3_DEBUG" g5 r2 k3 d7 Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). ]9 w& x1 [/ \# p$ r) P1 f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# y2 G' H& F! K# t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 F% z! a' ]$ _. z# }$ ]& _ - #else- m/ t) j! R- v: J
- #define DMA_PRINTK( x... )1 L+ z+ k9 @3 m6 w c. I- [
- #define DMA_FN_IN4 x O, L/ B% M3 h1 {- J
- #define DMA_FN_OUT% R& |; A5 k* R% Z
- #endif
; K& [ u+ o9 f2 f* e* n5 [+ R
" {' z6 A+ D. o8 ?( a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 K7 x1 {. h! k" @' F7 G
- #define STATIC_SHIFT 3& h1 f& I- b0 B" H6 \8 O% O5 R
- #define TCINTEN_SHIFT 20- H( a9 z$ ?2 E: \
- #define ITCINTEN_SHIFT 21
- H% p. K6 w9 k2 | - #define TCCHEN_SHIFT 229 g3 W. x% b& e$ G$ j3 Q$ a3 ^
- #define ITCCHEN_SHIFT 23
0 M- ^9 S' C- ?% u
! W' J3 b1 b4 M4 r6 M% Y& Q- static volatile int irqraised1 = 0;; o' A) S5 f* T/ W- V: G( R) T
- static volatile int irqraised2 = 0;) O+ V) Y5 Q" R: o2 n; r& W
$ |$ v0 [) ?4 ?/ Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* D# `2 Q0 Z) |- B/ ?: a5 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 C; V" }% Y1 K6 _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" M# h7 H! Q/ I* L - % g5 d5 @# m/ ~
- dma_addr_t dmaphyssrc1 = 0;+ \, l- w. T" N3 w
- dma_addr_t dmaphyssrc2 = 0;
1 F4 e% L! `0 m: K* c- F# D* E - dma_addr_t dmaphysdest1 = 0;
0 J' K4 H. _! R- {/ n0 O - dma_addr_t dmaphysdest2 = 0;3 _- D4 s2 n" v U
3 c8 ?8 @" @$ T5 C- char *dmabufsrc1 = NULL;
2 u; l( ?, U: q - char *dmabufsrc2 = NULL;
' `) J1 X5 C+ g - char *dmabufdest1 = NULL;; d2 I1 v: O/ n% s5 A) N
- char *dmabufdest2 = NULL;; \# f8 P7 g' h4 P4 A
- " }' t0 L4 A, Z/ ^& E$ A/ m
- static int acnt = 512;3 R# d1 T+ k* @2 O" \+ h, m0 Z
- static int bcnt = 8;/ D! P5 W/ N { [
- static int ccnt = 8;
% v2 ]5 q$ P3 `0 @
( J7 b- L! m. n9 C) ~- P; Q- module_param(acnt, int, S_IRUGO);
# |" ^; {6 X7 R& t* x- L - module_param(bcnt, int, S_IRUGO);
6 [: n) V9 a" z- J - module_param(ccnt, int, S_IRUGO);
复制代码
! f1 C2 ?3 r+ y) R+ T1 E# @6 a& R. I% t1 t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
y$ W' y/ ~: Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ q) ]. q+ \- v' |0 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 r* E+ k* v' V& X5 n
+ ?" p6 C2 I' b; S8 f& g `' u% u8 ?+ r1 I
|
|