|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! }& b4 I% A" P, Y3 d6 a, R- [code]EDMA sample test application
7 v0 b* \1 x8 T4 J( m - /*
. b9 n% y/ [- { - * edma_test.c
8 C. K5 y: ~* d+ {8 s% Y - *
1 a) o, p/ ~# `0 N1 x* B1 M9 b - * brief EDMA3 Test Application
% \" ]- |; D* x; S+ ^ - *
: n- a- k; M2 E% n) c* c! B( s - * This file contains EDMA3 Test code.) B6 N. }$ p+ V
- *
4 t+ T7 p; P* S( X8 w) o: Z9 j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% \2 \' M, N8 W+ L- h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 Z+ w2 T& z) Z/ m% l# P5 T( `8 ^ - * TO CHANGE.# l X \( {! B+ `; N3 G( [9 k: e
- *( I! W2 n: Z) a: L( y/ J( y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- N) o$ \9 Y/ n
- *7 u4 x$ V$ D& j$ w E3 q; W! I
- * This program is free software; you can redistribute it and/or
A; E4 ?4 n; t0 R- q* h - * modify it under the terms of the GNU General Public License as
( T- ? z) Q- Z7 j6 W - * published by the Free Software Foundation version 2.0 j) v& O9 P* |
- *
* j: f2 R" a/ T' a' m3 _2 D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% X* _( X+ a% ~& O
- * kind, whether express or implied; without even the implied warranty
- \( y# C5 i/ P6 E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, ?6 f. H5 k4 J, ^- b5 q ] Z
- * GNU General Public License for more details.
; p" M4 P% S! [. d* n" {, z - */" g3 O# J$ K$ x9 r7 C
- ! O+ A1 |( B3 K
- #include <linux/module.h>
* a2 `" j% n9 g4 W2 d. K3 B - #include <linux/init.h>
) F1 }4 n4 G, H# f& f& G - #include <linux/errno.h>' N3 V$ d; v; O' ^# `- `; U
- #include <linux/types.h>
" T' B( C& L, G* o. P" | - #include <linux/interrupt.h>* z) Z& p5 f! r9 g% }
- #include <asm/io.h>
* T1 \( q- Q. x Y - #include <linux/moduleparam.h>
8 N; S/ z# d+ {9 ^" @ - #include <linux/sysctl.h>
: u4 V; b$ d; |/ N+ ^( |/ J - #include <linux/mm.h>& v% C3 x9 _0 n, Z/ {. _9 R
- #include <linux/dma-mapping.h>
8 V* I- `% z& T5 i x* m
4 A l% j9 `- j% g6 w- #include <mach/memory.h>1 X% V9 a1 S& [& S
- #include <mach/hardware.h>
/ q/ u! r' X3 r) R/ E - #include <mach/irqs.h>
+ @' H+ M8 I0 j6 v; B) A' B - #include <asm/hardware/edma.h># c3 T! v4 g% u: y
' |: x8 `7 F7 l- {- #undef EDMA3_DEBUG. r+ P+ }0 k0 m
- /*#define EDMA3_DEBUG*/
9 W* Z/ G* _1 w3 z5 S3 F5 v - & Q$ v' j9 r1 s- [' }( |
- #ifdef EDMA3_DEBUG" }+ P+ ^) t% ?) q; h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); O0 t# q1 m7 ~2 i/ L0 l0 X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- ]6 h) g \% W! y* I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- S. A g$ n' H/ d) e' o - #else! V B. m% O! S5 V. ^+ U) c
- #define DMA_PRINTK( x... )
. n$ @0 M" S3 k - #define DMA_FN_IN
' C$ d" t) h/ Q4 q - #define DMA_FN_OUT
" v1 J, s+ [4 i" M) p4 U - #endif" ~7 O' k J6 n0 t0 ]# A3 y( y
+ T- l4 T: N3 W! O5 p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% J3 W5 N: I( i9 m; J0 ?
- #define STATIC_SHIFT 3: b! ?$ }6 [, g; k
- #define TCINTEN_SHIFT 203 j$ V# B5 t8 b: G
- #define ITCINTEN_SHIFT 21) ?- z9 B+ |9 Z- v! J$ B9 ~( u- O
- #define TCCHEN_SHIFT 228 l! d7 G& i9 V, @
- #define ITCCHEN_SHIFT 23/ s) M3 j# c4 Q/ v) R( A
- , J* M: ?* w/ M$ W8 J
- static volatile int irqraised1 = 0;8 q/ z- O1 v6 s+ D
- static volatile int irqraised2 = 0;
0 g+ Y- b3 \4 e0 D& y - & F, b) [0 i' L. H( m: v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. A; c( a7 c7 t! O# j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- a3 P+ C! \) J) g* d6 U2 y1 P+ b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" F E3 |2 _# M9 ^* V
; V4 M: |0 ~4 m5 @- dma_addr_t dmaphyssrc1 = 0;1 @7 H$ a" q! u2 {# A! u
- dma_addr_t dmaphyssrc2 = 0;
! M+ X' s* b k- |& G. Q5 [( y9 A - dma_addr_t dmaphysdest1 = 0;6 T* ~6 }+ p" z6 [3 F. C; j. \, B
- dma_addr_t dmaphysdest2 = 0;
) U0 C/ U3 e0 a
) G4 s4 \# { n6 a, T- char *dmabufsrc1 = NULL;- {7 T& p A. h& J6 q/ p- L
- char *dmabufsrc2 = NULL; L7 r/ j- r, ^& G p" Q) k" {( ~
- char *dmabufdest1 = NULL;' G3 d- J/ l. [& G/ P
- char *dmabufdest2 = NULL;* S _* {( L) p {- ~+ _+ P
- " m# v2 a" }/ T. ?+ `. h
- static int acnt = 512;$ l) p. K+ h$ s# @3 S, h- T
- static int bcnt = 8;
; m9 L1 N7 M ]3 i* g - static int ccnt = 8;
0 @$ k) Q% ~1 n, a) h
; A1 C6 B) b1 D- module_param(acnt, int, S_IRUGO);2 x7 B* u5 N: b! O
- module_param(bcnt, int, S_IRUGO);
( v. z/ Y2 d0 L) X1 T6 n5 J - module_param(ccnt, int, S_IRUGO);
复制代码
( t- s' ]8 o& z& F* f/ b- v; q' \! v: m$ H0 d5 g! _! X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: o$ s. u' V5 ^1 g, a' M( q- k
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, i8 Q% T. ?7 P! W( f# }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 i4 p0 ^: }8 t6 v. B0 U
. x# P0 P# A6 z$ b$ j, s4 k {. e8 V
|
|