|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . x1 e% d& Y b7 i( U
- [code]EDMA sample test application
[7 e/ z; @0 e6 o5 b - /** R5 ~6 R6 {. H/ o* K
- * edma_test.c
% r. ]: r. k0 H; O6 Z - *
8 j8 r1 }* U9 @8 e7 j - * brief EDMA3 Test Application- E5 D2 Y# q/ {7 V# V: C0 O
- *
+ g. Q! u' T! Q- i- _" H - * This file contains EDMA3 Test code., G# a- P7 Q2 w$ U- G, ^% _
- *
2 v8 E) g( @ x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* L1 {8 }) B7 Y* f5 j1 D; e# K9 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# x5 [% p% c; e7 A
- * TO CHANGE.0 a) A9 Q0 q* J' _( j
- *
0 `; S) L" V. y+ Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# @- J) A$ @! M4 X: h9 t9 q
- *( k8 O* E9 T# v1 V' @: q
- * This program is free software; you can redistribute it and/or
' [) c6 { w" A- Q- } - * modify it under the terms of the GNU General Public License as) o8 G% M& J2 ~( I, ^5 q% x' _
- * published by the Free Software Foundation version 2.
8 Q9 j1 Z# d$ D, K6 J! s b - *: D- S$ m% n9 w8 v! N% }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; m T1 h8 {' `$ S1 E& ] - * kind, whether express or implied; without even the implied warranty' b) h# o$ B. N U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* y* X2 N" r4 P' t! l
- * GNU General Public License for more details.
m5 w, n1 c* U* g - */( `) Y4 u9 G& s+ i5 U+ O, G2 X& G7 V
9 U7 E; V l" q. f! q6 H- #include <linux/module.h>
5 l# {/ d2 o1 ?8 x0 q8 S - #include <linux/init.h>( c1 J" g: h: H8 a
- #include <linux/errno.h>
, h! i# s E* j$ l1 A - #include <linux/types.h>; r; n. m% Z" v
- #include <linux/interrupt.h>4 Z# ], z1 H4 e* z0 U* [. e
- #include <asm/io.h>
% W. S/ |2 F2 x2 N& y% j - #include <linux/moduleparam.h>- n7 X' G% I) G8 f
- #include <linux/sysctl.h>
) k9 {- }3 y; M- E e - #include <linux/mm.h>
$ ?/ \: r p* d - #include <linux/dma-mapping.h>6 p! i1 w/ g5 u
& A+ P$ R* o1 m( |, y- #include <mach/memory.h>
4 d& P7 U- o- R+ r5 A7 L' w4 I - #include <mach/hardware.h>
' C! @) }8 E4 l0 n, t& B, @ - #include <mach/irqs.h># \' V' @1 d2 c, s
- #include <asm/hardware/edma.h>9 o; g* J8 H7 o% B8 m
0 s1 j% D+ s' O& C2 A- #undef EDMA3_DEBUG
) }% Q. w- f0 q& { U/ n5 c( @ - /*#define EDMA3_DEBUG*/
' n% ]. A: n" Y2 I8 C5 Z' c - % `: _0 q1 ]# G( w& J6 q. D; E
- #ifdef EDMA3_DEBUG
. n- k9 X! }' ^+ m( Z" R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! x( H+ l6 R" w( ?; O1 j0 Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 R& k3 y0 { _+ T; Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) |; w9 t$ w+ U- d) W! X& p - #else) T, B3 T: X7 ?2 \
- #define DMA_PRINTK( x... ): d( T5 X- O3 \& y
- #define DMA_FN_IN
g; x& J% N3 c" x: Q, O - #define DMA_FN_OUT
/ t ?7 d n% r% C5 Q - #endif. v* l8 e) s2 k. Y" a. z- M
- 7 @3 w: w' |9 }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 e: S/ t) B/ {3 ~9 N8 O - #define STATIC_SHIFT 33 t. [/ I- \. ^+ s
- #define TCINTEN_SHIFT 208 P# e" i& M, Z7 [
- #define ITCINTEN_SHIFT 21
5 M3 X9 Y8 R- }; M- W7 q - #define TCCHEN_SHIFT 22+ w- A* C+ P" _ n6 B
- #define ITCCHEN_SHIFT 237 p; y# E$ o3 \! { l
& s. H$ `0 K3 u1 i( G( `$ c- static volatile int irqraised1 = 0;2 P# v5 u( k- z, c) W7 v
- static volatile int irqraised2 = 0;: e5 ?$ g+ x: b0 ?: S, |
- % c9 Z% G. S/ D4 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 D/ ^) j# R% d" X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ p& v% B/ U- v$ K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- i- l; t4 i' j9 }, r4 l" p
6 f7 I- w8 e6 {. A8 D2 _- dma_addr_t dmaphyssrc1 = 0;
) h3 P) Y) `% |6 H8 u# A! J5 ^1 H - dma_addr_t dmaphyssrc2 = 0;
1 L( o- { M9 k& p7 ~0 S - dma_addr_t dmaphysdest1 = 0;
7 }& @+ F: K7 m" _* _& r5 g. m6 \ - dma_addr_t dmaphysdest2 = 0;
& n9 O" K6 T2 i" l - ) A+ E% Q; W6 \- n
- char *dmabufsrc1 = NULL;
7 ?) l% { E7 n. E, ]" _+ } - char *dmabufsrc2 = NULL;
! f/ s2 h8 P. x& {3 K; ?; B - char *dmabufdest1 = NULL;
9 M: |$ D/ |9 r" z - char *dmabufdest2 = NULL;
7 ]$ n) a2 N% h, p! Z/ y' E2 E
2 u- P6 O' A) u% ]- static int acnt = 512;
. P4 a( L: }0 p M0 D$ u D' W - static int bcnt = 8;* S' U# S2 y5 |7 a4 W$ j; c3 \; `
- static int ccnt = 8;
" E0 ] T& L! t* D - 6 v$ g. {' l8 j, a$ q
- module_param(acnt, int, S_IRUGO);# E# t5 O" e* [, _
- module_param(bcnt, int, S_IRUGO);
. j/ \* J v% }8 w9 G - module_param(ccnt, int, S_IRUGO);
复制代码
9 |+ z/ |1 z" }
& f' i' o/ N/ d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" P' }& E$ Y3 ~3 v1 A8 h: @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: _7 Y& ^" W8 r( k: Q0 J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ^9 f9 C" p/ U w4 |$ r
; i+ h/ _/ U1 W' B* v* A6 m
* f- M: @0 J c0 Z' y |
|