|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! | e( o/ @2 A- [code]EDMA sample test application. L% I3 @9 M: d3 y- f8 [8 H* X) T
- /*7 J" d# n; E; a9 I L! Y5 Z, ]8 G
- * edma_test.c% Z4 y) W" z) {2 v
- *
4 ^" Y. ?& u* x# x5 T/ P - * brief EDMA3 Test Application
5 s4 u# p) }4 w/ w6 x3 d7 V - *
! r/ ~3 q4 p R - * This file contains EDMA3 Test code.. i [) \4 ? x3 ~6 O
- *
0 z- p, @$ Y8 L+ u6 R" Q% K4 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 h' W7 o1 t7 e9 |' j* j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 q: C+ N0 j6 a1 B( [) z - * TO CHANGE.
8 G1 l7 w* ?* \2 @" z! Z( n - *
# N" _* C+ @) V+ J/ o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ I; u/ C% Y: ^; I( b
- *
6 G& N% Y8 U- l( U - * This program is free software; you can redistribute it and/or
% T8 s3 j+ _6 H3 ^* L - * modify it under the terms of the GNU General Public License as
) T! ]0 ^) n$ J& O! o: W - * published by the Free Software Foundation version 2.7 ^4 |1 k) d) b9 M' p- i K& N
- *, e% U9 H6 D) t- f8 T! t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
s8 J3 V# _$ R. h ^ - * kind, whether express or implied; without even the implied warranty
; a B# ^# x! r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 @5 e- T) V& A+ N; x' v/ P/ ? - * GNU General Public License for more details.
% B, V% L- m( \, Z H4 r$ z - */: t8 R8 W" l/ y( c+ {* K! ^
- * q; i" q/ {! f8 @4 |
- #include <linux/module.h>
' Z9 `5 x [9 k' v - #include <linux/init.h>" x C2 x! }; ?
- #include <linux/errno.h>. }0 k/ G' @+ l! L3 `8 b
- #include <linux/types.h>
) Z5 `3 |" @: c9 U& l3 _ - #include <linux/interrupt.h>: ?* { r0 m# `8 x7 V7 p
- #include <asm/io.h>
! d" G1 N, J- f- R! \: | - #include <linux/moduleparam.h>
* _* B' W, g& t5 @ - #include <linux/sysctl.h>
; j) D5 i# o0 P( y* s' H - #include <linux/mm.h>; |6 h" k* _! J
- #include <linux/dma-mapping.h>
! Y4 C9 @: x$ Z; S! k5 U$ [
, M; P$ a5 U) U7 u: S- #include <mach/memory.h>
: A# ~& U8 D0 p( h - #include <mach/hardware.h>! Y1 T6 O: l3 p+ `! K5 ]$ |; A) q
- #include <mach/irqs.h>- V, V+ V' U4 v! o+ h
- #include <asm/hardware/edma.h>: X6 O6 C6 R7 m8 E. w
- - G! G( }' t4 R) ?
- #undef EDMA3_DEBUG! \- A6 C& e5 i7 c
- /*#define EDMA3_DEBUG*/9 C2 n, {* V# l" p9 g7 s) H9 r
- . \3 a1 d' [ A; I$ q6 j7 V: g) \
- #ifdef EDMA3_DEBUG6 a! z4 W3 y& K, E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( {2 C! m+ Q3 P2 ]: ?2 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! V, {/ i) F/ n. D! k' y( H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# T3 T8 ]! h! z$ `
- #else4 \5 T% y7 t( p- n) A; X2 }+ c1 T8 {
- #define DMA_PRINTK( x... )
/ L" E: e% f/ X5 n - #define DMA_FN_IN
; b3 U, O' }1 b) Q& v+ ^% h& g - #define DMA_FN_OUT. k u4 x- ~3 I% `; t
- #endif- }' u! B& Y- G; u3 d; ~4 |; {
# j) u/ z1 S& M$ y+ j9 B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. E9 i$ K5 v1 d* y4 Q, R U$ `% w7 { - #define STATIC_SHIFT 3
. U0 W! C( S; i" A* m - #define TCINTEN_SHIFT 20
8 Z; s5 P' _' z - #define ITCINTEN_SHIFT 21, A4 U$ H& k. B6 t i+ i5 n
- #define TCCHEN_SHIFT 222 r( F1 \! f/ u
- #define ITCCHEN_SHIFT 23
, x/ P- g+ m* R+ N# l/ K% L* V- ~ - & k, u8 \# ] F4 F+ E, N1 N
- static volatile int irqraised1 = 0;
2 C# T1 {) \/ L0 |4 I - static volatile int irqraised2 = 0;" Q4 K9 ~( X% K# A
- 2 N0 ^5 p8 a% a5 k# K. q# \* _8 i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" p4 T/ r$ }. m$ d3 s; I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 |8 q; S1 r1 A M$ r4 E+ Q5 \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 {; ^0 ?$ Y4 z$ j+ {" G
- . i' @7 x8 g+ g# z
- dma_addr_t dmaphyssrc1 = 0;; ]. e2 j/ t9 m. e- Y: q) B) b' @" M
- dma_addr_t dmaphyssrc2 = 0;, ~+ a4 |( k8 b
- dma_addr_t dmaphysdest1 = 0;
* x, `0 u% ~7 R+ S1 l6 z& w - dma_addr_t dmaphysdest2 = 0;# a- d% s4 k( @* K( P
; _7 ^; k/ J" M: _3 t- char *dmabufsrc1 = NULL;& S! D, y3 Y6 C
- char *dmabufsrc2 = NULL;( s9 q+ n1 N7 S6 F. `$ `
- char *dmabufdest1 = NULL;
) A% m0 p: a( D9 h z8 K" E - char *dmabufdest2 = NULL;' Z9 ]! A' j" {1 H- q9 b
+ P, V7 ~) T/ t$ a- static int acnt = 512;% T% G2 N4 e! Q: A q0 H, m. n S
- static int bcnt = 8;
8 Z; T. Q3 `" ]( v8 p - static int ccnt = 8;
( G6 W V. F6 o/ `7 o - 8 }; s# \( D$ J# [: k) y' z
- module_param(acnt, int, S_IRUGO);4 }$ l7 H1 F# f3 ]0 d4 D
- module_param(bcnt, int, S_IRUGO);
1 h$ a! W: r* ~* V. b0 Q - module_param(ccnt, int, S_IRUGO);
复制代码 ; [2 }# i7 u- A
4 R: L$ M( G4 T! Z8 y' D [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 G4 m4 F: h9 c B, D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, f+ e$ R. f8 S, p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) e D1 R; r2 J% L- A8 B" x
" _0 Y) p# {' Q
) c" o7 L% `+ N' Q7 ` |
|