|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 i" u( }# e( r' n- [code]EDMA sample test application
9 Q1 d8 ~$ N& | Z* t - /*
8 w0 F! `+ P0 W" i8 C. O' `. L( Q - * edma_test.c h4 ] L9 l t6 _" a
- *8 K% E: H- s: C
- * brief EDMA3 Test Application( I& \6 v* a& M- N
- * C7 n; y/ t/ O1 y' S
- * This file contains EDMA3 Test code.+ m% a8 t e& N$ H, M$ X' p+ }* ~- E# ]
- *# s* ]1 b% {; X; I- o8 B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ E& i h3 S: ^/ w7 `0 W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ t+ `8 a1 l$ [5 [5 @% X3 r
- * TO CHANGE.$ v; D w6 y3 c! u/ J4 q H$ K
- *
, k" o1 K9 A8 P! h3 y* S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( g& ]& p+ U M; O* y
- *2 V: y. h( }' j( D2 _
- * This program is free software; you can redistribute it and/or
T; P1 j: {* ]# F5 H- [ - * modify it under the terms of the GNU General Public License as3 M) J9 @: @" } l0 E u& ^2 }* O3 k
- * published by the Free Software Foundation version 2.
$ A" i3 N, D. u - *
% m- `1 W- Q) d3 E) q, G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* w% o7 A& @- f* O3 J6 `' T& {
- * kind, whether express or implied; without even the implied warranty
4 v! H: Q# X/ G( x& W- b, D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! I9 M% m$ g$ w3 t; {/ B- ] l
- * GNU General Public License for more details./ i0 j6 e, M1 Z8 G [
- */
1 @9 Q1 x0 v: U; R* e
4 f. c! R2 g9 b. Y8 D3 _9 B- #include <linux/module.h>
4 E$ n K+ D0 F b( l; `. A4 x - #include <linux/init.h>+ Z5 f6 k: X$ L% ^% d* G
- #include <linux/errno.h>& e/ U& G f: S0 X
- #include <linux/types.h>% L. j( J$ R+ E b
- #include <linux/interrupt.h>+ j6 O5 C8 k9 B
- #include <asm/io.h>
3 r+ P3 [' d; S* X$ d* s - #include <linux/moduleparam.h>
" e& D$ `( b* D, i - #include <linux/sysctl.h>
, A. `2 R4 A' V. s. M6 o n - #include <linux/mm.h>
% K/ H2 A! e" z5 G& \" X. k/ m - #include <linux/dma-mapping.h>+ [. `4 [1 x0 b8 z% w6 c2 I% C! h
- - {0 w7 d( c, S
- #include <mach/memory.h>5 H4 t" m1 U# H) @! n
- #include <mach/hardware.h>
' f8 K1 c1 A3 w: }' A0 p3 T4 q6 N - #include <mach/irqs.h>
% b" H" N- I: b/ _5 b4 h4 c - #include <asm/hardware/edma.h>
- e+ `% L% s* p5 C- @/ M
5 f7 ^9 t7 q" U& H- #undef EDMA3_DEBUG
! R q' T9 o+ c' J7 A - /*#define EDMA3_DEBUG*/6 B+ V; _) c1 T
5 ~% w* o# J+ S5 f7 [/ U7 z5 T- #ifdef EDMA3_DEBUG3 w! ^( J4 z* I9 O1 @9 |+ g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* H2 q/ f) x! v) i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 I( E/ U: _. V; t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 }5 \9 x$ y* U! ?: t+ S9 I - #else; t, P! F6 r' d5 P; e
- #define DMA_PRINTK( x... )
9 s0 R4 N, a( F/ r - #define DMA_FN_IN
* ?4 Z5 m! `" X1 P' q - #define DMA_FN_OUT
' s. w3 X# Z0 X5 ] - #endif
1 J) S; [. E0 \# ?; E# l
" G# `4 _. e# j1 W1 v+ E0 [( h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- j( w; B4 I( W) A
- #define STATIC_SHIFT 3
, K9 w) S. L) ~; x( L# u - #define TCINTEN_SHIFT 20
$ j$ o1 f' K) {3 ^0 b3 O - #define ITCINTEN_SHIFT 21
/ G% ?* `% B9 S8 x3 G" o - #define TCCHEN_SHIFT 22
# Q$ E8 f. P% E, E! P) _ - #define ITCCHEN_SHIFT 23
* z5 ]; _$ s# H4 n6 l
) M6 H& O" {: u7 M4 o- N! h- static volatile int irqraised1 = 0;: N! e' V9 P3 | ]# E, u
- static volatile int irqraised2 = 0;
" j7 e' M7 n$ A8 _9 v
+ X5 x9 s, X4 Y; V- l9 f8 Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- f- e9 x \) D% \0 Z4 H9 M* m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( C) ?. Y2 s3 H) | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: \ Y9 E6 _3 ^& c* n6 O# {1 ? - , i+ E) O& m) s7 g
- dma_addr_t dmaphyssrc1 = 0;" ` R9 D" J3 n- `& }
- dma_addr_t dmaphyssrc2 = 0;
- n. A: z. E h9 H. [ h" v4 O - dma_addr_t dmaphysdest1 = 0;
7 H2 B+ }) J) v& [% X) b - dma_addr_t dmaphysdest2 = 0;
- R$ ^( e! c" L; |8 v - * `+ c% [& A: w$ \
- char *dmabufsrc1 = NULL;
% N+ r1 B* R( D4 A, C - char *dmabufsrc2 = NULL;- @, ]% j8 s6 {6 \
- char *dmabufdest1 = NULL;" F, q8 Q6 i/ `$ \
- char *dmabufdest2 = NULL;% _2 t! s" T+ Z' Y" l8 l
- 1 f3 A+ d8 h- r7 o& o
- static int acnt = 512;$ `( a' u- s: H9 @2 D `
- static int bcnt = 8;
: A( b! T, M; h B* G. P, g - static int ccnt = 8;
% _" n9 C7 Y0 Z8 o J
* K: @- k3 X f7 r4 Y! ^# \- module_param(acnt, int, S_IRUGO);4 `5 T6 y. J8 T$ U [" {
- module_param(bcnt, int, S_IRUGO);0 F; U$ R# W& @* y
- module_param(ccnt, int, S_IRUGO);
复制代码 : y% ~; B4 J& y6 O7 l
; ~ O) L! {+ @3 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ @& a1 |% x' Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: Z( B- j# B/ q& d, F; p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ `5 j, Q/ X2 `1 X" ], j
7 u: {5 i& `7 M% a5 S
2 Z6 ~' M. N2 [* E" h |
|