|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: v" f/ t( Z, \: f% I7 i& \( F1 X- [code]EDMA sample test application
' E/ O. X4 E, ^ - /*" A$ E2 {+ j1 }) t# j8 Q
- * edma_test.c
2 v# R1 d3 g% S" s4 t2 y6 u. o X. C - *0 v8 {* D3 \; O* F f9 c# ]4 s
- * brief EDMA3 Test Application
5 V/ A" g8 }9 v, E0 v$ ?& \ - *: j0 N$ ~6 j7 a/ m% k" u
- * This file contains EDMA3 Test code.6 c4 o" R5 t0 x/ f) H& Q
- *
$ C' R O, t# `% S" s/ u5 Q8 q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& `# g. C: n8 l' b5 [8 } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& R0 h/ z9 ]! W% {
- * TO CHANGE.5 i' q- A" ~+ _. D; |7 `! h
- *0 p: C$ d' S" b5 o: ]$ O0 p, z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
Y; U4 o7 m6 L6 _- [ - *
* \8 g5 ^2 {, N - * This program is free software; you can redistribute it and/or) L3 N& G' }' ]: {
- * modify it under the terms of the GNU General Public License as# P$ i* K, ]4 n. t1 A# c* \* {
- * published by the Free Software Foundation version 2.
" i+ ~* `: h9 U - *. }4 m9 B$ u5 q' b: J# W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& z* }+ d# S3 E: w - * kind, whether express or implied; without even the implied warranty
, J# k O1 ]- M# P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' V* ]9 Z6 f& z9 ]+ s/ ~! r
- * GNU General Public License for more details.
8 Y$ n, q) V$ C4 I2 s0 V+ M - */; I, M0 g2 Z- H+ h* n6 U
- + p( A6 I0 _) U4 ^
- #include <linux/module.h>. r0 c5 L* W8 r% Z* j- J H2 |
- #include <linux/init.h>1 T7 X$ M1 A5 G8 w& q5 ?$ S$ u
- #include <linux/errno.h>7 h6 D* i( d; Q' X. Z% Z
- #include <linux/types.h>
7 _2 v$ l4 `; Q) @! Q - #include <linux/interrupt.h>
* w' |+ `% R. d" ~7 y. b2 R - #include <asm/io.h>
# V- w8 H: g- n9 Q - #include <linux/moduleparam.h>& l6 O G' |9 U4 O
- #include <linux/sysctl.h>
; M. x7 Y- p, S. l - #include <linux/mm.h>
/ K0 s, F$ G x2 }/ r& @ - #include <linux/dma-mapping.h>: R: N: R) q8 g( X
- . d' Z7 H5 d1 p8 k2 W! x
- #include <mach/memory.h>5 }8 v2 `5 v; W
- #include <mach/hardware.h>
8 ?7 ]2 i5 u- _2 L, P - #include <mach/irqs.h>
. `7 i: P4 p' ~, D9 z - #include <asm/hardware/edma.h>
1 m% O) N4 v% F
d. y4 i/ j9 ~4 r$ U3 j- #undef EDMA3_DEBUG- c' J4 \2 [1 W0 G+ B2 F
- /*#define EDMA3_DEBUG*/' |6 e/ A+ Y* G# g) v6 G
) G# U3 J$ ]2 u4 i) C" s- #ifdef EDMA3_DEBUG
1 K P1 A/ F, y1 i+ l* k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ s* e" B+ X2 x; ^* F/ F O# `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 V& a9 q8 X- [+ M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( e+ _1 b; A7 p: W3 k) V* E
- #else' F+ s* g& X8 u# ?' o' @+ q( t/ t+ G
- #define DMA_PRINTK( x... )
, ~9 S# |7 [/ |2 [3 ~' `* d - #define DMA_FN_IN- w8 {" E% M4 `, Y
- #define DMA_FN_OUT
# [# Q4 `8 K7 a) D1 U5 c0 h - #endif
& J5 U' N1 _2 b- K% R6 p6 a - 5 g: {# h1 O$ Y1 C5 b) z5 t) b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
X2 V. \- g+ k# s7 j D, v - #define STATIC_SHIFT 3
0 W3 z6 _( O' \0 K# d9 ?; K" v9 U - #define TCINTEN_SHIFT 204 p" m2 o3 t& j/ k7 p5 S0 {
- #define ITCINTEN_SHIFT 21- U* \, K9 ~9 g) o6 ~ F `8 x1 j6 {
- #define TCCHEN_SHIFT 22
( j. _4 u( U" [7 q - #define ITCCHEN_SHIFT 239 P! p7 B8 o$ B3 H( b" `
- - l7 m2 w5 [8 O1 S8 v
- static volatile int irqraised1 = 0;6 k' _; R" f0 H2 c! j- A3 f8 q
- static volatile int irqraised2 = 0;
: d) k) T& s( p3 K: x7 `$ I/ Z
% \. J* o! g* e Y2 G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 r- h: e+ g2 }: ?8 m* t0 W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ f' W4 ~: S' ^0 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* r- C: C7 W/ I
1 m) o: h! c/ V- dma_addr_t dmaphyssrc1 = 0;3 y& d/ T7 @# w! x- p+ G) B
- dma_addr_t dmaphyssrc2 = 0;/ w% D* J/ r6 l4 c: _ T2 R
- dma_addr_t dmaphysdest1 = 0;9 I; P: v7 P7 e5 a- T
- dma_addr_t dmaphysdest2 = 0;! ]1 U$ h }1 ]* J4 T
5 y1 [ H6 M/ n P4 j# E2 |1 h2 T- char *dmabufsrc1 = NULL;
4 `: n3 z3 z) @) z - char *dmabufsrc2 = NULL;
( A9 |3 @3 G- f! Y6 L# \) H8 K# D - char *dmabufdest1 = NULL;
& g# ? h+ |" Y& m1 f - char *dmabufdest2 = NULL;
4 o9 Q! M1 D/ @) g. g& k t' {
/ L6 H) b' j+ W7 L3 v- static int acnt = 512;2 G, q; P6 ?/ K' H% {3 l" S5 R
- static int bcnt = 8;
& o' |+ o) X E - static int ccnt = 8;
# G9 g( e1 p' R9 I5 p, N$ A - # c" o) V; w7 U9 H+ r* U
- module_param(acnt, int, S_IRUGO);
0 V0 S) i4 x+ I5 x/ n8 i% U" V5 H; U - module_param(bcnt, int, S_IRUGO);
( K8 T( s* b/ g" c5 f/ n- M; ~5 M - module_param(ccnt, int, S_IRUGO);
复制代码
7 i% O" d( X8 q B3 q2 A: [, @0 T4 [* s; w+ `' H# Z* l; G! o% e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 u) X6 H/ c/ \, T2 D8 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 f9 T; v# S5 V# Y- c) N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ P9 x" V/ K* U3 u4 T
7 ^# t: A$ w/ f. f( s/ C+ M0 F O% F& z) g
|
|