|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * k) W Y( u6 N2 F- \9 r& q
- [code]EDMA sample test application0 N+ n: f# P; d1 N" _/ c$ v
- /*
# c- ], _/ {; ?1 b! x - * edma_test.c
, }8 n4 m5 H6 w; [* r - *0 u5 `6 F* K# y2 F, M0 S
- * brief EDMA3 Test Application; Z J# v4 @2 q/ H4 _3 V. E
- *7 x7 w$ b/ \) u7 w+ _$ S9 w
- * This file contains EDMA3 Test code.+ r) r7 v2 ?; e5 G5 Y Z7 }2 ]
- *6 Y7 D7 M* A( C6 E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ O% J5 {% y2 |- q4 H9 r6 {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 J) `1 {+ b, D* \ - * TO CHANGE.
3 M; M w4 ]; ~9 N- r" E - *5 F! t* i- H3 B1 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" o% p( Y7 H) s
- *
2 _1 c! H, I. l1 W. N - * This program is free software; you can redistribute it and/or3 g+ m1 V2 H0 E: j! P& u4 B0 _
- * modify it under the terms of the GNU General Public License as
. F3 K4 Z! z* s; j - * published by the Free Software Foundation version 2.! ~) Q0 J$ I* r G; ^& N: F
- *
& M7 l( M% X/ I p, X4 p5 D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ T0 p0 V4 @; c2 ?4 Q1 k2 \
- * kind, whether express or implied; without even the implied warranty
, }0 b9 l! [' c& i5 X: l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 u! Z- Q) u' r8 ` v - * GNU General Public License for more details." h" G5 Q- o7 b0 V0 D0 V
- */; I( s3 B; f2 i# t% _2 R: W+ r- P' {
- # Y E! B8 D r0 `; Z3 M0 z% c7 ]: m
- #include <linux/module.h>
4 ]+ L; m' t* z - #include <linux/init.h>9 X) o) N: \' T, T1 y
- #include <linux/errno.h>
! i5 |5 m3 X$ g. G7 E q# k* D - #include <linux/types.h>
( ~+ l8 q& B; o' R' I# ] - #include <linux/interrupt.h>9 N* \8 O- O( L7 m9 p8 q. p% p9 t
- #include <asm/io.h>: _ c( u4 G i+ v) \% i) i
- #include <linux/moduleparam.h>- v8 k2 H' i$ i4 C! m+ }+ [; \
- #include <linux/sysctl.h>% q. ?* s- S {* ^
- #include <linux/mm.h>
9 m$ t6 c/ M& l3 Q4 M - #include <linux/dma-mapping.h>
" t" E; d$ C4 c0 k- A - # x' J3 z/ G e4 Q( S) Y6 L, d- H
- #include <mach/memory.h>! ?$ g* t1 p; V
- #include <mach/hardware.h>1 b" L" G& Q" a/ M% I" ~4 {1 S
- #include <mach/irqs.h>( M' z* D/ M; H& p5 j# b
- #include <asm/hardware/edma.h>
8 s k/ z; Z; N9 ~3 Q - . Z% ?& ^ Y3 q9 b- a
- #undef EDMA3_DEBUG: l) P6 T( w) Y
- /*#define EDMA3_DEBUG*/) [/ @/ r5 z1 ~$ N( H! W
K) H' c: T. Q$ ^5 g6 y- #ifdef EDMA3_DEBUG
. Q' Q, m# c( V. Q6 c& x, q# w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 v8 [2 q, \. ?3 y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ E7 W& U" r) [5 h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# B9 @, o% C! h: f4 b4 G
- #else
, [/ E3 q Q/ C/ `# | - #define DMA_PRINTK( x... )
" L4 \3 y: V. Z" H( T* P - #define DMA_FN_IN
\( W: u4 _- n9 Y+ } - #define DMA_FN_OUT, |: [$ U0 i$ I9 @
- #endif% \) N/ E3 q/ G5 B y
- $ L0 v/ ?2 l, w% n8 O \: ~- g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. p0 n* N- y& k# u. [( o - #define STATIC_SHIFT 3
, B9 u# j+ |/ O1 A$ R! g - #define TCINTEN_SHIFT 20
' B9 H1 g" z8 M- q# V - #define ITCINTEN_SHIFT 21# G5 ]8 P/ h& ] N! y6 Q/ ?! }
- #define TCCHEN_SHIFT 22: s6 c4 }8 A$ y0 V3 u
- #define ITCCHEN_SHIFT 23 B/ [8 J) O$ u9 M( Q6 E7 z
+ G0 _. i* G1 Z. V( ^( y9 I- static volatile int irqraised1 = 0;- D9 y/ q2 d! O. N
- static volatile int irqraised2 = 0;
* L" {1 ?* S' v/ ]5 F# O - , h2 @5 m; \9 y9 [8 H1 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ V% N- h) e; o3 M/ |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, U5 P7 U/ Y5 Z0 C6 O& k! T( Q7 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, s; l; a# i' _- I6 D
- 4 ? |4 d7 ]9 {" H
- dma_addr_t dmaphyssrc1 = 0;
% O& `3 Y: M$ p3 {, r - dma_addr_t dmaphyssrc2 = 0; B. G H# a: Q: f2 l. z# H9 B
- dma_addr_t dmaphysdest1 = 0;3 Y0 o9 P& a- f. y, G
- dma_addr_t dmaphysdest2 = 0;
! K3 L k7 D! B. Q
$ W8 g6 \4 }2 ^9 x) x" }( y- char *dmabufsrc1 = NULL;% [0 ]$ B/ `6 \ B( Q+ a7 y
- char *dmabufsrc2 = NULL;. ^2 O s, ~, T7 h* h9 ^
- char *dmabufdest1 = NULL;
, F( m/ A6 i9 a6 G# d3 b - char *dmabufdest2 = NULL;
1 n( x& a, y' z0 _
( B! N8 Q% ^& r! P+ l9 \7 Y- static int acnt = 512;4 r7 u8 n* ^ ?& U* f
- static int bcnt = 8;5 M/ q9 ~0 A* \. L% ?+ a
- static int ccnt = 8;1 e& T9 a3 _, J- L |- U9 S
% E% d3 w' s! D) L2 C2 m2 r- module_param(acnt, int, S_IRUGO);
. x6 ~( @+ M2 k: c3 z ]: a5 B' A - module_param(bcnt, int, S_IRUGO);
2 _5 w# Q% L8 t" m - module_param(ccnt, int, S_IRUGO);
复制代码 $ l/ d2 { p9 J0 m
) ^+ ]( a- J7 |3 J+ G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 h5 T Q& d4 o' O( ~3 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; V: a) Z$ K$ A5 V, K% M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 E: ^8 i4 k* y [2 W( s7 y
1 I" d: i' `! I% w$ F2 W
0 G- W O- k& y: L8 j1 K6 ^5 l |
|