|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ h+ d, K9 b0 R- ], j. O! F; y9 H0 [
- [code]EDMA sample test application
" B' N3 J* A# Z" b - /*+ v1 G3 }* X) Z2 _0 V0 _
- * edma_test.c/ a' n- m3 a: A8 l- [2 o+ Q
- *" Y+ j4 ~- n y! ]1 f3 ^
- * brief EDMA3 Test Application
& [7 p8 h( p7 b# d' T - *% [4 S# ~3 k6 B- ?7 U
- * This file contains EDMA3 Test code.' e7 O& B5 _( ?
- *0 t0 s- i; u3 b9 O$ D v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: u3 K1 X7 f- S) L2 g8 U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# k( r3 {/ |, T6 Q( K+ j0 e, f
- * TO CHANGE.
6 d j! K0 @, j; x U - *
0 |7 c6 S- c) h7 S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# |1 z" O- l4 X! |* n/ r - *
0 h, E2 w: |* ^ |* O+ z - * This program is free software; you can redistribute it and/or
2 d3 {, X: j5 ~8 V0 A - * modify it under the terms of the GNU General Public License as
1 g+ \0 }5 k7 p0 o3 P; ^ - * published by the Free Software Foundation version 2.
( S+ q' G2 ]3 ~ - *; a" z4 y1 f+ m5 l0 A% K6 f. k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 o# O" h) T- u' h; R N$ Z! z
- * kind, whether express or implied; without even the implied warranty
" c# @/ g8 \% S+ [' u) Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ e6 Z; \2 S! t& p - * GNU General Public License for more details.
8 n' |+ E% Y' m E* V* u H% Y - */+ S" H% }9 \2 Z' {+ C# W( `
- ) t+ e0 u* m; l, o' y
- #include <linux/module.h>" f! V1 G, F3 ?" z: Q
- #include <linux/init.h>3 L2 Q1 X3 G4 U% j$ C# _
- #include <linux/errno.h>* [2 N# L+ i, X. |$ B
- #include <linux/types.h>2 ~2 B9 b/ C0 a7 [- ~( t
- #include <linux/interrupt.h>
7 H6 m! t4 F! V* \3 I3 h - #include <asm/io.h>+ \2 f! o1 }* |6 q, b6 r
- #include <linux/moduleparam.h>
. [, D1 `. U* W- j7 P - #include <linux/sysctl.h>
* @' v9 g5 U; O" o* q5 ], k7 F" b6 Z - #include <linux/mm.h>0 D9 d% A# j, B) W
- #include <linux/dma-mapping.h>
( N, S" _0 b$ W4 ^) { y* p' _- x
- S: G9 K, C, d- #include <mach/memory.h>2 Z1 u1 x8 O; O8 ]. L. S k
- #include <mach/hardware.h>2 `# n6 ?2 y- a
- #include <mach/irqs.h>6 U) y) [, x* C$ S4 L1 V
- #include <asm/hardware/edma.h>
( k: e) C: s: B* K4 Z' O
/ e$ B. |5 z4 M1 K2 K& J- #undef EDMA3_DEBUG# K5 A) b" H9 l5 b: J0 D" [8 h
- /*#define EDMA3_DEBUG*/
X, V3 t+ b1 B+ F - $ I/ ^$ g; [2 ?3 I6 h
- #ifdef EDMA3_DEBUG
1 X+ C# T* p- n R, g. P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). _, {$ m) B: Y# E& A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% @, C- w8 T$ b) Q% ]8 w1 s# Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ ~7 q9 ~, T! [, [* b
- #else
/ o! C! K& j# i& i" ` - #define DMA_PRINTK( x... )
1 ]( g7 t0 A6 D4 { - #define DMA_FN_IN4 [5 q: O$ _+ O( ?6 W; o
- #define DMA_FN_OUT4 Z3 X R' f0 p: i
- #endif' l) b( w% s5 R% O- ^- [" M
- , P' S8 [% }9 j1 q" M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), ]0 S" W( ~$ }6 F
- #define STATIC_SHIFT 3
, ^( J5 X3 {) U( O2 v; B+ } - #define TCINTEN_SHIFT 20 T6 `* \0 r8 y$ A
- #define ITCINTEN_SHIFT 21
; r$ [: [- N: ^3 @ - #define TCCHEN_SHIFT 22, P- A6 ?: v- ~# b2 Q
- #define ITCCHEN_SHIFT 23
2 A" f+ Z& @3 T - $ Z+ k0 m! x1 `+ [3 W1 b3 b9 L. Y2 W
- static volatile int irqraised1 = 0;
" F/ P v; Y1 U' Z& f4 E4 _+ Y8 ^ - static volatile int irqraised2 = 0;
! V7 P9 C- R: Z& @' R - ; ?/ x3 ?) o# B1 d# z7 ^4 l$ ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 h- Q' G/ ~- ?& x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }- `0 i2 h" f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 y4 F6 ~& h+ G* O7 k/ }$ N
- . c/ Q& J5 d6 [: ~6 L
- dma_addr_t dmaphyssrc1 = 0;
5 p) @ [% `: X! N: z% t/ v( d - dma_addr_t dmaphyssrc2 = 0;
6 a2 x7 E# e) w - dma_addr_t dmaphysdest1 = 0;3 t1 m) T5 k' V% M. y
- dma_addr_t dmaphysdest2 = 0;
+ |/ A- v' K1 m
5 [4 S5 @' l$ I# ^% K8 m8 W- char *dmabufsrc1 = NULL;
; w7 {# h; a S4 a+ Y - char *dmabufsrc2 = NULL;
5 L4 J! C& f! Y: Z - char *dmabufdest1 = NULL;
9 k- T ^1 t% n$ x' V1 n2 G" N* u - char *dmabufdest2 = NULL;' H% T# c# b- H, o! y8 U
- 2 T. L" i u! ]* ]' `! U
- static int acnt = 512;
: h4 y" G" ]8 h$ c1 p! e+ T/ Z( x' D - static int bcnt = 8;
3 z& ^: J! ^; p - static int ccnt = 8;5 h% _, ?8 o8 O& r$ e" r
- & i& R2 P# \$ o$ q
- module_param(acnt, int, S_IRUGO);1 \2 ]: u0 P, ^# V" F6 X! s* y
- module_param(bcnt, int, S_IRUGO);
% C$ ]' u9 s# W1 M - module_param(ccnt, int, S_IRUGO);
复制代码 5 z+ @1 I/ I! _6 R# V N3 ?. O+ v
6 Z- e. y& ?' O" c& D/ s' |7 t0 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: z; ^7 s' g& u( p& z ?) darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( z Y1 r/ @* j# \+ z. v! t; Y' c) O% J% |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ g! O8 Q* y9 K; g1 G4 \- J$ A
2 v: {& F+ _& ` m& o
! B2 b- h; c5 u" x) z |
|