|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& B% |0 C/ i6 }- [code]EDMA sample test application& }2 r$ Y8 I7 s- b1 R0 w
- /*
/ F6 F1 T o4 h - * edma_test.c3 ^$ k3 ]7 j2 y V
- *+ p( m1 P0 B* h3 y8 M/ i5 Q
- * brief EDMA3 Test Application/ j8 l6 a+ E0 a) n0 ?$ e+ m
- *% d! y& \ @+ F8 d$ T( p
- * This file contains EDMA3 Test code.0 M t% X- e+ S( w+ u7 A
- *! F% a+ N. f" j* j$ W0 x* i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Z( i' w. L6 Q, o; H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ C. D& [) G4 r2 j. y& a) U2 z& H - * TO CHANGE.
. v6 y: F. F3 p: O. X - *; `5 m3 z5 j; o; P7 j0 e+ r; v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) m) @: o, i9 q
- *
8 f; P: b, K4 D - * This program is free software; you can redistribute it and/or
& \( U/ j. G; |+ j( _' e - * modify it under the terms of the GNU General Public License as
5 v# Q6 i% | N0 {- ] - * published by the Free Software Foundation version 2.* W9 t! @& F! V* S) G" R
- *
% w6 u, W* O1 _- {5 g z( `# H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! }) A, Z) u& H6 Q- L( i - * kind, whether express or implied; without even the implied warranty! n* l' r9 w9 z0 ^, x* [/ R; d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 g) G4 ?2 e) J; z, O0 t, J2 h4 @4 i - * GNU General Public License for more details.
$ C2 t; b- m5 f4 A - */0 `3 b j: j' \( O
- " X5 H% r1 [/ p0 \$ H
- #include <linux/module.h>
" O+ Z0 ~, z# S. l3 ], K/ f6 y; j - #include <linux/init.h>, y; u4 S5 J9 J
- #include <linux/errno.h>% S6 t: A# w1 [# ~+ n+ @/ k
- #include <linux/types.h>
4 x- b( G) w/ g8 ? - #include <linux/interrupt.h>
3 r' B5 q& j6 Q6 @1 d: U/ F% K - #include <asm/io.h>0 K* v& }) S+ G. b4 d+ U' `
- #include <linux/moduleparam.h>
5 C9 W* T* w( R( M5 f% a+ D2 W - #include <linux/sysctl.h>
( s5 l- w$ {" [( d- t \ - #include <linux/mm.h>9 C: o4 {" C- h) b0 K* I5 l
- #include <linux/dma-mapping.h>/ g+ E! q" @ Y% V7 {
- / X6 l. o4 m7 U4 z" N" W* n
- #include <mach/memory.h> @5 B) h4 P+ E+ H( y
- #include <mach/hardware.h>, Y2 {7 Z+ t7 e I0 f! a, F& N
- #include <mach/irqs.h>9 u$ w% Z& K2 o1 |8 I9 T! o
- #include <asm/hardware/edma.h># q. x$ Y/ T+ I
$ o# c) t ^ N5 W/ L; O. l! H- #undef EDMA3_DEBUG
4 r0 i; j( l+ t# w* s% V - /*#define EDMA3_DEBUG*/0 k4 |) J" D) [& B: f' R3 `. p
- Q/ c( t V9 R$ n. A# Z; c
- #ifdef EDMA3_DEBUG
9 l. ?4 f- E' L0 N Y$ \2 p( m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ D6 B: U4 o7 ^ g! B8 G+ h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# i9 c1 S0 u: h# B2 g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): |" ~( E: Z o0 ^6 ]0 e
- #else7 v- D' @5 Z4 a% _
- #define DMA_PRINTK( x... )
. \$ s+ c6 A- R/ a! H - #define DMA_FN_IN
* D, @' ] B) p# _* L9 \ - #define DMA_FN_OUT
, D" D8 c1 r" A" S; } o - #endif w. s8 m. [( `& t* I: `: O8 N# P8 f
7 `7 Y2 ]8 Q; Q! F3 R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( t2 L. ]3 j( W+ d2 n - #define STATIC_SHIFT 3
, t5 i6 n4 y: W6 y3 x3 G { - #define TCINTEN_SHIFT 20% W' z' g5 m# h
- #define ITCINTEN_SHIFT 21
7 b7 S6 W/ j1 A t- W3 D - #define TCCHEN_SHIFT 22* J4 _ q: H' v8 S4 D
- #define ITCCHEN_SHIFT 23
9 S& z$ i/ k' k. l& L - 3 g! y O/ f x x4 Y4 A) N& C
- static volatile int irqraised1 = 0;. P' F8 u9 a8 G4 A( A0 ?9 t
- static volatile int irqraised2 = 0;* a& @9 l# Y) A% H3 g( J: b; Y
$ s. ]& c4 w0 b5 f1 k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 Z$ K: e6 u# J; E3 s N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" K7 d" x% E2 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* }0 K1 B( o1 R' C; Z/ X0 Y. C' ~
- # c3 D' I3 N% j) F* w, l
- dma_addr_t dmaphyssrc1 = 0;; ? A: G) D5 ]# ?8 A& W/ i
- dma_addr_t dmaphyssrc2 = 0;
0 T5 M0 C3 }; M% r: q x; t- m - dma_addr_t dmaphysdest1 = 0;3 I. W1 g) w8 A+ w' s( P: p' m
- dma_addr_t dmaphysdest2 = 0;9 B% v+ a2 L2 b6 b
- S5 W, a. k1 ~/ Y' h4 P- char *dmabufsrc1 = NULL;$ i0 C+ t$ `3 _! {+ e+ w
- char *dmabufsrc2 = NULL;
! b+ s7 X4 G& p* L4 b! Q - char *dmabufdest1 = NULL; m3 S8 D" ~9 y* y7 {
- char *dmabufdest2 = NULL;
8 z/ C G/ X$ ^4 p$ l - ! r- _+ Z# h2 z, R
- static int acnt = 512;
4 R" O7 _) W3 Z# W0 T' p9 s3 q - static int bcnt = 8;
( ]0 X- |# i/ V) k# c" } - static int ccnt = 8;
E' x( I5 b3 F0 q* i) x) H* y% s3 l
/ ~2 @' U6 S) m6 }- module_param(acnt, int, S_IRUGO);% ^2 ^) A6 }+ x y+ i, |& g- A
- module_param(bcnt, int, S_IRUGO);
% w. M1 F* x2 l/ G+ V7 N - module_param(ccnt, int, S_IRUGO);
复制代码 2 ?) Z/ S% v* t+ q& F
6 s& u0 l* ]/ J( r6 B' q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- }+ A4 _4 K0 H( v5 n% larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ]' T6 Q# }- q" Q+ H7 D4 h7 J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ W8 {0 ^+ C" w1 g9 L, q4 n
9 v r; L1 a5 b$ q
# m4 j! r4 ?/ ?
|
|