|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! R2 Y* C2 [: k" x8 I8 m* n9 e9 w' ]- [code]EDMA sample test application* p; m4 x5 Y5 s$ w9 ]
- /*2 O# m5 b7 A. G4 c$ y T L
- * edma_test.c0 k" H, y# b0 B+ t C5 w
- *
2 Z2 w, h4 z$ L* B- n) g# N - * brief EDMA3 Test Application
+ n( m1 w$ \8 F! ^: N: M - *, n* T, `/ T3 M/ V
- * This file contains EDMA3 Test code. O" |( L* ?: r. t
- *8 ^! ^! n( T2 q1 `( W/ q6 j0 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ I7 J" A4 L k @% U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 }: [4 H4 f: e. A! Q ` - * TO CHANGE.- |* n7 A* J& m# M; y0 M) Z
- *
# m; h' U @1 R. U+ a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! h8 N$ l, t% h' n' X - *
2 ^3 @! a: J, \ - * This program is free software; you can redistribute it and/or
7 o1 {$ m% P4 P! G/ l - * modify it under the terms of the GNU General Public License as ~- {8 N9 a9 A* y% b9 B3 o$ t
- * published by the Free Software Foundation version 2.
. j9 t' k, g$ s3 t" M0 E - *3 c0 p3 I0 L" H' q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; f8 {* A7 T+ C# c - * kind, whether express or implied; without even the implied warranty0 {/ X- x0 N& Q4 U3 N% p! e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( r: c+ x' E1 M3 C2 _1 I - * GNU General Public License for more details.
/ s' Y) v5 b' v) v - */3 n$ u$ \& l; j8 k d& a
- 3 }* L/ h& Q. j$ |
- #include <linux/module.h>
. r' f4 D/ V# B# E& q# a - #include <linux/init.h>9 Q. H- n& s8 U6 a
- #include <linux/errno.h>9 @2 K- H4 h0 h. T3 Y/ u
- #include <linux/types.h>6 N2 S# s, l+ Y% q
- #include <linux/interrupt.h>
7 u* M" q5 p* U g6 O9 P4 B, ~ - #include <asm/io.h>
$ ]/ T+ L2 k& M - #include <linux/moduleparam.h>
2 X* ]7 x4 _7 j6 F, U - #include <linux/sysctl.h>2 o: [0 H- i+ }
- #include <linux/mm.h>
9 o( ~" N j/ b; s7 k( e0 m' {' o - #include <linux/dma-mapping.h>
) U5 Z/ G$ {- n- k. O
- A# c4 j& D* Q- #include <mach/memory.h>1 g" ]! j5 `/ z- c
- #include <mach/hardware.h>2 G3 X- i3 |% n8 Z9 |) T) Q
- #include <mach/irqs.h>3 r( Z& F' r; a; U# e8 V
- #include <asm/hardware/edma.h>
' X# ^8 E; A7 u! p0 U7 U1 \" I1 n
6 P. l0 ~" i, ^( o1 @- #undef EDMA3_DEBUG
7 ]( t, B" p) i+ A6 v - /*#define EDMA3_DEBUG*/5 i0 F6 r8 a4 S" {+ w
1 h) ~$ c- E2 d9 B- c( T7 Q4 `- #ifdef EDMA3_DEBUG
+ f) `4 d4 p% T7 Y# Q' k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% |# T( h4 a& n2 s* e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% C3 \/ x( h; l1 C8 t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: ]; o$ d! i- H" P- O8 G3 h! e% A - #else7 d1 V, [! ~" B8 E i
- #define DMA_PRINTK( x... )5 z4 c- ?) m' Q4 H
- #define DMA_FN_IN" F% I8 V8 h9 N$ I
- #define DMA_FN_OUT
- L7 w" F+ W) N$ G8 E7 G - #endif
3 |) G3 x2 ]9 T- g+ G7 }* \, K. Y) D
0 t) b, ]( x% y" c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ T6 v1 A8 h* e( V* F4 j
- #define STATIC_SHIFT 3# O) K- }/ E+ c+ r
- #define TCINTEN_SHIFT 20
- H( N) P2 z7 _7 F) F- n$ X- b - #define ITCINTEN_SHIFT 21
# f+ W+ t! R: C R6 M - #define TCCHEN_SHIFT 22
) f/ V8 `, f# f8 f7 D - #define ITCCHEN_SHIFT 23
5 p) x/ m9 Y; r0 t/ \$ ^
0 k8 n0 C" `9 K& ]; x5 E- static volatile int irqraised1 = 0;
) U6 X1 h0 e& [ - static volatile int irqraised2 = 0;
, X: f/ W- m/ v* C& v: U - 1 l* V5 F0 d8 d. d% ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" W( b6 u& p5 p b# z. ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ H- P( ^7 S. {. z. j% q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) b* O$ c- v' {1 v! d+ o+ ^# j( e! A
* ]1 c& K# k: N" M8 L R- dma_addr_t dmaphyssrc1 = 0;6 G2 B. l' D0 @: S# [+ Y
- dma_addr_t dmaphyssrc2 = 0;' R* z! Q; v$ J9 r6 i, ]
- dma_addr_t dmaphysdest1 = 0;% D& R; |( T4 Z& V \6 k
- dma_addr_t dmaphysdest2 = 0;: R" K* ]9 W' v
! k' r8 D. H7 k5 I" T- char *dmabufsrc1 = NULL;1 @; U: \, ^5 p$ b: }
- char *dmabufsrc2 = NULL;
$ b$ w, w, a# o/ M9 L+ @- G6 g - char *dmabufdest1 = NULL;
) n8 }, {6 {- d# u* N% d - char *dmabufdest2 = NULL;
1 E0 u6 N9 X c" D( h - 5 L$ @/ {* w1 ]# N7 r. {4 _2 X
- static int acnt = 512;$ r" k# A& H6 E, i7 \
- static int bcnt = 8;
! J0 ?3 B' U4 m, B; i1 T8 w - static int ccnt = 8;
) i; `/ d6 K& @ ^. i - 7 A$ Q) M x, L; f# X
- module_param(acnt, int, S_IRUGO);! w4 Z* Z9 v! r( R* B
- module_param(bcnt, int, S_IRUGO);
& i, D1 d6 I/ l - module_param(ccnt, int, S_IRUGO);
复制代码
) w& d, h* w! B0 \
3 z- S/ u8 x- e6 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! [* J( `& I6 K8 }- X Y( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) T& z$ G1 i' P1 L4 @- ^+ b2 S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 ?8 p5 o0 N; D& b) C( w- y: X! B) m% e' C ~ U7 r
8 ]! k9 x: K7 K$ ?% [
|
|