|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* i& B# K0 z1 d6 d8 q' Y2 r2 I% f- [code]EDMA sample test application
/ k3 A. e' w, M& L+ v7 ?. V - /*
% p6 Q9 {; H. g& \. t4 w - * edma_test.c
" x& f8 M- d- w6 q& p - *$ i# _' d: K& B8 Z! E# H
- * brief EDMA3 Test Application
9 A, v( m+ O$ d) T8 T - *6 o( i* C5 C) v N& C- _
- * This file contains EDMA3 Test code.- e% V7 E2 a' P9 x" a! H5 p8 t- |
- *" A+ T- h! n* l& n2 G+ P4 O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- l" y! F% n! J: t; w6 Z! P# V; n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: @: r( F4 a% E$ a! j- H9 f6 o - * TO CHANGE.
, p! |5 s* @% |1 z" L- r - *
3 S3 c- t( H ^: q/ e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' A0 t' ]+ u) O- Z+ S0 S: }$ V0 b
- * s3 M' N/ O5 E; ]6 Q6 w
- * This program is free software; you can redistribute it and/or
4 F% t* ^0 a, }9 [& q9 T - * modify it under the terms of the GNU General Public License as' k' _9 G" R r7 j; A; R/ k
- * published by the Free Software Foundation version 2.4 |1 s$ F) z9 _& c
- *
7 w9 {6 C0 _8 C$ ]0 q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ N% a' }8 a& z' C, ~! _ - * kind, whether express or implied; without even the implied warranty- `# W, @. [9 I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- E! v- c: j' h7 f3 q+ p
- * GNU General Public License for more details.
8 j2 W' x% l' t: j/ w - */
0 L& V" W# c( X' a3 k1 X* b
, f' A [6 @) P& Z4 q# ?9 t3 c- #include <linux/module.h>; v m, ?% F+ r5 n0 ~0 g2 a
- #include <linux/init.h>
( S) F, ^" c4 b f$ B - #include <linux/errno.h>* g8 |7 X' N4 a# p1 h5 F$ q
- #include <linux/types.h>
8 h/ j. V u' V" A - #include <linux/interrupt.h>% `" g7 r1 K: ~: U6 n
- #include <asm/io.h>0 P5 Z+ D2 V! N1 I. K }, [+ x
- #include <linux/moduleparam.h>
, s! d0 C& h# Z A - #include <linux/sysctl.h>
1 F8 V5 @7 R. \/ x/ ~: @$ ? - #include <linux/mm.h>; S( |, }' {3 b7 }
- #include <linux/dma-mapping.h>8 D: g Y, k2 I! D* H
7 N4 q) c* C$ e; v- #include <mach/memory.h>$ v( ?2 H( A6 q6 }6 v
- #include <mach/hardware.h># p# }' [5 a& v; \& e( a3 d
- #include <mach/irqs.h>. E4 X& I5 O( M& a9 _0 p1 o8 \ _# B+ [
- #include <asm/hardware/edma.h>" o) r% |5 b8 l! t7 w* y
% S$ h2 e* E/ B2 C& ?; V& H' L- #undef EDMA3_DEBUG( k$ K% C+ q1 A5 D
- /*#define EDMA3_DEBUG*/
8 M A" W) }# q0 o' l! g
+ b% Z8 Q; x# H9 }2 z1 F' @- j- #ifdef EDMA3_DEBUG: e& Y& [0 O. N( Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' u, Y# g/ C$ Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* Z- V' n* o" P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! ^" Q% x) r+ h* I
- #else
5 @2 C G6 H5 R - #define DMA_PRINTK( x... )
n/ e$ N. h/ K: P: I - #define DMA_FN_IN
1 @* } f) Z% O4 m - #define DMA_FN_OUT9 {* b9 [" w8 B8 U
- #endif
- Z9 o( b$ H+ w6 {9 Y" O
7 p8 `1 T0 ~! V2 U+ ] U7 X" z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ K- h" c/ h6 v9 p3 M0 D8 t9 W! z# n' Y
- #define STATIC_SHIFT 3* }- n2 l+ M" p h
- #define TCINTEN_SHIFT 20. D1 n. c' k" b& T
- #define ITCINTEN_SHIFT 21
. l+ m: D6 e, {% e6 d0 r5 t - #define TCCHEN_SHIFT 22& m3 K# {! }' W2 e$ z, X- [
- #define ITCCHEN_SHIFT 23
4 n6 c B4 X2 P; Z
" ?, F4 c$ i; N9 R& b0 i- static volatile int irqraised1 = 0;
1 C4 Y7 [: S6 |, z6 R# O) g0 Q$ s - static volatile int irqraised2 = 0;( J- m8 i( K5 X1 g! M
( z" t( T9 c/ m& {1 Q8 J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; \3 y4 L2 z" l3 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Y( Y; Z- i4 ?$ j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ]2 l# g" h# J3 D7 h - 3 |& r- O& n/ B- y d
- dma_addr_t dmaphyssrc1 = 0;
5 N; P Q0 Y+ s* f N - dma_addr_t dmaphyssrc2 = 0;+ ?- P3 a- x$ h5 E' [! L
- dma_addr_t dmaphysdest1 = 0;, x5 _! E. e3 C% X
- dma_addr_t dmaphysdest2 = 0;
( _3 T, F4 g& a) g
& ?0 V3 p! X9 Z- char *dmabufsrc1 = NULL;% W1 z. { t* }* T$ ?" s5 f2 ^
- char *dmabufsrc2 = NULL;4 u5 O- t" e) n' h
- char *dmabufdest1 = NULL;
1 C% R( v6 h0 p3 { - char *dmabufdest2 = NULL;# g3 `% S1 j) g8 k7 L7 G8 _/ A
- 7 T; L, y; Z/ {+ y8 v3 t/ F# W
- static int acnt = 512;
: _; F: D1 x( b i. m - static int bcnt = 8;
9 |' m8 n) I. Z" s8 j - static int ccnt = 8;% `2 s2 V) Z% L7 {* O+ G
- " n v' S3 S7 u, z' ~
- module_param(acnt, int, S_IRUGO);8 `' W6 u$ \7 p% {5 i; J# q
- module_param(bcnt, int, S_IRUGO);5 ]! t7 V$ B8 o# s$ m6 s
- module_param(ccnt, int, S_IRUGO);
复制代码 8 s) r9 n7 w) j& }/ |1 u" V
& i0 F3 P. g1 a4 R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, M/ \8 }3 X' f. l( W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 q! T1 O0 |( M* k3 o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 g2 U) Q, w5 i- T# n
' C/ ^5 c }/ ^ V5 }& Z8 }
: q7 _6 s# M6 r4 k' X |
|