|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" o O" ^, K6 i) W& q2 w, }- [code]EDMA sample test application
& _* |7 ]: \) R# } - /*5 e' i8 Y8 K! g
- * edma_test.c
' U0 \. o4 }3 |3 R: y% x/ O. l& q: W - *
+ h. J; c& \6 S- x5 [$ u# n - * brief EDMA3 Test Application5 r# ]6 p. m" `; X/ \
- *2 i8 j, ^3 E ?) M% I
- * This file contains EDMA3 Test code.' o b9 r: s! K! P G$ }
- *
' d+ n5 Z0 X1 y5 C- o4 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 s) R* f: S- H* u' @+ e& ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* x- k( ?- A/ e. b" F0 r - * TO CHANGE.
1 q/ K- j; ~: c! G8 V# k - *
) f9 H5 m. T0 c: a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) J8 g. G( M6 B! V, g - *( a$ v1 S+ }) |1 ^
- * This program is free software; you can redistribute it and/or
5 W% G( |4 Q) _6 C$ c( J- D' o( x4 J - * modify it under the terms of the GNU General Public License as
6 Z. [% A/ K4 p- j2 {! k2 H - * published by the Free Software Foundation version 2.
( c! ]' {# S( ?! A/ y - *
; v8 h+ L- V7 R' C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 S8 D) ]/ ~, q* x - * kind, whether express or implied; without even the implied warranty& x2 d8 m [4 c0 v7 {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: v! o+ w" y# x; `% q( v - * GNU General Public License for more details.
/ Y% K1 {8 B* S - */( X4 G. h, ]: |; I; ~( y
- ! f* s. T/ G' ~# @2 `! g- R- \
- #include <linux/module.h>$ X4 _9 m' | ^
- #include <linux/init.h>6 m2 G2 ]4 K% m# O$ V" M3 N
- #include <linux/errno.h>; v. [) L9 R' R" @0 T- L2 T
- #include <linux/types.h>
" ~1 T2 i& D- q& K# g* m/ ~! w - #include <linux/interrupt.h>" a9 l0 y7 b: e& I2 s1 x4 Z5 F
- #include <asm/io.h>
/ f/ \3 g" R+ q1 N/ Y - #include <linux/moduleparam.h>: p& [8 b. a% ~0 o" I. y7 C2 X
- #include <linux/sysctl.h>
" H7 _, G+ ~; K - #include <linux/mm.h>
% ]1 P' }5 J5 h% Y* X - #include <linux/dma-mapping.h>
' a7 U0 b4 I% U" M4 t
Y, z* O: Z) J- #include <mach/memory.h>2 R5 _0 H7 y, n0 C4 b# j
- #include <mach/hardware.h>
! v: ]4 c; k8 I - #include <mach/irqs.h>+ }' i' e/ h. b! [
- #include <asm/hardware/edma.h>
2 s7 }5 m" g" b4 i, q( Y5 d/ L - 1 ]2 k. _4 U9 n8 d1 ?. W7 V
- #undef EDMA3_DEBUG4 I* C0 l( w9 Q/ C( P/ ~ z
- /*#define EDMA3_DEBUG*/! }3 ?4 f0 L3 E& ^/ d
- 8 |! e J! @5 ?- k: ^. l
- #ifdef EDMA3_DEBUG& b7 j/ ~& ^) r8 S( J" t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 J) F' x. g- f( |( C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ O, G# K# X3 H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) M% ?3 j5 j: m* \
- #else. x- o6 @% r0 h. Y# }8 i/ T
- #define DMA_PRINTK( x... )' U( `: r0 T! ?# I4 K9 `
- #define DMA_FN_IN
3 ~; U- y$ `' k! @# }2 M - #define DMA_FN_OUT3 ? `6 ~+ ~9 h d( H
- #endif
; ^0 l' M( O$ k$ F
( P1 }$ P+ C3 }: U9 H- #define MAX_DMA_TRANSFER_IN_BYTES (32768), D. e; e; j9 _* g& s# \' P; n
- #define STATIC_SHIFT 3
8 p# D1 H! g1 I3 m4 A, s E - #define TCINTEN_SHIFT 201 O# z# u8 o& l3 ]1 a$ f
- #define ITCINTEN_SHIFT 21, f" V% x3 R! J5 Y5 z0 v
- #define TCCHEN_SHIFT 22
$ ?; a4 r/ u! {; N - #define ITCCHEN_SHIFT 23
0 }) ~9 r+ l" Q - 9 I) {0 U3 S* z
- static volatile int irqraised1 = 0;6 B4 m9 b2 n" X# |! G
- static volatile int irqraised2 = 0;
, B+ l2 a# [* Y7 ^8 g
8 o$ n/ _& J/ k4 i- ~5 J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# y" h5 w1 d R. K4 Z" h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, y2 F9 P5 U7 C B- z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. u8 f2 g2 A# V7 g/ e$ N
) {, Y" t5 C5 b( c/ N- dma_addr_t dmaphyssrc1 = 0;
1 n4 s m) i7 \+ i4 I, ~ - dma_addr_t dmaphyssrc2 = 0;
5 C7 \3 p, N+ S1 X' S7 s2 T- _ - dma_addr_t dmaphysdest1 = 0;
$ N) i+ {2 s6 J/ u# i8 {# E5 ` f - dma_addr_t dmaphysdest2 = 0;# @2 ^5 ?# B$ O2 T4 y
! F4 V# ]4 ~9 t* f8 F/ J- char *dmabufsrc1 = NULL;
. b8 ~% M+ A W+ G3 d; J! l0 q - char *dmabufsrc2 = NULL;7 `" O/ @' E# ?4 l- X3 d" i8 h1 @8 Z
- char *dmabufdest1 = NULL;
. m& v- F ^* f$ b+ l, s8 ^ - char *dmabufdest2 = NULL;- E6 c: s) F5 E' q, M4 c+ }
- # u' ~5 U) P% B* h4 K. h
- static int acnt = 512; A, Y4 Z" a+ [/ R; M7 e
- static int bcnt = 8;
8 m0 M$ a+ H% U! ?& z - static int ccnt = 8;
% a' I/ i) B& Q
$ C5 C$ d3 \' D+ K5 ~- module_param(acnt, int, S_IRUGO);
0 r% r; ^8 S- u2 H* O - module_param(bcnt, int, S_IRUGO);
9 w0 P# R% [, M& ^& h - module_param(ccnt, int, S_IRUGO);
复制代码 1 m: H9 O& k& U( A
/ ?' [& C7 w8 [; w; k. o% K. R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* c, v4 Y# S: j) U% h4 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 M8 _8 t7 [8 X) N& V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! m+ r( d& W z a+ ^$ U1 k. H, g- a9 a- k
! P- N# g$ K. [ ]- z
|
|