|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* J \7 \9 r. ~' K- [code]EDMA sample test application2 H/ D, W( L5 [0 H) c" i4 y6 d( |
- /*$ s8 B6 y: w7 {8 t0 ^
- * edma_test.c
1 n0 ]! a* b3 C1 ]4 f2 i6 E! I& | - *. ^+ s) R, y' A% l
- * brief EDMA3 Test Application
0 I2 d( `, F V: f+ M4 j6 t4 T - *
$ T& x' l- q. ^ - * This file contains EDMA3 Test code.3 t5 ]+ g- ]/ G( n) |, z! x
- *
* b$ N6 m- k7 s7 y0 @7 B$ b/ E1 C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( T1 Q$ p; Y$ [) h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 T, o6 t9 A" [0 t, [; a) Y
- * TO CHANGE.4 D7 T& c1 ?- X
- *, t& D8 \. p) x) j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 k8 C9 [, O, h) `* G9 k* R4 ^
- *2 n9 c6 s& V( g3 ^8 c( L( K/ P: V
- * This program is free software; you can redistribute it and/or
. i! I" k( B) u: Z1 ? - * modify it under the terms of the GNU General Public License as
, y% \, |8 p7 T H {+ ]6 o$ u - * published by the Free Software Foundation version 2.3 x- U2 G8 M3 B! Y& ?% m8 q
- *) M8 I" D8 v4 d* u& w% q, q7 N0 S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 \+ x- N3 X# z9 f; u# } _
- * kind, whether express or implied; without even the implied warranty5 e) D- P/ z: f1 Y0 u$ h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 e/ H1 ]7 `( O" w( L
- * GNU General Public License for more details.
% E( m( j c" F. ] - */# }1 {' t: ]$ b% [; ?
- ( R, r+ r2 Q% b
- #include <linux/module.h>
0 l% R W- u W+ X3 u2 ]( _ - #include <linux/init.h>
- T2 L& O# ~5 f2 X% H: z5 m6 G* d - #include <linux/errno.h>
; i' d4 H) {1 y- g7 a - #include <linux/types.h>2 P. m: ~7 o0 h! k
- #include <linux/interrupt.h>
& z) l+ O6 m# v3 K( R- Y0 H7 N$ m - #include <asm/io.h> w n2 N d& s% s. j5 ?6 E- G( C
- #include <linux/moduleparam.h>- M) S" k) U$ q7 V* e! O8 d
- #include <linux/sysctl.h>/ d7 p2 Q1 i, y, D0 D( J
- #include <linux/mm.h>8 }% R, B! W. W, c3 u
- #include <linux/dma-mapping.h>" C4 o' O7 b1 R# ^
- 3 E: r$ g9 ~! Z' p7 f# D' a$ Q
- #include <mach/memory.h>1 [$ \; R9 B6 O+ u( \% U
- #include <mach/hardware.h>3 B- ? d9 a, c
- #include <mach/irqs.h>
9 @0 K+ p- ?( ]% ^3 X5 H" x - #include <asm/hardware/edma.h>5 U* v0 \# _; ~5 F) j) F& F
% n: X0 s0 W* b& g9 @' m- L% _- #undef EDMA3_DEBUG2 }0 S( W5 e6 X( I9 w( W9 h
- /*#define EDMA3_DEBUG*/6 q1 G# t% r/ x& R" S
- # Q% A8 J R, `$ v/ N7 a
- #ifdef EDMA3_DEBUG
8 v* n* ~! F( r+ d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 `, O A& |* `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 C" i R) u8 a! Z5 {+ s* j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), S3 c$ ?0 Z8 ^4 z0 Z
- #else9 w* _4 H- `% S% j
- #define DMA_PRINTK( x... )
1 W" A% |7 O8 M - #define DMA_FN_IN
2 S- }. ~) g5 D8 J2 d! ]9 k s - #define DMA_FN_OUT
8 B$ P* E5 k' Z8 C( t: m' ]" g. g - #endif
) C) e- K& Y$ ~! \1 S" h - . v6 K# T' F6 f3 t; |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); r3 b- W" Y p8 |. r2 r
- #define STATIC_SHIFT 3
# n0 ~( I- y' `, A! g - #define TCINTEN_SHIFT 20; {8 o$ v E4 Y$ q, L: C( c+ R/ H9 N: l
- #define ITCINTEN_SHIFT 21
3 O; ^5 j1 d1 E& |+ _' g- ]- E3 t" y - #define TCCHEN_SHIFT 22
. G/ c) J& _1 L& v& Z( N - #define ITCCHEN_SHIFT 23
. B! [/ w* O V3 ]+ T
; [: o7 z! A9 `9 R: W- static volatile int irqraised1 = 0;9 M. U6 Y: E1 ~2 w3 z a' a* Z
- static volatile int irqraised2 = 0;
# ]$ \- r( A: U; ^: G8 J
& i, F4 w; V0 e! e9 W# m: U0 v v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' c/ ]" j) M: a" ^* P+ c8 M8 V8 @6 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- }: c% m2 e5 i+ B5 \$ f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, L$ J, ` H% A/ X/ X# f$ _ - . y0 t3 q' l% i% b) m5 N
- dma_addr_t dmaphyssrc1 = 0;
' I! l3 g& c8 d" K* r - dma_addr_t dmaphyssrc2 = 0;
! g1 Q8 K0 s% N - dma_addr_t dmaphysdest1 = 0;3 ]$ j2 I; `. A4 m" u
- dma_addr_t dmaphysdest2 = 0;" p; v1 U: { t- Q* s/ K* @
6 `9 u1 |0 C! t- char *dmabufsrc1 = NULL;
8 t5 w. P/ x1 N0 C: E& i c - char *dmabufsrc2 = NULL;
: i: c; m' G2 A3 b - char *dmabufdest1 = NULL;
# d: ~$ d3 ]' Y) O" I3 H$ ?2 L- P - char *dmabufdest2 = NULL;5 l& _! U; `/ S b
- % S1 l9 J9 G% |# k; {' e7 L
- static int acnt = 512;7 f9 a) S0 ^- l
- static int bcnt = 8; C1 a/ h; x; C, R9 J3 X5 v# y
- static int ccnt = 8;
7 F* N, B! k+ r0 f3 s - 7 |1 @7 A' L+ B+ p8 B _
- module_param(acnt, int, S_IRUGO);
8 J$ {5 K1 ^+ _6 g - module_param(bcnt, int, S_IRUGO);
4 V( t, t( ^. w - module_param(ccnt, int, S_IRUGO);
复制代码 9 c/ {4 J! R( i8 o3 B. P
0 f0 f$ t/ e2 n; {9 G( ?1 ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# b g0 e. o: W& V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% ^' v9 w* Y/ G) X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ E* o+ Q9 v# }
+ M- Q, G1 Z1 U
( c/ l) v1 }( `- e |
|