|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + o' x" p1 L" X: b. P
- [code]EDMA sample test application. } L: \, W( h% v5 Z4 `8 X h
- /*
% X; h5 [+ ]# p, m" x - * edma_test.c* q' k; {' g8 `8 Q6 o5 O
- *$ u' c( y1 }* y6 ^) P/ ?
- * brief EDMA3 Test Application
. n2 R( B+ |6 o- V, h - *; |+ k4 [$ k" J( n5 X1 R8 {- H
- * This file contains EDMA3 Test code.0 A; r* s; L8 Y; e
- *
7 w! R6 h( Z/ ?: D' \9 Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
V5 _# C5 G U/ h; @3 `$ j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" G2 S! T2 t8 V
- * TO CHANGE.* H7 B" F3 G: R* f7 d
- *! D. W! S3 B; |6 j' a! N; o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: ]$ {. m5 _9 L7 Y
- *
( ~+ n1 l& u A - * This program is free software; you can redistribute it and/or
0 Q0 o, b* [" b4 x - * modify it under the terms of the GNU General Public License as) r3 R$ ~) A; W6 Q0 d# X
- * published by the Free Software Foundation version 2.* H' v& s6 |, \1 u
- *& C# H5 ?% x, J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* H$ B i2 L% N# y1 G! @$ U* D/ U1 o
- * kind, whether express or implied; without even the implied warranty
! ]3 v% s" ?3 ^4 U; G( Y) n7 B3 A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Y& }8 c7 ~ x* X! L2 Q! ^4 D* z - * GNU General Public License for more details.
4 D4 p0 P$ R3 J+ X' c& R% { R0 f - */
, T# E1 q8 j. Y1 {8 Y9 g
9 F1 U! X+ G! X9 r" |! W- #include <linux/module.h>; |' }& p4 Y( [% A) s# o. t
- #include <linux/init.h>
& {! w6 j; p! r$ ]5 }7 X - #include <linux/errno.h>6 x. C: I8 G0 A+ k6 @
- #include <linux/types.h>
8 ]9 z1 S, t% ]1 n ]5 ]4 x3 l1 o" E - #include <linux/interrupt.h>- S( A3 h# Y% q% F' x, K/ u
- #include <asm/io.h>4 v0 Q! X/ q, v1 D4 v4 J* k, }* S
- #include <linux/moduleparam.h>
) u9 k, |1 n0 S& N8 v' d - #include <linux/sysctl.h>
* g; {# E) l5 O! ]9 q( g( d - #include <linux/mm.h>5 i) }0 g8 F0 ]- I8 U8 c
- #include <linux/dma-mapping.h>0 q* C& {0 P- g4 V/ m" i" O
- 2 y) ^9 _' c5 F& l! [0 z
- #include <mach/memory.h>
1 u6 O9 I7 j! b% S) c% D - #include <mach/hardware.h>6 Z) \, P/ D- h# w& Q& {3 g9 ]; r( t# s
- #include <mach/irqs.h>
' H+ }# N$ {* {' ^ - #include <asm/hardware/edma.h>
( O1 d; O# ]# `! b1 K7 u( a
/ Z: h: z) y+ i- L- #undef EDMA3_DEBUG
6 ]4 y( P; [, j& i/ I5 b - /*#define EDMA3_DEBUG*/
6 W, Z# F) ?# b
' [- w9 @# |7 A e$ F- #ifdef EDMA3_DEBUG6 N9 H& s! d3 V; C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 g6 G. n( w* r9 c# N; z$ Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" l: T5 t4 z& ?9 g2 z& v- W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 H4 Y9 w( o4 G- [- ~ - #else: ?. D$ v$ |% I) Q6 Z3 }8 r1 ^, Q
- #define DMA_PRINTK( x... )
; g2 W- K* M- d( Y: ^ - #define DMA_FN_IN. d6 U; b2 A) Q# G# b0 }* k
- #define DMA_FN_OUT! t% ^( G/ k. }0 o5 {% ^
- #endif: x4 R# O9 s) `5 {' [
, F2 D. }, r( n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, B- l* U$ w n! j7 M - #define STATIC_SHIFT 3' P, y( e* O4 J) |
- #define TCINTEN_SHIFT 20
3 D8 G- z. W! K7 R o - #define ITCINTEN_SHIFT 21
0 P4 N" q! r! P0 n# U, f - #define TCCHEN_SHIFT 22
* D, s, N u5 r - #define ITCCHEN_SHIFT 23
/ i$ N) o: ^9 X1 i- r
7 q4 X8 O- @/ v, q" @% K- static volatile int irqraised1 = 0;
3 P( [/ Q/ Y2 d# w - static volatile int irqraised2 = 0;
# C" A+ o* [5 ~+ S0 n$ v( K
5 W) ]; |- m( @9 x2 r! h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 d) b* z8 O. t U/ P6 I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ C$ d5 S3 ~' e. w$ h, t' d! R t3 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 v9 r8 H# f4 f& F
4 ?) U. G; y1 U# N+ ]) \- dma_addr_t dmaphyssrc1 = 0;
t) e: E# |: l' F v7 ? - dma_addr_t dmaphyssrc2 = 0;
9 ^( x9 E# ?, y& D7 ^( t; }& m3 o- D - dma_addr_t dmaphysdest1 = 0; N! B2 E& r) ^
- dma_addr_t dmaphysdest2 = 0;
% y8 H0 f N3 w, X/ y - " N) W9 q3 b' d3 C9 E9 m, `6 V
- char *dmabufsrc1 = NULL;
) V% @% ^1 v' j! n. G4 n9 f3 G - char *dmabufsrc2 = NULL;
' b A; {( t1 ? - char *dmabufdest1 = NULL;) t$ g: _$ L8 h. r7 `- l, Q% b% s
- char *dmabufdest2 = NULL;9 [; D2 c% ~* z
4 ? `9 G9 c/ {* _- static int acnt = 512;$ _7 J% m: r) p `% u0 v* d- s& b
- static int bcnt = 8;! _4 X. F1 f* o ]+ r
- static int ccnt = 8;. Z! d+ K2 f2 F( [" S) d- q
- {; ^9 g% _2 x: G- module_param(acnt, int, S_IRUGO);, x" K/ t4 s" n- i3 E* P0 L
- module_param(bcnt, int, S_IRUGO);" y# R6 f$ { d3 O$ a, \( Z! F
- module_param(ccnt, int, S_IRUGO);
复制代码
4 c# {; m: c9 N# p( g
2 D. D- l! a( }3 C1 ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ Z6 Y3 K* f0 p/ I. E9 x$ X0 larm-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 U+ p S/ t) U6 e* c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# p# u8 r0 ]* B' g; Y8 ~/ V) l3 ]* j8 ~5 a- ^: g+ l0 X6 w+ ]
% i! h9 Q4 J- d' B
|
|