|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # n) x0 m2 N( M; E. p
- [code]EDMA sample test application
) b* P1 r! o* K$ y" ^& C - /*
$ n( r# }8 p; i- q - * edma_test.c) B3 l" U# C" }% T: C
- *& `, b3 B( w6 {/ l; F0 K. r/ F) k' j
- * brief EDMA3 Test Application. a/ o$ m- V1 Y
- *
) \% T4 r8 W5 D9 Q, m; E* y - * This file contains EDMA3 Test code.! i7 N; S! ?; V+ a
- ** h y3 ?7 W0 e# s. e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* h$ a( \ m% ~& u. p1 \) A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) ~/ j7 U( E3 b$ p - * TO CHANGE.* O$ U) x9 x7 r) \% d& W
- *( k6 U2 ~) d" P$ W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ a! u% z( V) w* t% Q- t8 @( M9 y
- *
! Y. z6 a: y% ~& l: |7 ? - * This program is free software; you can redistribute it and/or
5 F* \! S$ L, E; B - * modify it under the terms of the GNU General Public License as) ^" }* K( c8 M9 d
- * published by the Free Software Foundation version 2.$ [$ S" o/ n" o9 G/ S- g: d C9 Z
- *
2 d+ }# z$ r. j$ y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' G- z% h8 m. q
- * kind, whether express or implied; without even the implied warranty- j/ s H" N* A1 ]* |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 `% k8 F) Y. Y) o0 _
- * GNU General Public License for more details.( O" T, B5 R+ W: T6 D
- */) B, m- ]- @) w; y# o$ F
- 4 q% {( K" k1 Q6 a2 q* x2 @- E
- #include <linux/module.h>* ]# l- e2 k+ K/ ]2 a- G
- #include <linux/init.h>/ f* V* { h& R0 d! b9 ~
- #include <linux/errno.h>
+ q* y, i* c6 m Z% m - #include <linux/types.h>
- C6 q" v% z+ s3 A, c3 s5 A - #include <linux/interrupt.h>' W8 ^% L+ h/ u l9 F% S5 o
- #include <asm/io.h>
% y; M( J! F6 ]+ |7 N - #include <linux/moduleparam.h>& ~' B$ ^* X& P- K- n4 z
- #include <linux/sysctl.h>
& x) @7 m! `0 b! d0 V/ U - #include <linux/mm.h>: Q( w9 `5 j& k7 e5 ?1 c# n) K
- #include <linux/dma-mapping.h>
1 O; i% r( _" W/ F" l! R - % }/ ^% {7 T8 S b
- #include <mach/memory.h>
4 E' f3 w' n- q, D - #include <mach/hardware.h>
& O2 N* k9 z6 R$ e$ [, B - #include <mach/irqs.h>
; i* u" A/ r# @; p5 A+ i3 z - #include <asm/hardware/edma.h>
* t( l9 k6 |: U2 z" h - 2 @- [1 ^7 P9 @7 I4 K/ X) {1 |
- #undef EDMA3_DEBUG. }5 b$ ?* B9 C6 G" D! _8 P
- /*#define EDMA3_DEBUG*/: T$ j+ c% M" p8 t. a/ f! W
- * `: ]9 M# r& y3 k: k6 A/ V$ V
- #ifdef EDMA3_DEBUG
. a0 Z% Z) Z! k1 n* \/ H1 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 M$ F9 b% q& R- [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" o1 L9 @0 v" Q3 `( a8 Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 O, s* Y' e7 L! _3 s( c - #else
6 h: v$ Q4 B. @4 ?% Q" k( y - #define DMA_PRINTK( x... )
; t2 k7 N& N8 `7 b& h - #define DMA_FN_IN6 v: Z4 k/ a4 [- o
- #define DMA_FN_OUT
0 Y+ D5 b# d5 d - #endif) h* b( _! R8 ]+ O5 Q, [
- - ~$ ~/ f) x8 N8 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# z4 R8 i( i" @; H
- #define STATIC_SHIFT 3
* m/ z p' S) b: J( t% t/ D/ l - #define TCINTEN_SHIFT 20
5 B* I6 t+ [. T - #define ITCINTEN_SHIFT 21
" Q5 t9 D" a5 b, k/ M* ~ - #define TCCHEN_SHIFT 22
3 p5 K7 ?# ?8 S: P t0 Y) x2 H - #define ITCCHEN_SHIFT 23# S- E& S: o2 a) s
X9 ~- d/ s2 C+ ]6 D3 \0 Q0 ]- static volatile int irqraised1 = 0;
& s5 U, F* k! Y7 w) x - static volatile int irqraised2 = 0;
% ?& u; Z2 z9 v' @' a- l
+ m* B5 c6 U1 B, N' {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 o# }% ?% I. P3 a$ w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 S$ g: L7 z8 v" E8 _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 Z7 F, N( b) _/ x3 P
* t0 o. V! V; w" {; ?, b- dma_addr_t dmaphyssrc1 = 0;- W' ? ~ ~0 r, w$ J0 ~2 t
- dma_addr_t dmaphyssrc2 = 0;
' W; l# g5 q8 C% Z! D1 W5 I - dma_addr_t dmaphysdest1 = 0;
; z8 Z$ q8 `0 u8 i6 M1 T! Q - dma_addr_t dmaphysdest2 = 0;
/ k. y2 M! d6 u3 K2 h! u
( {& R% \- m2 l% X- char *dmabufsrc1 = NULL;0 E; D6 L' n- ~: K# o/ s O7 |
- char *dmabufsrc2 = NULL;
$ e! q1 _3 C- O4 e E( B6 z' E' F - char *dmabufdest1 = NULL;" A; U! u- n, m8 [! O% q ?; H; d% m# E/ g
- char *dmabufdest2 = NULL;
2 I! H8 r) U& b- c6 `/ b5 e7 k' h2 s+ D
" k+ o+ z" G$ u! [3 M e/ q9 K+ s- static int acnt = 512;/ A- [/ E, b9 X6 t5 g* S9 j
- static int bcnt = 8;" u7 E% O" A' R/ v1 G" A
- static int ccnt = 8;
" [1 Q/ g3 M- U" } - + C) {; K Q6 F2 O7 \
- module_param(acnt, int, S_IRUGO);, C* H1 t5 w0 ~
- module_param(bcnt, int, S_IRUGO);
1 B6 l; g) V! y0 R4 _4 i - module_param(ccnt, int, S_IRUGO);
复制代码 ) ~. y0 B$ h7 x+ K. {
7 ]4 }" F8 e3 b: o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 Y4 h; q @) ?% h( |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 o0 p# l; e: ~# H+ r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: Z/ s) L( j% _7 m+ g. Q
9 B+ p/ w: g0 o6 n W5 h6 t4 ` M+ w2 v ?
|
|