|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # |4 B. C. W6 o E4 d2 b% p
- [code]EDMA sample test application
% p9 L. A% N; x1 M( s3 r - /*, w+ }) q- a/ O H1 o- m% V b
- * edma_test.c
/ Y4 g% g$ e8 [5 J: k# _% T - *4 R6 Q. v! o; t7 ]
- * brief EDMA3 Test Application
0 G1 _- ^: y. y, P' ] - *5 b7 i9 U* N3 g8 b; a$ @- c s- g
- * This file contains EDMA3 Test code.
. k- u8 x7 ` H; z/ d |6 t - *5 ]+ V3 N1 X4 U0 ] o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& b) [% o- W; a$ Z) L L9 x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; b5 c( W8 ~; t9 M - * TO CHANGE.
? X& Y2 X) F9 b! c, n7 V - *
7 s% w$ K3 Z/ L2 j7 p% S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 Z4 ~" s$ u/ m6 B8 m- A/ s$ L* p - *
6 ]9 h0 Z: n& l - * This program is free software; you can redistribute it and/or
& O" Y. ?( v6 |1 T - * modify it under the terms of the GNU General Public License as
( [9 @( ^+ m1 X4 T' Z - * published by the Free Software Foundation version 2.# \. A5 f) E9 l: R
- *
3 ?! I- O& g5 y) R) P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* b- P* P2 F; a - * kind, whether express or implied; without even the implied warranty
/ R8 f; f/ x/ }4 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* g) L6 t p- [& C8 t8 @' M& u - * GNU General Public License for more details.
* d. M' x' J/ F/ c - */
1 g. }+ d" p* X
- i1 v; Y$ Y% e9 ]- #include <linux/module.h>
6 c5 i& Q7 p5 w - #include <linux/init.h>
7 @# }( H: m8 q9 I3 c" o9 ~ - #include <linux/errno.h>0 Z+ c: @' e# ^0 r1 f8 X7 ]7 m
- #include <linux/types.h>3 ]% f7 G7 A) l: [) k7 B
- #include <linux/interrupt.h>5 o& t- B. S% w, Z' Y2 a
- #include <asm/io.h>) e7 {+ O' d! n
- #include <linux/moduleparam.h>
! o) c+ L7 w3 v' b9 T0 u - #include <linux/sysctl.h>7 c$ ]( Z# E1 t
- #include <linux/mm.h>
u4 k/ }/ y8 T - #include <linux/dma-mapping.h>
0 k) m& K0 Y- w8 J: W' E- H/ n
* r! u8 @' k& y `- #include <mach/memory.h>( W$ M+ u! E3 f K
- #include <mach/hardware.h>" z- ]2 i9 @5 q+ l. O
- #include <mach/irqs.h>
9 S0 l" P7 a$ `3 C: s - #include <asm/hardware/edma.h>
& }. W3 \# ], `* ]; t& d - 2 G8 \' @2 K2 f( y8 a. B j" Z
- #undef EDMA3_DEBUG
- f4 {* D1 _! |9 w7 V- H D - /*#define EDMA3_DEBUG*/' ^& S9 q- h3 B2 G: Z' Q8 I% v
# |" G" ^! b% a, ^- A# i! y* y: x- #ifdef EDMA3_DEBUG
! f3 y# N" ?& O2 B# l, d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, H3 C U1 B% s; H/ M. `# C& u( l6 s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, d. V, C4 r6 F2 d7 u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 o* ~+ M" [7 i4 h1 F - #else
/ e K3 y. n: j* T - #define DMA_PRINTK( x... )
% E9 | U! i9 D - #define DMA_FN_IN' k* n: v! d* b; u# R" x- O* N& o5 k
- #define DMA_FN_OUT
6 W+ K* G$ R# F, H: b m) d - #endif( g7 \: S1 ~% g( c
- 8 E$ C6 B" a1 l1 \1 J. x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 m, }# X+ V ?7 y - #define STATIC_SHIFT 3, Z9 f2 n+ X3 _5 j9 S
- #define TCINTEN_SHIFT 20
' J) Q9 T/ g. V# D; V - #define ITCINTEN_SHIFT 21
% o' m N* c) T* J/ q1 v0 f - #define TCCHEN_SHIFT 22
' f) Q; ^" w% N7 e$ L" Z" v% B3 d - #define ITCCHEN_SHIFT 23
8 `8 Q+ y7 z: O9 s3 r6 z% |
7 m5 Y: }0 K- Z7 _4 h3 U# a- static volatile int irqraised1 = 0;: n. M7 A: O A# ^- b
- static volatile int irqraised2 = 0;+ t+ w# C% s- v0 r# B
4 M- T3 Y' D1 i9 J) D/ I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e& E' ?7 p6 W9 m \: G& m% n6 g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 \6 X! v& r* D3 w! Z" g) a* c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ H4 i+ L% e6 `, O# l f0 g6 z - & R4 ~. e4 G% O8 u6 O
- dma_addr_t dmaphyssrc1 = 0;
& J: v( v7 m0 g& Z1 O- @ - dma_addr_t dmaphyssrc2 = 0;: R0 O( h+ I+ d7 T' {
- dma_addr_t dmaphysdest1 = 0;+ [/ Z2 ]8 z8 T0 {& J" p* u
- dma_addr_t dmaphysdest2 = 0;
' x8 K( T, i& L& X7 Z2 s - # D+ D0 p5 \# B m2 X5 H K
- char *dmabufsrc1 = NULL;4 Y. w6 D M+ c# W. r
- char *dmabufsrc2 = NULL;
5 x+ e; f" s/ H% p& G* z - char *dmabufdest1 = NULL;7 j3 n/ f2 W4 u A
- char *dmabufdest2 = NULL;5 R c2 {' U5 u/ k" v# a5 D
0 |' r7 ?% c8 m" U" f+ k* U- static int acnt = 512;9 j9 `$ _( N* O8 O
- static int bcnt = 8;
2 [ ~) _0 i# q! H" s% _ - static int ccnt = 8;: B% x0 y/ z* M. @
, D0 A; i7 s2 ?/ h4 J8 g" M/ b- module_param(acnt, int, S_IRUGO);
+ k$ V$ Z" t7 h( u - module_param(bcnt, int, S_IRUGO);6 ?2 f B7 l% s/ q& P$ L
- module_param(ccnt, int, S_IRUGO);
复制代码
! j/ T% Y/ H7 M! I6 ]4 G% W3 M- V( [$ Q7 [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, u' P( ]& G) u& B2 ~" J7 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ l( i1 i4 {) }* P0 g2 L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: K+ N. g* e; y8 h$ d
( T, _. z5 g+ m6 q1 A7 l! F0 h% M* u3 u
|
|