|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - p! `4 A7 j9 ~- l- f
- [code]EDMA sample test application+ f5 [( Q5 p( |* l5 x
- /*
& s E, a+ M4 U, n - * edma_test.c
- }+ c- k, i" `5 Y - * u8 S% u, k- N2 J0 [( K
- * brief EDMA3 Test Application
" e- P0 N0 s- e: s* Y6 d0 I - *
2 G; C) n: @5 @4 L - * This file contains EDMA3 Test code.
; ~6 _# x5 S y1 F* G - *- P$ z, W8 L/ o1 G* ~- t! U# f5 }) R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( `) O; r/ K! p% t/ t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ T+ v$ Q. Y" C$ ] B& i - * TO CHANGE.* h. {( `9 z0 Z0 S+ d) o9 \
- *
' k. y! S1 ?( a% {. c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 P0 Y; b+ T( P5 M; o2 J5 C
- *
% C y% `. V- f" {; t+ H/ f - * This program is free software; you can redistribute it and/or
. X; h, }! ~! M: `# Q - * modify it under the terms of the GNU General Public License as5 ?8 y- U0 v- _6 n1 t4 k! w
- * published by the Free Software Foundation version 2.
. r+ ]; u. {4 w6 r( @ - *; f n3 Z$ ~. m% n1 r- j5 h3 f i7 _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ V& c2 X5 p5 N - * kind, whether express or implied; without even the implied warranty
7 c* k& Z' z1 G* ]9 u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 j- P7 W7 y( R5 T/ _( S - * GNU General Public License for more details.. M# M2 H9 j% X8 ]( h
- */
# u+ v- p* y* T2 b G% c - $ ?) }2 g8 m. s0 k; s/ T
- #include <linux/module.h>0 O$ F1 C1 A( F9 R c
- #include <linux/init.h>% k6 C! A2 K2 y y
- #include <linux/errno.h>) B/ {' \/ R$ Z ^ Q6 l
- #include <linux/types.h> x! D& c$ S# \/ p' B; A: p% u8 F+ t
- #include <linux/interrupt.h>, N S0 W& D( i+ E, `6 ~. {
- #include <asm/io.h>; v( J4 z/ N! Z$ V# [3 ~
- #include <linux/moduleparam.h>
/ F& y% {- t; V0 O$ n - #include <linux/sysctl.h>
6 F- v/ a5 A( f: k6 f2 x - #include <linux/mm.h>
. c5 r [. }, i% q* E - #include <linux/dma-mapping.h>& a. Y2 t( n' z$ W4 Y2 m
- 2 f2 j! l4 y' y, w! U
- #include <mach/memory.h>+ M4 v# R# c& u- b
- #include <mach/hardware.h>
0 \0 u+ r# c/ Q2 n- N - #include <mach/irqs.h>3 Z9 V# u3 \$ W5 _% `
- #include <asm/hardware/edma.h>
- C" s2 {2 V( ` k* E* @
/ a/ b$ _: V. S( X" ^- #undef EDMA3_DEBUG
6 L! `' i2 l" Y4 f - /*#define EDMA3_DEBUG*/
: V6 _" T# q# E' |, a; C2 m) S! _ - 0 n* m* \; B- O* c& H9 k( n! c
- #ifdef EDMA3_DEBUG
; F: O" Q6 u) B, ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 P2 E* m! V" @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 [- O' z. v4 w. u) Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 n( s. h) D/ U( Y" I2 u4 u - #else( J% v9 [) U+ e1 ~6 J; g
- #define DMA_PRINTK( x... )
( m1 X7 ^5 k1 @7 Y) {9 n( a - #define DMA_FN_IN
9 q& E$ y. Z! p) S8 h# L - #define DMA_FN_OUT
# l# g6 s# Y$ Q# U: y - #endif
0 l* d* L* N& z8 H" f/ c - 5 w- J6 i) C; ]) a( Y; A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 M1 C1 l6 \ [; k9 H - #define STATIC_SHIFT 3/ R5 C- a( U) L1 z& R$ p
- #define TCINTEN_SHIFT 20, Q+ w8 O5 O+ {. \6 D
- #define ITCINTEN_SHIFT 21
. K( S6 j$ p9 Q u T6 T, D+ U - #define TCCHEN_SHIFT 22
1 V) R# R( w* C2 d' q' Q - #define ITCCHEN_SHIFT 23
; q8 u! V- }# R0 t% x - & w [! C- u' I
- static volatile int irqraised1 = 0;
/ @, b: R* Q4 b: b s# x - static volatile int irqraised2 = 0;
% q" `3 J. Y% D9 P8 ] - 7 Z" L, D' @% U: e" R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: p7 s8 g* ]3 U" P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" R p2 c$ S0 g! _2 L7 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ b) N! V+ u. H, g
' w7 f$ X: Y+ }8 t- dma_addr_t dmaphyssrc1 = 0;: ` L9 U) M. A/ w* O
- dma_addr_t dmaphyssrc2 = 0;, `) l* X1 X+ `5 b6 n! ?
- dma_addr_t dmaphysdest1 = 0;8 t3 ^; N2 v: F) r$ }! a
- dma_addr_t dmaphysdest2 = 0;
0 S; D4 {* o/ d+ I3 z [
4 a& j' F0 [6 i4 S; u- i2 A, |- char *dmabufsrc1 = NULL;
: F1 b- h5 s9 R: J% u - char *dmabufsrc2 = NULL;
! l9 l8 z1 g* ~+ `/ b% ^% e9 q. s - char *dmabufdest1 = NULL;
8 W, v0 A7 b7 x# Q% o - char *dmabufdest2 = NULL;
. n9 q, a3 G& w' h$ @; _2 N
+ H+ ?- t0 ~, T% U- static int acnt = 512;3 k1 \, T2 w! ~
- static int bcnt = 8;
3 l& B" }2 l+ x' T% n - static int ccnt = 8;: a7 o8 C S+ q, i' R, d6 e
- / w6 ^ q( k1 n( _
- module_param(acnt, int, S_IRUGO);( C: `) s5 o7 ]% z
- module_param(bcnt, int, S_IRUGO);
2 G; M {# Y4 {5 T4 l - module_param(ccnt, int, S_IRUGO);
复制代码 + u3 u2 h: m7 i+ g; s
2 R) N: K' j( ^6 P B0 { ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ J: m7 N# x, e3 d3 @' G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 b3 M& R) v. W5 g% u5 `1 m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 S( r" i& X% k% x a K- K R
! }: P! m, b. K3 {) D1 n
2 u3 T- K4 R+ R1 T9 k5 q |
|