|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% n, G8 p: j; F! Z! S" t- [code]EDMA sample test application6 |$ E5 g3 L( ?) N! Y
- /*
8 l/ q0 S' j2 f/ ?3 k: O - * edma_test.c4 _# k+ H; M" n. Y
- *
3 ?# y X6 Y Q - * brief EDMA3 Test Application3 C' d7 X' |2 E
- *
6 ^# D$ ~. M; K( a% I6 r - * This file contains EDMA3 Test code.
3 q W5 c; N5 {! t5 X - *
1 q+ |9 q( ]) O* v' l1 M1 Q. v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) t+ |! L/ [: }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- {8 }0 ~" M" o' b3 b. c! ?1 J
- * TO CHANGE.8 g0 U! L- j% ^
- *
6 b% f. G( M8 M$ `) k+ v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& ~& ^3 g& o, ]# ^( i - * L8 q5 p `3 r$ |' l5 c+ W4 A
- * This program is free software; you can redistribute it and/or
5 }7 p: k' s( P5 `9 R: q7 U - * modify it under the terms of the GNU General Public License as
9 W2 R v+ }6 I" l, t - * published by the Free Software Foundation version 2.% `$ p/ q" R- k8 Y
- *
8 S2 u& u0 T) I2 Q% S3 j8 ~% b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 L( q& x2 Z2 ^9 x h! \ - * kind, whether express or implied; without even the implied warranty
9 Y1 y* B. @% ^- c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 n. N: D5 d+ O: F( S
- * GNU General Public License for more details.
. g# Q8 H$ p& v. x8 }& \/ ~ - */% E6 ^& i& }4 }$ B4 \
5 ]4 k; X3 B7 H8 u9 R- #include <linux/module.h>
: {% c; p5 X; J# n6 G - #include <linux/init.h>* H/ I( C$ L5 y( ^
- #include <linux/errno.h>
Z8 I r* J) k, F6 y - #include <linux/types.h>
7 `& _* y+ f) I# T$ A - #include <linux/interrupt.h>
$ t( Y% [4 w; Y6 B; {3 U - #include <asm/io.h>
* p$ Z; I. V% A - #include <linux/moduleparam.h>3 _) T3 m+ i& \! }6 e
- #include <linux/sysctl.h>
3 x$ t+ @$ m! r- N+ o5 ` - #include <linux/mm.h>" |6 u0 R/ |+ Y4 M3 U9 ?
- #include <linux/dma-mapping.h>
4 Q- x V1 z3 c- a
P9 z# X8 y8 p# u. W" }4 n- #include <mach/memory.h>
! C3 V7 _' T( }" F0 |8 U9 h - #include <mach/hardware.h>
1 ]# ?; e. ]$ w - #include <mach/irqs.h>
2 ^6 p! S- H( i# w* f$ ]- I3 R$ d8 ~ - #include <asm/hardware/edma.h>/ |0 {- \0 |" P( X, @( O
. X$ q! _3 k$ x- p- #undef EDMA3_DEBUG
+ q0 C& j7 K9 R: M - /*#define EDMA3_DEBUG*/
T) M$ O% b2 S u" K/ c, F
2 Y: U3 n. U& E- #ifdef EDMA3_DEBUG0 ^/ I6 E* o9 ~ k) D/ \! X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) ?6 L- l7 d* e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 Q2 A: a- u0 T3 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! x4 }' G( e/ n2 Y, D3 j( r. A+ r - #else
: ^( S' w' e% @) c' C- z! u - #define DMA_PRINTK( x... ), E/ k4 L$ [) r) c8 X5 T
- #define DMA_FN_IN
+ P$ E8 S. h! R" W" T f a" j - #define DMA_FN_OUT7 {4 _ d0 I; T
- #endif
7 B+ y8 q: A. B& g - 4 f2 C8 U: c% T+ O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: U* V2 @, k* D% I! N0 U - #define STATIC_SHIFT 31 d5 x% z) G; D( J
- #define TCINTEN_SHIFT 20
9 y: d) X& o6 w( i( K, h& B' e - #define ITCINTEN_SHIFT 21
$ X" o' Y0 d) r4 H& i, t& o - #define TCCHEN_SHIFT 22
3 V7 {, Q) Y) m# Q) {0 R( {7 O - #define ITCCHEN_SHIFT 23
5 v9 E: B. V8 e1 u9 k" N - " ^3 o0 b3 r" x; }
- static volatile int irqraised1 = 0;5 p4 B |5 p8 d U5 Q3 r6 m/ [) u2 ?
- static volatile int irqraised2 = 0;
& F+ f6 t# G) J. d: s8 g - ; Z$ O/ q# X/ s( Z* h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 l: s! P" v W" h& ^6 x3 {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& }: D5 ^+ r1 f; t+ m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 L. e" \ a* l+ M& s5 J
( G1 ?* g* q# s4 y* K4 b- dma_addr_t dmaphyssrc1 = 0;# I% i+ f' V. d7 i$ p! I0 V0 H6 @
- dma_addr_t dmaphyssrc2 = 0;
d3 h F+ ^" U3 r9 _& L' K B - dma_addr_t dmaphysdest1 = 0;" |, t+ @! B; e& k$ u( x
- dma_addr_t dmaphysdest2 = 0;
" @0 [0 B+ ?8 M% { - 8 Z! k& ^. X$ i, m2 ~
- char *dmabufsrc1 = NULL;
+ _# O1 h4 F% w! d5 r- o; m - char *dmabufsrc2 = NULL;
# ~# W$ f, C# i1 h6 n T - char *dmabufdest1 = NULL;' C. @2 ~, ^4 s3 n- ~8 x* q) U- a
- char *dmabufdest2 = NULL;4 N0 ]) w# f- |, K5 Q- l
: U8 p" i- H" o5 i8 L! I' E+ J- static int acnt = 512;6 M* }. y J/ Y& B- c# M
- static int bcnt = 8;+ r W% P* Y* D& w
- static int ccnt = 8;1 u2 d" }* U/ _
$ I3 M4 D$ j B: T; l! K/ |8 M- module_param(acnt, int, S_IRUGO);
3 u6 n0 x. M; M P# F - module_param(bcnt, int, S_IRUGO);
: a7 U$ N) {0 X - module_param(ccnt, int, S_IRUGO);
复制代码 + c0 H& @" R7 \; g/ X' Z. d: s' ^
a% ~: s+ O0 _* m* Q* T% y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) w1 }' j) o0 _3 ?" t% Q! P- G# Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) V W# q4 P- o) H4 d6 c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% r+ M4 S: I$ n) C
6 p) U* b$ L( k) o9 b. F$ g! c
' V5 a+ Z* ?' Y9 b |
|