|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 i8 k5 e5 Q* n( [6 H0 b
- [code]EDMA sample test application5 v8 U, R1 ]! A* q4 V! L
- /*
; l: [, u: J V( H1 A - * edma_test.c
' D# l. p- K/ f) N$ T - *5 s S8 r o% d, B- p! e
- * brief EDMA3 Test Application
1 S: B: w- u* B5 O0 F4 |* K4 d" q - *+ c8 t( V) `" E( R0 | A
- * This file contains EDMA3 Test code.
, G; I$ k; P; A" c0 T - *
2 d( i4 r6 o* ~& g5 N$ N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, g! x) I- \: f) N6 r9 `4 d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& Z! f3 h4 D1 q9 N# b
- * TO CHANGE.. k7 g# V9 D& q) s6 Y/ @
- *
' j( h! I, ?- M4 y8 @: i6 T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ f) t- ~& y% | J! b J1 @) V& F h
- *
6 j8 Z+ I K! A/ S* c% F" x0 }; } - * This program is free software; you can redistribute it and/or
& E, t; i' Q% g. @0 U" H& \ - * modify it under the terms of the GNU General Public License as
* f" k! j/ o5 W. L* d" w* Q) Q" h, n - * published by the Free Software Foundation version 2.* O2 x9 z( \5 @$ f8 Z
- *
. L* u- u- P9 v7 U8 X2 B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' D, q0 t; z' c N - * kind, whether express or implied; without even the implied warranty
3 t' l$ m8 Y K/ L" \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. u. b* u* U! J - * GNU General Public License for more details.
; a: r! @( _+ G/ u/ H) o - */
6 g" x4 N0 ]! \' D. p7 ^ - : ~& a+ X0 M. B
- #include <linux/module.h>3 _2 ~/ m1 j; Z7 R9 ^3 P
- #include <linux/init.h>9 G' y' ~9 w4 Q- B% t1 J5 @. {
- #include <linux/errno.h>
7 [6 J4 n* d0 R& a- T9 W+ m _% Q - #include <linux/types.h>
: h* C+ q3 O2 r8 `3 Y: k0 l - #include <linux/interrupt.h>- H6 l% T: L. B# s, Q# S6 Q
- #include <asm/io.h>8 T, O. G/ A* [3 r7 y$ |3 O
- #include <linux/moduleparam.h>
6 U& b: F K* c+ ]# j* Q8 B - #include <linux/sysctl.h>
, k( H$ {% U' N4 c& e - #include <linux/mm.h>
7 u2 r5 k* c A4 [* P2 U - #include <linux/dma-mapping.h>/ g. X' z8 T4 W, A
- ' r* Y+ L# I% I& r B3 G4 W
- #include <mach/memory.h>
( d) C0 K; K/ c4 K$ T/ @7 h# _ - #include <mach/hardware.h>. p1 x/ K# S0 ~" P: V1 m0 c
- #include <mach/irqs.h>% f9 F$ O" Q! ]: h1 p5 w2 G1 C4 U
- #include <asm/hardware/edma.h>
1 x( v' k+ a* j* A/ P) `, }; C - 8 P! \7 K, E9 i. P
- #undef EDMA3_DEBUG U# i9 U- s7 S) a; J/ T* s. X
- /*#define EDMA3_DEBUG*/
6 K; Y: v# @/ e; t, z
; h0 H. u; r! J8 T' t- #ifdef EDMA3_DEBUG% m* L0 D/ L% T9 j6 _5 x/ a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) P% K8 H: ?3 n) k2 X: Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) y* K7 ~1 M+ N) n% Z" Q7 d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) |0 Y2 x# L* [2 v
- #else4 A! L. \3 e: f) t6 A+ U$ i/ M
- #define DMA_PRINTK( x... )
. M# p& U# D- a# A - #define DMA_FN_IN
- U$ P. |. P2 ?0 o9 B* Q% g - #define DMA_FN_OUT
& V& ^7 m$ l( r0 C7 F- o - #endif& y; m. q# o) ^* n( {* C
, N t2 u3 j/ M9 a+ `7 n: [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ ]/ t @! p( A8 L - #define STATIC_SHIFT 3
& {: `" k6 ^' [9 D3 Z - #define TCINTEN_SHIFT 200 ^/ [1 l9 B+ x, D9 |
- #define ITCINTEN_SHIFT 21
% L( Z2 b5 j# A - #define TCCHEN_SHIFT 22" U* X% M' e- v: q* H8 v
- #define ITCCHEN_SHIFT 23
0 l! S- [' w% {0 \1 K; h s# D& ^
, @# \7 @4 R0 p3 }. w! R$ a: M- static volatile int irqraised1 = 0;
( K5 j, Q \$ s8 O. c! a; q - static volatile int irqraised2 = 0;
0 b' J7 H$ K9 }: Y% ?7 q' O
% L5 Y9 s- b2 K# j1 x' R# H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& P# K2 y, M, X- R5 T! e- {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 Q/ r3 d0 [4 a/ s# k: ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 m# t8 p; Z: t
( Q2 F- d& q1 E: z- j* G- dma_addr_t dmaphyssrc1 = 0;6 O) D- x3 q- H3 q
- dma_addr_t dmaphyssrc2 = 0;" {5 g8 ^+ c2 b4 L9 [6 _
- dma_addr_t dmaphysdest1 = 0;
* }% s. s3 ~: u - dma_addr_t dmaphysdest2 = 0;+ f# T+ e% u4 z
- , b! U! c, E4 f0 N2 Z9 v) C
- char *dmabufsrc1 = NULL;
8 J3 `1 Q' X0 z. J: f - char *dmabufsrc2 = NULL;; x: ]+ j" S) H$ _
- char *dmabufdest1 = NULL; o( O$ v# G( M+ Q+ S; N
- char *dmabufdest2 = NULL;
6 V) _8 l; ^! a/ a
% P) O8 z7 Z( G1 i# c6 K# a- static int acnt = 512;
6 b( ]) l; ~( H - static int bcnt = 8;
( B- y& q/ f- v B: K - static int ccnt = 8; i% B6 ?% F/ D
- - N: E3 R% n. K- p6 J
- module_param(acnt, int, S_IRUGO);
3 y6 L$ L" }! ^$ b' o - module_param(bcnt, int, S_IRUGO);+ P, P% C+ z" `0 w/ K* ]$ U
- module_param(ccnt, int, S_IRUGO);
复制代码 + M5 z9 i8 `* v" ?4 ?
% N/ j+ S; |2 a& d# G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# n" ^ t; t4 L; W% g- S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 Z! D, O5 |- {9 z3 [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& C) L, i, i: C) g9 S
2 r, z: \+ a2 f
& I! k2 J! j2 y3 l
|
|