|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + Y+ N) `9 y9 o* A5 t
- [code]EDMA sample test application
2 k/ `' H& P( F0 x6 K8 U - /* ~" ]3 N l6 ?* U, N
- * edma_test.c4 C+ `% X2 y* t8 m q! E" o) Y
- *1 b1 ^0 z+ X | @ D4 t& Z$ c' ]
- * brief EDMA3 Test Application
5 y( G$ U/ q3 w) t$ |. |$ Y9 A - *
+ E$ d' X5 j' c - * This file contains EDMA3 Test code.
- w- \4 a& @2 f8 G! Z e" i - *
1 Y# o3 n( A$ p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 E! N* O4 Y6 R2 c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# r/ t/ v, q! W" I. {8 t% s
- * TO CHANGE. ]9 T3 W: T, ~3 n4 [& r' W: a
- *& e, x8 _3 M2 w c1 r3 O6 @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( S* U* {; M3 ^0 H" X1 I
- *
* D0 v9 E- t8 h( y - * This program is free software; you can redistribute it and/or/ @+ G" B ^7 _+ q
- * modify it under the terms of the GNU General Public License as% a/ o3 g* o% s& w
- * published by the Free Software Foundation version 2.! Q/ E5 j: R( i3 h1 j
- *8 I K" R0 d- t7 |( b3 X7 G9 G& Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ n7 Q' e$ f; V* { - * kind, whether express or implied; without even the implied warranty" S6 |* O0 B" t& H2 [+ F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, y1 `) s& M; Y3 t0 P
- * GNU General Public License for more details.
* X, O0 e6 _) R% Y* B7 Q* n. l* W - */
# I- f2 S! q( b" w1 ~! l0 f- F - - f- R. K. O5 q: F
- #include <linux/module.h>) W! H. T" ~2 w; m
- #include <linux/init.h>
& `. `2 a8 L* k$ R& }& h - #include <linux/errno.h>
0 D8 y( H( ]/ e - #include <linux/types.h>
+ a& }( g( l; Z+ f - #include <linux/interrupt.h>
: n4 I F4 }2 E7 P - #include <asm/io.h>& ^0 T6 O) N6 I& b6 v# G3 ]7 ?* w
- #include <linux/moduleparam.h>0 d- {# y9 @1 A6 Z. w8 h( Y8 W9 ]1 [
- #include <linux/sysctl.h>; y2 D) S- i% `. u
- #include <linux/mm.h>- t& o, W2 |" m( F- A. g
- #include <linux/dma-mapping.h>
4 Z2 ~1 _- P) g - ; E2 l) _8 T j# m
- #include <mach/memory.h>5 T4 W+ m7 B1 g8 V# d u
- #include <mach/hardware.h>% S# d% Z' M- Q& A
- #include <mach/irqs.h>
- N5 d2 J( P3 W - #include <asm/hardware/edma.h>
+ X8 J1 Y, @2 q3 K, X - & U8 w8 `; t, J3 M8 A
- #undef EDMA3_DEBUG7 o5 R2 {1 Q" E$ d% d. F: H
- /*#define EDMA3_DEBUG*/
8 m4 k9 u$ @% \
! ^$ x& G2 d5 j1 t- #ifdef EDMA3_DEBUG
8 g! n$ l A7 h5 d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- f N& W0 X7 v ^! ~) j T. d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! {; q& b1 R1 h! v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" n2 b! y2 i7 N+ D# j' V/ @
- #else
2 v- e4 M$ y! e9 H: o. D% l. V - #define DMA_PRINTK( x... ) c- `) y+ R( ?& y
- #define DMA_FN_IN
; ~1 ?+ I+ V0 D& j9 x - #define DMA_FN_OUT o2 }1 A: \0 s8 u6 R
- #endif0 @5 Q: k/ o( ~' h. @1 Z
; }& x& J, C8 i( t) R2 J: x2 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 ? a% x0 n% Y3 P- F! \& q) M - #define STATIC_SHIFT 3
+ U. G$ u* { _* c - #define TCINTEN_SHIFT 20- `: G5 O$ U6 t) P2 Q4 {, }
- #define ITCINTEN_SHIFT 21" t* E- d/ q4 o" f! E) O
- #define TCCHEN_SHIFT 22: x0 X! D8 J% z( d3 \+ ^% s0 q
- #define ITCCHEN_SHIFT 238 I9 [" R% `* @) m7 t- G7 z0 G
/ A1 k$ d5 [$ v0 V- static volatile int irqraised1 = 0;
9 ^0 {; @4 n/ _. a7 d' A3 j$ w8 t9 m - static volatile int irqraised2 = 0;) R5 {0 e/ b v5 I3 D/ W) y
- 9 B: _1 ^4 d7 J( R7 K& B, r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" l# n! R! A4 E' h+ Y4 W5 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" P3 ^/ `! j5 r0 a$ u' G1 ^, {- W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- @3 \( y4 _: b0 y1 _( p' |4 c
- : X. p. ?* ?: W# |' p. X" D/ u2 e
- dma_addr_t dmaphyssrc1 = 0;
1 ]3 K& [! x2 y% r9 l - dma_addr_t dmaphyssrc2 = 0;
2 K7 N5 _; P4 I- n& k8 J' T - dma_addr_t dmaphysdest1 = 0;
" e1 M* b# q! L. Z/ o4 r8 c - dma_addr_t dmaphysdest2 = 0;
. O. C: B2 ?- z* q; C' Y, D
3 @! F5 W& ?$ @% x6 K8 F; B6 z- char *dmabufsrc1 = NULL;/ S1 X7 J% u4 I8 d
- char *dmabufsrc2 = NULL;
- Y2 a" Y* |- @ X# C - char *dmabufdest1 = NULL;
2 ]' \" m( q0 Q6 W) H0 k6 ^# v - char *dmabufdest2 = NULL;
6 V# @2 _7 Y9 _" |4 T5 V4 H - : T+ }# J- x5 u$ ?) h; Z9 N& P
- static int acnt = 512;
# [. Y" I7 E0 w `4 q$ N - static int bcnt = 8;
3 y$ i# P$ g- [ K: U: D7 w - static int ccnt = 8;; U/ ]; _9 t0 k1 D* n) h4 G0 z
- + Y! _% G( V/ b X$ t8 _/ U
- module_param(acnt, int, S_IRUGO);" b( t$ ]2 \( ^
- module_param(bcnt, int, S_IRUGO);6 J4 e* l( e6 D& x
- module_param(ccnt, int, S_IRUGO);
复制代码
& S- H4 ^, u6 m. e' _- H8 x4 S: D+ Y4 N( G* I$ z. o. ]3 q0 x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ F% e, M0 w1 A) }2 U8 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 ]; c, C1 A# d* h8 b1 \4 z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 {# H# h! G! X8 i# `
( ^0 M% ~0 O% ]' ^/ ~! L" I: {7 T! |
|
|