|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 ^0 R! j. r5 [( j5 x
- [code]EDMA sample test application" l+ `5 Q; i# @7 T& ^1 B; V9 v# c h
- /*4 X* ^, a8 X# S, U
- * edma_test.c
4 E' y1 @ _) z, o ]9 M/ b( E; I4 @+ j5 k - *1 R+ Y; N. U$ Q0 h& D4 A
- * brief EDMA3 Test Application
5 x% G( W* Y* V0 d7 N$ f - *4 ~$ b. f8 y) m% S2 S5 e' ~& D8 p
- * This file contains EDMA3 Test code.1 Y6 v4 V' T, F. G6 ?
- *2 s# F( q% v; F) L6 s4 [: x5 W, o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: Y/ l$ G& E ^, r& ]8 K7 u0 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ S7 I( s. h+ c - * TO CHANGE.
4 t9 U7 Z% J7 q, }4 H - *- s4 {; Y) a+ e L4 o5 `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# W' s' V, \# d, J$ E, \( L1 k
- *
: P* Y' g) N4 H. u - * This program is free software; you can redistribute it and/or+ k( p$ |# v2 W/ j6 A
- * modify it under the terms of the GNU General Public License as' w6 J/ m* [2 k1 [$ I* n9 W ^6 I
- * published by the Free Software Foundation version 2.
; S- q6 }) {4 _- G) T( A. T - *
q5 B# h/ _' _( G2 ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% c; Q5 d: C3 e- y7 U - * kind, whether express or implied; without even the implied warranty
: ~' m+ e+ X# @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- N+ p) r, j+ J' d1 L o - * GNU General Public License for more details.
* x& \, v* H9 I8 r - */ E8 ]: N. j7 N3 i# X2 s
- 2 u# l0 a, j% r( r' V2 H
- #include <linux/module.h>
! J& V% t, H) r# r1 c0 S1 Y5 H - #include <linux/init.h>
0 m+ `/ I3 ~+ Z - #include <linux/errno.h>' A: i8 f0 U8 Q+ n5 V6 r. J' \
- #include <linux/types.h>
, N, A' }) c$ |0 g) `9 Q" e - #include <linux/interrupt.h>$ ^7 B6 t; }! i3 O6 P
- #include <asm/io.h>( a. o& f5 P* e) `- U
- #include <linux/moduleparam.h>
. q3 M) O" K: x1 l# t, R - #include <linux/sysctl.h>
6 y1 x, P7 O u! Z8 i1 v - #include <linux/mm.h>
9 c+ T# g/ t" D# v; H6 X3 k - #include <linux/dma-mapping.h>+ o) V/ d3 p7 }4 _
- 4 y9 f3 s) a3 v- `' q" p }
- #include <mach/memory.h>0 G/ i$ S0 g# T% j Y- q/ r
- #include <mach/hardware.h># B+ v, L2 g7 L6 G- Y3 N
- #include <mach/irqs.h>- P* U1 `7 \+ c7 U
- #include <asm/hardware/edma.h>
* n/ G- H& p0 b% p* D. `
$ t6 ]5 b: C' j% B2 P1 u+ I- #undef EDMA3_DEBUG
! U$ V' @4 J9 \ - /*#define EDMA3_DEBUG*/3 X% `/ W2 ]% g; x: i3 Y
8 i7 v% e- E7 g8 @- #ifdef EDMA3_DEBUG9 {& v0 L" J" W7 }: V- H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ x5 e7 m+ w! Z5 p6 I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Q; u9 Y( d6 z' U# g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 F/ R" R! @1 w0 I - #else
4 ^8 p; u- C. e: i& X* U - #define DMA_PRINTK( x... ): n0 v" G2 O: A! Z
- #define DMA_FN_IN$ n9 p' n( _/ t7 ]: N
- #define DMA_FN_OUT
U/ [( |$ h! e* f. g) p - #endif: H# Z! p2 l! g6 k% y$ ]: C8 _. G2 r
4 x4 W" q1 ?; z. y6 ?0 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% R( e' `6 g8 P - #define STATIC_SHIFT 3
3 r* T, f3 ~8 O: q4 d# b' }8 e - #define TCINTEN_SHIFT 20
2 e, |, ~0 i" s6 U% U1 E& e - #define ITCINTEN_SHIFT 21
. y( G% Q G3 p! o# I - #define TCCHEN_SHIFT 22; M$ O( S6 p3 r: y6 _
- #define ITCCHEN_SHIFT 23! j! j. F- H9 D# Z: ?" c
2 B6 t% w+ n {! B1 O0 }- static volatile int irqraised1 = 0;3 _! g4 f5 k F% [$ w
- static volatile int irqraised2 = 0;4 \- |3 a' L/ |# e- l9 l& E) Y
3 ?% d D! V M! r% N. U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' Y. ~: v5 r2 H$ j( w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: w" L5 i. _. ?$ B: x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ d! ?' ] S; ]- O# \; u5 r - / ^/ e/ {# e# Q9 }
- dma_addr_t dmaphyssrc1 = 0;
/ F7 Q3 E B/ `/ j) O" `- B' m) x - dma_addr_t dmaphyssrc2 = 0;' C0 k6 S# I) H( R f! ^2 V7 H( a
- dma_addr_t dmaphysdest1 = 0;5 `/ q5 ~: F8 V/ ~5 W
- dma_addr_t dmaphysdest2 = 0;' |6 L' a5 i- o: e6 ?& E$ \1 b
- / x) z* j2 H5 g# n) z
- char *dmabufsrc1 = NULL;
& R& O( H1 ?+ \9 ~) n4 z; I/ J - char *dmabufsrc2 = NULL;4 T# A% N* J2 [
- char *dmabufdest1 = NULL;- a. X* F0 ~ k% F* Y2 A
- char *dmabufdest2 = NULL;, C( v: \1 c& R4 t
1 N3 j, f8 _7 c* I8 y% g- static int acnt = 512;
- R! H8 y7 @" A. D* e; y - static int bcnt = 8; ^4 k' c6 v, e, J# Z
- static int ccnt = 8;4 s7 H% x2 y/ \- e" m
- 1 S5 Q1 V, B& [2 C* Y" i" z
- module_param(acnt, int, S_IRUGO);
- [# K$ o# G" s - module_param(bcnt, int, S_IRUGO);
+ x; s" R( K( Q8 N% ~ - module_param(ccnt, int, S_IRUGO);
复制代码
* L4 q P/ Z0 @5 i, o. P8 ~- u7 o. i' Q2 b* k+ R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 {/ J- ~% r j# {. w8 `5 t8 D- [
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 ]2 S9 o9 N6 C! x9 }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* T3 k1 Z+ [& q6 F
- u1 V; D0 D3 h Z& z9 A
* G9 y- r% H0 F8 m |
|