|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 F7 x. B/ [; B
- [code]EDMA sample test application0 z' k! }6 b8 B0 b6 h% U
- /*
) ` ]7 J+ R$ Z2 ` v! y - * edma_test.c
, \3 Z$ t, Y) ~- O - ** _3 Y2 U6 |# s4 r7 m* T
- * brief EDMA3 Test Application
( t6 }( L2 s3 i/ u' `- s* G, q& M - *
5 s c* m2 Q8 N5 [ - * This file contains EDMA3 Test code.
4 k. \& x3 {) ?5 C. ?' U" Y3 @. R: J+ G - */ N: l5 \2 e! g& S( e" ^4 B& N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE a. i+ n9 K* F$ s" n! b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 y. T* H) p7 ?( |
- * TO CHANGE.
) G- t- o% N$ f. t. P5 h - *
1 |# @# B- l8 k, q y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 ?+ a& B I$ y; \ x
- *
. m6 G) s$ X( L! s8 x8 } - * This program is free software; you can redistribute it and/or
* |2 k5 \0 n$ }5 C4 H$ T8 U1 V& M2 X* i - * modify it under the terms of the GNU General Public License as7 G5 u1 \, H( Q
- * published by the Free Software Foundation version 2.
! D( J0 ^# [0 {3 `4 f, j; O- x - *
* g6 K8 e6 T& R5 w0 K$ r7 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 P9 C$ K! e5 V6 i" f - * kind, whether express or implied; without even the implied warranty* k( u5 s: m( \- y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) ?% P8 X j- n
- * GNU General Public License for more details.
, Y- V& u/ h( D8 W - */
$ ~9 T$ J' m2 v2 h9 A& _' z - # O/ g/ n5 B6 g: Y, m$ a
- #include <linux/module.h>5 L4 n* N; B1 } f1 A
- #include <linux/init.h>+ ? ]5 b {4 N* _, ~6 F( T
- #include <linux/errno.h>
) ^) L2 n- z8 o9 {, D: ` - #include <linux/types.h>1 l t( i& H' B) X
- #include <linux/interrupt.h>
; L8 k1 S4 H9 q+ E: u7 r - #include <asm/io.h>; \3 M/ k. B* A3 k
- #include <linux/moduleparam.h>! [$ E: f% M& v3 j9 ?
- #include <linux/sysctl.h>, t9 [7 j; y0 E1 d* U# l4 j
- #include <linux/mm.h>5 v- f+ U' I. n7 |9 x- v
- #include <linux/dma-mapping.h>
% B7 G1 g* @3 O
3 f& H ~# F! [# A' V8 J- #include <mach/memory.h>$ F$ h/ Y/ {8 z( d
- #include <mach/hardware.h>: S7 j0 a. @: g* S# X& B
- #include <mach/irqs.h>+ `; U# V' E0 ~. L
- #include <asm/hardware/edma.h>* O w7 e2 x, a8 p5 s
* F3 P: Z, F% u. b- #undef EDMA3_DEBUG
7 }, n3 y& D( c+ b7 Z# g* O4 H* C - /*#define EDMA3_DEBUG*/
* S7 ]) }( b& z( i; Z0 A/ o
3 Y4 A& k- l: I5 E! X4 y4 ?# C- #ifdef EDMA3_DEBUG
9 @3 X: t) S! V" ]+ [; V1 { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( t. G7 t2 g/ n: F$ r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ O& D, W- P' U9 a" p% E: i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 L: \0 ^1 S& d
- #else' {* P+ I E( x' A2 N5 b
- #define DMA_PRINTK( x... )' [& s! ]1 A2 j l
- #define DMA_FN_IN8 b3 ]! j+ X" O( h9 X' O8 Z
- #define DMA_FN_OUT% w( V/ x- t# Z7 u/ Q: }
- #endif* S* T! [6 J) Z2 U. D
- ! v( ]. H' S* H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) k& A6 @# `) e9 c - #define STATIC_SHIFT 3* k7 S, h0 i& v5 v6 a
- #define TCINTEN_SHIFT 20
- M% e) N5 i/ P2 Z# {1 p; O9 h( v - #define ITCINTEN_SHIFT 21
" M8 s* ~% A" O( I2 B: v2 c# V6 D6 | - #define TCCHEN_SHIFT 22; E4 L( J8 }+ o: |8 `- Q
- #define ITCCHEN_SHIFT 23( w3 l6 }6 U/ S, Z9 M7 R
- 0 f- ^4 D/ w3 t: h- \
- static volatile int irqraised1 = 0;
9 S# {8 y3 I/ e! e - static volatile int irqraised2 = 0;
* b2 ?& E$ G$ Q - 8 s. @" i6 Y5 u6 Q) E; h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Q5 _" @3 y& L8 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g% `* |, [; }2 {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 X' |$ T! K1 M% z - 5 W7 X: o; h* U9 m
- dma_addr_t dmaphyssrc1 = 0;! }3 z) b5 b9 @: u+ E
- dma_addr_t dmaphyssrc2 = 0;
4 j2 P1 J% X9 _+ {8 _ - dma_addr_t dmaphysdest1 = 0;
9 @$ U: s- N" l; C. `3 n - dma_addr_t dmaphysdest2 = 0;9 B2 N+ r+ C4 @, O) {0 R3 Q
4 `3 y1 p; ~8 I7 e" |8 f" f# w+ D- char *dmabufsrc1 = NULL;
* d5 Z4 J# J' c8 q" p - char *dmabufsrc2 = NULL;
! k5 p* d% L. \" D' ]3 ? - char *dmabufdest1 = NULL;3 c* Z, S! N2 D) Y$ ^. ^4 p" K! @: G# l
- char *dmabufdest2 = NULL;; H; m# c7 s. Y" T, G
- 4 N: K0 R9 p% r- P1 x0 |
- static int acnt = 512;
8 b0 t* ^6 h" P! f - static int bcnt = 8;$ U* X; E( ~: a: ?3 m
- static int ccnt = 8;
6 f5 e) q, H3 `$ E; ?- p
( L9 C2 r, N. ~$ h; t- module_param(acnt, int, S_IRUGO);9 }) P8 c; n1 ~( Z0 U" C3 t% W
- module_param(bcnt, int, S_IRUGO); H! ?5 W. m( R2 W
- module_param(ccnt, int, S_IRUGO);
复制代码 ( T% N' X3 p* T: w, B' \( ^( J
. E1 _0 @3 o: C- n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; S. F1 m) {+ L1 k3 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ b* H! ]8 v# r" L; t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# A; u3 S# D8 ^
4 ~( Y/ _" o4 W' z$ N
/ T/ x+ Z9 O* y8 L/ V
|
|