|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( a# ]4 d* a2 x: o2 n) N% Z( b
- [code]EDMA sample test application
% P8 ] k" P' N, z; _; ]* q% j - /*; H' Z D. B. ]
- * edma_test.c/ [+ `$ Z C% l6 Q- i u
- *
# G% w5 d5 V( J( e - * brief EDMA3 Test Application
3 d1 O& a% A* |6 _" U7 w( D - *, |; t( H G* |
- * This file contains EDMA3 Test code.. i* s" U1 N V7 x, u4 \( p
- *7 B7 S8 k( s) M+ t0 f6 Y! V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) J/ d | t: ~1 |* s4 m& D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: T/ n# N9 V; \ - * TO CHANGE. }% n3 C8 D: n% ]
- *$ L. {; g5 N K2 q/ a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( _! ]; O/ e7 X& ]% a
- *; v _) ]8 J. m; Y: L- _
- * This program is free software; you can redistribute it and/or5 ^7 h- n' @ d! ?
- * modify it under the terms of the GNU General Public License as( L V& b' d! k) F/ E' P7 b
- * published by the Free Software Foundation version 2.6 L& m' E/ w" H* ~3 s0 d
- *
6 Y# @8 D# f! ?% q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ P! @& e1 L7 [& [
- * kind, whether express or implied; without even the implied warranty& r2 N: W! s/ |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\" q5 B- J1 Y4 d; G6 y$ Z5 n - * GNU General Public License for more details.
4 H0 v1 c# j. I* t U! m: Z - */5 G8 {' E8 e! [( {
( y! q8 y8 I2 b- #include <linux/module.h>
" v" c$ a6 G3 l( @- u% @8 q1 R& ?+ r - #include <linux/init.h>' x4 A5 I* @. H1 c6 ^* f/ |
- #include <linux/errno.h>" a) K2 @/ Q0 Z) S4 W: D
- #include <linux/types.h>
3 k% c+ S6 y* |7 T! m - #include <linux/interrupt.h> K5 U( s9 ^# N1 W% q1 M8 ?
- #include <asm/io.h>
6 F$ I0 a& {+ r9 W/ i8 W - #include <linux/moduleparam.h>
6 D: p" b5 `& f* O" q) S - #include <linux/sysctl.h>
* q( V) G) x) q6 R! l# S. D - #include <linux/mm.h>- p+ | k% F( p* H, e8 J3 u
- #include <linux/dma-mapping.h>
$ Y2 N, d4 \) S8 E/ [' i% C# s( t - ' k ^0 f, n" N. D
- #include <mach/memory.h>
# n4 H! r8 H6 J5 C - #include <mach/hardware.h>
) p2 A$ j" K( u - #include <mach/irqs.h>
5 m3 ?0 s% D6 n: q7 U" ^ - #include <asm/hardware/edma.h> S/ y: y+ _* x) R, r* i( b+ G r, r. i
- ( h3 I7 k' u6 \
- #undef EDMA3_DEBUG8 S3 Y5 q/ g1 W9 X& q4 }) K- A
- /*#define EDMA3_DEBUG*/& t; h: M' N* x* B' T8 Y' q4 z& `
) B& Y- t4 {3 e' ^& N) q4 U- p- #ifdef EDMA3_DEBUG8 F% X7 S3 @, ?) q5 W j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 x* _4 w2 P* W6 J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 R8 E5 y _/ w L m7 H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 g* ^/ l% J8 m& U, w* [
- #else; ~8 X7 P3 Y L0 R6 g9 d. c
- #define DMA_PRINTK( x... )
* A: R! z/ C" S - #define DMA_FN_IN
7 A: B" }6 u+ D) B% [9 ?! t0 A9 ` - #define DMA_FN_OUT& Y: N# _0 y7 p/ R
- #endif @- p: N# [8 Q! Q/ r! U
- 9 _) a* s# H1 b9 C2 V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' |1 E& y% \, g) Z
- #define STATIC_SHIFT 3
- m% E: I% S3 F' e9 a7 X8 _ - #define TCINTEN_SHIFT 207 m4 A0 C Z" [" ?+ l5 a5 H! k
- #define ITCINTEN_SHIFT 21
9 q* F, i) I& V! u! o - #define TCCHEN_SHIFT 22
4 S- `8 c) \8 Q0 W( A5 Y$ J' \2 q - #define ITCCHEN_SHIFT 23/ B3 a0 Q# R; ^7 R# x5 ?
- . ^; w0 {8 w& @( K j
- static volatile int irqraised1 = 0;
6 J9 y: [5 x6 m. F1 Q6 J1 x - static volatile int irqraised2 = 0;: m) l: r5 {& ~8 }% G4 x
- 6 V# Z% I: ` u b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ^1 W8 o0 ^3 V% c- K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) W2 I- i/ R' O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: Q. _' ^( G- l+ ~7 D: a
$ N9 m( O1 _( U5 n: N7 ^* O' o- dma_addr_t dmaphyssrc1 = 0;, U8 n) t1 O5 w% R2 }6 }8 U
- dma_addr_t dmaphyssrc2 = 0;
1 D7 g: [7 q1 G: q - dma_addr_t dmaphysdest1 = 0;
2 s9 m# A. G1 ?5 G - dma_addr_t dmaphysdest2 = 0;
& T8 F4 r j/ h H9 v8 q3 ] - 6 G" F' b4 o; Y1 H2 E
- char *dmabufsrc1 = NULL;) f/ \9 l/ \& Q, \. }) o
- char *dmabufsrc2 = NULL;# }1 `' c7 i6 L
- char *dmabufdest1 = NULL;
; [4 @4 D& z3 Q4 J5 ~ - char *dmabufdest2 = NULL;
. E. c; K7 h0 j4 G - / b `2 q3 b [% [1 H v
- static int acnt = 512;
9 b% U! @" f1 N8 b - static int bcnt = 8;
8 o; A' ?- u3 j7 N- U - static int ccnt = 8;* f7 _6 E. i) F- J1 f* S: ]
% t n* B1 l7 c/ y- module_param(acnt, int, S_IRUGO);* ^+ i: c H X# n
- module_param(bcnt, int, S_IRUGO);3 e# E2 o1 }0 f; ^- O8 o; w! b
- module_param(ccnt, int, S_IRUGO);
复制代码
; X+ Q$ _: P; q$ [: _$ T7 K6 [- N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 @. e1 f# e9 T" N; f# e4 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 d$ a! m# g$ |# v" q1 C3 p& k8 i: \/ [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) k4 X2 W$ `8 u2 G
]; _1 ?, K0 V6 C
5 b5 E; C, W/ D+ t3 s |
|