|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' o$ k" Z, `) Y8 n
- [code]EDMA sample test application7 V8 R, |( k. K. H
- /*
& e' c" ~- M- _/ h; ?& q - * edma_test.c& d6 h. t! P$ g) _4 W/ e
- *9 _+ ]: q! s+ R' O, J- N
- * brief EDMA3 Test Application/ \- x9 |4 O) V8 ?1 O
- * i- _8 k2 z a3 O
- * This file contains EDMA3 Test code.7 Q* n0 m+ h8 ~9 C' t+ R
- *
. T) [2 y1 v: O2 ~0 V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 y1 H6 L3 M# k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 q r9 Z% E2 { - * TO CHANGE.
1 }# @, b: m$ a3 F - *6 C Y- x& K/ R i9 ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& \& ^5 ]5 N3 {5 y - *
& V' y5 D$ ?6 I2 K - * This program is free software; you can redistribute it and/or
8 d; D+ J G8 B0 _ - * modify it under the terms of the GNU General Public License as: H5 y* d8 |& h" e. G: J
- * published by the Free Software Foundation version 2.
5 I9 M2 N6 I2 @* w - */ u8 ]# c, y+ k# z8 n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ o/ O7 O+ I) P1 ]" x2 l3 v
- * kind, whether express or implied; without even the implied warranty
# t* F: n N& b& h( h: U" U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! h3 d) Z- k! C, y9 A9 A9 a1 q
- * GNU General Public License for more details.6 \3 E5 \6 t4 I
- */: o6 A8 _, z& u; T& F
- 2 |9 g9 Y) S0 w& y$ @9 v
- #include <linux/module.h>
9 ?9 V" i( J6 S# M' t - #include <linux/init.h>1 U7 {* A: t. F( r9 P; z E7 m3 b" u9 l
- #include <linux/errno.h> x# o* |* Y3 [+ q9 Q& l
- #include <linux/types.h>5 Y' F! e% u1 w2 z( O
- #include <linux/interrupt.h>
# Y& b K* u6 P3 c8 C$ V; c - #include <asm/io.h>" |8 g: h; o% t( [' w" P
- #include <linux/moduleparam.h>
- |' R0 |; L L9 ]) L3 U - #include <linux/sysctl.h>" C2 D. Q7 N, q. o
- #include <linux/mm.h>. G/ W# T( P: h0 L3 |
- #include <linux/dma-mapping.h>
7 ]: c2 y A- {- q d2 `; c+ |
! p; |9 Z% o6 @/ Z- #include <mach/memory.h>5 F/ w/ @% h# s- C- W b2 [- j
- #include <mach/hardware.h>
/ d1 i$ h9 W6 L) i2 L% z - #include <mach/irqs.h>
: B- l5 H" X4 O) u* S - #include <asm/hardware/edma.h>" ^- @1 a# e* X- d p
# P$ u9 D9 \9 q* z- #undef EDMA3_DEBUG
0 X( @5 |/ r. j5 x - /*#define EDMA3_DEBUG*/5 X- M+ c7 j; n) U
& S p# O" l' Z0 B- #ifdef EDMA3_DEBUG
1 t) v! `9 Y+ ?7 n0 \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ J- N( c4 h( ?' q4 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" k1 D/ F- K8 ?+ @& d/ V( _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- y& I4 c- o1 G; o
- #else5 M( U3 J& O5 N
- #define DMA_PRINTK( x... )
( d. j* p) W Q" i+ P - #define DMA_FN_IN
$ Z* B3 h5 Q2 }/ Z/ A) A - #define DMA_FN_OUT
- S' A0 e! o" z8 C+ T( L - #endif1 x' Q, f+ [# }+ w( F6 a
' v/ F9 w5 i2 r$ R3 z' w, s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, X6 Y* `; \# {" t! U5 ]0 X - #define STATIC_SHIFT 30 k( L2 {- C" q k
- #define TCINTEN_SHIFT 20' r) B5 H( p" @6 X4 o1 p; i
- #define ITCINTEN_SHIFT 21
# {( A4 _: k8 H9 x - #define TCCHEN_SHIFT 22( @: r9 \4 @% I5 b
- #define ITCCHEN_SHIFT 23
2 J8 R# u( C3 M# `' `+ K
% I% V3 }4 e7 V- static volatile int irqraised1 = 0;
% h4 [5 y9 G( V' u t! Y" o - static volatile int irqraised2 = 0;' p8 i- I7 K2 b* \! x9 _1 m
- # y$ r, a) m; L; O' _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 A: H; b1 `* u$ X0 |( c4 K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y3 g3 [% `3 n0 l+ c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 \& S* c1 c. H; ~( I
9 E/ \9 C3 n( a' T, g9 W/ ^- dma_addr_t dmaphyssrc1 = 0;+ K7 l% b2 Y3 ?4 V6 t
- dma_addr_t dmaphyssrc2 = 0;$ {% y- M1 |( f" o# b9 h! I) H
- dma_addr_t dmaphysdest1 = 0;! m; \) {8 A. Q3 K0 _8 l1 o* e, ~
- dma_addr_t dmaphysdest2 = 0;
3 v+ A( i* U( \0 \7 [, c - " |1 ]6 _; h. n/ r% a& h
- char *dmabufsrc1 = NULL;
. n! q+ R4 L, |4 f - char *dmabufsrc2 = NULL;
3 }3 ]8 ?, H: p - char *dmabufdest1 = NULL;
, h8 v3 R) _* y+ x2 E - char *dmabufdest2 = NULL;
2 }( E B8 @7 R& K U5 e - $ m$ i" F( s, L" q9 Y7 k
- static int acnt = 512;
4 n. M$ d; P7 x! Q ?7 b$ t - static int bcnt = 8;
5 r/ l- _+ {& C0 L* y7 n, Z - static int ccnt = 8;$ {0 f; d9 Q* q+ D; I
- : C% d( R& [7 F' {
- module_param(acnt, int, S_IRUGO);- o8 q) S5 u+ d+ k( P( @6 q
- module_param(bcnt, int, S_IRUGO);$ Y; Z- X& S6 L; N
- module_param(ccnt, int, S_IRUGO);
复制代码
- W$ Y# O. v4 z& E% n4 P, j2 b
8 g! @. x+ M% q0 \3 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 w0 m9 c8 K& F% _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ q3 L' w8 b* ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 S0 F$ d1 x& V
6 J" p) Q7 X. g- J" n3 D4 e
3 y4 N; i/ w8 \$ P/ @" V# Z+ G |
|