|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 \5 X; H9 U- @' k/ ]- [code]EDMA sample test application1 K( u* }/ e# X7 M5 U) c* H
- /** ]* V9 S: f* k9 Y
- * edma_test.c
0 k8 V8 t- p# @- v. x C - *
J# A7 j; [1 H7 p% u - * brief EDMA3 Test Application! Q* T+ L% C) o7 ~! E( Q
- * g; }: r! q+ _1 S3 `# u
- * This file contains EDMA3 Test code.6 m* w" S4 k! F; Q( z D) h
- *& _2 h# ?5 U9 f% S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Y# F: n+ M9 N+ \: W8 }' h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& A; N$ B* V4 P" y1 R+ o+ b
- * TO CHANGE.% X* _1 a" P7 e1 q9 ]' D% n
- *$ K/ u) S; ~7 c1 u' h( F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ ?6 T; G3 ]8 |# W8 o - *- c% u+ D/ K, Y
- * This program is free software; you can redistribute it and/or
1 u9 l" w, X/ F) s) P - * modify it under the terms of the GNU General Public License as. N |8 B( A0 u/ X7 i* j! J
- * published by the Free Software Foundation version 2.. u3 |- m5 v, Q& W/ [' c/ b6 _3 e
- *9 g4 O4 I3 r& _% [' z2 p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 @( T6 P: [4 e, X
- * kind, whether express or implied; without even the implied warranty) j, G0 J" R/ ?* U2 [. _$ H ^1 m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 X) f1 c; D: |) {: P& m - * GNU General Public License for more details.+ P: G% B$ a% K2 q. s6 s& u. v
- */: f4 @. e# e) S8 x1 L0 W# {
6 V9 y8 q' B% p' D- #include <linux/module.h> \( k( q7 P1 @$ J
- #include <linux/init.h>
; d0 d; {( o$ M* f! u& N - #include <linux/errno.h>$ D' p# h( A! C1 M# O; P
- #include <linux/types.h>5 z3 ?$ f0 i% m7 ?" V
- #include <linux/interrupt.h>. ~6 q) m# \/ ]
- #include <asm/io.h>3 h& }; F( m5 G; b
- #include <linux/moduleparam.h>
; B7 L/ {/ T9 |: O, n - #include <linux/sysctl.h>8 Q6 P8 ^/ L2 f, i
- #include <linux/mm.h>
7 Z3 F6 _, ~: _ - #include <linux/dma-mapping.h>
. t, X9 E( C+ L4 V& F - 4 M s' v. m1 D- k" e x
- #include <mach/memory.h>
# W5 X/ F I+ `% G - #include <mach/hardware.h>( j" o$ e& b+ v+ e( [9 Z3 V K
- #include <mach/irqs.h>
! h; H( D1 |9 l1 T+ z - #include <asm/hardware/edma.h>0 L& A( T7 ]; p \+ Y% v
- , n% ^3 |% T- o: c% d6 m6 |
- #undef EDMA3_DEBUG
. s! u0 I4 Y ` - /*#define EDMA3_DEBUG*/5 |+ N9 v8 E: |5 w, Y, o
f# d- C' o' W ~( z4 L- #ifdef EDMA3_DEBUG
! a+ [# L1 T" H; j T4 o; c7 p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 u t. }0 K* f8 U" W; d- m9 N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). H8 q% [0 Y8 o. M j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 ] R1 W/ x/ @' k" v - #else
1 h' H2 {& M& H0 s - #define DMA_PRINTK( x... )) a4 `" o% _' ~$ a6 ^
- #define DMA_FN_IN
! O' |' N/ \' R! s9 r$ U - #define DMA_FN_OUT
$ l& H3 u0 V! ^4 w( U' Q3 g2 V9 ~ - #endif( E4 ^# W: ^5 j
- 0 C+ p) z" S _9 U+ d+ n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 b `- o5 {: @- ~; g4 K3 _ - #define STATIC_SHIFT 34 Z+ H2 ^: [/ q8 Z; V4 P/ _
- #define TCINTEN_SHIFT 20
5 u7 }% }, y! a2 |) r: T - #define ITCINTEN_SHIFT 21 {# g% b/ H& s! S3 p& o
- #define TCCHEN_SHIFT 22% X) U) b2 U( Z# Z; z* `* r3 T7 _
- #define ITCCHEN_SHIFT 23
; B, |8 p+ Q) l& x+ A
8 s( O" U# E2 `! K/ }- static volatile int irqraised1 = 0;# R6 N# @& H7 U9 P7 }# n
- static volatile int irqraised2 = 0;- x+ u3 \, p4 B* w- M7 W9 @
+ H8 \- ^7 A8 Y/ R/ L4 J: D+ @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); y( U8 W& D" z" f! U' ?" m8 A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Y# l( N' B m6 O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: I& C. r$ U4 S% t
! {; y- @& _/ b! g) K1 F* x- dma_addr_t dmaphyssrc1 = 0;
+ I E3 Z) S9 b0 `$ s, D - dma_addr_t dmaphyssrc2 = 0;
J( v0 {* a3 l2 }, h) X - dma_addr_t dmaphysdest1 = 0;
- C0 u7 j$ i4 O1 Y! ^" h - dma_addr_t dmaphysdest2 = 0;8 C( r H; O- \
- 8 H2 i9 ]0 i1 B* q+ P$ E
- char *dmabufsrc1 = NULL;# A# q3 i+ \0 ~
- char *dmabufsrc2 = NULL;
6 {* l' L' `4 R' R, i: t - char *dmabufdest1 = NULL;+ t. j( q; m# @9 b% t9 \
- char *dmabufdest2 = NULL; d5 J7 _. t+ F& w. S7 d3 ^: w5 l
- ; L4 \4 B; g& }3 F
- static int acnt = 512;
! R1 v, F4 i# |! u - static int bcnt = 8;
# Q( @; u' Q8 l3 F- [4 ~" D - static int ccnt = 8;
8 u# m! y& C- r3 S - 6 b2 Y' R2 ^' y* ]$ b# q, f, F8 h+ u
- module_param(acnt, int, S_IRUGO);
% d5 z6 k" L& K - module_param(bcnt, int, S_IRUGO);( N2 e7 e/ a% \. @9 ~: Q. E
- module_param(ccnt, int, S_IRUGO);
复制代码 , ^% _7 R1 u+ L5 V/ U: Z8 ~
) D) ]& e5 @ L+ Z' y( [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- h) x8 F8 J T5 Y8 t7 |( E& X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, s- o/ i* M& ~! } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 t, c. a2 x" q* y( k5 b, Q* f( Q, m+ @5 r3 ?* Z: L
/ Q1 J( Z8 t2 x' W' d
|
|