|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 D! k/ K) A8 o# K& K2 s5 u
- [code]EDMA sample test application
q# K6 l- K' C" V, x - /*
! N3 z1 @" |2 I, ? - * edma_test.c" k( {! _$ V8 F" N1 @) P
- *
3 A7 ?. v+ c7 c! m* o2 t7 K: C* X6 x - * brief EDMA3 Test Application. o9 ^& b4 F% v7 u# H
- *
5 C5 c# M6 o( n3 V- f3 b - * This file contains EDMA3 Test code.
% X' P* e3 |; t# S c8 ~ - *
: n% h2 U9 `. D- q4 @( g4 h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 A8 D: ]3 w6 O( v1 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. f- ]! T1 G- j2 Z2 ~8 n$ D5 } - * TO CHANGE.
( O5 R3 ^+ B$ q8 h - */ O1 Q0 D, `* k0 e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. X7 u, i! p O2 J - *( u$ q5 Y& g% l3 X
- * This program is free software; you can redistribute it and/or
! z8 r4 ~. \/ x+ k" b7 `' ? - * modify it under the terms of the GNU General Public License as
1 Q7 t8 e) u" Q7 S9 | - * published by the Free Software Foundation version 2.
; A" S: R& l0 [- n# B) n - *
& H0 \" L# y7 b" ]4 y& I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 h; q8 E0 P, N. S - * kind, whether express or implied; without even the implied warranty
4 N: q6 C% O m. v8 f8 K! v3 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, s3 |4 h6 B- p0 v* B - * GNU General Public License for more details.& \) `/ m1 Z2 u4 W6 G2 T0 _6 G" ?
- */
9 t0 l) t8 X, O! ^! X" {4 H! I8 p - " v. `) J' M' w* D c/ [
- #include <linux/module.h>% y/ m7 V! u! T: T
- #include <linux/init.h>' X+ g+ q1 P" H
- #include <linux/errno.h>- N2 f2 x' ?0 g& r! J
- #include <linux/types.h>1 h( J; o% W% p; w6 t& I
- #include <linux/interrupt.h>, R! {( \$ z+ V% J% @7 o* c! L
- #include <asm/io.h>
' b4 e+ y2 \- b8 _- H. e, t/ F - #include <linux/moduleparam.h>) X6 F/ U$ L& \1 U" y1 y4 q+ K) J
- #include <linux/sysctl.h>3 s/ j: K* z# L' s' ~
- #include <linux/mm.h>
3 Q! ]& A% v0 v - #include <linux/dma-mapping.h>
/ J" ]7 U1 L5 p' l7 y5 M# v* p
1 |1 I9 E$ w% B d6 r2 D8 Z6 _- #include <mach/memory.h>
0 m2 _! X& W- d( w9 |1 ^- S - #include <mach/hardware.h>% ^ Y: u9 ], H& S; }
- #include <mach/irqs.h>8 v- Y; \# O' H* V! w* q, t
- #include <asm/hardware/edma.h>) |* x" Y6 F: B' g6 s
( P' ]" G9 p( G5 O3 B- #undef EDMA3_DEBUG
! C8 P- o" J$ d - /*#define EDMA3_DEBUG*/- n) }- R+ h3 J: m$ j
8 J* ^0 L+ B( S7 R( H: n- #ifdef EDMA3_DEBUG+ T2 i5 e. [' z) T" l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- N6 C' f2 e/ Z( U: L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): q8 x6 B( v4 A/ U- C& J7 ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' t+ S' S# u3 r3 q' m/ ~
- #else8 d& n* d, q9 \# e$ e: Z4 W
- #define DMA_PRINTK( x... ), T7 |: y; l7 g7 W' F
- #define DMA_FN_IN
; k9 G; O$ C- s. T P - #define DMA_FN_OUT" r* L, y. I0 p& |6 |+ i
- #endif; P/ m& P3 `" T; k4 P1 _( ?; t
- : t" n8 H2 Y% i4 ^$ \' m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, A1 g1 ]; u* S1 U; r5 e - #define STATIC_SHIFT 34 ? r3 v0 u' j6 k5 {
- #define TCINTEN_SHIFT 20
0 {; b9 O8 D A1 S - #define ITCINTEN_SHIFT 21
) H% k# U! R, g! s" n - #define TCCHEN_SHIFT 227 l" \4 E! Q" H/ {4 B" S
- #define ITCCHEN_SHIFT 23
. X( O' B0 ]8 p - ( J# [* H5 z& H9 `
- static volatile int irqraised1 = 0;5 k6 I3 f& s$ i6 t
- static volatile int irqraised2 = 0;
& c P" j/ ]$ H" l% r; \5 e - / [5 t2 d9 P- `! \' ~& }" Y* e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ V I0 w# f7 {) Q7 I+ K, A1 K: B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' W A6 a5 s c: r( e/ ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% g: f4 p1 s# h8 { - * a) w7 \& J |0 d+ x
- dma_addr_t dmaphyssrc1 = 0;8 `+ x& z- t" |0 K+ ]
- dma_addr_t dmaphyssrc2 = 0;- X" m9 m9 i% E! [, A4 Z0 p( M
- dma_addr_t dmaphysdest1 = 0;& b" z, i; w3 g( ?( o( F
- dma_addr_t dmaphysdest2 = 0;
' w8 E+ g6 M) w7 ~# S/ h4 d& N5 }/ | - 7 y4 d$ \9 b( H2 E
- char *dmabufsrc1 = NULL;
% q& P2 V% z+ w2 U - char *dmabufsrc2 = NULL;1 q8 C f/ b3 y0 f9 R' Q3 y! T! u9 s
- char *dmabufdest1 = NULL;6 ?' P% b" n3 ]! {' l
- char *dmabufdest2 = NULL;8 A: `# c0 \/ x0 d& ^) c
- / y' z" a+ g6 v2 K4 [) R J
- static int acnt = 512;
) }- D4 d: U: n0 X0 m, { - static int bcnt = 8;2 ~+ y, x3 V9 Z# U" A
- static int ccnt = 8;& |% _- E# J+ z% @, `0 S/ f& T6 c3 Y- _: k( R
( x. q( C" M( P7 N% ]+ P+ R- module_param(acnt, int, S_IRUGO);
$ W2 l. K' J. d l; L1 D - module_param(bcnt, int, S_IRUGO);
) ^! I _! b8 L - module_param(ccnt, int, S_IRUGO);
复制代码 / z r5 V) n: @& t) c* E3 G
% d- f( [. r& l2 [0 w; w7 I0 u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ [) q2 E5 _7 U# n: G) Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) A+ Q9 i* w! q) _1 M. E4 ?# o+ O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 \1 O* R* A& `
( N6 @6 Z; h' b) H. b W4 D. P1 R
) L' h3 M, C1 |4 p |
|