|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 o7 l4 d- k9 D! B2 a9 A
- [code]EDMA sample test application
- h2 Z- X3 ?7 `1 R9 S* R+ E" u - /*
: M4 z/ k5 H2 I, S4 R' y' {) E$ e - * edma_test.c" H7 _) N$ Z7 [+ z+ }( Q ?$ ]
- *, \' }: d" O; J- B
- * brief EDMA3 Test Application
9 i) z" i% C5 j9 ?) Q v - *" h; X* d7 v, O$ E
- * This file contains EDMA3 Test code.
( O% Y7 o4 L, O2 C, Q$ p. v - *
M4 W, {+ i) A! m2 w5 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 i/ F W& x7 b2 q/ ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT g$ k- l6 a/ ^& R
- * TO CHANGE.
) ~- `2 T0 e! z, |- U. W" v - *3 V4 `* f5 g# Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ g; _. a( e: G+ e/ ]
- *- ]5 B% |5 X# S
- * This program is free software; you can redistribute it and/or
7 ~- ]- m( q4 B2 y$ a. S+ [ - * modify it under the terms of the GNU General Public License as
# A) H' D/ x: \- x% f+ j) j - * published by the Free Software Foundation version 2.( f# {" F) {3 A/ c" ?2 ?) M! y
- *
3 d, D) c S! I* t2 y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ b2 M2 Q! n! o - * kind, whether express or implied; without even the implied warranty
5 a. L; M# S4 q: Q4 c# [/ d0 H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 ^* i* {/ B f
- * GNU General Public License for more details.
, d/ p1 X* j% r6 T9 `0 J - */
; E; I$ a$ _& Q
0 C0 t$ {* J# c C1 n- #include <linux/module.h>% h( K, u; a* }- ^
- #include <linux/init.h>+ J+ q* g* z8 w( D
- #include <linux/errno.h>4 B; @% h T" C
- #include <linux/types.h>0 K3 R7 x# _. } }! R
- #include <linux/interrupt.h>9 c) o; [3 K: X( z8 P
- #include <asm/io.h>7 H( V2 z1 }8 W; C
- #include <linux/moduleparam.h>
. W+ r" u |' v+ V% B - #include <linux/sysctl.h>
; ?& V" W, ^ @7 }3 f) m9 S0 {- v - #include <linux/mm.h>; L X% {9 e9 q
- #include <linux/dma-mapping.h>
, p) t& D# z9 E' V2 s' Z
! a# ]) R' |9 L2 D- #include <mach/memory.h>+ f2 `1 _! ~, K9 a2 o6 ~4 I, h; Q
- #include <mach/hardware.h>1 _9 B9 N5 g' u. M! i* C. p7 H. M
- #include <mach/irqs.h> d1 }$ r6 K9 k; X9 ?; ^
- #include <asm/hardware/edma.h>" i! p$ ]' y# Z4 H% o) {- C& s
- 4 U2 a) Q: }+ K7 L5 S. F
- #undef EDMA3_DEBUG' ?+ ^4 a) q' f& y
- /*#define EDMA3_DEBUG*/" Q$ M Q6 u! C
* V; x. ?4 _- G' _, t5 f- #ifdef EDMA3_DEBUG
& _1 D. }+ E6 t! Z' _/ P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 H8 E4 w) H+ g) ?# m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* u& S/ ]8 U. G6 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 O, x8 s; \( u1 h1 P" K - #else
4 L4 m9 j9 F m0 I, {5 Q0 C3 ?, ` - #define DMA_PRINTK( x... )0 b/ d" {4 ]( u0 C: b# t
- #define DMA_FN_IN0 U4 Z( x/ `, {+ Z; X) v* g! W
- #define DMA_FN_OUT
% S% Z8 r# r; ?4 T! C - #endif
5 o! L6 I' U! h! p; t - 9 |1 E$ T3 y6 ]) l1 @9 o" T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' ~. T" Y2 D* T3 h' y: [9 w" `
- #define STATIC_SHIFT 3! f9 d' I7 G% d n+ d2 S
- #define TCINTEN_SHIFT 20
% d, o& Q8 v* d: i - #define ITCINTEN_SHIFT 21
. \" e: `4 k6 N5 ` - #define TCCHEN_SHIFT 22
/ ?" X" }' @: T) f1 Y( u/ G - #define ITCCHEN_SHIFT 23. J) E! E1 Z0 m) {: B Q
- 3 @4 [2 }1 z X( M
- static volatile int irqraised1 = 0;
! F* F# `; q: w+ ` - static volatile int irqraised2 = 0;5 v: J0 c2 T( Q5 @ f0 ]! y$ R L2 R! Q
2 |2 y8 n& U* B: C, _* V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 h* E# S, F2 l" K* z J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) S% w# b: d; U5 O# U6 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); i1 C+ g+ e1 E Z |) R R
- " ?* c! _) X4 Y# C. k
- dma_addr_t dmaphyssrc1 = 0;% t2 m; l) E8 V7 V1 P3 e8 U
- dma_addr_t dmaphyssrc2 = 0;8 ]" O4 \8 C7 s, A" D
- dma_addr_t dmaphysdest1 = 0;
" l, N# w1 v5 Y1 K) I6 Z - dma_addr_t dmaphysdest2 = 0;
9 M7 ?, }# ?8 n$ ?9 [' y- @! @ - 6 M, H4 P& N( ?
- char *dmabufsrc1 = NULL;0 f" v' w, t$ o
- char *dmabufsrc2 = NULL;
/ T( B2 \: P5 }& B# O4 S8 ]: U: u3 M - char *dmabufdest1 = NULL;; h2 \% V8 P' S
- char *dmabufdest2 = NULL;8 y+ E. s4 |, x
$ X7 t& p5 d) b1 \* s- static int acnt = 512;
' d0 p& E+ k$ |' L& e - static int bcnt = 8;
* v" g `3 U& y9 e - static int ccnt = 8;4 A9 p" s; L& b. y. r1 W
- 2 E: o7 @: l4 o1 o3 [+ A
- module_param(acnt, int, S_IRUGO);9 x' f5 A2 g+ _
- module_param(bcnt, int, S_IRUGO);
6 s3 A8 z! N& D. I' `: Z - module_param(ccnt, int, S_IRUGO);
复制代码 : S J \) j- V" m
# t2 J# G( x( A. T* H0 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; |4 g/ N+ Y8 E9 w! v3 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, C3 T3 C$ _/ E7 {4 X' n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 s4 P z, m j i; J
6 C4 A* s$ t* \1 n5 z
% }* C: ?& I- X; n% |7 w' @ |
|