|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" `; v8 @) A' c- [code]EDMA sample test application2 c+ P4 d0 d. R* j, l* J- Y$ p
- /*$ R" u# d6 f. C# a, u5 h. s, [
- * edma_test.c
, N- J: R h% h! ]* |* b: m8 n - *
8 g! _9 s3 B d+ S - * brief EDMA3 Test Application
0 [. y9 o% L% L - *" R- K6 G4 L5 `2 E5 o
- * This file contains EDMA3 Test code.# o! p/ U7 { t2 C4 x
- *7 U1 `( w. {6 P8 v% ~2 R4 d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 c5 n, {- {- J5 B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 s7 K: D) J _1 o# S+ m! v3 T$ ~ - * TO CHANGE.
+ q* }6 m, L+ b+ |) O" m - *9 W3 @$ l6 o( H, l& W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 \' C! G) U5 b/ D1 {6 f - *
( w5 U& ^ z" I* f+ l7 L - * This program is free software; you can redistribute it and/or
$ z8 n7 i( r* J( N( o - * modify it under the terms of the GNU General Public License as* X5 f) U6 _! J* T$ E$ W8 [% m8 }
- * published by the Free Software Foundation version 2.
! r* g) i" P: ?9 x u; M - *, J! E+ P& _; I$ V5 k5 J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# ]* Y o. j2 |8 F) U9 c1 u+ i: j+ ~0 E& T
- * kind, whether express or implied; without even the implied warranty" v P1 Z% ~' W( d9 s' [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ y: p* d/ B% _( D6 g
- * GNU General Public License for more details.2 I3 G4 F: \7 B0 K* m' c# U
- */+ j- r) m! V3 w+ w- M- Z
7 G" {: ^$ G, J- #include <linux/module.h>
& W& \! L1 _4 E/ q& G$ m1 f! M+ A - #include <linux/init.h>
" @, ?" `* a2 j9 u - #include <linux/errno.h>
& d$ x$ j l6 D! _/ G0 ` - #include <linux/types.h>
7 I/ Z% r% d' V& Z. k - #include <linux/interrupt.h> x/ s) G9 T0 @/ x
- #include <asm/io.h>
6 U+ y8 e1 o n, y8 Y: g. h - #include <linux/moduleparam.h>
( u( K( c/ q/ b+ P J; ]4 x! U - #include <linux/sysctl.h>
8 ^6 z- x0 _, s& Z( s - #include <linux/mm.h>; D, n5 S. q7 d0 b0 u. X
- #include <linux/dma-mapping.h>5 q, {. m: K$ ] r. X! a H
8 \+ ], k" F# ~' e* R- #include <mach/memory.h>. |9 L# b6 N) {- S4 @$ [1 j
- #include <mach/hardware.h>
" f( T% P/ _, f# X2 ~ } - #include <mach/irqs.h>4 P& a# ?1 |0 W/ Y6 p8 q
- #include <asm/hardware/edma.h>
+ O/ }4 M# o6 F: T - ! C( m# N. Z m2 v
- #undef EDMA3_DEBUG
" n/ j5 M4 c: e( E - /*#define EDMA3_DEBUG*/7 b- f: U2 L) [, Z! ~
- 9 y8 j' {7 Z+ m' i1 Z+ M
- #ifdef EDMA3_DEBUG
1 ^9 m5 G2 `8 k2 J' X6 b& }$ { X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): j! U8 D7 j2 k/ w2 E$ _9 D+ B& C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 t$ E/ U6 H0 i" q6 ?( ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% W( A: D) I$ F; H% o - #else
( C2 J/ c" t2 O/ {* L, f - #define DMA_PRINTK( x... )! \8 X; y8 f" O* _3 h
- #define DMA_FN_IN. j; a6 T" B6 ]$ e
- #define DMA_FN_OUT/ x1 f' I9 x4 Y- P
- #endif
# A0 e, I' _, N6 s
( z* r* O0 `7 z5 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' k! \# O) [8 ], |- D6 } F
- #define STATIC_SHIFT 30 X7 t: f V+ @& A
- #define TCINTEN_SHIFT 20
8 M) q) }9 h2 Q6 M& i9 w+ x4 I+ y - #define ITCINTEN_SHIFT 21
/ P7 ]/ B% |7 J) k) k - #define TCCHEN_SHIFT 222 P, e. q6 J2 [+ c+ E& V. F# U
- #define ITCCHEN_SHIFT 237 Y) z# O/ b1 c
0 R* V" L8 f" x6 z3 k- static volatile int irqraised1 = 0;
+ u2 d) z+ R* k2 N - static volatile int irqraised2 = 0;2 w5 ? F1 v! \* i
- @* X6 C" z* D$ _) z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ B& T8 k- F1 c: p% ~, @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- u8 e: [( P$ f8 o# o; G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) I3 `( c2 H3 Z; G: b' `+ i
+ Q; I7 f+ ^4 v$ I$ C( h0 f- dma_addr_t dmaphyssrc1 = 0;) D! A/ a( S! F. L8 M# o
- dma_addr_t dmaphyssrc2 = 0;7 @' O* |8 p: ]# W0 E0 X
- dma_addr_t dmaphysdest1 = 0;8 M' k* E+ k* j2 z) W/ {, D
- dma_addr_t dmaphysdest2 = 0;" M6 x& N$ b9 g
- L5 r. v. r1 x ^8 N* L2 D+ | i; j- char *dmabufsrc1 = NULL;
3 L7 q* T% s( f, Y9 C9 Q: } - char *dmabufsrc2 = NULL;
6 T% h3 K: u t - char *dmabufdest1 = NULL;
w) w$ V$ g. \# x; T; o q1 I% x: ` - char *dmabufdest2 = NULL;) b7 Y( a) d; c9 s# |. Q
8 P% a8 v [- @6 B" L0 v5 H; z6 }. b- static int acnt = 512;+ ~) y- V. ^( s* D+ W5 B. z# n- O
- static int bcnt = 8;
, m v: X0 j: ^( H" z - static int ccnt = 8;; `8 |( y6 W# \& m8 \
/ s4 K- b, u. U1 R8 ^$ P- module_param(acnt, int, S_IRUGO);
7 S# x2 Z% a& I8 j3 a' J3 L+ K8 y - module_param(bcnt, int, S_IRUGO);
7 j* e. p3 A: k - module_param(ccnt, int, S_IRUGO);
复制代码 ) x7 Q4 `) e& t/ \
4 t. A5 c! g K: o- A$ Z5 f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! y4 T# j' V# d* Y( Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 z& k5 M5 K( T2 u/ l8 b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: B+ y$ v+ I+ q# R- R
) R- ^; G% Z+ u! O/ i$ Y8 H; E/ j) u% l0 W z
|
|