|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; S# n) b1 s5 e6 o* e5 o- [code]EDMA sample test application
3 G7 s, |4 ], J* i* U) V - /*
+ k% S9 h) H! L$ p - * edma_test.c
C2 J/ C! o+ ?# \ - *
, L5 D& E! N7 v3 Y3 q: S, S9 \ - * brief EDMA3 Test Application
1 L: R8 I( k( B! ~5 t: l - *6 `1 n) y- C: S
- * This file contains EDMA3 Test code.: U+ |) Q$ C7 t7 j0 x& {
- *
0 r& n! v' u* F4 G; I- v; U% i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ `5 Y& l1 h0 ~/ ]0 ?8 P& T) ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; X% D' a2 @. l* Y5 h
- * TO CHANGE.
, A' ]. N9 @6 R# S7 s" {# U - *
; i! n( y3 W- @2 T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( v8 s2 l6 U: e& k- Q& A _* t
- *
]2 G( h( c: v: U& {% N5 _ - * This program is free software; you can redistribute it and/or7 r0 W5 ?* X9 x% c
- * modify it under the terms of the GNU General Public License as/ U% L+ ^: C* V8 S' v1 z& G) V
- * published by the Free Software Foundation version 2.2 z, H0 H! N7 Q9 z) j# \0 O
- */ {* R) r% F- u3 w9 o" V) J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, `* i2 h! d+ l% t7 W5 X - * kind, whether express or implied; without even the implied warranty
2 \ S$ C, @6 k/ _! @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* l2 x$ e% R6 I3 w - * GNU General Public License for more details.
2 Z6 e4 ?$ l2 | - */' R" I0 j: T+ Z/ M# z( r
- / k5 k4 E6 w( e+ D: G, z( f6 z8 H
- #include <linux/module.h>$ v7 v6 C- c) w. Y9 K
- #include <linux/init.h>
4 B# F( `* Y3 y W" p3 ^ - #include <linux/errno.h>! l2 E9 t- w R4 o2 _8 T" n; p3 l
- #include <linux/types.h>, t6 w6 b _$ o( B- Q
- #include <linux/interrupt.h>0 J. I; l# j9 h& @& J7 _
- #include <asm/io.h>% K" K2 y# w5 e s' R$ M
- #include <linux/moduleparam.h>* l3 g; w# X) `& b; O9 g
- #include <linux/sysctl.h>
1 D! z/ ~3 o U( d2 ` - #include <linux/mm.h>
! W! U+ u2 t& W, {7 K( @* J5 F - #include <linux/dma-mapping.h>: |9 Y, s1 P. e
* X+ h5 n1 |! m3 k1 [3 f- #include <mach/memory.h> Z% W2 \5 Y9 s1 Y1 S j
- #include <mach/hardware.h>2 [! R3 [6 G0 Z2 E2 u2 N
- #include <mach/irqs.h>" x/ o$ E3 X% s ^* S3 U9 L9 z
- #include <asm/hardware/edma.h>5 z' q1 H# E% X. S+ X m- C4 t( t
- ! W4 `0 F5 n, ^- \% T$ q
- #undef EDMA3_DEBUG
+ R6 a0 B* v' C7 k9 e - /*#define EDMA3_DEBUG*/
% h/ N* \! \3 d6 _( {, R - % _8 \/ n- ~( O) ?" b! G
- #ifdef EDMA3_DEBUG Y5 i9 p3 ~5 g. ]; a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) B% }( Q* C" p7 ? r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# W9 K- t- p" ^- H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, T1 O" r% Y' P6 m/ g* A' A7 N3 x - #else, D u+ K7 P7 L" m, [2 F
- #define DMA_PRINTK( x... )
8 X; K1 N: G9 W0 [2 j9 G: ~6 f - #define DMA_FN_IN4 j& {, V6 d+ F4 p% l5 e8 h6 M
- #define DMA_FN_OUT: h3 p' o" {+ s1 r( r/ l
- #endif
* O; d, x& M. h2 B - ) T( ~( j; ?9 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; C2 [6 B8 `7 d/ c& g7 P* T/ X - #define STATIC_SHIFT 3% N$ O; S: O6 T' G- Y
- #define TCINTEN_SHIFT 20! }1 `* N& L; q0 T/ @6 x' v; Z
- #define ITCINTEN_SHIFT 21+ \9 E2 l. _; m6 X/ }
- #define TCCHEN_SHIFT 225 [* Y# I" E3 h
- #define ITCCHEN_SHIFT 23
5 D8 Q0 h/ `1 i
7 z5 }6 W' q; N- static volatile int irqraised1 = 0;
! n" }8 L5 o* [" \! Y7 x - static volatile int irqraised2 = 0;
! f" K. G, Z3 B& r& f - 0 m& E3 G( b& @9 ~. h9 \3 E' v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: F. Z% L' a% @2 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ K* _( y- s/ U* A9 t+ h6 s% }. I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ q8 N' o$ n0 X7 \7 N - + @/ ]# k% ]2 s3 }6 C5 p, y, O
- dma_addr_t dmaphyssrc1 = 0;
1 Z: F n( G) z! ` - dma_addr_t dmaphyssrc2 = 0;7 X& W7 G; w: z( }
- dma_addr_t dmaphysdest1 = 0;# C2 G* S# ]6 ^ o
- dma_addr_t dmaphysdest2 = 0;
9 ~ i- ~8 C) o. \
, |8 X4 M4 e' D) |% d- char *dmabufsrc1 = NULL;" h2 j7 E. a2 ?% g3 V C# m; I5 B
- char *dmabufsrc2 = NULL;9 n8 b0 G0 D' i$ i5 C
- char *dmabufdest1 = NULL;: R/ v( r# F/ u, v
- char *dmabufdest2 = NULL;
" u$ d6 c4 R' [( \* @" U
, y1 V0 a* j k7 w- `- o- static int acnt = 512;
1 K$ I: Y* l2 b# I3 i - static int bcnt = 8;
7 j' }0 j: S% S$ @, f - static int ccnt = 8;
3 s7 s/ z) g* T! o - 1 D9 v0 w6 O a, K. f4 K l
- module_param(acnt, int, S_IRUGO);* X2 v t4 [, d
- module_param(bcnt, int, S_IRUGO);! @& C$ g: {4 i7 Q/ C% j3 @9 j
- module_param(ccnt, int, S_IRUGO);
复制代码 & G8 _# b+ }% p: y( M5 ]+ _2 R- k5 f
. ~# y4 n# ?2 E; j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 ^8 F5 V/ W+ L$ z2 w4 k3 U- o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 s2 Z3 x4 d* }7 \( a' j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 h; H5 q' }# v' R! H* B# q1 C
8 |" e* f! W/ `4 j0 ^% A( r# Z6 G% Q7 N* m; ~
|
|