|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 C. F2 _! C1 ^7 c9 ?& {9 V
- [code]EDMA sample test application
; m% H3 M( f# F+ S; x9 @ - /*3 U% h+ J5 s; ~1 q; j2 o7 g
- * edma_test.c
' w4 I; g& x" |/ U4 v" w0 j - *
9 s) r- ?4 Q! c- _# h/ O% i - * brief EDMA3 Test Application t3 ?' ]+ z; R+ w+ M# L5 h
- *
2 M2 n: \/ L2 [! }& _/ S3 [3 N: _ - * This file contains EDMA3 Test code.
+ v, x/ {* D( _$ p/ X - *$ M i* G9 }0 s9 ~+ f. n9 e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 n. J. A& R0 |8 R2 w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
d; U; ~2 y7 \& U - * TO CHANGE.
6 h( O$ _8 V* u - *: i1 f' k' P( q$ U. ~1 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* h! u. I5 ]8 Q' z
- *
& q* F. |0 _( @7 F9 `. R - * This program is free software; you can redistribute it and/or2 M/ j3 \- ~' _( z$ h
- * modify it under the terms of the GNU General Public License as
- |7 c' ~7 s/ \/ M3 e5 E - * published by the Free Software Foundation version 2.3 G: E$ S+ X. f5 n Y
- *
1 W$ K, U; G# N F# ^3 n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% U( F# L% @% ?/ {& {/ G, [1 p0 o - * kind, whether express or implied; without even the implied warranty
( H# Z" \& q9 ?1 n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 a6 o+ c# G! k5 ^
- * GNU General Public License for more details.
9 Z% G1 E. ?1 e% Q* S, M! V2 N - */
6 E @6 { |" y* ?, G; S
! D& M) ~; V' l+ f# s, }- #include <linux/module.h># E# Q; G) S: b3 L l+ p( I
- #include <linux/init.h>4 z' b. t- o4 h
- #include <linux/errno.h>
# ^, O g3 s" w( `7 g+ L8 y - #include <linux/types.h>
r$ k) V6 R- C% h- P2 b5 v# N: Q4 | - #include <linux/interrupt.h>5 c" b I( ]/ n. R* H
- #include <asm/io.h>
F( r8 O/ U3 H+ g - #include <linux/moduleparam.h>' M. D$ L1 D3 l4 c7 t% U5 }3 @7 b/ i
- #include <linux/sysctl.h>
7 G# v. A4 \7 u, J: D - #include <linux/mm.h>
* H, t# h: ^! ?8 Z5 B - #include <linux/dma-mapping.h>
2 Q. | v6 c7 H5 G1 a5 {# `& _
1 Q& g x9 a" z- #include <mach/memory.h>
! K' _/ b7 L! ?+ u - #include <mach/hardware.h>% [/ n4 S$ P# q! ?
- #include <mach/irqs.h>4 W3 b! {8 y% \1 a5 b# S3 |, { u
- #include <asm/hardware/edma.h>9 R5 n9 U4 {+ F4 }
- 9 {+ q- _6 ^: `: g& e2 A
- #undef EDMA3_DEBUG
' ^( O$ k: r' c. n: ^ - /*#define EDMA3_DEBUG*/
) m- K8 Y+ G; n' p* w - , W) { H' F, A G( G2 K
- #ifdef EDMA3_DEBUG6 U, p- c$ w3 p a: Y# X; s$ q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" s5 M4 C( ~, _3 Q, F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* _4 T+ M. A) }1 ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! b* ?& `) q# h! y/ R4 T - #else6 ^5 {* k: Z& q5 ]. x4 h
- #define DMA_PRINTK( x... )
9 H3 h) l2 K# ^" y* J - #define DMA_FN_IN
. M$ m0 b' n5 O. b% e6 v - #define DMA_FN_OUT* q: I( g3 r U. R7 D
- #endif7 c$ ~9 P. k1 h( h# i
- + O1 G( p7 r% Y7 l l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 N" }/ y7 M. u8 p5 f0 |
- #define STATIC_SHIFT 3. s8 E' y' Q" p9 B
- #define TCINTEN_SHIFT 20
0 t- j( o. \. e9 F0 G, Y - #define ITCINTEN_SHIFT 21
- t% C' r# u1 ]+ C - #define TCCHEN_SHIFT 22
4 [& k. D8 l! _- e4 M7 c - #define ITCCHEN_SHIFT 23
: m: L8 h: W0 f6 O0 v0 y - 6 P% \* `% s, @; N9 f
- static volatile int irqraised1 = 0;0 c2 B1 T- E+ A8 L4 ]3 P5 y5 q. L
- static volatile int irqraised2 = 0;
4 T$ X+ J# b$ v
2 [! `! w. k) A4 w$ c" ^. c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* B* d' [6 W& E* J& d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 p3 y# v$ f$ K+ N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. `0 |: ^$ R& H* W9 C5 M4 y$ r
* k u* h* e6 X3 s$ B: u# _: X- dma_addr_t dmaphyssrc1 = 0;
. A; |1 A( }2 l& ]- G9 o% Z, j - dma_addr_t dmaphyssrc2 = 0;( P+ N) h& U. v" F3 h& D
- dma_addr_t dmaphysdest1 = 0;
7 t7 [; T* ^8 O X0 [ - dma_addr_t dmaphysdest2 = 0;: g' [0 `% V' Q/ @4 I
- 4 O4 i/ @( I- L, @* W
- char *dmabufsrc1 = NULL;8 J( \4 e+ u! S( i7 T! O
- char *dmabufsrc2 = NULL;5 Q! W7 w, w: l/ L1 V3 H3 b
- char *dmabufdest1 = NULL;
8 G6 i4 l% W( X5 u9 P* \ - char *dmabufdest2 = NULL;* d6 @; y; W5 Z1 W) F' G
- ( C$ J4 K& | H5 U5 w5 _" A
- static int acnt = 512;* t' U a4 A, u4 f) i1 m4 ~# J
- static int bcnt = 8;
- u3 S) k& i o: _. ] - static int ccnt = 8;2 y% M( E; ^& [
: i: h' y2 t0 k- module_param(acnt, int, S_IRUGO);0 j3 S8 e5 W4 R6 k$ s) a, |
- module_param(bcnt, int, S_IRUGO);. V. j1 H( f1 [; n4 r4 n3 O
- module_param(ccnt, int, S_IRUGO);
复制代码 ! M4 g# G, ^# A& L$ m
: t- r6 Z- ~6 G4 h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# E5 ]" u: R2 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 @7 X" {5 ~' E( U1 ]) m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& T/ \+ y% a" Y
$ X# T' ]7 ?0 J% n6 t: @" v8 [4 w" J1 L% B% R
|
|