|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : E" G) ], x7 Z- B$ e; r
- [code]EDMA sample test application
d% }$ M) m: O - /*
9 k% T/ l' D2 w% l1 t. i( _* o5 l - * edma_test.c: ?+ S2 K) ^) L3 t5 D. j( ^ Y
- *0 f- h! j/ i9 Y
- * brief EDMA3 Test Application
1 b. u: _/ B# N# B9 D. o8 t - */ O2 \9 @" O# D4 x" l
- * This file contains EDMA3 Test code.! [! W9 F; ?# L$ \2 s' {. L
- ** j/ Z+ U* I+ `0 H9 M, S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 @4 z3 i) d8 `$ f% | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 I0 W' v! w) p5 A - * TO CHANGE.9 {# I( c- n) K8 w5 e
- * H/ ?/ E7 [2 T+ F/ ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" Q9 {' Y5 c$ l) C( F8 X1 L
- *! E7 l) k% @$ B; f$ b' p. T
- * This program is free software; you can redistribute it and/or
( T/ M& `9 R/ g# j6 S - * modify it under the terms of the GNU General Public License as
# N2 P2 H+ k. z( Y% V - * published by the Free Software Foundation version 2.
# e5 F# G) N J" ? - *
+ ]. j* G( }0 v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 C8 l9 ?& R) M. Z - * kind, whether express or implied; without even the implied warranty0 `) p* \+ \* V. W4 I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- B0 L7 T8 E/ p; u0 ]
- * GNU General Public License for more details.
. U1 B' k' J& G6 z! J* Y - */3 Q. Z+ k `& k3 ^+ l) z
& @2 U* x& t4 ]- #include <linux/module.h>3 L& q& W0 u8 V ^% S1 e5 g! y
- #include <linux/init.h>. N$ D; D4 @' O9 G& [
- #include <linux/errno.h>4 o/ |$ K6 _8 U
- #include <linux/types.h>
1 }7 d, P, e5 Q; y+ W; `7 K' Q% R1 ] - #include <linux/interrupt.h>
2 N* l) {7 h) M! M# I - #include <asm/io.h>6 ]- J9 L5 I2 l4 c; Q, E% m# l* B2 K8 D
- #include <linux/moduleparam.h>. E0 e+ v! d: B2 m: G0 c$ ?3 } ^8 z
- #include <linux/sysctl.h>) G( [. w; F" }0 c! ?, b
- #include <linux/mm.h>& I& a* U6 j; w) T/ D& Q
- #include <linux/dma-mapping.h>- m$ q* _+ ?' L( a/ K# T6 A* {
4 z) [4 q6 V4 `3 T1 @' Y" \) u- #include <mach/memory.h>
' J d9 L5 Y1 | b" ^% E! j) Q. p# t' u - #include <mach/hardware.h>0 y: b* `" D, Y" ~. ~; X
- #include <mach/irqs.h>1 _# t$ c: J+ f" Q% s, |( m4 w. r
- #include <asm/hardware/edma.h>4 P- T+ m5 n" n. _5 P
: F' l4 R9 b+ v- #undef EDMA3_DEBUG) ^6 }! l3 _' p9 O3 t' o
- /*#define EDMA3_DEBUG*/4 A/ b3 g* b4 C5 e2 G/ j+ _
- ' L3 h/ r+ A: `6 J
- #ifdef EDMA3_DEBUG( S N, U$ N0 D1 I3 [8 X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, a7 N# w6 R( l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). e& K( d' e* [6 |4 N' |; y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( r" ^6 E A7 g% b( v
- #else
8 G* r6 P3 D5 l7 Q* q9 j3 o - #define DMA_PRINTK( x... )
6 {1 y( k# `* s1 }$ J - #define DMA_FN_IN
* q2 |* t: ~1 j7 f+ _ - #define DMA_FN_OUT3 y6 _0 o3 E' t" F, \( W4 g
- #endif
2 g' J, j( i9 @# p. U
: a8 Z- V3 H+ ?0 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; }/ O; N- v) V0 G - #define STATIC_SHIFT 3
& C3 E) Q1 \" E/ m; m9 T - #define TCINTEN_SHIFT 20" z7 k; s, Y% n6 R$ D W7 W: `3 j
- #define ITCINTEN_SHIFT 21# g* D/ U- J% Z3 I$ U$ @& Y4 A
- #define TCCHEN_SHIFT 229 A4 i h3 y2 W2 ~& r# o" P
- #define ITCCHEN_SHIFT 23
. T0 H* w* [0 B$ q4 b4 p1 Y. u - ) `0 V$ x. ^0 c& P3 m: ^
- static volatile int irqraised1 = 0;
) `! P1 U/ W7 O1 a' s# c9 [8 X - static volatile int irqraised2 = 0; s# }# a+ D. q$ |* R
- ; ~0 K% m1 v/ e0 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& [- W* x0 m* ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& y& N, \/ [: f, A4 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& i x; @3 G2 U4 I8 v2 M
- ) C* Q: Z+ x: g/ X! r1 a/ m
- dma_addr_t dmaphyssrc1 = 0;
/ O9 S* v+ m* V* L7 Y - dma_addr_t dmaphyssrc2 = 0;
( @( {$ Z1 N6 k4 |9 Y - dma_addr_t dmaphysdest1 = 0;, _9 r! o# @% ]! R' C; }
- dma_addr_t dmaphysdest2 = 0;* g) W& s5 l6 _8 c% Z
& w! F0 @! q$ P) C5 v- char *dmabufsrc1 = NULL;, M% M8 y4 e& _: p- N
- char *dmabufsrc2 = NULL;; ]" i" E% T; B+ X# h) J4 ~
- char *dmabufdest1 = NULL;5 D# y( C5 \2 p
- char *dmabufdest2 = NULL;1 K5 e$ A' k1 Y% K4 J; o5 ^+ l5 C
- 4 v9 L* A4 r' E& f, f* T+ v- G/ H
- static int acnt = 512;9 f) d1 a2 p" s
- static int bcnt = 8;% E( p) a+ F- I- v7 ]1 P
- static int ccnt = 8;
' @3 f9 P4 A& ?- n% U( @
$ l& U( X4 {% Y# b- module_param(acnt, int, S_IRUGO);
& T; d% d! p9 }; h, j7 J9 H' B - module_param(bcnt, int, S_IRUGO);
% P/ z. g* E: L' \5 v - module_param(ccnt, int, S_IRUGO);
复制代码 0 J! z9 }- o% p. h( q( |
% t2 L! U/ b. r1 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) u; S* k; L; I( Z% y5 g$ s" u! Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- J! j: w! G9 ?% N! w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, D4 C2 X9 c& t6 ]5 G" I
" l/ @+ D3 R5 H% P) y z# B
# b! h: R T' @. }5 z* K |
|