|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 Z1 s* Z9 Q2 J- [code]EDMA sample test application
! X4 C3 p% t/ k6 y - /*
4 e& B' i; S: `% P. S - * edma_test.c
! x* B+ m g/ G; b3 r: p% d - *: @% p' z3 t2 S5 t2 }' p1 b5 y
- * brief EDMA3 Test Application8 H7 |. a6 ]& b8 `5 P) Z! n; @* E
- *3 Z) b' _$ \2 j, o- m3 n1 l% v' d
- * This file contains EDMA3 Test code." }6 a v. [1 Y2 N
- *
4 p2 a5 k' M! y! B) T, h; u" S0 [% t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- s0 _! o9 ?8 E' ^ [1 x7 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ M7 K* U) m, ?0 r5 ?6 y, H- ^( V - * TO CHANGE.( E7 M% I- O( k& _" y
- *8 {9 W( H2 z, I: _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ Q5 h" L# _7 M1 ?
- *
1 E9 A2 H; u' C5 `2 S - * This program is free software; you can redistribute it and/or. l4 p3 c; X# u/ Z/ k0 P
- * modify it under the terms of the GNU General Public License as
& G) h& A9 ^3 ? - * published by the Free Software Foundation version 2.
+ d& b( l3 r& k - *: ^! J1 j( H; _' B% M0 c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 l1 ?& G1 `3 Y% X+ [/ y2 L C$ t
- * kind, whether express or implied; without even the implied warranty& c0 K5 |0 { [. T: S3 I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" h& f5 S# E; J* ~0 P# O - * GNU General Public License for more details.0 y) R- n C o% q
- */& _: n2 e0 V3 b+ D" Z" c
- ! E& g+ E) i* W) i: F& z
- #include <linux/module.h>
0 r/ z0 D8 q/ ?/ Q: T - #include <linux/init.h>
; z$ n2 C/ ]4 w - #include <linux/errno.h>+ h+ ~* t8 K4 ^! l6 b% G" g5 {
- #include <linux/types.h>. T( W3 g6 u' }- y
- #include <linux/interrupt.h>8 P9 A8 p, G0 i- J* l" t9 S+ y
- #include <asm/io.h>
2 k0 v4 c+ r- i. A6 p - #include <linux/moduleparam.h>
* R4 B; \% g$ C! O - #include <linux/sysctl.h>
9 j, o9 ?- D# j9 s( P$ w( y - #include <linux/mm.h>* v. v. o4 K2 g! k6 J" S9 }
- #include <linux/dma-mapping.h>. u3 l7 q& B' O; ]+ I' s: T
- , z4 v& Z- I1 T" }5 E
- #include <mach/memory.h>
, \, J, q3 p$ M. F - #include <mach/hardware.h>) @- p- b5 O D1 }" ? p
- #include <mach/irqs.h>( d; P+ I# C+ X8 E# V& T ~4 ]+ T5 e3 z
- #include <asm/hardware/edma.h>* @* c0 F% L$ y$ ^& Y2 b9 I# X- n
" E1 V+ |: `4 t; e3 a6 y) |% J- #undef EDMA3_DEBUG
- J8 w4 x) q5 p3 b - /*#define EDMA3_DEBUG*/
0 u7 Q) J" n" E8 l0 l L. q
; O5 g3 L- S, P/ r- #ifdef EDMA3_DEBUG4 o- e9 }5 r' P1 c6 h* g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! }2 y4 m7 C7 Z! b( Q4 ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 u8 x3 D( j) C. Q& k& @! J4 V1 S0 W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! A3 c: s, t8 e+ q$ M
- #else% o- f7 F1 e# r& F* ^
- #define DMA_PRINTK( x... )+ C- K5 n6 z7 z; [
- #define DMA_FN_IN
+ f. K) a9 O( e! W - #define DMA_FN_OUT
1 d( D7 l- ^! u- k. J/ E9 D+ ^ - #endif( `/ E9 R% ~/ b2 O( ~5 m8 V+ z; a5 |0 X
- ( T, P$ A4 x- T0 t* z. d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 V8 ]0 a. V+ P" K - #define STATIC_SHIFT 36 r5 F5 r3 x! {% q4 u- m. x
- #define TCINTEN_SHIFT 20: v) G( ]7 m& h0 p
- #define ITCINTEN_SHIFT 21
: g, N1 t; A X. J, _ - #define TCCHEN_SHIFT 22
/ o. |, X2 x1 u+ c. U& D - #define ITCCHEN_SHIFT 23
6 t2 I3 C2 p/ A' S H - - X9 W# i( }$ A0 }3 J- F, d, d, L
- static volatile int irqraised1 = 0;
! x% M4 c# E% q! s0 c - static volatile int irqraised2 = 0;( L7 l. O- k1 ?8 T, z# n! ]3 C
- 9 g4 W, y! X2 y5 A7 ]# d$ @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ]# g" R& ?9 B+ i( i/ ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 {/ T9 r! i; `) `& G G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 p8 u/ e2 P' ]7 ~. R3 ? - |+ t' T' K# ]) ?% ~2 v, T
- dma_addr_t dmaphyssrc1 = 0;
" _* H2 o# t+ B, K ?5 l( s6 c - dma_addr_t dmaphyssrc2 = 0;
/ |6 z3 A# A8 ]8 ? - dma_addr_t dmaphysdest1 = 0;8 ^! J# U$ ^! ^5 O7 p* P
- dma_addr_t dmaphysdest2 = 0;
z. g3 h& w* }7 D& d% c - / Q! f9 Q' k- T8 O7 l
- char *dmabufsrc1 = NULL;/ | v! c, Y, o
- char *dmabufsrc2 = NULL;
# [* L6 V$ N% `- [. q - char *dmabufdest1 = NULL;9 F: w0 ~8 [# n7 D% a) G2 C3 G; L
- char *dmabufdest2 = NULL;
# d- u+ K$ [; w2 }: r2 A - * }! a; a m6 g
- static int acnt = 512;
, n; O$ ^* K6 }, g" l# e$ s - static int bcnt = 8;
8 w) H- m) i' P4 V - static int ccnt = 8;
9 n, p, f( O$ F) K: C7 d4 y - $ {8 P7 ^1 }1 n& `6 w. F# `
- module_param(acnt, int, S_IRUGO);/ C5 D* Z0 [" O w; ^ n3 X
- module_param(bcnt, int, S_IRUGO);
% y* _' t6 B/ P& g - module_param(ccnt, int, S_IRUGO);
复制代码 # h- S: C; S7 G8 ?: s$ {3 ?
- K, c3 `7 ]5 m. O& D2 i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( k* B% q( e1 c% }* Z, a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 p% a1 m) W5 g& _: l3 F7 O: y9 ?% D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" |) W. p4 d! g
: T4 ^3 @2 G) x+ R1 f: L
% g9 Z2 Z! r0 L, ~0 |. K: l7 j
|
|