|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - {1 x1 [% r( m" ^# I9 |: Z
- [code]EDMA sample test application
) M8 { U( ^1 [1 y - /*
}% o! [7 C7 W9 x - * edma_test.c1 |; u/ Q" w% L) c! w( F& `
- *& T( a. [9 r7 n- r4 j
- * brief EDMA3 Test Application- l$ z9 q5 F8 g& v
- *4 O! G( p7 s ?; J; Y
- * This file contains EDMA3 Test code.
) b+ ~/ D. M S1 Z+ O/ | - *% k, z: v9 S+ X' p* e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ x3 x y I0 u5 v2 |7 X3 u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# r; f) f! l% p* \: H1 }" Q
- * TO CHANGE.. c8 v* Z& ^1 }
- *
3 R1 t8 E) V" @' g6 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- \2 @+ w' e7 d
- *% x3 m. I( [/ m8 H& T
- * This program is free software; you can redistribute it and/or
; a \' L+ f m- p5 r) W - * modify it under the terms of the GNU General Public License as
: z# G7 c) O; k% j1 ]8 q2 C& C& s - * published by the Free Software Foundation version 2.
& L L/ Q$ v2 K8 _9 L' } - *
2 k# Z1 Y) j2 G) I- q# I2 {$ I1 N% v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- G8 B0 O9 l( _+ u" S( Y - * kind, whether express or implied; without even the implied warranty& S3 ~( S! w5 `6 i3 @9 ^0 b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! a# R+ ]8 Z2 f' f8 O
- * GNU General Public License for more details.- q/ B9 F2 Y5 g0 o5 I
- */
+ `# B) u7 M3 H) G - 1 j( _7 y; K7 u' U( ~
- #include <linux/module.h>
7 h9 U2 C1 n& C, V3 J# q4 C - #include <linux/init.h>
& h. k- G7 G" P$ J7 Z7 g A0 K6 g - #include <linux/errno.h>" h: U9 }4 L. s3 T& }# t5 V
- #include <linux/types.h>
) H: w# ~2 g) ?4 a$ K& i" q - #include <linux/interrupt.h>
, q( m0 z4 i' I s) Q# k+ D - #include <asm/io.h>- O- Y b8 `2 t9 {( I
- #include <linux/moduleparam.h>' I# F* D8 S/ H
- #include <linux/sysctl.h>; D5 R- l* Q8 ?5 ~3 X5 e" d* ]
- #include <linux/mm.h> Y. B, I4 i8 A2 x
- #include <linux/dma-mapping.h>4 q* Q5 y7 d% u$ f
. w; e/ @. n7 H9 @- H4 s9 E- #include <mach/memory.h> z5 y0 G3 O' h" t
- #include <mach/hardware.h>
$ u# [$ {# q; A. m) a - #include <mach/irqs.h>3 j! W+ p5 c' l' ?3 x
- #include <asm/hardware/edma.h>% ~( [; Z% M! O- _4 V) X
a7 x5 e! m/ N) Z5 O7 N$ p- #undef EDMA3_DEBUG
5 O/ q: m: w) U# n8 D5 X - /*#define EDMA3_DEBUG*/" y$ ]# Z; T" F& i- e
8 z. k* C% X: B: T7 J- #ifdef EDMA3_DEBUG |/ g: V4 F" B4 y4 G: k2 J. ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 L7 f8 U: l. V: W+ l) W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! h8 F& ?5 `# l4 a4 E: T) R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( B8 b$ Q7 x5 f4 N( c - #else, L4 f7 F& _+ k4 ~
- #define DMA_PRINTK( x... )( a. I0 |+ \4 o
- #define DMA_FN_IN
* e( L- {9 [1 s w/ L - #define DMA_FN_OUT7 d5 \4 Z% B/ C0 d; c3 v
- #endif
! w2 ^- ?+ h( D3 T- p( c! T - + z- X7 X1 y! ?6 J% o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ Q ^5 ^* `$ g, t- v - #define STATIC_SHIFT 3( j! X+ J% z3 h% M4 `- G+ k
- #define TCINTEN_SHIFT 20+ O; y2 D; Y* d* a
- #define ITCINTEN_SHIFT 21' o6 R$ u& w7 Y
- #define TCCHEN_SHIFT 22
/ t2 m. x! o3 F, X5 L* d/ } - #define ITCCHEN_SHIFT 237 A$ I ~* Y. j; T* t6 E. K
8 w7 x* N# f. O1 h9 k. L7 h) d- static volatile int irqraised1 = 0;
" X( Z2 b- d+ p( O - static volatile int irqraised2 = 0;4 S/ ?% u% V5 F4 u8 A2 _
- . Y6 `$ j4 ^$ v; v4 \! h/ O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* [6 u& \* `* |3 m/ ` } U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 w8 S. d. H6 @( n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m( Z0 ~6 m; E: \# W# S8 T
9 Y8 d; _3 h% f- dma_addr_t dmaphyssrc1 = 0;
3 m% Q0 o3 x- _+ v3 W4 [+ b- X) h+ _ - dma_addr_t dmaphyssrc2 = 0;
2 ?0 y5 [8 L" \6 V: j2 }3 e - dma_addr_t dmaphysdest1 = 0;
2 e1 y. M: ^$ _8 W) g - dma_addr_t dmaphysdest2 = 0;" ^! C. @) w! i& h: k+ W
- . P7 k. w" V5 F" W m
- char *dmabufsrc1 = NULL;
" Y8 A) g# A: O8 z - char *dmabufsrc2 = NULL;
. Y' D" K/ L m+ B - char *dmabufdest1 = NULL;4 J; h; }9 t* _5 d. B; M! f& I
- char *dmabufdest2 = NULL;# _9 a: i+ `1 T8 ?
# ]* h L* g! S E. D- ]8 ?7 m1 s' \- static int acnt = 512;2 |% n4 M# _, X9 K
- static int bcnt = 8;
$ p% b8 z/ t3 D9 }4 P - static int ccnt = 8;
5 H) M4 c3 A8 X2 B! Y/ P5 Z
1 _" A9 l/ y; P$ z9 @, d* S$ L. o- module_param(acnt, int, S_IRUGO);
* Q @. R5 m4 x0 b" I - module_param(bcnt, int, S_IRUGO);& H Q' }8 Q! n# ~3 ^2 ^- r
- module_param(ccnt, int, S_IRUGO);
复制代码
2 `6 @9 ~2 m4 @5 ?8 d3 E# x H# [# e9 ]5 A6 Z: }0 {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, L _! R5 t; |2 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( p" Y# w$ C6 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 h" q1 V6 @, c! E5 B1 T( c: P
% f6 }/ p q/ ]- Z" h0 A+ `! d- G) ], z6 O: I- ?$ g
|
|