|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, O% }* a! P1 h+ f8 T- [code]EDMA sample test application" H+ A5 F7 s1 l7 l
- /*
5 v' a! y4 {$ `3 y: y& D# m - * edma_test.c3 o, ? |; b7 A4 M4 h5 d
- *7 s2 l: X* }) W, H, ~$ k ?3 a* n
- * brief EDMA3 Test Application3 T1 l, o. [3 H8 A# @7 U- X
- *
* L& y/ I: x m# F7 _) H7 r - * This file contains EDMA3 Test code.
' }7 i, [/ o5 z" d6 d. v - *- [3 q) `" U; m4 F; j6 g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" G* Z. Q( l: | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 w5 N% W" }0 s5 i3 i. V7 P& E! O
- * TO CHANGE.
- t/ w4 j2 I1 h0 `' m - *
; e! Z6 S& P4 |% y/ z5 F! o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 F8 g; E* V& v [+ @! ` w" m: r - */ s: A" @- e" X+ R
- * This program is free software; you can redistribute it and/or( K% G/ P% U7 L/ M
- * modify it under the terms of the GNU General Public License as& [! D( u, q1 b% e$ z; M
- * published by the Free Software Foundation version 2.
: j2 Y( e5 f$ V7 H5 w - *
+ i2 L2 \- j- o# B( r% K3 Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& D$ T3 P! d* m) _2 v" j! |+ D1 g - * kind, whether express or implied; without even the implied warranty# b/ a" W8 g. f- m! P" d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! g* m3 z( {- P0 Q - * GNU General Public License for more details.; {3 d1 w* _! M3 E
- */
1 v8 a7 ^) G0 {6 ~1 W" q* ?" b0 d/ s - ]1 ~2 `' f) a/ e) e" V
- #include <linux/module.h>
1 d* n. @* v! M# K - #include <linux/init.h>
+ x6 y4 v9 [+ ? - #include <linux/errno.h>" s ]* M3 F! k. |' V* [
- #include <linux/types.h>
0 K0 m( b, e1 q# ~ - #include <linux/interrupt.h>
" N, d9 v8 c. F% A% Y$ e: `# ?, l - #include <asm/io.h>& y/ M7 J# v; n: {! D; L& i6 m
- #include <linux/moduleparam.h>) {* T! z" q$ W/ ]0 ?2 q" t
- #include <linux/sysctl.h>& v' y1 f; O* S
- #include <linux/mm.h>" ~+ E# r2 N$ [6 g
- #include <linux/dma-mapping.h>
) s& q. w/ y# H! K( f
0 n/ p4 ]$ }9 q; @ u9 }- #include <mach/memory.h> H2 q8 q! `( h$ M; z
- #include <mach/hardware.h>
" p! s; H1 _4 e: `3 o' A - #include <mach/irqs.h>
( V8 N! \- x* U; w - #include <asm/hardware/edma.h>1 h. Z. G0 ?* g& q& \3 D
- B- E' v- Y2 p, p
- #undef EDMA3_DEBUG M9 q M+ f( P! n4 C
- /*#define EDMA3_DEBUG*/
! \# a0 G6 C6 S. U
" Y/ b& d& z$ ^$ n2 F* E- #ifdef EDMA3_DEBUG
4 u9 T9 {/ K, U5 J" f# L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- V% t! t: m, z5 C$ F! U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# _) t. ]1 N: W: ~5 ]% Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# n( I* _& q9 ]9 R( b* v
- #else+ I" j9 T3 L; y' h2 A& U; X+ ~3 B3 A
- #define DMA_PRINTK( x... )
4 p" t% I/ j" w3 N% R - #define DMA_FN_IN
0 q" ^7 w q0 U0 b - #define DMA_FN_OUT- A; k2 n, J+ {3 j# H: V! j5 s
- #endif
* R; o, _9 H8 @9 @ M+ p% M
# s. F/ A3 ^7 M# ] O4 D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% @8 M$ V; w8 V1 ^0 p - #define STATIC_SHIFT 3/ c5 ~ j7 @* _- j3 n7 E$ O
- #define TCINTEN_SHIFT 20
" }( C) Y6 J( ^7 F1 W5 I - #define ITCINTEN_SHIFT 219 A& h* q+ ~& z9 T7 t* _
- #define TCCHEN_SHIFT 228 _* B3 ^: e& i& f. Z1 w, l6 a# o9 X
- #define ITCCHEN_SHIFT 23
! W8 U* R6 {/ {
% l+ P% |& z' r$ z; }5 } f- static volatile int irqraised1 = 0;& W/ `: l0 b. C
- static volatile int irqraised2 = 0;
% I/ b! l. s- f- ]" T: {8 R, w - # {& E3 k9 q) z& o" r. a6 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 u" K% [" X# q9 b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& l; L$ {" Y$ n6 @6 S/ j0 }/ U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, J |0 U) w3 \! i' R/ x
- , A/ N) y% u: m" A3 U3 [: T5 o
- dma_addr_t dmaphyssrc1 = 0;
. j9 Q& Q; l3 X6 c - dma_addr_t dmaphyssrc2 = 0;3 i8 ^6 \) v& i$ ^) {
- dma_addr_t dmaphysdest1 = 0;
) G- S$ R; C6 G. Q* L8 w5 [/ H" d# y - dma_addr_t dmaphysdest2 = 0;
9 I1 P" A4 x3 v) r) q8 Y - $ l2 j2 p+ U- F* z! \
- char *dmabufsrc1 = NULL;
/ S6 r0 V/ U7 h) d7 Y% I( Z - char *dmabufsrc2 = NULL;
6 B+ F/ Z& G3 O; ?- A# D: F - char *dmabufdest1 = NULL;
* @) Q7 l& w* v& c- x! c O - char *dmabufdest2 = NULL;
1 a% b% m% }* O - 5 t9 }' C1 L" n, J' m
- static int acnt = 512;" N6 h: a7 U2 u5 ~: G
- static int bcnt = 8;: r7 s5 f5 X) ^: }+ X @
- static int ccnt = 8;2 g" K, |3 s: f+ l K3 n6 C
, J& t H$ O" ?* K- module_param(acnt, int, S_IRUGO);
5 B9 Y, n6 s6 ~, o9 [) Q - module_param(bcnt, int, S_IRUGO);
- M, D/ ?& v2 w4 m- Y0 }' A - module_param(ccnt, int, S_IRUGO);
复制代码
4 x" |- \! Y1 \5 K9 m* S$ o# W# n8 v' J# _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! S! j5 ^0 `% j4 {. }4 P; |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 a$ c# W! ], x- ?9 F- E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% Q1 N& \; ]6 z# o0 O
- s* A! N8 f+ F) _! \$ r3 w/ }, i- L6 J: Y x
|
|