|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - N% V8 R+ S' a+ ^
- [code]EDMA sample test application
: E" }: Y! b2 w9 e( W - /*
+ p- m+ {5 D5 n - * edma_test.c1 n! y% y! V1 g) T* s
- *% e) K% q- N" y3 f. W4 n: d
- * brief EDMA3 Test Application
. Z$ i+ b N, @* A2 p - *
4 c7 L. t0 o) c$ g - * This file contains EDMA3 Test code.; V# ^' [8 T, w# I+ |+ F
- *# x# ^* D" J. a) c, d( G8 _$ j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ h) d' ?5 m# u6 @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 D0 p/ I% u& | - * TO CHANGE.* j6 f3 n" Z W6 f( l
- *- s1 L) h2 H- o1 T, |6 y6 M9 t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" ~7 T! O% w) P* X* W" A* q - *( e1 D% n* e" e& A1 W7 a1 X
- * This program is free software; you can redistribute it and/or
, ]! S$ k5 n" [; t. d) ? - * modify it under the terms of the GNU General Public License as
# y$ G: n* E: [% Z - * published by the Free Software Foundation version 2.# S g! ^* |* d# k/ t
- *
# M( y' r( r; X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* [, j) y! Y9 t
- * kind, whether express or implied; without even the implied warranty
# k" x! h3 B8 k5 U( x+ ^( C3 U; Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# t, u; u# J$ V6 o$ x. @% B! H" G) a1 K
- * GNU General Public License for more details.
% ?& p( a0 m% f! W - */
7 n2 {- q& o4 B, M9 C3 j
4 Z I W# i; _6 t' w( v- #include <linux/module.h>3 `# z/ d. J0 l, ?/ ?
- #include <linux/init.h>0 [# s! E5 C! b$ O4 V
- #include <linux/errno.h>
9 g3 d: }- {! N/ ] - #include <linux/types.h>
4 V/ N0 Y c* ]2 c5 |7 F6 | - #include <linux/interrupt.h>
! r Q5 o( Z! v4 w& d9 j+ I8 @ - #include <asm/io.h>9 L6 u# h0 I Y" l5 h- n) F! k
- #include <linux/moduleparam.h>
, K) S+ L6 G8 p4 b$ U: w4 }% r# e4 i - #include <linux/sysctl.h>* U% ?, N1 E( v: ? w; `- o
- #include <linux/mm.h>
) h1 X+ ?6 z* s - #include <linux/dma-mapping.h>" k0 L+ V- q9 |1 w
0 ]* X8 f& ?& _0 m9 I2 \4 K" @- #include <mach/memory.h>
" _& w1 x: u5 u - #include <mach/hardware.h> w% ]; X6 G$ o7 P0 w5 t* s% `* X
- #include <mach/irqs.h>1 l; p; {, C! p$ V
- #include <asm/hardware/edma.h>
' x9 l0 l2 D6 ]0 v+ [5 \0 J1 y% e - 5 K5 P) J) x; u0 I- \" d6 v
- #undef EDMA3_DEBUG$ q) i' _' V6 ~0 X: v+ {
- /*#define EDMA3_DEBUG*/
4 [8 U7 u& s: v, O* b3 U3 ^ - # g- O Y$ d$ e+ P+ c- ~% R+ s
- #ifdef EDMA3_DEBUG
* E% g/ L/ @8 W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* n# d* _& Z7 w- }& }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 o2 M/ E, S0 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 C' S) P3 F, _- z - #else
9 _ x( `0 l$ t& `/ u - #define DMA_PRINTK( x... )- z6 H: u& G; M0 G7 w A
- #define DMA_FN_IN
: w3 B6 D, \! N$ t0 Q - #define DMA_FN_OUT. r$ b) v1 b! X
- #endif2 L( n" z0 {! Q& ~, O) G# R
- - L8 m, M. A2 I" ], m+ ]: s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( X+ {) H6 p* K1 q3 R- m0 M8 V' W& _ - #define STATIC_SHIFT 3
% _) A) B! ?, B3 d# Q' ` - #define TCINTEN_SHIFT 20
9 X) O1 j- y3 h3 u: a - #define ITCINTEN_SHIFT 21/ f2 T1 a- b: f: }
- #define TCCHEN_SHIFT 22
+ E# Y% }- p8 h6 v2 ^% G8 u - #define ITCCHEN_SHIFT 23& [, b* ~. F' `( M' u, U* t
- + S' q. f6 |' @& m, ?, H
- static volatile int irqraised1 = 0;. R" |! W& P5 k
- static volatile int irqraised2 = 0;* x% d; r* {5 ?, z1 T" c: M6 g
* j, L; U- S- o; x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ r( A! v; A. D. }8 ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: d- k. U& v- [. p& k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) f$ b1 T% u( M - 4 T/ J! Z8 H0 ?# t! t, r
- dma_addr_t dmaphyssrc1 = 0;
0 _) d- E# O' q: F" Y - dma_addr_t dmaphyssrc2 = 0;. r: [' h' W9 a# Z1 T& c$ n8 ^2 l
- dma_addr_t dmaphysdest1 = 0;
* v) _8 E; F. z d! V! C8 y5 _. o - dma_addr_t dmaphysdest2 = 0;
4 G' W6 L( s. R* {
" m o4 B$ J5 F3 {- char *dmabufsrc1 = NULL;% _9 w% a3 g& ^' Q3 N* z7 E5 |% c
- char *dmabufsrc2 = NULL;
, F8 c4 B8 F% L9 r0 ` - char *dmabufdest1 = NULL;
7 \9 x+ g7 n; R6 K; q' | - char *dmabufdest2 = NULL;; w; A; d! y! O9 ]0 v' J
. g+ ?% V# v8 |7 F4 [3 U- static int acnt = 512;
7 [( j& {6 ?* m; E% z& `. P - static int bcnt = 8;' c+ a. j" ]( Z7 S+ L
- static int ccnt = 8;
* A) z6 P' Q1 i3 d8 e: D3 i - 8 _! G( O8 Q! U
- module_param(acnt, int, S_IRUGO);* U6 t3 O: F1 T' q
- module_param(bcnt, int, S_IRUGO);3 \3 F7 Z6 x/ X7 Q# C3 }' C
- module_param(ccnt, int, S_IRUGO);
复制代码
6 N- u; t( B: w) q; E; `9 Q1 e
/ c+ k/ u" i' _$ X" _+ B; Q$ F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 b7 b% u9 L, p" H4 W( D3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
_; ]1 T' V( Z" a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 g, W$ ~6 ]8 g; o+ _7 y
* ?2 Q1 m `: g$ d
- t3 d' W0 R3 C$ w+ G0 a2 ?
|
|