|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! J. s* R" l4 w5 R
- [code]EDMA sample test application
# ~9 c' ~4 ]3 `( H, B" }# z% |; z - /*% ^9 p# E7 d+ A- x' }& v( R
- * edma_test.c
5 J0 U l" i" W - *
' N& y5 f' z+ C0 b" R* W/ s - * brief EDMA3 Test Application2 W4 i) H1 K7 N; R! R; D
- *
( z2 F1 I1 t* y4 i4 g# I! Z* V; | - * This file contains EDMA3 Test code.9 d9 `# R& g. g; G$ [9 x
- *
$ u* [, t, X" ?# X) X# y# F" d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, D) ] b3 C! p# W5 S- O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# b; |+ E5 x" M* p - * TO CHANGE.& D0 g' V# x, L' S
- *
O1 R$ u/ r+ x& S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
H# r+ `" {7 Q' ]! d# Q( ^ - *$ ?. y! T% ?, b: N7 e( S: O8 H9 j
- * This program is free software; you can redistribute it and/or
, f, w* G1 S& i1 `3 P# z0 o" d! ` - * modify it under the terms of the GNU General Public License as7 K/ v! ?( V/ M) ^5 c/ r' \
- * published by the Free Software Foundation version 2.
+ U, F9 R! x; s+ L7 P6 f5 r - *
7 p- v# g6 V. C( x# }8 O1 ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& X% I" T% H+ i' d/ d/ V8 B, I - * kind, whether express or implied; without even the implied warranty
, p0 t+ p4 v& D4 A5 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 c* M" G* P; J6 U - * GNU General Public License for more details.
$ q/ a0 z: D1 B/ p8 p2 M( [' ~ - */
* C: W2 q( O9 G( E4 g7 Y/ g ~ - : n9 c% [% t2 p% h0 E' @5 |* G
- #include <linux/module.h>/ @6 g. F+ h3 n- Q4 t$ Y, O" u5 k
- #include <linux/init.h>
( S1 g* ]! d5 t8 A - #include <linux/errno.h>
* l5 U& n! W( ]4 J7 ]+ r) R0 y8 }+ j - #include <linux/types.h>% m* F R- C3 G+ {# s8 g
- #include <linux/interrupt.h>3 g `0 h0 d; k) k
- #include <asm/io.h>
9 l9 L( L& q/ k - #include <linux/moduleparam.h>
. _% g# }" Y1 m& n' y- T - #include <linux/sysctl.h>6 d4 G, |* j8 x
- #include <linux/mm.h>
, Q' w; s: Q- D9 c! W' [/ V8 C - #include <linux/dma-mapping.h>
0 m; t4 |3 k1 S8 ]& D - $ [: f" H/ z" [
- #include <mach/memory.h>9 C5 o9 d3 D t: R4 z, G
- #include <mach/hardware.h>
+ ^4 X# M1 S/ q. l - #include <mach/irqs.h>
# }* b3 D8 Y' _ - #include <asm/hardware/edma.h>& G& Y% q' ?* q( |
6 `' G/ ?) t) v2 l) N: J0 O- #undef EDMA3_DEBUG
: F3 T. k! h, H5 B, [ - /*#define EDMA3_DEBUG*/7 V3 {6 `7 ?1 B
8 @+ q3 A) j6 ~! _- x0 n: b; }- #ifdef EDMA3_DEBUG/ ^% {. @, M' l. q" r2 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* v9 {5 K8 R, Y6 ?5 ~& i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) T1 Z7 P# ]3 k8 O8 ~" }7 b& u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. M- p0 w5 a; Y, j% s- F6 c - #else: C; j0 w/ E' D" q" O' J# {
- #define DMA_PRINTK( x... )4 z3 K# x% d# }; f' b: M
- #define DMA_FN_IN
; G, u: F3 ?# a U - #define DMA_FN_OUT, P) l- z# z0 z( p- {. U
- #endif
6 f8 [' n3 d6 M7 d1 r4 u
- W, ~5 V8 V( u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 o- |- ?+ y1 Q7 e7 a
- #define STATIC_SHIFT 3
( I H3 b* j1 A' ? - #define TCINTEN_SHIFT 208 j! [3 d- q, e: S8 Z2 n& N4 M# D3 o8 ^
- #define ITCINTEN_SHIFT 21
& d0 ~2 w: d( H5 p1 W - #define TCCHEN_SHIFT 22& u- T9 A9 N7 ?# H+ T# B0 K
- #define ITCCHEN_SHIFT 23) b8 ?" ]9 T7 [+ w
- ' c2 K4 f% e; L) l4 N4 p$ `
- static volatile int irqraised1 = 0;3 j; {# g& N9 G7 ^- h& `7 e
- static volatile int irqraised2 = 0;
1 f9 U4 g6 W9 H) o0 Z" D - 7 a9 P0 J, N" n0 t9 z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ]4 }* H- P% g$ y+ Y2 i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 P' ?/ H8 K! O) G; r1 P4 | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ E9 T- J' s8 S/ Q8 _* _
- ( r( S" Q2 R/ j* q3 t9 Q# l* t6 W
- dma_addr_t dmaphyssrc1 = 0; F/ Q; P4 h6 t; G: I$ h% q4 d
- dma_addr_t dmaphyssrc2 = 0;
( k. c! w3 f% U) B - dma_addr_t dmaphysdest1 = 0;
, I/ q) r2 A* Z. `: z+ f2 S - dma_addr_t dmaphysdest2 = 0;4 o- }1 k: o7 f: M6 S
- ; a7 Z% Q4 ~% q! }2 o, f i
- char *dmabufsrc1 = NULL;
5 R% f/ @! d0 u& G1 ~ - char *dmabufsrc2 = NULL;
7 P: v R+ L# c8 \3 z: J( ^ - char *dmabufdest1 = NULL;+ L: A/ J7 y+ P8 ?( H- n
- char *dmabufdest2 = NULL;
4 T: U' @8 ?: Q- J1 J8 ^
% `" B# G0 S+ g! O& U- static int acnt = 512;
1 f5 g5 p( a( j$ {& f, j - static int bcnt = 8;
- Y% X, s3 k; [* J8 y b - static int ccnt = 8;$ n0 U: C! Z ~( x
- / J8 v( n) _# [4 @! y0 L, L2 C- \# y
- module_param(acnt, int, S_IRUGO);
2 }6 H; E" f3 u - module_param(bcnt, int, S_IRUGO);
. _5 f: G& `' Q% S - module_param(ccnt, int, S_IRUGO);
复制代码 9 q4 G1 K. f8 g" o F2 y1 J
6 w& F9 t( i( T& X! N/ N5 N9 P5 Y: N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, E& j g& }: V1 C* [, i0 e' V1 l
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 Y) E3 h" u$ q& h. |, |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! v5 Q# l: b( b# H
+ D9 L. G+ T0 F, X# D
/ O2 }; i8 C6 j4 r |
|