|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 |2 `$ a$ x' I: X- [code]EDMA sample test application( j$ [' Q* |) l2 H
- /*( c; j$ u( t$ w8 D
- * edma_test.c3 R9 @# H! L2 y! ?- b+ v1 ]
- *
* F$ U4 B' \( F. |' R( \ - * brief EDMA3 Test Application( U- h7 E) X: V: m; r
- *$ J6 x1 J2 m+ V% y; w
- * This file contains EDMA3 Test code./ U. W, z+ ]! ~. {6 t; O
- *' m9 }1 d& Z* [) g& p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 D1 ~) S5 s6 R5 p( C8 @# c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' I# M: l$ T+ `) d e - * TO CHANGE.6 d) `5 c$ h* `: [. F5 @* T
- *
4 b2 [" d5 r" P: I) p' X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 C1 N6 O- X) ~8 |/ P3 N - *! g5 h1 Z: z! J: V' c2 O8 P6 `
- * This program is free software; you can redistribute it and/or
+ y3 X( D5 v& G# @) S" q( G - * modify it under the terms of the GNU General Public License as1 k N2 G; g- ?2 M
- * published by the Free Software Foundation version 2.
. Q* O! C% }% U5 K - *
9 r; L" ?; [; f/ x: ]3 a/ _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 G: s3 @$ F# q3 O
- * kind, whether express or implied; without even the implied warranty
* j6 Z9 k: g k8 ]: v# L1 M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& s! P0 L% S& G' p% { f - * GNU General Public License for more details.1 A, X, Z. M( ~) X
- */8 [4 X3 y: n) s: j' g% h% H
# R& t. R) s% R* @7 R. Q1 _8 f- #include <linux/module.h>9 S; G4 J, ?- g$ |
- #include <linux/init.h>5 Y& m7 z5 Q. X
- #include <linux/errno.h>
% Y/ m. _ D' d( i( e8 n - #include <linux/types.h>
& a5 X' S/ v/ O5 }" |9 E% K9 w: a - #include <linux/interrupt.h>2 _/ ?. Q( o# z5 x# W, o
- #include <asm/io.h>
8 X' h0 T1 H5 P& ^$ c4 `9 a8 `5 |2 w - #include <linux/moduleparam.h>
% k- w% A. h& o/ S) a0 o8 Q - #include <linux/sysctl.h>& O# U. u* p; Q1 G6 Z9 D
- #include <linux/mm.h>
. {4 t: j: T0 q2 Z1 L) ~ - #include <linux/dma-mapping.h>
9 S2 f4 X7 |3 k
3 D* [* n0 z: |; }! S- #include <mach/memory.h>- V- c6 ^5 _9 }! d4 s. f
- #include <mach/hardware.h>
( L3 m$ t/ u! ^; x' v8 {$ t; T - #include <mach/irqs.h>" t( W: r# ?) D3 X! s" r
- #include <asm/hardware/edma.h>" m5 G. ~ f3 c2 i& g) f. @- ~
- / K- H9 y! {% `2 D( E
- #undef EDMA3_DEBUG
2 [' h/ ?% F# E; Y8 H2 S8 U8 i - /*#define EDMA3_DEBUG*/
; W: F, @/ a5 t0 r- O1 Q# ^2 n - : M) |4 {$ ] `
- #ifdef EDMA3_DEBUG
8 m0 d* M; y7 A+ b! u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, K2 c! Y" W9 O& b$ g' C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 {/ t" r8 _2 O4 w. o7 p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. h. m: p; m/ O - #else
' @/ r W; L) c7 N5 f - #define DMA_PRINTK( x... )
' R% E8 q! a( ?3 c4 c2 T - #define DMA_FN_IN
9 N g0 } t5 t6 X8 P+ p, Q - #define DMA_FN_OUT) O6 g2 J# {# _% Y
- #endif
6 v/ B( r) q, v- `' Y1 F1 Q. V+ [: Q# |. i
% Q" ]! Z E# E2 F8 ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" s& i$ N- q g - #define STATIC_SHIFT 38 @4 P5 j, o& r8 b& A* R1 _0 |
- #define TCINTEN_SHIFT 202 Y& \! A M. h! X8 q$ d! N
- #define ITCINTEN_SHIFT 213 r' B& P- m) R0 X
- #define TCCHEN_SHIFT 22. H }0 G! `8 y) {" l" C1 H
- #define ITCCHEN_SHIFT 235 V/ K: K" Z! ^' p$ X1 \
- * x ?4 Y) ^1 B; t1 ?
- static volatile int irqraised1 = 0;4 F/ s* L4 {; I! m
- static volatile int irqraised2 = 0;
6 d W, ]& T+ R% J7 v
8 X5 Z. l! R1 S9 b2 _- n( x3 R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ r" C# B- `4 ~7 W2 ]- [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 V* ~ R0 G; J0 b; U* D( e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ]) [# u6 h! [ R- i, V7 n+ Z& e
- " W0 K z, }' g
- dma_addr_t dmaphyssrc1 = 0;& k& K3 P1 K q% b6 X; v- I
- dma_addr_t dmaphyssrc2 = 0;
`, |" M' j2 h: a5 |2 N/ d) R! Q - dma_addr_t dmaphysdest1 = 0;' D" n+ M8 k! ~; }
- dma_addr_t dmaphysdest2 = 0;0 [/ [" I7 V) _- o
0 p/ c" j% D$ d% |0 i- char *dmabufsrc1 = NULL;
& S" h$ o7 g- B8 W+ H* g - char *dmabufsrc2 = NULL;
$ q. {. p4 U' M2 d7 b1 B - char *dmabufdest1 = NULL;; `$ a/ {3 i3 {) U& F- p- H. C
- char *dmabufdest2 = NULL;
V$ P1 p# d1 c. q, D. ?
4 B: w2 f7 o1 v- static int acnt = 512;
# M" I! i8 V5 y& l - static int bcnt = 8;# J8 G$ l5 k# d- J/ W# A6 `, y
- static int ccnt = 8;
1 y, `* {1 P% T/ L2 _: N - 1 ~1 D0 f, {, A% R% L( @
- module_param(acnt, int, S_IRUGO);
5 g! w( m1 j! k: j! j - module_param(bcnt, int, S_IRUGO);5 j: c4 `! c! c; i$ s, A0 C5 |
- module_param(ccnt, int, S_IRUGO);
复制代码
2 t( r+ r( ^: V# K1 @ L/ u0 |0 ~2 j$ t1 B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" s9 X) M6 ~& T5 A3 Z& Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: x- z, g" B( B0 i' K, e+ H0 `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 d/ y# g! }) q7 M$ K7 T& |% O0 s
5 P( _1 M* c1 U
|
|