|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 n# l7 C" v, R% t( D
- [code]EDMA sample test application" X8 _: R" L, T- V3 L5 o$ s8 d H
- /*# X: G" Z0 S) n
- * edma_test.c: l, w0 }9 w M' L$ j
- *0 G% C4 j) C9 r5 ]& N; {# u
- * brief EDMA3 Test Application$ v' C K# A9 P6 T* i0 `
- *2 s4 s7 {# ^: [
- * This file contains EDMA3 Test code.1 s S5 l( I7 O6 S, r! P9 s
- ** l0 x) C3 _' Q1 R! ^& h/ T' `. B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: O* ?! e9 U- O0 k" H) \3 e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# |3 Z" e. Q" D/ |7 c$ `. L; } - * TO CHANGE.
' b2 U% N+ q( k3 E/ a4 X - *
7 L" a' }" n1 w% _5 _5 f" c7 T' B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- {+ M4 d: `9 }$ [* D - * O( `# c: x% F4 r5 P4 X
- * This program is free software; you can redistribute it and/or) a+ D# v. G, S1 s: A M% X
- * modify it under the terms of the GNU General Public License as5 [6 E+ y" Z+ J
- * published by the Free Software Foundation version 2.6 P8 ^, J- Y$ {, i0 \$ j- x w
- *- n3 n W4 B% V( [9 n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 d8 r8 r7 G8 w0 T- }) v: }) l, D
- * kind, whether express or implied; without even the implied warranty
5 } Z* `$ Z) T: I) Z: b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 C( g! l9 K% e, E
- * GNU General Public License for more details.! B. z+ P, Y4 R/ F
- */
! Q# ]' X" Q) F" e# q1 t - 8 I/ ^6 q! Q$ [: K; S; r4 x1 E
- #include <linux/module.h>+ r* e3 y3 P5 Y9 w0 i
- #include <linux/init.h>( q+ m7 k! F* ~. M3 D
- #include <linux/errno.h>/ `' I4 ~! ~- Q3 w; t; M
- #include <linux/types.h>
- I2 ?# q- q& J - #include <linux/interrupt.h>
% s' O3 d9 f- @6 A, C - #include <asm/io.h>8 L) s+ a7 W9 s( w9 Y% L
- #include <linux/moduleparam.h>8 E. M! J- r/ K5 F
- #include <linux/sysctl.h># E4 {- E' F4 H4 L! A" V
- #include <linux/mm.h>
' i' b3 P( T" u! Z0 D! n0 | - #include <linux/dma-mapping.h>; s, p3 y; J0 q; ~
X) _/ W$ c1 Z6 g4 e- #include <mach/memory.h>% h- O9 b: \& Z* _
- #include <mach/hardware.h>
9 l7 W0 z: R- U& p4 O! z* [7 ? - #include <mach/irqs.h>* ~, p5 B# H" a" p( ^+ S
- #include <asm/hardware/edma.h>
5 P/ h) z' _+ V t- X5 I' V - 1 @# k6 G5 F2 p# o5 }
- #undef EDMA3_DEBUG; z) |) y3 n+ {& u6 _3 V9 h9 E
- /*#define EDMA3_DEBUG*/" n, F* s0 k" c ]; M
- 9 d( V9 B, z X( j$ S( k# y
- #ifdef EDMA3_DEBUG
& k8 j7 i* R+ b( B! c1 n& ^: C* b0 V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
V/ x5 D9 e Z5 g" X/ }9 V/ m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ g. C4 y8 [% U" n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- V9 l# y8 c" d9 s$ z8 m# w) I - #else) J h' i$ `4 Z+ j/ O2 w. T# D( o
- #define DMA_PRINTK( x... )9 n! ~! ^2 \8 m% t
- #define DMA_FN_IN
/ |% \% W% g w% c$ C c- ^8 ] - #define DMA_FN_OUT" i$ N( h" Y5 O( h# p
- #endif
5 ]5 d# e1 W/ o
0 a6 p* B( t4 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 \0 D* o& u, q, B# G) z - #define STATIC_SHIFT 39 C8 o5 e2 w v! Y) L
- #define TCINTEN_SHIFT 20- ]" {6 ~4 t Q% M) P! C( i! q V
- #define ITCINTEN_SHIFT 21" g/ X# y' {9 R5 E- W
- #define TCCHEN_SHIFT 228 w- _+ H, ]" ~2 B& r9 s/ v
- #define ITCCHEN_SHIFT 23
/ z! e- B8 T. ?7 T
! |; X# R; s+ ?( Z" L, m5 g; k- static volatile int irqraised1 = 0;
( m0 {! y" ]- {# ]& ^ - static volatile int irqraised2 = 0;. K: N9 k. _3 Y$ S1 v# U- l
+ m1 [+ t: }! ~" Y, T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. S' }$ M4 F, U# z' t& p! u6 y% W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) A' H- v) \( o8 ?; q3 Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- W( D5 T/ s- N/ s
/ Q% n0 R$ k$ r- c2 S, U- dma_addr_t dmaphyssrc1 = 0;* R5 d' _3 g* y% V
- dma_addr_t dmaphyssrc2 = 0;
0 u6 _) J' k9 C! S2 z; O* e - dma_addr_t dmaphysdest1 = 0;/ |. u* ]: e8 @) I" }
- dma_addr_t dmaphysdest2 = 0;9 {- B2 C, s0 ^+ j: S! T
$ U- X9 r" x- m: F( f4 T- char *dmabufsrc1 = NULL;
7 t. \5 F3 h( ?8 Y - char *dmabufsrc2 = NULL;- y# ]7 {; l" K7 d6 B9 ]0 s# y
- char *dmabufdest1 = NULL;
' I+ ]3 x, h( j# K6 B. q8 J% C - char *dmabufdest2 = NULL;
" a( m) h. ^1 ?/ ~, d! e - " v, ^' R0 [! X: n
- static int acnt = 512;6 k1 q2 f M6 H6 N; W2 u" g
- static int bcnt = 8;
% m& W3 e2 y1 t" i5 x - static int ccnt = 8;4 x! T+ s" I. Z* l& L
- 5 A; G m7 a6 _" l' |. z$ Y
- module_param(acnt, int, S_IRUGO);
% ~6 X7 C9 p7 f2 C4 F/ W+ H - module_param(bcnt, int, S_IRUGO);2 d: O* S2 B% h0 Q9 z8 s
- module_param(ccnt, int, S_IRUGO);
复制代码 6 K% _. e2 |; y" ?$ G- b W7 r. E
, F" n5 j4 r0 y# b$ I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 R" r- ~; n) d; B' b- s7 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! F; c D0 l' @/ C$ T$ B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! c o# S w+ @" O
0 c, `0 S5 k% {$ ?* h. d6 M
! h! S3 L6 d: U1 A. X |
|