|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 O7 {! n9 @9 j
- [code]EDMA sample test application
L; }: F0 H8 ~7 }+ M: n - /*
' l9 [, O# D4 b: a. `) J5 S, J t - * edma_test.c
5 G3 y. F0 t# X8 q4 B6 W - *
/ y5 q' [5 Q4 g+ T; X - * brief EDMA3 Test Application
2 _* z5 {; c+ c) A8 Z0 N - *& [# W+ @& A& U& t3 K
- * This file contains EDMA3 Test code.
) v8 L: q. M0 l+ I" K - *
- `/ g5 b2 C# @* d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# C8 C% R! Q4 N+ X7 f3 J0 y' Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 `1 G7 L/ [" }; U( o: X
- * TO CHANGE.$ T5 s1 p) @% J/ m
- *; i5 H. q1 M' R; I7 ^1 }* ~1 k# s+ d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! A v. E7 ^' e7 `
- *( h9 K" A. K% r' U& V
- * This program is free software; you can redistribute it and/or+ z! [# w$ V) }: n* h5 P
- * modify it under the terms of the GNU General Public License as
' b0 `: t! E% ` - * published by the Free Software Foundation version 2.
/ k) o- p5 M8 \5 q - *
# p% ?5 J8 ?8 f7 m6 V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 y% s4 K8 {8 w, P( d - * kind, whether express or implied; without even the implied warranty
! M' H+ x4 z3 f+ ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* H% P" y% i& e0 h - * GNU General Public License for more details.
, h- V, x+ W5 w: H% u - */
& g! @4 \: y; N. r9 h7 D - + E6 L( N [" ]+ }5 U. i1 f8 r
- #include <linux/module.h>
$ K: y3 A6 P+ V - #include <linux/init.h>* o0 K4 V3 t3 d/ p" G8 X
- #include <linux/errno.h>7 ]# X0 u9 ]1 m' C
- #include <linux/types.h>
H/ g7 v- A- D4 b) W - #include <linux/interrupt.h>
0 Z, B! M2 z( f5 ^" m/ N1 B( R; c - #include <asm/io.h>
6 D8 x" `$ s8 f% ?8 i' a - #include <linux/moduleparam.h>
9 J* ]1 M' ?1 _/ W& P- p - #include <linux/sysctl.h>$ _1 J5 s: _1 P, u
- #include <linux/mm.h>
% [' G5 g: f" |5 Z - #include <linux/dma-mapping.h>2 d7 S8 O# e" Z# e8 T- A
- ' \8 R {! \2 y
- #include <mach/memory.h>& }$ h5 x \' n* J" ?: |6 s
- #include <mach/hardware.h>) D! G: r9 g4 |/ P( i/ q
- #include <mach/irqs.h>
2 G+ I2 ]& H7 m% F0 u W - #include <asm/hardware/edma.h>
% Y$ Q( I4 U6 Z! F3 ^
# {! r+ V( d: m0 q5 \8 m- #undef EDMA3_DEBUG
7 D* l* _2 |# ~7 j- m h1 L2 e# j& w - /*#define EDMA3_DEBUG*/
& w" `/ _/ R0 C5 s - 8 M7 Y5 R7 b' l/ [( b! ?
- #ifdef EDMA3_DEBUG
; r6 b2 Q, d! `6 A( N8 a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 H" q4 B/ m& }9 ?" I: v8 y, D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 W* ~8 X# ]# t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& e6 k+ O1 _9 C' G( R8 j& Z( m - #else) A, e4 [+ ?. `* Y* {4 C8 P
- #define DMA_PRINTK( x... )
3 ~6 u, M8 T l - #define DMA_FN_IN9 Q$ C' T: O2 o# E. L; c! y( b
- #define DMA_FN_OUT
1 s% p% y/ N9 p; |+ E* d" | - #endif) I7 U8 p4 a, k& A6 A1 C
% n' R. k3 y! E, J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, r s+ c& @1 \: x% a - #define STATIC_SHIFT 3
b& _7 Y! M! C9 D0 C- |( Y - #define TCINTEN_SHIFT 20! q: @0 I6 W5 i& f' L6 {5 s# ^
- #define ITCINTEN_SHIFT 21: z6 z' _$ K7 r/ @, T( Y
- #define TCCHEN_SHIFT 22
7 f$ H5 Z% Q4 |( |) J - #define ITCCHEN_SHIFT 23) ^& d( N( @: ?( J0 s
% Z" K2 O$ S) s- static volatile int irqraised1 = 0;7 v. u# u, I9 U/ e) E/ X q
- static volatile int irqraised2 = 0;
/ H2 i" [" m& R/ E: p - * z4 J5 f& w. N; S# V) Y; `: W9 S. f7 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) q& o# ?6 P/ u4 E8 p+ h; T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) @8 S' h% \4 g/ a& k) f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 h: C% Q' G5 @4 g3 ?( O: Q
# F6 x# j* H+ U, y- dma_addr_t dmaphyssrc1 = 0;
# u5 S i; y: ]: b" } - dma_addr_t dmaphyssrc2 = 0;8 h( g4 S0 c3 k: V1 R) c
- dma_addr_t dmaphysdest1 = 0;
/ D* ]7 ]2 t6 s$ u, P) z+ p- U j - dma_addr_t dmaphysdest2 = 0;" n0 z' X, f L" _. D3 d' M
- 9 u) x# e+ S) B- L- s
- char *dmabufsrc1 = NULL;
- Y+ K: R; K, f. L - char *dmabufsrc2 = NULL;' @, s5 b2 T* w! ]& }3 e2 f& G
- char *dmabufdest1 = NULL;- b' G, v9 X( x% N
- char *dmabufdest2 = NULL;% J4 N6 h$ i2 a k6 J0 R* `9 M
- $ |- M7 Q' `7 c3 E2 S) u
- static int acnt = 512;8 g8 k6 M0 E2 r0 z/ |
- static int bcnt = 8;
6 s g0 H1 {% t9 O6 B" V - static int ccnt = 8;& c, m/ t- y! K% ` z& w
3 b9 y/ Q' d$ `- module_param(acnt, int, S_IRUGO);- L2 h" n+ j' x6 Y r- g
- module_param(bcnt, int, S_IRUGO);0 S* H v! L, `" `/ X- z* O
- module_param(ccnt, int, S_IRUGO);
复制代码 . t* S8 l8 n1 }' o. G* P
' J& j4 w& b( \$ ?/ N( ^" P; Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ k! y p% _ \6 c- H* I3 k+ @* rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ ^( o; N- l0 `$ q4 T0 s/ [$ M2 G; N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
B6 A2 D3 G D$ m0 t& {/ k4 V+ H2 X, n! V8 n. |; _1 {
; V6 M$ W F. v
|
|