|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # `/ J( G- o" q5 g4 e
- [code]EDMA sample test application) l$ U7 D) G- c- }" w# Z* b) z
- /*
% o+ f* u6 S+ `; j# a6 u. j) h - * edma_test.c
1 p( j# E- M( l) c8 x - *
9 r& W, c& R* t! \8 A4 } - * brief EDMA3 Test Application3 I5 k7 l/ _* D2 H# H! B- g
- *
- W- \$ F2 d) U. ^4 Z - * This file contains EDMA3 Test code.
% \: G8 \+ W9 _ - *
% ]4 ], b, _. w+ O$ ^6 p7 T: l, k0 v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- d) \8 N! t' e1 k* [6 r7 \) E- [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT { r4 t# C5 R4 X$ P$ j7 @0 ?( [' z
- * TO CHANGE.
?/ V6 ?/ Y# v- p1 `# y - *
W* H% C1 D. D4 U8 X ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 A3 a& ] X9 y u6 c0 d/ ~" s
- *7 e- B3 L4 ^3 t7 {' `" P4 W
- * This program is free software; you can redistribute it and/or) B' I1 X8 T9 b+ C' ?* h
- * modify it under the terms of the GNU General Public License as' ^5 |8 D7 M& `# Y. ?3 L& `; j& {
- * published by the Free Software Foundation version 2.& Z8 Z5 }/ t5 `5 v" f
- *: J* S- f4 p+ K% j8 m' H6 \# G0 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 l& D, y) r- F9 \
- * kind, whether express or implied; without even the implied warranty( i* I5 k' i6 I' R7 r6 V% t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* `5 ]) X% T: V
- * GNU General Public License for more details.
! [4 N# j4 S( i% ]1 j5 V - */
% D4 k+ A% G, s L. `- x
0 c8 q8 _2 p; V- #include <linux/module.h>/ |+ ?4 G3 G" d4 u
- #include <linux/init.h>0 Z9 G, E" U, f% x: g
- #include <linux/errno.h>
- z, J# S: _; K$ I4 f - #include <linux/types.h>
; {1 f& R$ N0 @# d - #include <linux/interrupt.h>
8 k, m4 O: e- D# g& ~! ] - #include <asm/io.h>7 y3 a4 d! w. |
- #include <linux/moduleparam.h>
$ \6 e' D g5 G# L - #include <linux/sysctl.h>
: O5 p- X P7 X, V6 a% O2 Q - #include <linux/mm.h>9 K. T1 z- v( I8 I
- #include <linux/dma-mapping.h># r: y' a" R7 o! c
, U; P/ z* c; T5 Q. a; I A" b5 c* N- #include <mach/memory.h>
$ Z7 s5 B: E% Y- d3 c& @% U - #include <mach/hardware.h>
3 L! f8 t% c3 [: \ - #include <mach/irqs.h>
1 V9 }* D4 @! ]' P4 e# v - #include <asm/hardware/edma.h>
: t6 u% g, }6 _ - " Z$ S' s7 N1 W/ _# @* v
- #undef EDMA3_DEBUG& |5 b$ d5 q1 i. H: b6 i0 E
- /*#define EDMA3_DEBUG*/
3 N0 I# y; k. Q+ [4 I3 u - 1 O$ K# m' D$ S! y& O9 R; t
- #ifdef EDMA3_DEBUG
8 L L5 n+ Q5 g1 }6 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# Y% w y z& A! Y- U0 h. F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ o5 S, Z9 H. K; P& L6 n' O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) Q& c" ~/ U- u/ d `2 M
- #else
5 H3 g5 V' R4 J( t, Z" G0 O - #define DMA_PRINTK( x... )
. E0 s+ N8 }6 \) W$ n: z' R6 z9 S6 m6 @ - #define DMA_FN_IN, V5 ?- ]; M! P$ F% k* j
- #define DMA_FN_OUT
: J8 ~- m6 ?6 v/ l& @/ q - #endif1 I% ]* T, h' ?0 l+ K
6 B8 p8 D, M! d Q- R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* `& c- P7 Q( ^; G5 @6 v: H* r+ S - #define STATIC_SHIFT 3" r* ?' ?! \! |# N
- #define TCINTEN_SHIFT 20: C: _2 l3 _9 W3 s: e9 d
- #define ITCINTEN_SHIFT 215 e! [8 q/ }! U& U6 X; ^
- #define TCCHEN_SHIFT 22% F! G7 P; Q/ S# J' Y. {/ a: ~" Q
- #define ITCCHEN_SHIFT 23
# x' A* }) `$ e. P2 O! h. z' p - R7 I1 k5 b) x) Z" d* Y
- static volatile int irqraised1 = 0;( b/ P1 O! q( u( P+ j' X
- static volatile int irqraised2 = 0;& g" H3 f$ O2 {3 }: ]/ C
- / N3 w: k" p/ y7 p j" q1 H( o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 N) c! T# {7 Z- i7 y8 S% O C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 X5 {1 N; f; u# t2 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! C2 {$ I0 c5 H, Z' W$ _5 a
" P% s! D9 ?( Q f0 x- dma_addr_t dmaphyssrc1 = 0;
1 d% ?8 h: F& Z4 A - dma_addr_t dmaphyssrc2 = 0;1 ?: {. x( q9 K( s
- dma_addr_t dmaphysdest1 = 0;
2 @: x1 k* R' b, ~; F& m1 H3 P9 M: b - dma_addr_t dmaphysdest2 = 0;5 B" g9 g9 x& f+ v+ P L
- % V$ D+ I- X4 v9 n* P% M( I' u7 R7 P
- char *dmabufsrc1 = NULL;9 s0 n* K7 |/ H4 _( ]6 u( g" p
- char *dmabufsrc2 = NULL;4 t( r- e0 o; Y7 _. p
- char *dmabufdest1 = NULL;7 p5 o( S* M9 r4 J+ H: H' R6 z
- char *dmabufdest2 = NULL;3 K5 B, J- d* N b! S' \
- - O0 R4 r% M2 n: m
- static int acnt = 512;: d. M$ H. v) c8 m
- static int bcnt = 8;4 y/ P. z! x3 P# J# _# z
- static int ccnt = 8;5 ^1 d4 [- o! F( B8 E; X0 N$ A6 c
- - o, j& }. Q* @2 V7 z# X$ N
- module_param(acnt, int, S_IRUGO);# x( d1 ^% P0 p. U0 R& n8 N' I! j
- module_param(bcnt, int, S_IRUGO);; \5 R" j+ V. H
- module_param(ccnt, int, S_IRUGO);
复制代码
1 K8 B. ~; T; f7 C. w [
( D4 F, a t' v9 u) M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( N1 a5 H! b, e5 f3 g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ F9 a" Z" {. [. ~, {5 I; t% P3 S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& e( g2 b1 }5 G: Y5 |
1 A- k2 L- T2 s7 h
0 x' a6 v W" o* C |
|