|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . v0 p0 R2 F! g2 P8 ~3 t
- [code]EDMA sample test application8 i a% K( S9 g* \, u9 d6 S) w G
- /*4 v9 O5 U( b* b
- * edma_test.c# u- F4 E9 {0 J
- *
) c: V( O* a: A3 y/ k - * brief EDMA3 Test Application' y$ e* v' V1 ~: p* N
- *) S6 T ?1 \* ]! [7 y* y
- * This file contains EDMA3 Test code.
) P% t) _* R. D- y9 n& X- F - *" s' W6 O, _+ l' y3 Z# k/ g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- Z: d7 D' |# `$ j8 O3 I+ [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) M0 o2 R* N8 e - * TO CHANGE.& r0 ]+ F7 W2 `9 `
- *
: b0 e; V! @" Q2 i! L% t+ z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 ~* I" k4 n2 L/ M& T - *
, t" O- h d0 Z, v8 e - * This program is free software; you can redistribute it and/or7 x( g! O8 {# n% m
- * modify it under the terms of the GNU General Public License as
7 w3 d1 u) E& b+ v/ O - * published by the Free Software Foundation version 2.! H6 [! p" V5 W5 e
- *8 n. F/ C7 }$ \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 o+ V3 L( J0 ^, J3 L. ^
- * kind, whether express or implied; without even the implied warranty4 [0 y8 ?! u' {* C( M" x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' }( U5 b$ T( N$ L% z, _. G
- * GNU General Public License for more details." H2 B/ N9 r/ b; ~) H$ Q- k/ w
- */
: f+ m; [) O' O: Z9 n. c9 D0 I - " O/ a+ Y/ n9 L' u5 ~2 O
- #include <linux/module.h>6 L) m0 {! C I0 [" ?; A1 v+ s+ S; X
- #include <linux/init.h>
( V0 E7 l! C0 c9 l2 m - #include <linux/errno.h>
% \$ t q$ H3 f) z) m - #include <linux/types.h>1 e! Z8 S' F+ H# w0 ?4 r3 `; u- x
- #include <linux/interrupt.h>
3 n" Z/ n m# E J! @' [( B1 \ - #include <asm/io.h>1 Y; g0 R4 S' \3 a5 V3 y& Z) J
- #include <linux/moduleparam.h>( L4 p1 f2 N7 }7 h5 L+ ?
- #include <linux/sysctl.h>
- z" G, C; Z4 V3 [$ @# U4 Z- M7 U( P - #include <linux/mm.h>
6 }4 T7 ?9 ^# w% ?4 @ - #include <linux/dma-mapping.h>
. {& V5 `/ _3 z& J - : w$ \: B {8 y# \! B6 k
- #include <mach/memory.h>8 y9 R' Z( I+ m) y5 w
- #include <mach/hardware.h>
0 e# m. N b- ^4 a A. z' _ - #include <mach/irqs.h>( p) L# I# L0 b) N
- #include <asm/hardware/edma.h>
2 b3 N1 }6 Q( o8 ]
. P% S' R0 J: F0 Z" _# t- #undef EDMA3_DEBUG
9 b0 v9 c# z. C; \& D, F - /*#define EDMA3_DEBUG*/
( ~. V7 h7 Y+ G2 l# D' k7 ^9 [ - ) g- k! N; ? T3 E# Q1 B
- #ifdef EDMA3_DEBUG# Z2 A; g j; q$ p7 ?! r, n' K1 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# N- q3 t1 R/ h7 t( T% W! D4 } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! W3 M5 h6 K4 G- ]( G/ B) } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( n; J& t9 J4 {9 c5 O! e1 W - #else
! Z3 m- H1 W* z8 d' {; T1 j3 K4 } - #define DMA_PRINTK( x... )
u8 R3 C' q# b I! X - #define DMA_FN_IN! |" e; U: F# I- e4 A- W
- #define DMA_FN_OUT
- y( Q& C$ X" p5 [5 `% `3 ` - #endif
8 ~/ V$ A# H! {4 g7 t4 A4 q
0 i' Y& i. c7 y) {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 d1 r2 h1 V" }/ L: M$ U9 U# R; S - #define STATIC_SHIFT 3
5 y9 d5 u* L! r5 j- G% ]0 D0 C - #define TCINTEN_SHIFT 20
$ Y/ a R& r$ {4 I8 Z7 d - #define ITCINTEN_SHIFT 21% u5 x/ c3 P# T/ P# a+ z- i. x# h
- #define TCCHEN_SHIFT 224 N# G& t q$ U, y
- #define ITCCHEN_SHIFT 23$ j5 V+ ?5 E* G
- / X) w" ~* \: N- G/ _
- static volatile int irqraised1 = 0;
) W5 p# {1 e8 H% @ - static volatile int irqraised2 = 0;
; ^6 }, }( L7 {: } - : B0 F2 ^. G2 X& r: N9 r5 z- V- Z/ ]& \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 |/ n5 P8 N& P4 n% B1 F( P( ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ i8 z& p: g G5 q- v1 g x( R* Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 ]% w9 v [' f: G8 X! [ - . t: l! Y# }! g" G! E' @2 I2 K$ ]' c
- dma_addr_t dmaphyssrc1 = 0;6 I+ c9 V" f6 _) U
- dma_addr_t dmaphyssrc2 = 0;
1 W1 z! k- t5 h; T; G - dma_addr_t dmaphysdest1 = 0;
) B& K1 D v# ]) R; X, K: J: { - dma_addr_t dmaphysdest2 = 0;
, M% ^1 e* C8 A - + L5 U% c% I" p$ n5 S
- char *dmabufsrc1 = NULL;; R, r2 y4 U; _
- char *dmabufsrc2 = NULL;- h' n8 c. R/ }) n9 k. q: D5 u9 B- D4 l
- char *dmabufdest1 = NULL;
) T G6 e) o; ?! F - char *dmabufdest2 = NULL;
5 D0 `, X5 ^5 Z( T - # F: C( u/ R# t8 b# f. \
- static int acnt = 512;
% R. E' S: }% d9 u - static int bcnt = 8;
! z$ g3 m1 k: U9 d - static int ccnt = 8;
* s0 O0 w# Q3 b$ b
# J% W, R5 @7 a4 w, `- module_param(acnt, int, S_IRUGO); E6 v- @2 z: h
- module_param(bcnt, int, S_IRUGO);
/ x* O9 b! t& C2 v - module_param(ccnt, int, S_IRUGO);
复制代码 6 J+ m( x9 U8 `( t4 H' Y& O) g. j
+ k7 L+ w3 {1 H: Y! l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 m2 Y* Z9 K) narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
g4 Z) q7 \8 N3 @! i4 V5 M) i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! d: L& W; t1 _; [+ q+ y" z; @, z- |+ E6 E( X6 m1 N
4 v& J1 Y; o' A' V! n2 O1 I
|
|