|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" v6 X) |$ i. x3 Y# F- [code]EDMA sample test application7 c$ j. w2 Y7 @ N7 e. U" S
- /*
3 f8 E9 v9 N/ @4 j! C7 P1 G - * edma_test.c/ W q# h* L4 [1 U) [* H0 C
- *
1 g# X' M0 W$ t - * brief EDMA3 Test Application6 O j8 ]# Q, w3 y9 x
- *) Z1 c8 T/ i0 z
- * This file contains EDMA3 Test code.- z) b- C. V8 w* R5 V
- *
' y4 l& \2 L( |" s. ? b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% c9 s1 O; A) _ ^9 U8 X5 h: ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" R: _2 O' ?' w! u2 I- Z - * TO CHANGE.. G, Z; ]3 `9 m2 ^
- *
# U. q( j4 G e; p1 H J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" k( P0 Y, k! P3 k/ S1 U) E& y - *
2 S7 z. l7 [- p9 s5 { - * This program is free software; you can redistribute it and/or0 n$ r7 _, P! a
- * modify it under the terms of the GNU General Public License as
# T0 T9 ~9 l) V6 x% u/ x - * published by the Free Software Foundation version 2.* @+ [( Y# C! j! `1 K
- *+ m2 v& W6 r; `" j& T7 e3 Z1 v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 t" N% M5 ^& j+ ^: q5 I
- * kind, whether express or implied; without even the implied warranty8 ], r- D4 _$ d# J- Z- k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ V. [1 u9 M$ ?
- * GNU General Public License for more details.* g- J6 t- N" |/ A: o' k% L3 |
- */9 _- u- S4 v; I& R
- F. ?/ ]2 u* p, F4 x1 j
- #include <linux/module.h>
. ~4 h/ }0 C' H& ^- W% L - #include <linux/init.h>
b- g+ Z2 H' i: v# Y - #include <linux/errno.h>, f& {7 D2 b: T6 t8 [) J% j0 V
- #include <linux/types.h>
+ x, U! g9 s* }! n1 s4 r5 G - #include <linux/interrupt.h>
) I, c& Q; Z ?6 @/ A - #include <asm/io.h>
# O8 U0 `3 q, e# N1 v) _7 H8 ~ - #include <linux/moduleparam.h>) U0 X* K3 T; r7 x4 L! [$ P! O* E
- #include <linux/sysctl.h>* q2 L. \) z. a& `% x! h
- #include <linux/mm.h>
' ]9 i2 b1 b4 J, l8 y$ [4 E. N - #include <linux/dma-mapping.h>) S/ I' D6 a9 ^4 T# p5 b1 a
' {' Z4 h: c2 x3 o" Q+ X* x- #include <mach/memory.h>
3 \- I Q" E- I+ z9 w& B - #include <mach/hardware.h>1 N* y& E" _' _* h" _2 {
- #include <mach/irqs.h>, z0 `; U. U" r' C4 S5 M/ M4 m R
- #include <asm/hardware/edma.h>
) |7 b/ [6 l, b# h |8 e - * V- F5 D8 w0 ^3 \. ]
- #undef EDMA3_DEBUG; C; \( J. M% C: l
- /*#define EDMA3_DEBUG*/
. R7 V& D9 e" [! E, V3 f - + |$ j+ c' E8 ]0 N9 I: k j
- #ifdef EDMA3_DEBUG. O; R; h0 u& \9 r- \* R6 U0 h: _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! I0 T6 ~. U g. o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ Q6 o d2 g( \( A/ z; Q. V+ U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, o- | e/ f& |& E+ | - #else$ ] y: s& C: ^$ O( K. x# Z/ f
- #define DMA_PRINTK( x... )5 P1 }, g: _ y+ A" g
- #define DMA_FN_IN
- M5 ~& Y3 m e- @+ U# o - #define DMA_FN_OUT
`5 Z. s: Q, L5 Q9 B: G; t& l - #endif" V' Z+ S& \) ]& J
& X. R) w' ?$ ~7 M* r* V6 R- #define MAX_DMA_TRANSFER_IN_BYTES (32768): A+ y+ ~: l4 n& Y! o! s: x. {
- #define STATIC_SHIFT 3& b2 @9 x8 A" {
- #define TCINTEN_SHIFT 205 w, B, m. ?/ O2 y/ K# x
- #define ITCINTEN_SHIFT 21+ q- l! P4 b0 Q9 n$ x
- #define TCCHEN_SHIFT 22
9 i' E5 M8 |3 {7 o2 O - #define ITCCHEN_SHIFT 23
$ @5 O8 x5 R* G/ c
: N6 V- W! ^8 q$ S4 S& a5 V- static volatile int irqraised1 = 0;7 z% Q' n2 o, M
- static volatile int irqraised2 = 0;
1 I4 Q' v" P' ^1 M6 h* E% B' @
) Y/ O+ K6 Z- ]. n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ C& G4 x9 T% V4 r2 I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* c$ V6 I, Y" m- g% m8 n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( I. u R! J6 l7 z( I+ T* P3 X
% T. e; u$ L7 Z/ ~. R5 ?! c- dma_addr_t dmaphyssrc1 = 0;
" W9 M5 Y; q( P& ^ |4 j n - dma_addr_t dmaphyssrc2 = 0;( ~1 f4 Z5 Q! b+ F: Z: e
- dma_addr_t dmaphysdest1 = 0;. y% v9 H7 H! b
- dma_addr_t dmaphysdest2 = 0;+ R( ^. A) ]8 z7 C. |) V
$ v* f& S1 H s$ ^9 P! u: q, @- char *dmabufsrc1 = NULL;
! M2 Z! ]& j7 \6 V" z& L9 ^ - char *dmabufsrc2 = NULL;
# \5 \/ E' l6 e$ P0 P - char *dmabufdest1 = NULL;
3 C: B6 r8 w0 L; q5 x5 O - char *dmabufdest2 = NULL;8 Q. A' U& M, B% r, r
- N& T' U/ f3 I, s; g8 }( F5 I( l
- static int acnt = 512;
+ W& `- W# ^( ]) D6 k - static int bcnt = 8;
' g$ ~3 S5 b6 d5 z8 c7 P - static int ccnt = 8;4 H' K8 U2 V' \2 z$ b4 K$ O8 B
$ E, \$ _# k4 t, {- module_param(acnt, int, S_IRUGO);
" t: h* t% E5 D2 I) m" g2 u h - module_param(bcnt, int, S_IRUGO);
) H! { ?0 J6 Q q! p) |6 e - module_param(ccnt, int, S_IRUGO);
复制代码
6 X ^* }+ d4 j8 d- b3 j7 w1 S
; g9 `' X4 x2 M9 t. R* H% s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% X8 G9 u6 {! J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 k- t5 Q" b' ]4 Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 D: A& v, W0 J% a" X% V( K
4 j) }% p0 P2 O) F# j
6 d4 `3 t; N5 ?! W; {5 E& V |
|