|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 h4 ?, V( {1 \$ a- [code]EDMA sample test application
& |/ k) [: B8 E - /*
8 Z* R; V% k7 _& `& }8 f9 J# m: G - * edma_test.c
* i: z2 F* j0 O# t2 s - *
% a+ J, O; d- h( b8 ~; i - * brief EDMA3 Test Application- ?: `+ ?, l. \! x( T2 J
- *( d! e" N/ U& T+ q1 c: b0 X
- * This file contains EDMA3 Test code.
. i/ n, g( j9 Y. R3 z - *
8 |3 q# [ e' [3 K" H1 e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* d- o4 d i( I/ H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 c, [4 e- e8 f$ f) `
- * TO CHANGE.
6 s) p" m2 Y# f' {7 Y7 \3 F x - *
' z/ h, ~7 `: I! N$ N' r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' W0 O5 t. Y9 y9 I+ ]% T
- *7 ]! ^: T5 R/ C. B
- * This program is free software; you can redistribute it and/or/ I8 V0 ^! l! J
- * modify it under the terms of the GNU General Public License as
! z4 T1 L! T" y/ e* x7 I; {! w - * published by the Free Software Foundation version 2.
* w+ t5 B+ i! G8 C% W5 v - *
; v$ ^0 X' X$ E8 ~4 F: [9 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 H. r' c" B# H2 s# I# m - * kind, whether express or implied; without even the implied warranty
$ F& g% |: J: l' t) b+ G$ H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# j! ~+ p1 k3 ~% M. M
- * GNU General Public License for more details.+ F- @- o4 R1 K: ]+ ~" B8 p
- */
6 j- Q5 k, |; u
6 v: q7 I( e7 W/ d& C- #include <linux/module.h>( I+ D$ m: p- \) E, y% u9 s5 W+ v
- #include <linux/init.h>1 `( z( S$ G6 s% `/ _
- #include <linux/errno.h>
, }7 r: s; {- S7 G* ~! W m - #include <linux/types.h>2 {/ K8 u3 f) L
- #include <linux/interrupt.h>5 y; n$ L: S# [% N4 b
- #include <asm/io.h>
1 k) z5 T5 o7 f [ - #include <linux/moduleparam.h>( j: E6 @& c4 Y6 d( Q8 I& y9 l
- #include <linux/sysctl.h>
/ V' ?; g5 G2 u; @ - #include <linux/mm.h>9 w+ y: ?- `' B& [# p- E% \
- #include <linux/dma-mapping.h>
I1 W, r9 W! J6 r5 ~9 o - " e# S- {. b* F& z( `
- #include <mach/memory.h>
" X: C3 H7 ?6 d3 @: ]: l - #include <mach/hardware.h>; V4 y. \0 x* L2 L
- #include <mach/irqs.h>6 I$ [5 ?" A N+ E
- #include <asm/hardware/edma.h>1 X! ^ E# ^: A- c! f
0 s$ h; i1 n1 c- #undef EDMA3_DEBUG1 T" N( D3 X& A& P7 p( z0 u1 }
- /*#define EDMA3_DEBUG*/
1 b$ A8 @; W7 y ~# T
: w# A/ L; {7 C, J7 G8 J- #ifdef EDMA3_DEBUG
' L3 i$ i( ~& w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 E/ p: p4 \( Q; V9 R4 y S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 V8 X3 `- ?' Y7 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 J" e! l3 B: X2 a+ ?( s& J - #else
" q# M6 F2 A2 p3 X% H - #define DMA_PRINTK( x... ). ]& a+ i$ C7 _$ Y
- #define DMA_FN_IN) x/ Q7 @% h( w
- #define DMA_FN_OUT
6 i2 w; p! S$ } - #endif7 S4 P6 S$ E8 x+ w0 g
- * p" t! t6 L6 T% k$ f5 h2 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) U' v) k" ^( {$ C
- #define STATIC_SHIFT 3% X. f* U( }2 t3 W f2 D, h' G
- #define TCINTEN_SHIFT 204 r$ D Q& k3 y0 ]$ d0 c
- #define ITCINTEN_SHIFT 21. y$ C; G9 D5 Z
- #define TCCHEN_SHIFT 225 J6 Y$ b+ g3 [ J9 H
- #define ITCCHEN_SHIFT 23$ r% y, R9 j& k9 h
- ; d, m; F$ r! s
- static volatile int irqraised1 = 0;2 V8 ]9 _, A1 {7 [0 r/ p
- static volatile int irqraised2 = 0;
, x2 F2 I- R5 H9 ~, X - 5 w0 |. @: r' S# m3 _1 L4 t; M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* c1 p8 P4 M' o3 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% T+ S+ o8 O" v' g1 |: N& x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! s0 a- ~( Z' \! w
/ D: F5 v$ I1 G. u$ D: [- dma_addr_t dmaphyssrc1 = 0;
+ e# V) {6 ~9 K4 u) ? - dma_addr_t dmaphyssrc2 = 0;
' J% M# z1 u/ e0 z! ^ - dma_addr_t dmaphysdest1 = 0;5 P% k& g% N+ I% ]
- dma_addr_t dmaphysdest2 = 0;- `+ P3 Q1 K' m5 v" [2 _' v
- * P# }/ p) J5 d
- char *dmabufsrc1 = NULL; r% X6 g+ E4 }. ~; G
- char *dmabufsrc2 = NULL;9 I( e# L" Q5 Y2 }- _" L
- char *dmabufdest1 = NULL;
9 }" h8 B0 C8 U% S - char *dmabufdest2 = NULL;
( g! [& F# x7 {5 i - 0 ?3 }1 e) w5 u$ O% ^
- static int acnt = 512;
% {5 l/ r, W4 }( b - static int bcnt = 8;
, e* a5 h: c4 }4 N - static int ccnt = 8;" J* K% V9 e. w% l# b
7 R9 q* u2 U4 m; C% P- module_param(acnt, int, S_IRUGO);
) G1 k8 z) F& e8 x. y+ T0 R4 i - module_param(bcnt, int, S_IRUGO);
8 J; [1 Y( N% }* S: B - module_param(ccnt, int, S_IRUGO);
复制代码 / c3 W6 a: @( z+ X' o
6 X( c! p5 k6 F* Z4 ~* ]0 t: v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 k) L4 `- U4 f6 q( e- d
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 e& T. N+ n1 f$ R, I7 a5 Z7 B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& J1 ^* h! D+ B( O' y" i' j& u. Z+ R6 p
2 D' P0 [) E7 q; i) n% V0 S$ I
|
|