|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) \* a6 l4 v% J# O6 A
- [code]EDMA sample test application. B. l8 t2 {# K
- /*& F9 d, T/ [1 g3 R- i
- * edma_test.c( y; J# b7 [( [, H4 H
- *
* c2 g6 y/ K( r; R - * brief EDMA3 Test Application6 c7 T! H; C! g6 }! `2 `5 C
- *
6 p! x" |* T( L4 I7 i - * This file contains EDMA3 Test code.
! j* Z3 Y, Q9 W5 e, g# p& ] - *+ k0 k. x* T8 S" W/ k8 S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 X& S, O( c7 S% h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* B4 T; H9 B! Z9 I5 m- p - * TO CHANGE.5 G$ z5 t$ d- O' q4 t% e& d
- *
9 S9 c# }6 w% s. t+ x/ B" @( w, j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% E4 m! H- M( T6 s0 ~6 Y - *
/ |( o; @2 b1 e$ J7 D1 M' f5 Y5 u$ y3 ]8 V - * This program is free software; you can redistribute it and/or; r/ x9 p G# G" _* S" t
- * modify it under the terms of the GNU General Public License as
- J) d5 G' C/ K - * published by the Free Software Foundation version 2.
; M1 t W3 w1 ~1 _. e* W - *# o2 ~+ {! t2 d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 p, [7 f( O( @3 I6 q( c1 p& ^8 l# l
- * kind, whether express or implied; without even the implied warranty& W5 y4 @7 l' r( u* Q$ {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' O# M/ ] P0 t! n
- * GNU General Public License for more details.
3 r( e, z* p+ S" S2 [ h7 a" ?) ^ - */
( J5 x' K/ ]5 p- t, u z. P8 ^/ k
$ E/ M: D% Q% M/ |$ `+ F- #include <linux/module.h>
8 d1 B! o* W$ z - #include <linux/init.h>
' v- g' \2 F q" T' p - #include <linux/errno.h>
u/ F U2 j) \- D9 { - #include <linux/types.h>% u* e1 K5 C& S% @# q1 q. w# [: z
- #include <linux/interrupt.h>
4 J# ^/ W7 i; a, {- e2 V6 | - #include <asm/io.h>6 m# [3 ]% Z& v0 m+ I& g+ E# a
- #include <linux/moduleparam.h>& F4 k0 A6 ?( M+ B/ F! f- X( H' k
- #include <linux/sysctl.h>( ~4 D5 [0 Z* f4 f% u L% R$ z
- #include <linux/mm.h> r/ B* @: t! A0 V% b0 O3 ?
- #include <linux/dma-mapping.h>$ `. P2 ^. {& K$ }: g, p
- ) U* Y, q O# n, O0 @$ J
- #include <mach/memory.h>5 h1 H0 Z9 z0 k
- #include <mach/hardware.h>* ?# r& {3 K: g& u$ f
- #include <mach/irqs.h>7 K2 {% n' ?! B; F* U
- #include <asm/hardware/edma.h>. _ q. W n) Q+ Z- X) v% u' O
- M% N1 t9 |6 H% {7 ~" O O
- #undef EDMA3_DEBUG% `: k2 Q0 g& V$ f
- /*#define EDMA3_DEBUG*/
$ K4 P# h1 N# |6 n F - : B# @. B3 P' `" v
- #ifdef EDMA3_DEBUG
: g, b, E7 M7 V& W$ e5 e" q+ | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) ]) [6 w7 q6 ~5 j: [1 {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# ?- S" f( D/ s6 G5 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% Q1 Z& S4 l/ ~1 ?/ C: ~
- #else
$ e* P8 [( u- R - #define DMA_PRINTK( x... )
* S* B# D# l9 | - #define DMA_FN_IN
* ~! `$ A% u" ^' n - #define DMA_FN_OUT
, Y C5 F% ]: J; _: f- Q+ i - #endif/ r6 ~. J7 g; ]9 S$ ~* e7 G
- 6 J" k+ p3 l) I2 x' W# X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* V0 }# J) C: d# L5 k6 J+ {. q - #define STATIC_SHIFT 3- x6 t% w8 T& y! d* o5 M
- #define TCINTEN_SHIFT 20
% }4 w# h+ X3 E) D - #define ITCINTEN_SHIFT 217 v" R! S2 z8 c) w# ~2 g, \; m2 h$ K
- #define TCCHEN_SHIFT 22; i( Y# i9 Z! R2 l
- #define ITCCHEN_SHIFT 23
. p: x$ S# s5 k+ Z i. H/ A; [ - 0 v9 \) i0 a( u* U* ]3 r2 m
- static volatile int irqraised1 = 0;
1 b) }; d% p+ G/ B) _8 o' T" l - static volatile int irqraised2 = 0;
, d4 o' Z) T* h e% w/ @& w5 k7 { - 4 U; c6 i8 {( z& ~2 B9 W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 |: g! F- w. R0 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( K% E" d- \0 J- S* H& _: i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ^7 Y+ Q$ [. H9 [9 C
# [% Z+ h& A- I0 _- dma_addr_t dmaphyssrc1 = 0;/ F2 A0 j) w% V5 p' H }. g8 F
- dma_addr_t dmaphyssrc2 = 0;- _. k4 `! n4 \" S3 H7 t# ~) r9 n
- dma_addr_t dmaphysdest1 = 0;
- J0 U( [. P m4 v - dma_addr_t dmaphysdest2 = 0;7 O% f; q; ~& a
3 R# @( v; B. U) y; [- char *dmabufsrc1 = NULL;$ R. z$ J2 O$ e4 D% m0 N
- char *dmabufsrc2 = NULL;; c' i; G' Q2 p- F% E2 l* b
- char *dmabufdest1 = NULL;
/ M% Q# K$ S# ?5 n. W: L( }, M - char *dmabufdest2 = NULL;1 }2 } g& G8 J Q2 ` u
9 W+ k7 u* U8 s2 S- static int acnt = 512;
, n$ D2 o% }: R/ U2 O - static int bcnt = 8;
" L- I4 Q1 u2 d- K - static int ccnt = 8;# B T- P) a+ K- E Q+ n2 m, y
/ X# h* D" x* O; c- module_param(acnt, int, S_IRUGO);( i2 o- s# t3 ]/ D1 O9 @6 ?
- module_param(bcnt, int, S_IRUGO);) ^- R( r8 x/ \6 l1 o3 [- F* ]
- module_param(ccnt, int, S_IRUGO);
复制代码 # X" X4 g0 Z4 M3 f
' u* W" C5 i; A4 t9 y; v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 E- M4 Z3 \( _- ^5 P/ `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& K- ?3 Y( n& f3 ^, L) g4 d/ f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 M) e+ q4 z: c0 l
) A4 V) Q! x; r* Z
; J3 f- C3 n5 q" N3 q9 I9 u( r1 v
|
|