|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * v2 Q' b6 o* R/ a
- [code]EDMA sample test application
; e: W7 |6 W% R' f! C7 Q - /*9 ~" K! v5 H. F6 y- }
- * edma_test.c
9 a& Y$ j; A- `1 P1 c- @) w$ ~9 C - *
1 D, j9 g# s" _* ?5 q8 e5 G% b+ X - * brief EDMA3 Test Application# ^2 \% T: }% [% f- l
- *
; G* v5 I8 X, m) O - * This file contains EDMA3 Test code.* F* _& z3 c: B7 I
- *
' S c: k$ S' A* t+ \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 e o! V3 j4 S; p9 a+ ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; D& S/ ?5 A7 ], O8 a N - * TO CHANGE. Z1 \7 Q8 P4 {. x" h5 J; t
- *
z( W$ I; \; e) R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 a7 f& \& C2 J. W5 a: F5 a) ]
- *
( W4 w5 e) u5 c* H3 r - * This program is free software; you can redistribute it and/or( X7 h4 S; {+ S
- * modify it under the terms of the GNU General Public License as1 |) [* s _$ d P4 f& n, S, c- c2 b
- * published by the Free Software Foundation version 2.- W7 u0 e' z# m; } G) i
- *
( v; i8 Q! l3 p! @8 F& o! m6 a/ L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 @5 I) ~3 Y0 v: E% @ - * kind, whether express or implied; without even the implied warranty& D. R3 y4 C; @3 @/ n. C- Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 f; Y$ w0 ~5 r: k
- * GNU General Public License for more details.
, P0 v9 O+ l4 _7 ]% s4 F0 c/ B - */1 L$ \6 W. Y+ e4 a, T! `+ y6 A: Q
- 2 u4 m p% y. [ y6 |% W
- #include <linux/module.h>
! n! m" g, K8 B - #include <linux/init.h>/ L& e. b2 P8 h
- #include <linux/errno.h>
& G5 u- a: t; E - #include <linux/types.h>
?1 q* O8 y8 X* b4 i1 R - #include <linux/interrupt.h>8 _7 L# x' T8 T' ]
- #include <asm/io.h> ?7 A3 f m6 C, J' n
- #include <linux/moduleparam.h>7 @$ m4 g0 A" T* k# i
- #include <linux/sysctl.h>/ O/ V3 W" M& }+ r! [, W# x
- #include <linux/mm.h>
1 ]0 T+ {0 f' I5 w( y6 T - #include <linux/dma-mapping.h>
0 [9 l/ `- V+ S - : V3 n6 b( I1 X% [! N7 d2 @
- #include <mach/memory.h>
( n! Y6 D; b' z6 h% U1 ]9 R - #include <mach/hardware.h>$ b8 I y2 d; {/ p
- #include <mach/irqs.h>
1 F9 Q H/ w- @% ?8 [ U - #include <asm/hardware/edma.h>
A" v Q7 X9 ]
. g6 ]5 Z2 V9 J& Z# P- #undef EDMA3_DEBUG) N1 `1 ~. L/ y; [0 P
- /*#define EDMA3_DEBUG*/5 R3 k" m$ p! F$ f& |
3 t" c9 x. h. x( ~4 e! I' B- #ifdef EDMA3_DEBUG; c- c: L8 k* {3 P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; K$ e) M. W! S3 y' m3 M& Q! [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- T1 q5 z8 F# x4 V. R& r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) W5 H- x1 k3 y/ B4 ^% E, u; r; Z - #else2 r1 n, y# Q5 x! W& _. j" K
- #define DMA_PRINTK( x... )5 _: s3 d9 k1 a+ U: h" I* E
- #define DMA_FN_IN
) b |; g: s4 I - #define DMA_FN_OUT6 \1 R6 v: p! q1 P4 p4 C; H- S+ ?
- #endif' v# r3 [$ p% \9 O. V, v5 N7 t
- ' H0 Q5 E! L% m; T* y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 F* D% W6 u' p/ @$ f% X$ ^+ v
- #define STATIC_SHIFT 3
9 R; d* a- S" h& e - #define TCINTEN_SHIFT 20
1 n( e% I- X' S* J* g - #define ITCINTEN_SHIFT 21
0 E! d- j/ H l& C+ O; k% G - #define TCCHEN_SHIFT 22
4 N! ~4 S3 K5 [* ` - #define ITCCHEN_SHIFT 238 V/ z* h7 x# r3 r" `
- % z" k, g9 O, i( l2 Y+ ]
- static volatile int irqraised1 = 0; I6 W* g; l) H3 `8 M
- static volatile int irqraised2 = 0;& p/ d8 `7 N3 j2 |. Z6 d! Z
7 Y- \$ r& @7 s1 R3 j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; m2 T0 R6 x b$ I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" f9 [# K3 ~+ V; p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 v) n' ~7 _+ o: _
4 \# j; A2 Q3 I2 \4 q- ]- dma_addr_t dmaphyssrc1 = 0;2 B) V# i6 Y ^5 v
- dma_addr_t dmaphyssrc2 = 0;
; M2 s- C6 x$ B1 C9 E - dma_addr_t dmaphysdest1 = 0;
' v) k m2 j: |" Q4 M - dma_addr_t dmaphysdest2 = 0;7 y5 e: t1 O4 O# ?$ i
) {$ X% J3 P5 Q) O8 X- ~- char *dmabufsrc1 = NULL;" U! z# m7 x# D. J/ |
- char *dmabufsrc2 = NULL;
6 V2 V5 @$ ?% b - char *dmabufdest1 = NULL;
6 A) _) U5 q9 { g - char *dmabufdest2 = NULL;
6 L3 E. V" t/ T8 `0 z& e n% | - * L2 F8 Q% f: u/ [
- static int acnt = 512;
$ n; [6 E. ]1 [, d( n1 c9 O8 d - static int bcnt = 8;
5 U+ ?- }' T* I: m, Q - static int ccnt = 8;
" J: }2 L5 X5 t) e - ' s# }6 {+ i i5 H8 `
- module_param(acnt, int, S_IRUGO);7 P! v! G: U" P
- module_param(bcnt, int, S_IRUGO);. n O1 H4 J. |& Z \8 E
- module_param(ccnt, int, S_IRUGO);
复制代码 ; ^; e; P9 o: B) Z0 {
" h6 Y8 I& o+ k3 v" w# R1 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, O r5 B6 W" e2 M0 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 c" c1 C! z. s$ x( g& e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
L3 C6 T/ H& X0 K* R
- Y1 p9 y7 {8 `: _8 O/ f$ v
9 O7 q/ h" K6 A: u3 l9 e7 p' X |
|