|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) w7 E6 }6 ?1 S# T- l, ^- [code]EDMA sample test application8 k' o) c6 |+ b) c, D1 Q/ K0 r
- /*2 e {3 \( b8 ^% `2 v% K
- * edma_test.c; X4 ]2 |; \0 B: P" c+ [
- *
9 i+ w8 i4 G1 F! P; H! g9 L+ w6 l - * brief EDMA3 Test Application
5 i3 Q5 [, p' f6 r* A' E - */ }3 a5 ^& B1 U4 w) P
- * This file contains EDMA3 Test code.
# F( {! I8 {9 \ ` - *
6 b3 H6 W5 _$ ]% g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 h0 \+ M8 o2 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 n j. D8 L X0 M8 Z
- * TO CHANGE.7 N) G2 M8 ~! `% x
- *6 g0 L, P- A4 |/ u8 t5 J5 a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; A0 `! h! _- ~6 @ - *
, d# s% Q+ ]( i. v d* e: [ - * This program is free software; you can redistribute it and/or& T% U( e, e2 r& D7 q
- * modify it under the terms of the GNU General Public License as
% }4 D& L" d I - * published by the Free Software Foundation version 2.
$ ~+ G- E3 v3 F# C5 X6 m - *
7 r- [8 c& b( e% c6 x; r8 G i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ^: }( K( V6 z
- * kind, whether express or implied; without even the implied warranty7 e7 V! f# h( Z3 R) y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 J/ V2 P8 A' E+ L8 p, {' t - * GNU General Public License for more details.6 D* E3 j: J1 r0 z: ^
- */
& N( c7 M& M/ ] N4 U4 {2 m - 8 N: S+ S4 C5 D& |( P# w
- #include <linux/module.h>
e; M0 W' ?# E# @5 h - #include <linux/init.h>
$ v) Q* j4 H7 M - #include <linux/errno.h>
$ G3 E2 D: @2 {* K. C - #include <linux/types.h>/ l2 x4 j4 \8 {: e1 M: _7 G
- #include <linux/interrupt.h>! }- ^# o5 I8 d: }" V
- #include <asm/io.h>
. l* ?& j% _ t$ R- H - #include <linux/moduleparam.h>$ B! v) Q+ h/ v7 m% z: n" o
- #include <linux/sysctl.h>
# {: p/ W$ n5 P2 N, i g) J - #include <linux/mm.h>' _; e2 z {1 |1 d
- #include <linux/dma-mapping.h>) P% m. U( f- M$ C
- ; ^" j. F5 C! [
- #include <mach/memory.h>
+ K/ M/ n8 z2 s, C1 M+ K' a/ y9 F9 P - #include <mach/hardware.h>+ H- ~. I( j7 u( r6 y2 H
- #include <mach/irqs.h>7 Q2 [! B5 `, y
- #include <asm/hardware/edma.h>; @% }: ~, P% ?- }3 d5 X
- 1 K/ w" l& D7 I( ?% p7 N
- #undef EDMA3_DEBUG$ w" T' Y4 u9 w
- /*#define EDMA3_DEBUG*/5 e: {4 u' Y* Y1 a( l8 b
4 U- F1 c1 V2 S6 k- #ifdef EDMA3_DEBUG/ i+ W9 N4 ~0 l# V2 Y1 m1 a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. j! d& h5 K0 m& c% A, Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! X' _7 o3 u% q5 X; L8 o4 ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% J0 R& J r. \0 n2 B8 @1 E
- #else
, j$ F; Y% v" m" u - #define DMA_PRINTK( x... )
# s5 e6 W0 V; s8 R& t# f$ i* r0 ? - #define DMA_FN_IN
* w9 v- }) Y# m/ N9 d, R0 `+ z1 p' }5 I - #define DMA_FN_OUT
7 v/ {3 U/ e$ R, v) j& w& ?/ v, @ - #endif
- u% }" l% b6 C, i
" P' h0 H: {7 C6 T2 H+ n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- z6 a: e* J1 n1 y
- #define STATIC_SHIFT 3: i' ^7 T( ^* n) @5 M
- #define TCINTEN_SHIFT 203 M1 y% `1 _4 S$ L& _3 W
- #define ITCINTEN_SHIFT 21- \5 [& Q7 O) M5 D7 U4 T. Q
- #define TCCHEN_SHIFT 22# W o- w: }$ W0 i' W
- #define ITCCHEN_SHIFT 23
- y3 J: G3 w. T; K. V
4 p9 F9 r& g$ o1 y% `/ v- static volatile int irqraised1 = 0;) r: }' Z, K3 K5 b
- static volatile int irqraised2 = 0;
. a' o7 e4 a% x, E( ^$ `2 g - 8 c+ h# {2 F1 T6 A" e0 m! c! `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, f& R% x4 @% X. ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ]6 P7 l$ T5 Q' P2 D" D! Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 S! @3 J( N" [% b! d
- : ]9 p" F- L; U! v$ G
- dma_addr_t dmaphyssrc1 = 0;2 w& N; b, x# `0 a' `8 s- z
- dma_addr_t dmaphyssrc2 = 0;
! A; U7 E( o6 n$ k2 A! [7 N - dma_addr_t dmaphysdest1 = 0;
) b2 u8 Q( C9 X' [. o+ ?1 E - dma_addr_t dmaphysdest2 = 0;
; r/ @0 o$ k0 `, G - ; ]% `9 T W/ p1 s% Z
- char *dmabufsrc1 = NULL;* ^0 U' D5 V1 S F$ ?4 t( l. Q% @; y
- char *dmabufsrc2 = NULL;
' o" ?% V# `# `( Y7 I - char *dmabufdest1 = NULL;
5 G% O6 b/ O5 r2 L" q) W1 J - char *dmabufdest2 = NULL;
5 E- ?" t1 k7 d/ J7 b
K8 y' t5 L8 N- static int acnt = 512;
' C1 t6 e; x. T% n- ], `; M6 ` C - static int bcnt = 8;
( `8 @9 M' h) w) e3 N: l - static int ccnt = 8;
# O. Q+ u) c, V( ]' l7 R1 w$ Y8 D - 8 Y: v& |! B: A+ n
- module_param(acnt, int, S_IRUGO);
$ T$ r& Y+ @$ ?; {4 N u/ s - module_param(bcnt, int, S_IRUGO);" q6 B8 `. x3 T6 a# n. S7 v
- module_param(ccnt, int, S_IRUGO);
复制代码 5 _( J( b3 I5 h6 a# Q
, \* i/ f/ h' l% h8 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ d$ U3 a4 O8 ?) B9 a7 l8 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) w( Z, `* O' O l- F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, b- k. L6 ~$ @0 a& e* o
; D9 t$ w* O& x3 B) Y% {
! g' _ [: w. R8 T m: M |
|