|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 b7 w1 U% U9 ]6 l- [code]EDMA sample test application$ E A, a. r* _* V' w
- /*
9 y" a1 Z0 n3 ~7 B - * edma_test.c E6 z7 x7 a: }; b7 _4 A
- *
/ p% a F' C% s5 t' i2 b - * brief EDMA3 Test Application; A- i4 n4 W) U4 I, l
- *
. J- o) |$ E- a. ]( j3 A - * This file contains EDMA3 Test code.$ B' K# c' v( Q1 E, E; n( l9 F
- *
& e& J/ u- E" ^9 I! j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) B F" y; ~( n7 b" }/ F1 a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; o6 w% m" O% ]0 W) t: I6 V; A: a - * TO CHANGE.) J, a9 i7 x* \9 w; D: G
- *
^+ S, j) d) Q; e7 C5 T g# Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% r! h8 ~4 G7 I' g; H
- *: ~. W. d) I' _, b/ ~% m( U
- * This program is free software; you can redistribute it and/or
8 N- h& j' b) `: b- ?4 Z1 y1 d$ Z n - * modify it under the terms of the GNU General Public License as: h$ p8 D; M! j- F/ e
- * published by the Free Software Foundation version 2.
" A6 N# w( a3 s8 c# L) p - *
$ K2 `! ^' h* }+ I' K. A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# `$ `* e/ \8 x9 t - * kind, whether express or implied; without even the implied warranty
, m- t C, b. C1 U- A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& l& Y8 q) W: s* n1 _2 D - * GNU General Public License for more details.
$ F) V6 C& D" A) Y - */
6 y% U! o/ V% q% C- N3 ]- G3 X - ( _6 j- F! q0 y8 u
- #include <linux/module.h>
; O3 v+ T" G: B - #include <linux/init.h># K6 u) y4 W& F) k! t
- #include <linux/errno.h>
1 Y3 T h8 ? q, Q& q - #include <linux/types.h>7 Z7 _; d0 f+ d1 K q0 U# S; @3 ^
- #include <linux/interrupt.h>
" }1 Z0 z* s- S+ K# w0 m$ l; @ - #include <asm/io.h>
( G o7 K" x" @- F* E5 V - #include <linux/moduleparam.h>
8 Z/ M6 x9 C! ~' C: ? - #include <linux/sysctl.h>
5 i, f" B% w! d: k' R& a - #include <linux/mm.h>. z& E0 F+ }: S
- #include <linux/dma-mapping.h>2 R' H- Y% c3 b5 F. J
- 1 I* G/ w# i4 d/ ~
- #include <mach/memory.h>3 G% _. @/ |6 j5 \# u
- #include <mach/hardware.h>! E" S" h# n) P- k2 U: y. x: N
- #include <mach/irqs.h>
+ `+ n) \* Q4 ~ - #include <asm/hardware/edma.h>, {& V' u- D% r$ \
- ! J/ G* j# L7 s! A
- #undef EDMA3_DEBUG" F$ X# h- x$ B6 e
- /*#define EDMA3_DEBUG*/
/ S; N0 b- R; f; t% E1 v; |
7 K$ ?) {" Z3 G$ ~- #ifdef EDMA3_DEBUG7 H8 L1 K5 I) L8 v. L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): M0 y' |+ Q/ w9 n. [$ O5 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 [. p! N% k+ M! x3 {- R9 o) R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 p& K$ i; D# u
- #else
& g( W; j% W; ^' Z# T; C - #define DMA_PRINTK( x... )( L4 t B+ H0 I& x! h6 H
- #define DMA_FN_IN0 c4 c; }1 D1 w& U
- #define DMA_FN_OUT( g3 P/ H5 K2 J* }( Q; }* g6 V% m/ G
- #endif* h1 [* }1 V$ f7 {7 Z/ \9 d
6 z5 J" j# {5 p& q2 m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 M2 j1 g0 s* ~8 h# q* i- h5 P6 k - #define STATIC_SHIFT 3
9 P1 w" Z1 k; H% } S4 d: U s - #define TCINTEN_SHIFT 20 ^, ]+ @1 q$ w
- #define ITCINTEN_SHIFT 21
9 Y9 C0 _% u l' g7 y$ [' m - #define TCCHEN_SHIFT 22, X+ r. t4 B5 J6 v* Z
- #define ITCCHEN_SHIFT 23+ ~0 u7 Q$ t3 y
# x# F' n$ B3 V$ o3 |- static volatile int irqraised1 = 0;
4 y1 P/ C' m' R& w, R - static volatile int irqraised2 = 0;
4 V' S' }, h! Y- n$ p1 _% i( M
9 c. j& _7 k Z. d& _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; w; Y$ J+ A0 G. j" b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 H( z4 k1 m* D9 g1 P; D4 } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 C, `) l. w" [7 r - J; f7 L. _- j) u; i5 V
- dma_addr_t dmaphyssrc1 = 0;
6 M" Y+ @, w& J$ t' [0 n2 Q. G - dma_addr_t dmaphyssrc2 = 0;+ B% ~) [7 {5 _( i: G& N9 z
- dma_addr_t dmaphysdest1 = 0;
% j8 P$ X5 e0 i - dma_addr_t dmaphysdest2 = 0;- s/ I! [) {- B" d# b9 o/ F
- , ?. g3 j) Y' z- R* j- O
- char *dmabufsrc1 = NULL;
4 w9 ]4 e# c3 ]1 J" k8 |. K - char *dmabufsrc2 = NULL;
& t% G- r2 x4 \- D, }9 Y - char *dmabufdest1 = NULL;
8 D8 D1 M n2 L N - char *dmabufdest2 = NULL;
7 m# b/ K1 ~& _ I6 S8 s - & x. t, v5 S7 T; s& f& S
- static int acnt = 512;: f* }( y& |4 o& P
- static int bcnt = 8;
9 b7 I" M( I& g6 w/ Q7 J - static int ccnt = 8;
1 n* {, o0 f9 N2 {/ F
7 F+ i4 m1 q2 R2 C- module_param(acnt, int, S_IRUGO);+ ~: s/ U' r# H/ q' C
- module_param(bcnt, int, S_IRUGO);9 B* y0 X6 v- M
- module_param(ccnt, int, S_IRUGO);
复制代码
& y9 E5 u3 l) V- o3 @' t
: [$ I$ x w1 [; g$ q8 l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# l4 P% h* a9 q- j# I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( P/ E. M& a7 V B) ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ i, R6 S, |8 r$ d8 d: E$ Y( I/ g5 L3 m
7 B2 C; e5 j2 ~! f) P& ?6 z& ~6 ~
|
|