|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& Q0 j* g6 b7 H8 q. D. i `8 ?- [code]EDMA sample test application
+ t1 r0 }/ Y" T* v! T: j - /*5 ?( ?6 |$ u$ w. j \2 I
- * edma_test.c
0 z, m3 J( G" d: _ - *' E4 x+ o* E6 C% |1 `% t
- * brief EDMA3 Test Application
. f1 M# [ _, W, p8 E - *4 N/ z. ]4 X% \: c& o
- * This file contains EDMA3 Test code.
$ [( C& f" X$ i! J) {* B - *
' d/ O: B0 ^9 g4 T1 a, Q6 N+ d- d% i* | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, C- J, {9 c* m [. Y* W8 p2 V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: b+ K: d$ B1 W5 z; j7 Z# [ - * TO CHANGE.* E+ \0 S/ b2 k S5 D! Y! G8 C
- *$ W% r) q) H0 t' L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# K0 L, H1 w% ?+ Y - *) R3 |8 `4 X2 B
- * This program is free software; you can redistribute it and/or
9 d7 Y r7 H, e7 x+ ^- p - * modify it under the terms of the GNU General Public License as
9 L: C% W s4 p - * published by the Free Software Foundation version 2.
4 T7 c8 o/ k* s5 H! O0 e, p% F - *
- A* N; a2 s ]4 r* j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" ~( c! K$ M0 n B7 F% d& w$ [# E - * kind, whether express or implied; without even the implied warranty2 r) `0 { _2 W" M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ~$ m( j6 p5 D5 e
- * GNU General Public License for more details.9 @' u4 R }( H( w/ _. d9 T
- */' f' z6 O* g) I" W9 S+ \' c
- - R% ]9 t& p _2 x
- #include <linux/module.h>
; S, W' g, T( B: ^- d: R; l. e2 | - #include <linux/init.h>
. b7 ?- \' I! P; f8 e5 X5 N- Z& @ - #include <linux/errno.h>: u% }( p7 P$ a. s
- #include <linux/types.h>4 @- K/ l# ?2 D/ M) a- h) |
- #include <linux/interrupt.h>
5 g/ w) L3 j' @8 Q - #include <asm/io.h>
/ l+ A5 J6 n* L) j2 V5 M - #include <linux/moduleparam.h># d, ]; P7 x( P. x! p( n1 h
- #include <linux/sysctl.h>
: @2 F8 |. }0 k7 _; S" \ - #include <linux/mm.h>
% R" M( s, ^; c) p% | - #include <linux/dma-mapping.h>4 I/ j4 w7 {0 l
- ( x: v8 ]( }% d! n# o3 m q
- #include <mach/memory.h>
: l, T5 q* G4 z* X$ ^2 z( Q - #include <mach/hardware.h>
4 c: m+ H& }8 `. [8 _+ ?) l( z* | - #include <mach/irqs.h>" d4 v8 J* ]2 _* h
- #include <asm/hardware/edma.h>2 H$ e0 a: U* h3 ~5 P& ~
; o+ Z- i; K5 K! |5 H7 F- #undef EDMA3_DEBUG6 Z6 n0 d& q" a" @
- /*#define EDMA3_DEBUG*/
1 _, C/ O; A! a9 v) w - - N5 \5 n1 F' e6 l! [
- #ifdef EDMA3_DEBUG
/ z' g. ]! l5 O7 L B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 w) h7 g! `* O Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 H% W7 {# _, T" j" V$ x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 e3 R" u: T: y3 n - #else
/ a8 u& \" a0 r2 X3 O - #define DMA_PRINTK( x... )
$ {3 R" R0 I* g; ]( U; k4 H - #define DMA_FN_IN; v! M* E. i% ]4 {! I* X H
- #define DMA_FN_OUT% e. w; V. y' u9 [
- #endif
_& u5 t @! f
7 Z) m, U5 g2 U% R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' q- P6 Y* s' Q; H6 V" U - #define STATIC_SHIFT 37 F9 V" w8 n) e! z ? |
- #define TCINTEN_SHIFT 20
, ~. l; H& T3 j3 l5 G! } - #define ITCINTEN_SHIFT 21
: G8 [; Y! b' o7 u" c - #define TCCHEN_SHIFT 22
7 G7 D, _6 D& K% }1 p/ i) B - #define ITCCHEN_SHIFT 232 w" X* _- H5 i+ X' N0 x
' L! d5 T- ]2 Z: g( g- static volatile int irqraised1 = 0;$ g) i5 J4 ^/ J
- static volatile int irqraised2 = 0;, p6 ]5 U: ] }
- , J: @' t+ [- d7 M# D0 [8 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- O' d9 }2 U; a7 L5 Z' ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ], f( }# G8 z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. u) N' H: O' l# W& u# D$ a
- - q' H9 c* A$ g& [9 s4 R6 N
- dma_addr_t dmaphyssrc1 = 0;
5 ?/ E- w* i" {: x - dma_addr_t dmaphyssrc2 = 0;/ G# ^" k6 G& _
- dma_addr_t dmaphysdest1 = 0;
! v2 d2 }3 N' o& f$ O - dma_addr_t dmaphysdest2 = 0;
0 X4 O& p( Z* Z
( [7 |5 a; d3 F5 P) t D; B- char *dmabufsrc1 = NULL;- _! _7 J% h% ?
- char *dmabufsrc2 = NULL;; \& ~: `3 a, r' {/ s z
- char *dmabufdest1 = NULL;5 j# M! p$ @. T8 X
- char *dmabufdest2 = NULL;6 @( W u$ O, m0 e% [
- / {% ?* A! ?. R7 l
- static int acnt = 512;
~/ r: a* A! ?9 D! I2 W - static int bcnt = 8;
0 e% e& Y" ~& q! O - static int ccnt = 8;
" z0 ?1 N- V S, _7 @ - - R9 B1 g6 m+ m
- module_param(acnt, int, S_IRUGO);
( @7 y- N3 T% `, K* r# E6 Y - module_param(bcnt, int, S_IRUGO);4 P" H ]6 |+ d8 b" Y4 o
- module_param(ccnt, int, S_IRUGO);
复制代码
: b1 e& ^$ g& |6 x6 y6 {
! G8 ?5 L! @, ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 P' w* S# H% z" \. d! y" r9 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 x9 [4 {3 w& V' L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& Q, I0 o* o, i5 q7 `' h2 R( i/ a
, }7 Z% `$ D) c' Q
5 h, D0 m/ M/ w" ?/ S |
|