|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . F% D' m: a+ C% b. C
- [code]EDMA sample test application2 C, [ Y; y) |& t( C. q
- /*7 E$ N; _# W0 q8 w1 Y5 [* _
- * edma_test.c- [8 A9 D F) X/ X5 K# m/ K
- *; z6 L6 ?( A9 ~
- * brief EDMA3 Test Application
) K2 C& O+ }5 F" ]( B" r - *
0 f1 `8 Y' X2 q - * This file contains EDMA3 Test code.
9 m, g; F. I0 _ - *9 n g, j& |+ B6 y0 t3 S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" S- | A% J. h* H% a& n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 U+ `# W$ b6 {7 N; M6 |3 V( K( e - * TO CHANGE.
x; N J! d# f0 n$ B& S. g9 w4 ]3 K - *2 Z0 G- P) I. E% F9 J+ b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
j7 V8 `, a* X. g; | - *
: l8 Y2 N% q; N2 w9 v" v; ? - * This program is free software; you can redistribute it and/or9 O! M: d7 `( W: [6 D/ e
- * modify it under the terms of the GNU General Public License as* F3 S* \- p7 b
- * published by the Free Software Foundation version 2.
6 p" E) n8 w2 w7 z' ? - *% W) l8 D1 P6 T( I1 `! W" ?, Q5 r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 G; n O: ?" C9 [7 z( B. h
- * kind, whether express or implied; without even the implied warranty
6 ]1 J. M8 d2 D% d( T. v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ a) z1 d! r9 H* E, [, y) q X - * GNU General Public License for more details.$ u% M! n. B4 u$ V) \9 z8 J
- */
2 G& R& ~6 U6 m; s: {0 D2 u
1 I9 P% ^# {" [5 f0 Z- #include <linux/module.h>
$ K; ]& [& k* r: s1 O - #include <linux/init.h>
5 w; I# F8 Z* L8 L. w - #include <linux/errno.h>& q" j) p8 t; k3 ~) |5 D* ~1 u
- #include <linux/types.h>
; {+ ~( _4 D7 z8 W, S: O - #include <linux/interrupt.h>
* A% ?/ {, K5 A7 I ~ - #include <asm/io.h>
" P- P7 ~( m# c9 ~1 r - #include <linux/moduleparam.h>6 t0 n- D4 U, q3 P
- #include <linux/sysctl.h>
* }6 d, P1 s5 i6 N, D) v - #include <linux/mm.h># c- n9 V" R3 ], t* `, c/ E
- #include <linux/dma-mapping.h>
' X) I1 U. E; p9 d# Q& r; [
6 o" s. ^+ @0 y$ k7 ?- #include <mach/memory.h>5 F' ?$ d( [( s, x
- #include <mach/hardware.h>' r3 t- _9 |! r; h& {, N! k# q
- #include <mach/irqs.h>, g' ~# w/ e' l
- #include <asm/hardware/edma.h>
8 q3 H8 t$ X) a0 r; v
! u& W3 x! G5 J- #undef EDMA3_DEBUG
& r: K0 u( v6 d% C - /*#define EDMA3_DEBUG*/. a' d8 W4 o2 r: v
1 J. S' r# l+ e: u$ _- #ifdef EDMA3_DEBUG. \- G- W1 I; A7 K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 j$ {, _( n% Z6 l5 i4 _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); Z* F+ P& [+ U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# M, }: q1 w9 N - #else
( ]8 ]/ _) V+ t2 I# a2 z# n) s - #define DMA_PRINTK( x... )- p8 c! S; j! O6 `. \7 ~) ^+ \
- #define DMA_FN_IN
: P" O$ j1 j4 h& H7 w - #define DMA_FN_OUT7 i. R7 V+ B0 E
- #endif
% g+ w3 y! Q' c4 ?
" Y I% B7 `0 V. V m7 h' w3 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 Z+ }5 ?! j- K - #define STATIC_SHIFT 3
7 v8 n4 b H _ u - #define TCINTEN_SHIFT 20
4 I8 D) m7 f0 [/ C% ]- {( A' g6 P - #define ITCINTEN_SHIFT 214 W z3 I# ?/ X& Y; T5 E
- #define TCCHEN_SHIFT 22
# O/ z1 L9 m% A+ ? - #define ITCCHEN_SHIFT 23
/ K; w% d _ x7 {) ]. M - 9 O) S8 p# q% K' s$ P
- static volatile int irqraised1 = 0;8 j' d0 C. x4 V! E( ^4 |7 M
- static volatile int irqraised2 = 0;. [/ K( A, u+ a- z5 m
- 7 x2 |+ H4 K; g- B+ \/ a. j$ {0 Z8 Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 v* Q! V% w5 N6 `- K$ e4 Z, s+ y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 s# f# T" ]% H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; N9 b0 J, A& v, W, h$ d - 0 L/ s: G$ `! h+ h* ]# |6 m+ M
- dma_addr_t dmaphyssrc1 = 0;
) c5 A& P) c9 P - dma_addr_t dmaphyssrc2 = 0;2 ]7 \' w& f8 r3 u n' T' o, j
- dma_addr_t dmaphysdest1 = 0; @0 y P' o/ K
- dma_addr_t dmaphysdest2 = 0;3 `0 I1 R7 f: `% f) [+ u2 X) d
& p5 P) y4 y+ G/ v* ~- char *dmabufsrc1 = NULL;
$ O; q/ v! D2 r$ O: l4 k5 j - char *dmabufsrc2 = NULL;
) }" m1 z( [. k& q. E6 w, N1 j - char *dmabufdest1 = NULL;0 h& y. D3 T5 m3 D
- char *dmabufdest2 = NULL;4 L4 l9 G% y o. E
O, Y2 o) F8 v$ [2 u8 i- static int acnt = 512;
- J) q1 u4 G3 r - static int bcnt = 8;
" ]. k7 h v# a6 B - static int ccnt = 8;
" L. m r3 v# o4 D' p& }5 q - 6 S) K5 g6 n* k0 i' H6 t
- module_param(acnt, int, S_IRUGO);
7 @9 ~' A3 l. {& E9 b$ p5 H - module_param(bcnt, int, S_IRUGO);7 K4 U( C% B. l( q3 l* t& N
- module_param(ccnt, int, S_IRUGO);
复制代码
! I' V9 {5 o! N4 ~
/ t/ u% l; U9 D+ u6 U, M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 H. @$ G0 I: V2 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ ~" u: Z w" }0 c, J$ s4 X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( I) |- B6 i) t$ \! K; X
1 @& r0 V }2 k
4 F, l6 w% {! X/ A7 | S3 \8 b |
|