|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + \) E6 Z. m! y, Z/ ^
- [code]EDMA sample test application
: T: r4 \" L5 S& M9 J" ?% d - /*/ ]- ^- \* V% Q. q' u
- * edma_test.c
o) C, T4 O8 ?/ w7 ~ - *
4 N% K. v x5 x4 `8 I6 v - * brief EDMA3 Test Application A+ l: u0 { ]8 D' b6 h L
- *
6 _5 h9 t+ s* F% A - * This file contains EDMA3 Test code.4 {8 j: I; i' W3 W( r- {& s
- *% h+ R; R. u9 }- k: y F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* I0 k0 X' T. Z- b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! {# \! x# @+ y6 O
- * TO CHANGE.
1 v# r4 }9 d8 n4 g! v4 R - *2 h$ v3 H6 U2 |8 n5 h* n* B e0 w1 V' E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. X _3 z+ [9 s7 l' r - *: j" S* |6 V+ [3 y
- * This program is free software; you can redistribute it and/or5 I/ Z5 j9 x. y
- * modify it under the terms of the GNU General Public License as" s: j; g0 e# n' D; V2 {
- * published by the Free Software Foundation version 2.; R: h( e; q# @4 y
- *
" _8 b7 K9 U. r8 e- {7 A) W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# `5 B4 h+ q( W$ G1 q$ Q- V - * kind, whether express or implied; without even the implied warranty2 d, B4 h. f6 C6 }, H& e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ \4 f" S; l5 b+ Z+ B
- * GNU General Public License for more details., l7 ^& ]# L+ V6 t1 ~
- */' E" a, u* y9 W% a8 e5 u
5 h3 u0 M, c* z; E8 ?. ?- #include <linux/module.h>: P" Q- |/ A1 s- p, U$ F/ L
- #include <linux/init.h>: `2 E3 z- Z4 G# ?% _( i2 {
- #include <linux/errno.h>
- |# p8 A' ^1 a8 M b/ f& n6 S - #include <linux/types.h>4 G0 M: ?( F& p9 Z
- #include <linux/interrupt.h>
% V0 l" A2 J3 n7 |+ s - #include <asm/io.h>5 {; p, @1 J: Z+ x; D% j
- #include <linux/moduleparam.h>
- i" v- s2 Z- C& Y - #include <linux/sysctl.h>
/ b8 g( S/ {3 N. B4 } - #include <linux/mm.h>
* y$ L2 h! Y5 N- H0 e - #include <linux/dma-mapping.h>+ w/ _% I/ ?9 R) D# {
3 j+ j/ u7 L$ V" M: h2 e- #include <mach/memory.h>
* H+ J; W0 x* ]4 W# { - #include <mach/hardware.h>
6 B6 d4 H3 A- e$ H2 ^+ a3 s - #include <mach/irqs.h>
4 M/ `1 f) ^) N% d n8 a& f4 \; a' M - #include <asm/hardware/edma.h>3 q" ^' e- r& B- n( \& {5 ~( x
- # l! Q1 F; {. B' s
- #undef EDMA3_DEBUG
1 K$ B" w- H' c5 z# ]! _ - /*#define EDMA3_DEBUG*/; H- n- D7 I& S0 _4 ]0 l
7 t! q; Z' v; J! L4 B- #ifdef EDMA3_DEBUG% A |# h4 _% {6 _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; @9 G4 j& F' ~) ~+ V3 ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; f) p# G3 H+ } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* H: x" ^) {1 q
- #else
/ C' [! o$ N ^5 z, [ - #define DMA_PRINTK( x... )
1 {9 C7 k _9 N7 W/ `! P; K6 Y4 T - #define DMA_FN_IN
, Z% \, m8 z3 a5 W3 Y! J% y - #define DMA_FN_OUT( S8 n5 ?$ t* q* D8 Q
- #endif
2 }4 \9 D+ U% L4 S( V2 { b - 3 R3 E, b, Z! C0 W: M4 q; d& H; T6 Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ x5 j8 J) l7 Y' t2 E - #define STATIC_SHIFT 35 y3 k$ N! G& V- f
- #define TCINTEN_SHIFT 208 @) o" f R5 _# J+ @) `& M1 z% j/ ~ z$ Q
- #define ITCINTEN_SHIFT 211 U, u5 e0 g; r! P# u
- #define TCCHEN_SHIFT 228 M9 \. H' X* n2 ^* u* c- g9 D
- #define ITCCHEN_SHIFT 23
( j( i! ~( i" n o1 c. r2 Y& U
1 Q7 U' I: p6 ?2 w0 d- static volatile int irqraised1 = 0;6 Q z6 U; p+ f3 f
- static volatile int irqraised2 = 0;
. ]8 V$ {5 B* i( A+ g
- C0 ~: g2 E: b! M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l$ s! C* S: T, {6 Z; i9 b0 j* e2 f0 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* O# \; z; K$ F0 f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, _1 H* `2 o0 E# e) J; y0 Y' i {' r2 z - : g# Y. U& b; ?/ p- F/ X
- dma_addr_t dmaphyssrc1 = 0;
/ O3 z! v& g" W/ ?8 M1 C1 K - dma_addr_t dmaphyssrc2 = 0;* k) z6 ^7 o, G: I" ~
- dma_addr_t dmaphysdest1 = 0; S9 q" s; d, m4 |9 R' n# O3 v3 q- J
- dma_addr_t dmaphysdest2 = 0;' A6 v3 ^. J2 M
, s+ U6 Z# o, ]7 z- char *dmabufsrc1 = NULL;
( [% O0 Z3 v' {( H - char *dmabufsrc2 = NULL;
2 W: N: U* }, o - char *dmabufdest1 = NULL;
" d; I8 X% d% {( a% M3 E - char *dmabufdest2 = NULL;, E# U: C% E0 L$ n
- $ m4 o8 w y$ ~2 n- V/ k
- static int acnt = 512;
# S* B! B, b2 T - static int bcnt = 8;0 l2 m, z) L; {$ R C% O# w
- static int ccnt = 8;. E! G e2 E; O% A& M% m
- 2 G K% z2 e" s5 T P5 `
- module_param(acnt, int, S_IRUGO);* m t+ x( q" y3 M3 i. j/ e
- module_param(bcnt, int, S_IRUGO);! v' j" j7 k+ Y g, f: S' b
- module_param(ccnt, int, S_IRUGO);
复制代码 M8 n5 X0 S% v: u6 c
7 m2 N5 i% E: T3 K8 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: y' n \9 x0 [6 narm-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 U1 M9 |% D- x0 ]& ]& n: C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 n; ?% ]/ ?, L2 b- D& a7 T
0 v) K/ Y5 ^1 t. d+ B; j8 L
7 b7 p- a4 s8 i5 z) D |
|