|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ f/ C5 a2 [- ?- [code]EDMA sample test application8 ~, ?% @; Z3 e
- /*) O+ P _9 a3 \ b0 a- ~+ P4 o! B
- * edma_test.c
* ~1 U0 D" z4 X - */ e: B7 h4 @6 g) n- b* U# f7 U
- * brief EDMA3 Test Application# _9 a Q7 R+ k7 F8 Y
- */ f1 ], V9 w) s
- * This file contains EDMA3 Test code.
: L3 [5 }* O- Q - *% F1 g" X" T# U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 |* c1 z0 q) Y( m3 h% ? l0 |" M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% R6 [8 q j! K - * TO CHANGE.
+ b5 M: _, F2 p* m+ A5 E% O - *
- y2 ?" v& W5 Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 b& o% x, g! z) A - *
3 B @/ V U1 H$ }0 d* { - * This program is free software; you can redistribute it and/or
; _! Z" ~7 d' P2 o - * modify it under the terms of the GNU General Public License as
: i( R k9 O+ z( H - * published by the Free Software Foundation version 2.
5 }, W5 @, u2 y6 ^4 N! C - *" @ ~1 ^- Z" U0 Q: @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 A& h3 M8 f( @4 o7 }6 }( r4 H - * kind, whether express or implied; without even the implied warranty+ [7 j1 e2 V* }+ O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; O. T! G3 Y, B4 l) Q; J
- * GNU General Public License for more details." ]( C8 m1 @2 U
- */
5 z* o% E1 @ X1 C; f1 b/ }
* L' b$ V& E+ [/ `( ^- #include <linux/module.h> P" Y' y. Y9 V6 ~( R2 U; R5 l7 p' l
- #include <linux/init.h>8 [' h+ L2 A" [. c! x( p( @$ L9 \
- #include <linux/errno.h>7 m o2 v# o- A
- #include <linux/types.h>
( F) B4 C) h+ q' i- F' D - #include <linux/interrupt.h>' w. g/ r; W2 l7 m( U8 H
- #include <asm/io.h>' _5 k7 s l6 L/ b" r
- #include <linux/moduleparam.h>
+ B# R( c/ [5 R2 e! ? - #include <linux/sysctl.h>
' x# k0 O2 Z$ `, E+ i$ i - #include <linux/mm.h>4 U0 H5 V" U% N5 m- v
- #include <linux/dma-mapping.h>. d1 s/ d" j( g) F0 ?8 l: a
- ) c- e4 K c% X: b: P g
- #include <mach/memory.h>
, C- G6 U) V& m/ N, x8 | - #include <mach/hardware.h>3 u& K3 u. H9 F3 R, u9 V
- #include <mach/irqs.h>
6 A0 _7 F; S8 Y& \5 M- o - #include <asm/hardware/edma.h>
' e% Q# y. y0 Q' v. N - ( g m' {$ u' \$ k9 \
- #undef EDMA3_DEBUG2 x7 u- F2 c0 Y# |6 t; d+ m
- /*#define EDMA3_DEBUG*/: m4 ?" t& p7 \, _' n
- 0 l; ~0 K+ d9 y0 S- O, ~
- #ifdef EDMA3_DEBUG
- }) e2 Q+ j) [; P2 q$ ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' G3 R! G6 R+ {3 ?' B# f8 `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 U+ n5 s, ?) @. ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) b$ v" X' k; a% Y! ^0 g8 ~
- #else
+ M, F+ Z' Y! ]% ~( e - #define DMA_PRINTK( x... )2 Q Y* J: H' U m6 l" c9 ]# r
- #define DMA_FN_IN1 v" k! c, w+ z
- #define DMA_FN_OUT
6 {: j4 D! d, } I$ |9 K, B - #endif
7 z5 Y7 A' @4 Y* _ - 8 K$ S, |4 q% ]2 s+ H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* |4 D' U5 |" a) x" F( c
- #define STATIC_SHIFT 3: f* j. K; p6 w: {( I$ D3 T
- #define TCINTEN_SHIFT 20: h" u& F: ~. _2 _, \
- #define ITCINTEN_SHIFT 21
, N; A/ S+ O8 {3 _9 T - #define TCCHEN_SHIFT 22/ g! G( V' g u; c* y/ M% X
- #define ITCCHEN_SHIFT 23) T0 Z: p7 E8 H7 Z* `& G
9 u G4 }% x: b4 k2 h' d( v7 N" ]- static volatile int irqraised1 = 0;
( P9 E; |( {6 b5 a. C$ t - static volatile int irqraised2 = 0;
c3 a2 k; \. @6 a% ?. {# t
Z- e" t* W( A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ m( n \! Q. ?) S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ^) T0 f; {+ D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 s5 B, E5 O. X$ {$ Y( j: U - 7 A) @7 g& g. a' z7 ^! L& a
- dma_addr_t dmaphyssrc1 = 0;
$ s4 I* `) ~3 n: j/ ? ~3 N% W - dma_addr_t dmaphyssrc2 = 0;
8 e4 L" G8 ^5 j - dma_addr_t dmaphysdest1 = 0;3 P3 U9 `4 |, i& ^/ B
- dma_addr_t dmaphysdest2 = 0;3 V) N1 O/ s+ `2 `7 w
% a1 E, O/ w: Q9 H% `: p* |7 ]: `% b- char *dmabufsrc1 = NULL;
# o. x) s; g9 D: n& U+ q+ R* ^2 d - char *dmabufsrc2 = NULL; g" [/ q' y$ t' {* B
- char *dmabufdest1 = NULL;
; Q+ ?( z! W5 o2 b - char *dmabufdest2 = NULL;
y5 q0 a/ s$ @1 E! e
- _' Z# `3 e$ Y8 B X. {- static int acnt = 512;! i; f* L# Z! w" G6 k2 t
- static int bcnt = 8; e; {9 d# z9 }5 _* x
- static int ccnt = 8;- F6 w0 W4 b( `9 N
7 Q' @& p( G& ^" I4 t. T4 N! \- module_param(acnt, int, S_IRUGO);
& w& ]* Y7 l- W/ ^ - module_param(bcnt, int, S_IRUGO);# F1 c# y, Z X; r
- module_param(ccnt, int, S_IRUGO);
复制代码 ! ?) |& N4 G! N
/ ~+ e+ Z8 x& F; A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 n4 u0 ]* R0 O/ j
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" Z R+ t/ j+ N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 G% P$ c( ]/ R) y- [6 E
9 L4 ^* h. _9 i/ }2 {0 ^% h8 m) `" z9 P/ w9 Y0 }
|
|