|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- E" E' [" |# M9 m! q) O" x- [code]EDMA sample test application+ q4 j e0 }+ X
- /*- d' q) m9 [6 l' `3 T* J$ W8 G
- * edma_test.c
! ~; m9 m& L3 `; W - *
( J8 Y9 D: a% R; d2 ~) }9 R - * brief EDMA3 Test Application+ m" P3 \; P: W$ L% ^
- *3 ~0 v- m9 b5 I" o" c5 q, z3 a! `
- * This file contains EDMA3 Test code.' L! i/ ^0 M+ i& C3 U, O5 z: N
- *
7 |/ ~# A; ^' x# h& w+ w, d4 `$ r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. \( z9 f& i" f1 a: M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% t$ N" h3 p5 \, F7 h, @8 z
- * TO CHANGE.8 B8 v5 y" k, ~ c
- *5 B. C* N/ b" ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 }9 k+ q: v5 h! A# P# I
- *
: ?/ h+ m5 Q/ y2 M* B - * This program is free software; you can redistribute it and/or) T2 m- D+ a0 W$ l
- * modify it under the terms of the GNU General Public License as
! I3 Z$ a& o6 m+ X$ p \ - * published by the Free Software Foundation version 2.( N3 A' v/ N- h, T3 P
- *3 b' q" {+ D$ w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ }6 H0 s% B, g! G5 y/ ?/ u - * kind, whether express or implied; without even the implied warranty
+ u d4 w6 G$ `, B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( u& F) N# ~6 j* z
- * GNU General Public License for more details.
7 D1 l! z( X! N) G n5 E - */1 W% ~% ?* i1 ?' X: P
0 Q: [: Q8 f0 v* X" c- #include <linux/module.h>0 e1 b0 m6 B1 R! i! A/ \7 A
- #include <linux/init.h>/ |& B) ?- x. p; [
- #include <linux/errno.h>
- C/ T; j- j1 s. A/ f0 j3 U w. r - #include <linux/types.h>
; s, u& {0 l. l8 Q3 N - #include <linux/interrupt.h>
& e. o4 F) d9 d4 O( r' m ~. B - #include <asm/io.h>) D: g4 ~ R. r# z
- #include <linux/moduleparam.h> ] L( ?# ]9 b: Y+ J% u+ |5 ^
- #include <linux/sysctl.h>
6 T! p$ y4 c" l- h% t - #include <linux/mm.h>
4 Q$ X* W/ ?8 ~. T - #include <linux/dma-mapping.h>5 X$ Q. [( R- ~- w( F7 _, _
6 _ C) [# _* ~6 [3 X, x- #include <mach/memory.h>
) y0 _3 x1 k9 r. n' l - #include <mach/hardware.h>
# ?, r9 c1 A; _' r6 p2 W - #include <mach/irqs.h>+ m4 i# l* R2 @6 O' w; [
- #include <asm/hardware/edma.h>
% ?! ~, x/ ]0 E6 E: x - ) s: [' e3 d/ S5 P& l& d- j
- #undef EDMA3_DEBUG
" H. G: o( D M6 F3 J - /*#define EDMA3_DEBUG*/
5 m5 A0 A8 n/ p0 } - ; e ^5 D U* \) k3 S
- #ifdef EDMA3_DEBUG% b I1 q" ]2 a2 v1 ]8 E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( A( w, U# l# c7 M( J* w0 b( G' S; q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 R! H$ k# @ l+ D2 \) G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, v" T% v9 V+ G - #else# \; i$ T$ C6 X( f+ i$ p& n) \( h
- #define DMA_PRINTK( x... )4 z& T# x7 x0 O) ~0 k6 J
- #define DMA_FN_IN
/ I! U3 S4 }/ A! L+ n - #define DMA_FN_OUT
1 y# J4 Y$ i: j: k& w, I - #endif
' F6 C, S$ C' d+ E0 {& H
8 ?2 Y! r, l/ b. S* `$ g0 ?5 _; @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. H1 w V0 u9 e* a) Z. C - #define STATIC_SHIFT 3; p8 p; ]7 A7 h& U
- #define TCINTEN_SHIFT 20
1 ^4 K8 M% m9 A2 T1 K. S# p" Y2 a - #define ITCINTEN_SHIFT 21
6 _, @* r( L9 N2 D- f' R9 O" M% E - #define TCCHEN_SHIFT 22
4 H/ `$ G5 O. y, ^; M. m - #define ITCCHEN_SHIFT 23
* h# O6 | S S% H
' u; T2 E+ l% t: e6 C& C# c- static volatile int irqraised1 = 0;/ t3 K% V7 f6 v( x) W# [
- static volatile int irqraised2 = 0;3 v$ U5 L: t$ Z5 _& v
- " Q P2 D; o+ c/ n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! W1 O! C, C% }% ^) j$ Z0 J7 A/ z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 R2 X I- [/ A3 v8 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& i! p& Q4 R5 R/ V, Q - H9 n; a% J" K) p$ c0 `
- dma_addr_t dmaphyssrc1 = 0;
2 `) t4 E0 S$ L$ e2 M7 W6 Q - dma_addr_t dmaphyssrc2 = 0;
3 i8 D2 n G5 D" @# E; T# U/ V - dma_addr_t dmaphysdest1 = 0;
; {8 Q( z3 |+ [& M r- E7 v8 b - dma_addr_t dmaphysdest2 = 0;
" d$ N* @& s3 p9 @% j
9 a! Z# [) f6 ]& n0 \# ?, B3 ^: t8 Q- char *dmabufsrc1 = NULL;9 {( }. D* m; q' X
- char *dmabufsrc2 = NULL;! T! E0 F1 f. c9 }
- char *dmabufdest1 = NULL;1 L+ V" N! J W; l1 V( y: H8 f! n
- char *dmabufdest2 = NULL;
5 ~+ v7 i1 r( l - : ]5 I" c/ N, T- t
- static int acnt = 512;
$ G2 K) x, O# V - static int bcnt = 8;8 f1 r6 t! Q# H
- static int ccnt = 8;
4 X5 v( O4 {) R
7 p# m7 J7 y" O9 F5 r5 ^2 b- module_param(acnt, int, S_IRUGO);
( l5 ~5 z& w" o) y# e( O# a - module_param(bcnt, int, S_IRUGO);+ m# a& K6 ?/ v" X7 z, f$ ~; G& u
- module_param(ccnt, int, S_IRUGO);
复制代码 1 F( M3 O P8 [) ]8 M" _ z
6 y! Y& x" t: w) _" X* S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ c# j3 @8 U0 \% U) c& x+ O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, m! H% Y! Q& B; v2 \6 ~ [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# q* m6 C) t# B- H$ g
+ f: q! `- l6 G
# F$ T( ~) W$ A0 e+ \ _5 z2 p
|
|