|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - k( p. ?$ y: W+ v- M$ f% J
- [code]EDMA sample test application
% P" D$ {- O. @) X - /*
. }# a# p- L% \: f. ?9 T - * edma_test.c
2 M) f! H1 w6 A - *4 B* J5 K) `- s9 k4 F+ l
- * brief EDMA3 Test Application
$ m! U3 P/ o- L' Y - *2 | f6 m p/ O( _/ h
- * This file contains EDMA3 Test code.! ^% s) A [) E
- *
5 l; ^; e8 S. C, x2 v% t3 o, X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE Z7 r7 [( ^ @% `/ T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 s3 F! y4 Z; | - * TO CHANGE.+ f; Q! J( {$ O; }* N) E
- *3 ]2 s# O5 N2 J) i& z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- u9 i5 @ I' S2 K8 u! ?/ P* L) w - *
# b6 F# \, H1 A* J( e3 U - * This program is free software; you can redistribute it and/or
+ R- W/ e" k/ Z" A - * modify it under the terms of the GNU General Public License as/ ?% d, B4 [4 ]" e: p
- * published by the Free Software Foundation version 2.
6 u B" n6 Y$ i: k% D8 d. j$ E - *
( Y! [- t+ s7 Y& b" C# H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ N7 X2 o1 g7 ?1 C5 x4 |3 a A - * kind, whether express or implied; without even the implied warranty
* t7 r) E7 n4 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( J8 `/ P( E2 C& B: }1 _+ W2 f& a
- * GNU General Public License for more details.; \) H1 a& P, B- i
- */' o' L$ q" p3 w7 n4 f; b- } F
: x# l. v% M7 Y4 G- #include <linux/module.h>
+ R! i' `9 @, l" z7 h - #include <linux/init.h>6 ?- D, [. K3 V" y
- #include <linux/errno.h>+ z* W! S' z: w! z% z8 C) `
- #include <linux/types.h>
/ N+ p; o+ l/ \0 | - #include <linux/interrupt.h>
7 D9 x! F9 R) n - #include <asm/io.h>; A2 P E5 t+ [" o. {: r
- #include <linux/moduleparam.h>$ P- @2 f4 e2 P3 ~/ u* `
- #include <linux/sysctl.h>
$ m) X' t5 \2 a4 W5 o# `7 a4 _ - #include <linux/mm.h># i# |* t7 U* T0 T: @& A5 w8 b, O+ J
- #include <linux/dma-mapping.h>
4 x2 s' G) g% t8 o0 g: e; O& K; k
. X E$ i& x5 U* a- #include <mach/memory.h>
) h. t' r* j, R6 _! V: {6 ~6 V - #include <mach/hardware.h>: o7 J; S' `+ Q! {: L( m, S
- #include <mach/irqs.h>
: b' w( u7 j* J3 ]- n; ? - #include <asm/hardware/edma.h>
, F4 r4 _+ S: W% e0 d - ) J4 q; K; z+ Q: ]
- #undef EDMA3_DEBUG+ a2 a3 J+ {' ~1 l; R, }1 i0 G
- /*#define EDMA3_DEBUG*/" s* q* {) s% `
! N4 U+ a" p, K4 @( t. g- #ifdef EDMA3_DEBUG n- M/ a: k+ k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 u" {- R5 y% ?0 S5 j1 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 V& ~$ _8 T" P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 Q- `- @; O" d! W" @+ U* R - #else
0 u3 F3 Y6 }* Q) L3 J3 [( @ - #define DMA_PRINTK( x... )
9 u) ?( g5 E' I - #define DMA_FN_IN
2 e4 H Y! s) G. p L- y: e - #define DMA_FN_OUT6 a% l$ ]2 y) e9 k& e. _3 c; E
- #endif0 j6 H7 G8 y: u, [' ]4 ~) D0 F
- * L7 D" m' n: r# r/ b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( @. p$ S) S s% v3 h - #define STATIC_SHIFT 3! q Y% X+ Q! i, l7 u( x
- #define TCINTEN_SHIFT 20
9 w; a+ w6 R9 |* V - #define ITCINTEN_SHIFT 21- D; d; T1 B5 C& n) y* x! P2 L
- #define TCCHEN_SHIFT 22
; [4 B5 c, p8 a - #define ITCCHEN_SHIFT 23+ `% I7 @* c) i% X
! U0 C, ^* T$ u3 S% g2 h- static volatile int irqraised1 = 0;5 d1 t' `" G' G
- static volatile int irqraised2 = 0;
. r3 I7 d- Z2 P- L9 e/ I/ } - 5 u( q3 C6 K5 R/ }7 y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) ~3 J2 X: D+ S+ ?) J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- B- X( g$ s( y3 c6 e5 E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ?# R! B) L7 x
/ H, S. h7 Y5 ~ _* I/ U. @- dma_addr_t dmaphyssrc1 = 0;( P) k; R& _, x% l% X6 _
- dma_addr_t dmaphyssrc2 = 0;
2 N, E$ w: B9 h - dma_addr_t dmaphysdest1 = 0;! k5 b/ G5 K7 E8 m8 j
- dma_addr_t dmaphysdest2 = 0;7 v" e: g/ g8 M3 \/ P' c
- - j( I( I' |% u' r, p) ^* c
- char *dmabufsrc1 = NULL;
5 N6 x/ e* X4 U) a! F1 Z - char *dmabufsrc2 = NULL;
; {! }) y6 l) K3 Q" y - char *dmabufdest1 = NULL;
! X4 }7 y5 i% o. Z - char *dmabufdest2 = NULL;; c% ?8 Y. T/ V: \% i8 G) Z
- 5 y. j; ?1 F4 d# _; x1 y% T
- static int acnt = 512;
7 W* k$ H: V3 u2 L& _" N$ ? - static int bcnt = 8;5 O" h k- r2 j1 k: _ X
- static int ccnt = 8;
; F5 W: [0 j6 u/ m/ t
: U' Z! h; S- [0 u& ]- module_param(acnt, int, S_IRUGO);+ F. t3 Z$ v: k( _
- module_param(bcnt, int, S_IRUGO);
/ M/ y- M/ q+ r1 _8 x. ] - module_param(ccnt, int, S_IRUGO);
复制代码
! `! j5 Y% G- |7 C
1 V; f9 f# T- T, h; T1 S2 v6 c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 f" H7 I0 x- P) o& Y% N( L/ A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 f* U; J! ^7 F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 R5 [3 }- F. y
+ h) U& k) h. E( l) R" T8 O
i. B: N5 k: s2 k1 i
|
|