|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ Y9 ~% [+ `0 t7 O- [code]EDMA sample test application4 x. C% o+ n6 P) l
- /*
$ V W% F: W! m7 G ` - * edma_test.c' a- }0 \3 C, S5 g3 C
- *
: w( j. }* q7 E; I - * brief EDMA3 Test Application
! P% F' u0 h- p) C# c - *& Y4 f1 v6 o" e9 {# j
- * This file contains EDMA3 Test code./ [$ d4 k" [) U; M, G6 A% T
- *
g: W% v. E/ r+ |& D- g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# B. h1 Z3 g% K R( H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 O3 c% y# _, m b - * TO CHANGE.2 n% }5 |* `0 f
- *
6 f& {8 _' d1 L# k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; Z- D- ~/ a# B6 h" ]- r; ~0 i0 Y, F - *
+ S- z% k \# q, f; R - * This program is free software; you can redistribute it and/or' e- e& m1 `& i* d+ _' U& y
- * modify it under the terms of the GNU General Public License as
$ g& i8 ?$ q- M* E$ E - * published by the Free Software Foundation version 2.
# G7 d: c+ a/ n8 k) F - *
' W2 Y# b( X3 b+ M) L* R. F" G% C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. L0 m8 c5 q& z7 K" ?
- * kind, whether express or implied; without even the implied warranty- ]& n4 N8 e5 ^7 ^% `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. G9 {8 O$ i- `( p1 ~* l/ Y9 Z0 Q: M
- * GNU General Public License for more details.7 Z# B2 `: h3 q; [
- */
8 n' T; q0 X3 t% k4 \0 X - 9 j7 K8 B1 g4 s+ y
- #include <linux/module.h>
6 B. t8 n6 X. x, W, I4 N: w! `9 D - #include <linux/init.h>+ O" X$ t/ E/ Q! E7 ~
- #include <linux/errno.h>8 b. w- E$ |+ J1 H
- #include <linux/types.h>/ U+ o0 w# ]- J% c
- #include <linux/interrupt.h>
, N6 d/ C$ F" y" n' Y - #include <asm/io.h>9 L1 ^. J: j( N
- #include <linux/moduleparam.h>
6 i8 {$ B4 w) l7 s" h9 ?4 R - #include <linux/sysctl.h>
3 G# q. F. @! v" q, S3 W( t8 v9 w - #include <linux/mm.h>" p- t2 f( Q) t8 f$ c' a* q
- #include <linux/dma-mapping.h>+ _3 v& y3 u! M2 A$ {) J
0 t$ }* E6 y% u& H8 _5 \% a- #include <mach/memory.h>
; F( i6 g) {" O; X - #include <mach/hardware.h>
9 C7 W4 R5 \$ ]! e" k - #include <mach/irqs.h>
; m5 F& o$ Z; P% ?! Q - #include <asm/hardware/edma.h>
: X: B" b8 R+ B+ `2 p) D8 e
6 \' m6 c% l: ]3 v- #undef EDMA3_DEBUG5 E( V7 s8 d3 l$ I& f# f5 u% e* p
- /*#define EDMA3_DEBUG*/! {) U$ F: q. W1 N, `, H& q. j
* c7 t4 S, X7 e! m% C- #ifdef EDMA3_DEBUG
5 z: n6 K1 B5 c3 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! I }+ f5 R; o# l( Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 N$ J: D! V$ o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' H# u) y4 s: i0 D2 V% y) N
- #else; {6 g, r K# W5 H9 T- e E
- #define DMA_PRINTK( x... )0 x; i% ]4 v) w7 f- q# j
- #define DMA_FN_IN. y+ s' v1 G+ s
- #define DMA_FN_OUT
% X( H+ C- e9 ?% D' i; I - #endif
; ?3 C4 ]8 Z. o0 D U0 J+ Q# E5 F
$ b% q0 X/ l( k. T, h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- G8 k" T7 o% H( e
- #define STATIC_SHIFT 3
B0 q* W8 {5 I9 n/ `( e2 x- ^+ T - #define TCINTEN_SHIFT 203 z6 O$ I- u( `1 H }+ @1 D+ U
- #define ITCINTEN_SHIFT 217 c* K6 D! s6 O4 ^8 z: M$ n( l7 P
- #define TCCHEN_SHIFT 22
& }7 z/ p/ J8 F/ e - #define ITCCHEN_SHIFT 23
( X, ~ M J/ P* J2 L' G
! _& k: ~6 }3 ^! q5 v) ~. \- static volatile int irqraised1 = 0;1 P2 S6 G+ K/ i; D5 ~# G b) y
- static volatile int irqraised2 = 0;* ]" Y5 x) D. j3 y& u0 x8 ?
- 9 A3 Z& M7 N2 `7 c) I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' [+ u \0 F$ y* l- J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 F) `* V# y: Z9 O3 Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- n$ }& W: h/ [5 q( Y4 q8 f# J
" |3 C" {( {5 u) x& k, T3 u% E! {- dma_addr_t dmaphyssrc1 = 0;
, j1 ]+ E8 H. I3 {" F4 c - dma_addr_t dmaphyssrc2 = 0;( ^) z* E9 C) D/ V4 h0 P
- dma_addr_t dmaphysdest1 = 0;) ?, _/ y! y3 g$ v4 k* ^
- dma_addr_t dmaphysdest2 = 0;
2 S, h; n) }! i# G9 ^8 N/ s
; Y" F- g! `, \4 Y3 I. v/ Y- char *dmabufsrc1 = NULL;
* M9 b$ n q% u) g- k- [5 L7 y$ E - char *dmabufsrc2 = NULL;
" Q1 M; T7 y% z! z$ _; l: f - char *dmabufdest1 = NULL; M7 s$ k/ R. |7 J& k, q
- char *dmabufdest2 = NULL;
( m+ ?2 J, r r+ ]+ Z - ( W. t2 @2 V" _" N( ]+ G6 }5 r
- static int acnt = 512;# u6 k6 Y; v% W0 }5 W$ {" T4 k" l
- static int bcnt = 8;5 K$ K: p7 q: s" }4 j9 D6 Q
- static int ccnt = 8;
0 Y. l9 F. s) w/ m: [, W0 o - ' X5 U l2 N7 f; Z
- module_param(acnt, int, S_IRUGO);
8 K- K$ J- g7 L# l9 v - module_param(bcnt, int, S_IRUGO);5 G0 t& P3 \0 b( n4 W9 I( p
- module_param(ccnt, int, S_IRUGO);
复制代码 3 @. s" y( w; o. g
6 P3 I6 l$ H: Y1 G7 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; J+ |# t7 K1 Y9 `) g% m- z; i0 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# W4 Y6 D2 a4 g: \' t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, T. t" D6 a6 X5 P+ u
" v1 i$ t* T7 T2 O& ` i0 r7 O+ l# X) r6 x
|
|