|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - a' c& a" n* A
- [code]EDMA sample test application$ D' a) X, Z+ K8 t$ r
- /*. @9 o+ g/ J4 ]: Z: K% G, \8 g) h
- * edma_test.c
5 ^( b! e b' w- C* { - *8 O4 {1 n4 P/ @
- * brief EDMA3 Test Application7 B# d" k7 _. L3 g$ C
- ** L! o1 a W, _! L
- * This file contains EDMA3 Test code.6 q" s S" f q
- *$ n7 r$ ^* m" G- P4 S' s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 D# D* g: J! ]) W$ L' X' t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& `6 B0 \2 ]4 F* ]0 C4 d - * TO CHANGE.$ u9 C) g) a1 T2 \7 y! j
- *1 H- z. J3 \+ W" F1 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- ~& }( F3 Q- p% Q5 L3 b* E - *: F& g6 V& V) Q6 W" A" w
- * This program is free software; you can redistribute it and/or% t7 R y" @" V( L+ N* V. \
- * modify it under the terms of the GNU General Public License as8 y4 ]" o9 ^1 c h" G8 y
- * published by the Free Software Foundation version 2.
8 F( A0 C) \, q4 p$ x+ } - *7 w" z5 v# {" y# P8 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- [0 k6 @( `% x; N2 ? - * kind, whether express or implied; without even the implied warranty
- ?2 z2 F3 f# H5 s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) E6 C+ t/ C! e7 [; H6 S7 @& t7 ^
- * GNU General Public License for more details.9 |3 N" E0 N. |3 G$ C6 Q5 ~, T
- */2 a+ E8 p! V# A6 e: c% `1 A
/ S/ ~, S) S: Q; V. y/ }! X. [- #include <linux/module.h># s7 t/ o6 b* K, ^; `8 Y- W
- #include <linux/init.h>
" i" ]' B z* e) d, G8 j1 \ - #include <linux/errno.h>
! i0 z4 N. S+ U2 I. R" W9 p. d - #include <linux/types.h>
# _" {* n' ]. |( b2 a. k# D; h t - #include <linux/interrupt.h>
3 s6 Q2 m k3 J! A: z2 X2 g) m) p - #include <asm/io.h>! B/ y/ r7 ^+ S4 u
- #include <linux/moduleparam.h>8 ^8 I2 w0 g. k2 l
- #include <linux/sysctl.h>+ ?+ |- p# g c$ s/ B1 e! h
- #include <linux/mm.h>8 s4 t w0 Q. D
- #include <linux/dma-mapping.h>& o6 P% X p; }' a
- - P; v$ Y5 x! i/ V% R
- #include <mach/memory.h>- h# n0 W1 T5 ]2 ?( q! P
- #include <mach/hardware.h>. I% S1 Z" u/ r% H* E5 b. x" D
- #include <mach/irqs.h>2 n8 Y/ r# {8 V# Q
- #include <asm/hardware/edma.h>
; `& o: c s1 g+ X* S# k( ~
/ W& Z' a6 k* ^$ k$ b3 O- #undef EDMA3_DEBUG, {5 R. K* M( e! F
- /*#define EDMA3_DEBUG*/* q$ z' {2 j6 ~3 E) d
8 q$ D# |: G+ U: @4 ?- #ifdef EDMA3_DEBUG
2 ]7 k3 o2 V/ \9 o+ C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" e+ p' _' A0 q! s+ O& |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
J" |' b8 w1 e. [. [+ [6 Y4 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% f* X2 X' _" }1 E% S6 _2 ` - #else
( h! s) R$ j. d& @ - #define DMA_PRINTK( x... )
3 B4 t% L& X* z& [ z7 t - #define DMA_FN_IN' \- F+ p, U# v
- #define DMA_FN_OUT9 r& Z0 O8 I0 @. ?9 r1 V; X
- #endif2 ]9 O) e( J9 z' n! l4 v1 ]" p) z
- ' y1 c* p1 Y, g% j5 h2 q1 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ i' @9 A, @1 u5 Z# o9 Z1 c
- #define STATIC_SHIFT 3
0 ]% P( D9 F5 G9 X4 S - #define TCINTEN_SHIFT 20
" {5 c5 _. T* a- s) \1 I/ ` - #define ITCINTEN_SHIFT 21
/ w& W u2 U [- @2 x: ~ - #define TCCHEN_SHIFT 22# }1 ~+ c7 V8 H5 v5 n+ p- s
- #define ITCCHEN_SHIFT 23
' A; {4 V: T* f) ~! v) h+ T
. P4 j: q N( T* F- static volatile int irqraised1 = 0;
& p3 a$ g) E3 ^3 O* l1 ^ - static volatile int irqraised2 = 0;/ r/ Z* K r) I9 j
- ) p5 I y1 ]$ d: G( J! P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; x2 H3 _$ ?- [, D$ H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ C/ W; H( t+ p' N3 a, \) G$ l" K. O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- x7 _0 [( p# l - 6 {* U: w9 G5 b. v
- dma_addr_t dmaphyssrc1 = 0;
) r4 u1 S9 J. g |4 ~% s! M# v - dma_addr_t dmaphyssrc2 = 0;
2 s( j6 g" g) [# h+ \5 R9 b - dma_addr_t dmaphysdest1 = 0;
+ ^9 L, y2 K6 d - dma_addr_t dmaphysdest2 = 0;
1 v* H" d. o" V% r
$ G( M% U4 O: ?, j- char *dmabufsrc1 = NULL;
& Y# @- G: U, H - char *dmabufsrc2 = NULL;% _2 D; E" R( j# I; q! \
- char *dmabufdest1 = NULL;
% O% g* e* f1 F0 R& O0 Q0 p - char *dmabufdest2 = NULL;
. [+ q C2 J |( r o& U - 0 T' X/ i$ H: z; ~9 p& p! ~
- static int acnt = 512;
5 C `) {( \$ f% k. M( y+ i, t - static int bcnt = 8;
5 e8 l0 H0 f( d7 M% ~, O - static int ccnt = 8;
& M( P4 E9 s0 n g8 I
" @+ U, l9 A$ x" s) d2 |- module_param(acnt, int, S_IRUGO);
: v0 K& y3 C) ?2 y - module_param(bcnt, int, S_IRUGO);8 G$ v0 F3 o8 A. i/ L
- module_param(ccnt, int, S_IRUGO);
复制代码 / k0 r% q4 L+ X+ |$ n9 d
% u5 ~& x6 E) u$ l) @1 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& y" T' o5 R$ j2 c0 t X( t; Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- z1 Y% t; _" v' ]! {" B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 [5 n) V T# N$ _; k7 M" D
2 S; k# r$ ^4 c- t6 z- @, F, R: H6 i; a
. e/ \! O( M9 p; D" c5 n/ p |
|