|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % `6 `! ]1 r. U2 F( p9 J
- [code]EDMA sample test application1 F8 ~% k5 _; s6 j
- /*9 Y6 V6 ~+ Q% A1 x
- * edma_test.c: }' Z( u, f. Z8 r- I/ k
- *
/ I9 U% e: A& O; n% {& | - * brief EDMA3 Test Application% {0 V8 }/ M; D
- *
2 G; |& y; a, q9 `$ K - * This file contains EDMA3 Test code.
; i$ Y7 B% t* l' I1 ^. y - *8 U; G5 B, g8 R6 ^, R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 c. y V9 _( O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" o4 O4 P; {- [% K0 j
- * TO CHANGE." R! j6 u9 G: X; Q
- *
. w9 w) d+ {* M3 u' ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ G5 c* M2 k! z% k* |1 k9 v
- */ [5 p. V% w7 l- @8 `! n6 ~# c
- * This program is free software; you can redistribute it and/or- M: R) }9 Q& P' n0 j8 Y/ ^
- * modify it under the terms of the GNU General Public License as
7 @% P1 w& `, f& d - * published by the Free Software Foundation version 2.
1 v- x0 S& Q' d: t- Q) c - ** Z7 ~/ `- l8 o% h( F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% m. H6 A& n) \
- * kind, whether express or implied; without even the implied warranty
3 R5 m8 s* [, g0 f8 m' m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 ?% _1 L# r' I$ m5 ~' F
- * GNU General Public License for more details.
9 s9 z& {, }" L9 t, r, f - */# ^, c6 A X5 n% ~ a0 i
- & u0 U6 o# ~: B3 }& d
- #include <linux/module.h>6 K& z8 Q! [: A6 _
- #include <linux/init.h>
, h5 F2 g2 _" N1 M, w/ I - #include <linux/errno.h>
. p2 B- ]& ~) [" U# `' k1 J - #include <linux/types.h>
6 M; q1 e3 L1 [2 r - #include <linux/interrupt.h>
9 @3 f% c1 c( R% M, \4 K2 C% { - #include <asm/io.h>. r; @5 B! J! P1 n
- #include <linux/moduleparam.h>
6 S9 v$ L3 G; _% L3 S2 Y& A$ ` - #include <linux/sysctl.h>
& p( K, j. x2 A; i3 S0 h+ t - #include <linux/mm.h>
( Z% n, r$ d0 s3 k# C( Q1 c - #include <linux/dma-mapping.h>2 k: J" p& a, s a
1 q; p; `3 q8 `$ X7 F- #include <mach/memory.h>
) n+ f/ k: D z0 x9 S* o - #include <mach/hardware.h>
/ D9 t7 T& b- D: M3 ?/ n - #include <mach/irqs.h>6 y# }$ W. F4 @# @* `6 D1 n( H
- #include <asm/hardware/edma.h>5 Q* u# B6 q+ \2 G
$ L" i, X" D3 @# N/ [/ w ]- #undef EDMA3_DEBUG& p: q/ ~$ a/ a% O0 a4 Q
- /*#define EDMA3_DEBUG*/
, j0 x& p9 N8 M( O: }9 c7 z2 a3 d
, `$ {2 Z9 e% o; D% S# F% e- #ifdef EDMA3_DEBUG
" d2 C5 i- a y6 [6 d8 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 v' ^# q8 k" @$ J: n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# F) S: }+ ~& I9 j, o& s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 ?& f. D* K& h k1 q# _2 B
- #else
5 c' S3 n. P- O. w, h, e - #define DMA_PRINTK( x... )2 q2 _8 f5 F5 d
- #define DMA_FN_IN3 Q. m' s! E j: }& Z7 @
- #define DMA_FN_OUT3 H" X; ?, T0 |$ _( x
- #endif0 h5 X" t3 Q k. c0 ^
. o% E( z( v& K ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 Q6 K( }. O7 K& j( ~: `% T, V
- #define STATIC_SHIFT 3
8 M# _* t- m p; n( e* u. V, b - #define TCINTEN_SHIFT 20
9 R& N' K7 D& @ T - #define ITCINTEN_SHIFT 21
6 {; \5 T/ u& g, o2 s+ Q4 ` - #define TCCHEN_SHIFT 22: ]4 T' U2 l4 ^ N" A! X8 h
- #define ITCCHEN_SHIFT 23 W* K- [9 I( {4 A
+ m* N6 J6 t$ l- static volatile int irqraised1 = 0;
7 t2 q& Z( h( ]/ P0 O - static volatile int irqraised2 = 0;+ h1 }# F1 c% S" z7 a/ ^& K
- ! e% _; s( ~% M# h6 O+ A; ^+ I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: s& s0 K/ T/ V3 Y, N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& z6 x! B' R: T) c8 R" U9 p( ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 j% Z2 T; v( E( g" {1 e8 t
0 p. N. X; D& X2 |; V d' k$ r8 @- dma_addr_t dmaphyssrc1 = 0;% {) o; W# a t% Z. g% k
- dma_addr_t dmaphyssrc2 = 0;4 _3 q/ z/ ?8 _, S* b
- dma_addr_t dmaphysdest1 = 0;
" j# ]6 `9 a1 ?6 F! I+ T - dma_addr_t dmaphysdest2 = 0;, [$ u; e/ r2 B4 @8 K
- $ {( o1 D+ u+ J
- char *dmabufsrc1 = NULL;
, v/ p, U1 F0 S) ` - char *dmabufsrc2 = NULL;
$ t4 q# d2 L( s, s2 N- a - char *dmabufdest1 = NULL;7 H: n7 C, W- v
- char *dmabufdest2 = NULL;" g& v0 R; o# F; h% g2 }! E
: L% b$ \- Q8 Z b/ ^5 u- static int acnt = 512;
, I* o5 t+ w3 R: i+ C M - static int bcnt = 8;$ t! L5 H/ u$ J2 B: |& y5 D, ]
- static int ccnt = 8;
9 c5 W" g$ i6 |
( m( ?6 Z; ?, u- module_param(acnt, int, S_IRUGO);* J5 F8 a8 I3 P
- module_param(bcnt, int, S_IRUGO);, K. \& M: p+ p
- module_param(ccnt, int, S_IRUGO);
复制代码
# w6 Q% ^" }- b$ c# E' Z$ @
4 _% {! Y1 A3 I0 Z1 X, _# q8 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 Z$ p W9 K4 o" Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# a+ z' }+ m& t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 o7 v: I' |. }
: E" X/ x8 N7 f8 b9 t' P9 {* k: Y
; @1 q; a+ p) G# H: P' k |
|