|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # y1 L! ]' q" c5 ?8 \8 T& w& X
- [code]EDMA sample test application/ V: A( ?6 [( C# w8 X
- /*, m6 H6 q4 L" b/ H% t! M; `+ r
- * edma_test.c& F }7 c: R. ^4 K& p5 ~& O7 X6 A8 K/ B
- *
- H2 {0 y4 r0 \5 T; J - * brief EDMA3 Test Application" @: @+ I9 T: H; L. [8 m; f
- *
1 P" u3 W8 `4 y6 \( T7 b, ~ - * This file contains EDMA3 Test code." W# g8 V; C9 ^' M E' }, _3 m
- *
- N- C! c1 X$ ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 @# w- f& |: A @" c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! y9 o$ V. E( o9 t# y* R - * TO CHANGE.+ a. w% b' F8 u* Y \
- *- x; O, E6 X4 ^6 A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 ]% \. C0 z. v+ D
- *
: ~" S; Z6 O& ?) b( n/ G3 R* t) w- C2 ` - * This program is free software; you can redistribute it and/or: M4 @- c9 v Y4 Y8 h8 k3 O
- * modify it under the terms of the GNU General Public License as
- c2 X& ^6 ^ l+ y! s9 Z - * published by the Free Software Foundation version 2. o+ L9 F8 R7 D) R& V
- *
: {: ~9 R$ J/ p$ v* m" M3 [# d' o' K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' w( k: w+ h4 l- a6 O4 E" \
- * kind, whether express or implied; without even the implied warranty
. h( K/ z% V8 T! { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* y+ F ?* k' w+ u; a
- * GNU General Public License for more details.
2 e0 o2 z6 E% W" k6 }0 J* s" }9 q - */* F5 {; U9 D8 x/ r4 b1 S
3 R1 }) V2 j; b+ Z- #include <linux/module.h>1 F' x4 ]. |/ c
- #include <linux/init.h>; H/ j+ S& }9 g% o: ^" D
- #include <linux/errno.h>. K) Y; ?4 W$ Q$ V k
- #include <linux/types.h>
7 M+ k5 [3 o! V7 p - #include <linux/interrupt.h>
7 J; S3 ?, z* F: q - #include <asm/io.h>4 z/ c# T+ `% D1 I0 C# J
- #include <linux/moduleparam.h>
6 L: K8 Y0 N, I% C( A- F. ]( Q - #include <linux/sysctl.h>/ p6 ^% h; H, D( z- r
- #include <linux/mm.h>. ?) G7 [! K6 u# [7 C
- #include <linux/dma-mapping.h>
8 w: r: T) D/ Y/ q* T
; t8 J: n; \0 T- I; K9 }- #include <mach/memory.h>
, `% J+ Z- g9 _! E5 R - #include <mach/hardware.h>
, F# H/ S5 c7 S4 K( @6 Q- D - #include <mach/irqs.h>, r$ L7 V7 h" Y
- #include <asm/hardware/edma.h>+ O+ q# p1 b [+ K
- M$ P! i0 _& [- Z! P
- #undef EDMA3_DEBUG W" G: T6 h4 g* V3 r$ u( x
- /*#define EDMA3_DEBUG*/2 N& t d, \% ^1 p/ q
- 0 O% U% C/ Y! i
- #ifdef EDMA3_DEBUG
! u2 J- Z8 y" q5 ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 N. n2 W9 D { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# A' g& O; m7 {0 `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( i: J9 v* [& N4 q \ - #else
" W( d( E/ Z8 [; |! N& B+ p - #define DMA_PRINTK( x... )
& h5 O8 z: P: h; h! _, Q% r3 ^5 v, T - #define DMA_FN_IN1 A+ o5 Y* _$ ?7 t8 { U8 A/ y
- #define DMA_FN_OUT( r; d3 I. ^% l c; C7 p" F
- #endif
, u* U: u' j; H- Y$ v% V7 z* R! P - , r5 J6 J j. h: ?6 \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ b4 u% ^0 e; X5 u) q) }- t
- #define STATIC_SHIFT 3
6 s9 X% I7 _5 L0 T0 V% h - #define TCINTEN_SHIFT 20
- b& _0 p7 \) S) X- L, Q# q - #define ITCINTEN_SHIFT 21
, C1 p# P0 q, M - #define TCCHEN_SHIFT 222 }) r2 Q. G3 a7 s9 k
- #define ITCCHEN_SHIFT 23
- s2 U! p4 ~$ D' Z! b4 g. f. G
; J' H' t" E( b( t- static volatile int irqraised1 = 0;
2 {2 I* U; U" [$ V% r4 A! t4 ~ - static volatile int irqraised2 = 0;
. K& L) x0 u2 ?0 _# `
+ n- O" D$ O; F: V# z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 J1 S Z4 B4 Z0 ]0 O Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); z) m5 a- H/ I" {. _) q/ i1 W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 V F, ~+ x9 [; I9 [ - 4 } |; e S- t! h" r
- dma_addr_t dmaphyssrc1 = 0;
" u3 V z3 G, y- I$ U# q - dma_addr_t dmaphyssrc2 = 0;- K" _5 \6 G- I% K- p& c
- dma_addr_t dmaphysdest1 = 0;
* I$ `. t z- o5 B& s - dma_addr_t dmaphysdest2 = 0;
! M: v3 w# h* S8 z
9 C5 {3 t9 k7 i4 k. O- char *dmabufsrc1 = NULL;
- }/ O# M0 O( Q& ~ - char *dmabufsrc2 = NULL;- i5 l& u: L* { d# G' {$ b1 G
- char *dmabufdest1 = NULL;
( h9 \6 V7 s; m# U5 w - char *dmabufdest2 = NULL;
: u0 X! g& O" s/ g3 x* `4 e - . h# l" D8 x6 c# O7 B3 R
- static int acnt = 512;9 L& n6 ^8 r: M0 l
- static int bcnt = 8; c, e: X# k. @4 @
- static int ccnt = 8;
5 E* k0 W3 {1 ^ - & H \( y; D- y0 a
- module_param(acnt, int, S_IRUGO);
9 b) j9 U4 U% o5 f; q! u - module_param(bcnt, int, S_IRUGO);
) `* Y) s& d# C5 x' f" X - module_param(ccnt, int, S_IRUGO);
复制代码
0 I- L1 ^9 |% K$ z1 K8 c' U6 e. K- p. G B* `5 m% K! M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- [. g. `/ U: Q- l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 R! j+ V* z7 Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ w' _6 j* N4 S3 R& n; s( J. U
5 Y: Y! M) l1 X' ]/ Q
8 U& S- o/ G5 ^, x3 x- r2 M' g) U
|
|