|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 G5 e4 ~% {4 ^/ q/ p7 e! m- [code]EDMA sample test application8 e+ c( X% A' n/ h
- /*
0 A" b# j5 r; @7 @+ u - * edma_test.c
" [" [7 m) M; Z5 Z. x7 h - *
. Z0 U6 b D5 Z# ?" K% `( d1 w5 x - * brief EDMA3 Test Application
9 T- X, r. c1 {2 v4 R0 H8 ?& P - *! k) r, j( V, }7 \
- * This file contains EDMA3 Test code. q5 }" q+ V" O. K4 L( [; I: U
- *
8 B: w) q' a! ^8 E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( x9 y) ^! d+ X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# e0 B) X1 }" [* H. e, U/ Y - * TO CHANGE.
! [' [2 T( n8 M, }5 w y - *
4 }( {1 G) c' R- [$ m1 `2 `# ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& B3 @1 h3 p. m, I
- *
2 {; ^/ U. W' ?. ~ - * This program is free software; you can redistribute it and/or
# H! f3 C: Y6 B |; F: t - * modify it under the terms of the GNU General Public License as
( ~5 w" [) Y6 d, ]4 T( j' r - * published by the Free Software Foundation version 2.; K1 w" l: C- w! g; C' S! o8 J
- ** e4 f( }, Z7 r% V! o4 v% n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 C/ r" Z- h$ [" d# T - * kind, whether express or implied; without even the implied warranty4 N& [+ \. x l) A j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% _8 i- _0 U. D4 u5 R# l# m9 p - * GNU General Public License for more details.4 Y: ?8 E# d7 c: I3 I1 `
- */2 c& I2 @( ^( m# W
+ X) z: E, L' L+ q7 A: Y: X3 Y9 a- #include <linux/module.h>
9 U$ c8 ^/ u n; z( V6 { - #include <linux/init.h>
3 V/ r# ?, t7 l# A" J. |8 {% ]; J: K - #include <linux/errno.h>7 q& H5 K8 n4 K& _) f3 r
- #include <linux/types.h>
! r1 Y2 z4 b5 I) K, S# Z8 H - #include <linux/interrupt.h>
4 u t: T' i7 v3 z - #include <asm/io.h>5 X! n# d( v& ^* N) t4 H6 G: m
- #include <linux/moduleparam.h>. j" g% L4 v4 K
- #include <linux/sysctl.h>
s8 h l% d/ W - #include <linux/mm.h>
; i$ a' h8 C0 ^3 O - #include <linux/dma-mapping.h>
- B- E1 h: i: L r- g
5 I, S x( m! i& d9 J/ a- f- #include <mach/memory.h>' n' A, h. S2 q0 z
- #include <mach/hardware.h>; z8 K' O1 z1 e O# ~; S U4 W
- #include <mach/irqs.h>
9 ^7 i6 L( D. U, J3 Q, B7 x1 H - #include <asm/hardware/edma.h>; \( d1 _6 |! m: P
- - V' u; ^' |* ^' G8 f) w5 ^- _) c ]1 x
- #undef EDMA3_DEBUG
: T& V& H' ^1 o& F& [& b - /*#define EDMA3_DEBUG*/- F9 O( Z& N8 [
% a! t( F, r2 A9 H2 c) ?- #ifdef EDMA3_DEBUG
, |' L) ?" x5 O# C, S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: P( r' ^; `" X9 l2 K3 ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 _: p3 F* U9 q, L9 c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); N4 v, D& v1 K/ g& Z i% E
- #else
4 x8 q$ f. _9 G. C - #define DMA_PRINTK( x... )
' W( Y3 ~8 n5 x5 {+ r& M- Y - #define DMA_FN_IN
5 q6 m$ A3 Y" m3 W4 {8 k - #define DMA_FN_OUT( i+ C; Y6 _9 N; L, G! p3 |
- #endif
- O: {! o1 S; F# {9 X5 b3 U
% ~! G G% C% k) ?2 {9 p7 V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; b6 N! ?9 o; m# S: ]! ^- F - #define STATIC_SHIFT 3/ e) R5 ^9 W1 _9 u8 d' H
- #define TCINTEN_SHIFT 208 u9 ]' `( \. l( h- X* `
- #define ITCINTEN_SHIFT 21
6 f% x( V% r8 M) z - #define TCCHEN_SHIFT 22: E" z# a" w0 b5 E" e
- #define ITCCHEN_SHIFT 23
( u. r! ^4 E) @0 h! N \
5 z% S% a6 c# k0 T: e2 ~/ O- static volatile int irqraised1 = 0;
8 j# O$ t6 n8 e - static volatile int irqraised2 = 0;
: R5 I! R4 P1 J5 z: @
' H, S: o$ h u/ R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; j( Q( Q- P% u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); i. f$ \8 h* @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 |4 ^+ H4 v/ q% ^; d
- ! a* Y% k! [8 u- I; u6 q
- dma_addr_t dmaphyssrc1 = 0;
x \! `, a- c/ Q0 O - dma_addr_t dmaphyssrc2 = 0;0 l- ~4 B- ~6 l
- dma_addr_t dmaphysdest1 = 0;: U- j3 u6 ^) S1 J! E B9 p
- dma_addr_t dmaphysdest2 = 0;
% \( ` ^! w3 M% y - * v0 L( }8 b3 O: g/ }
- char *dmabufsrc1 = NULL;
" M% E" v" |) d! P5 U4 h# U - char *dmabufsrc2 = NULL;
# i7 B8 F' w: c" ~ - char *dmabufdest1 = NULL;
- N! Q1 [: L( M( m6 V/ l" _3 R7 d - char *dmabufdest2 = NULL;0 c0 g0 {/ D2 V- p h
2 k6 E z; r( ~; m! N7 q' I: w- static int acnt = 512;. s3 u9 E u3 d
- static int bcnt = 8;
0 B7 j+ F0 k" i7 n0 v+ ^ - static int ccnt = 8;! k, U2 U0 Z W- [' i
2 p% I- N2 w: r. P. R- module_param(acnt, int, S_IRUGO);
- g3 L3 w+ ], N9 \ - module_param(bcnt, int, S_IRUGO);# T H: m& F+ T4 k
- module_param(ccnt, int, S_IRUGO);
复制代码
* @4 t, l6 n$ N' C4 B& q8 a) [- [( G5 v" j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 R3 i; b7 r+ L0 P# e. x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ]; I+ F) X' q( w' A( b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% g. \* z5 D: a1 T M% h
5 ~1 p- K( h4 A, ~7 I) b+ L3 e
* S$ @9 O! r) E" ~. D0 {+ b |
|