|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 c% H- r# c. b' M/ Z+ G9 Z- [code]EDMA sample test application9 f# K$ u& W$ B0 w k5 w. X
- /*
- K ^- M+ J% N$ M1 E. P - * edma_test.c
2 |; O0 N! w P& k* m# C" w! I x - * r' M) j1 E) ^( O( g- Y& D' `5 [
- * brief EDMA3 Test Application
4 _: C: O9 H! o" x0 y' g2 @1 g" a - *1 r' f2 R) z! q0 `
- * This file contains EDMA3 Test code.6 s9 c# H' e5 C/ K5 x# e* D
- *: ?! W( z# @* Z3 n5 Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 P0 g9 \3 R$ C$ G% B' |, G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! U- S/ M1 K6 o/ m
- * TO CHANGE.
' S# b: j& p! m" \ - *
/ k6 s7 K- ]- i( K: {; m* B5 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ W1 P) y& D, Q" u4 F' s; n - *1 n& C U7 }; s
- * This program is free software; you can redistribute it and/or) n; e- F5 [8 d9 o0 {# D* P/ r
- * modify it under the terms of the GNU General Public License as
" n A( q$ }* t3 P - * published by the Free Software Foundation version 2.. z) A! Z8 s; F. s
- *
3 C& }* q8 w* h( m, p, _/ e4 y* q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 y: \/ h* f# L# f# R) i; x }
- * kind, whether express or implied; without even the implied warranty, M% r& Y7 f7 d# a8 ~+ a1 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ B' a$ p0 k! ?2 J' t& J b
- * GNU General Public License for more details.
A# D5 w9 B+ j+ e5 j# j! C - */+ i4 q% S: X4 B( a0 j. v0 p p5 r
- 8 H6 j& N* a4 S8 \; g! k
- #include <linux/module.h>3 M. r( Y$ z4 e
- #include <linux/init.h>
0 @5 a+ d9 o. f$ } - #include <linux/errno.h>! R, L; I5 X- z- s
- #include <linux/types.h>7 G( T1 ~ A8 y( d' e) D$ ]
- #include <linux/interrupt.h>
9 K2 {% ~4 H r( u8 W# ` - #include <asm/io.h>
# f4 p" k" u& j - #include <linux/moduleparam.h># E/ ~3 |! v1 q/ ^8 Z+ _4 ?5 y
- #include <linux/sysctl.h>5 x: g9 l: S& z& n; G
- #include <linux/mm.h>
# V( ~! |4 f! u$ }# q5 J - #include <linux/dma-mapping.h>3 K9 s2 m: ~1 q7 }' F, e! n
- 6 ~4 S) W+ f! d! u' ~" Z$ N+ N4 S: `
- #include <mach/memory.h>
. W" U# e5 Y2 z- w3 c8 o - #include <mach/hardware.h># C% S# ?+ N8 @* V
- #include <mach/irqs.h>
% C6 z( C7 v; ^% F - #include <asm/hardware/edma.h>
4 s( V4 X. k8 Y, ?7 {1 m% `
5 g( |9 i& s% S- _ N- #undef EDMA3_DEBUG/ {3 d! [* t) G1 v$ r
- /*#define EDMA3_DEBUG*/
6 E& K8 \5 Q6 @ - 1 C2 p9 n; d. v5 A6 `
- #ifdef EDMA3_DEBUG
7 e Q0 S1 }& k; v. G% P- l3 |4 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 {( \# L. L: ]7 ?( a& Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). y* [( |- F9 T8 S3 i8 s( s, O; J+ j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), [+ F% E0 r J: N6 r& ~
- #else
+ T+ }: }' A, l! ^* e, L - #define DMA_PRINTK( x... )
1 ?( C9 U8 b7 F; y6 G - #define DMA_FN_IN
& ?( j+ N0 z) n# Z1 T. O8 t - #define DMA_FN_OUT
6 R/ V$ N4 j3 _( c/ _ - #endif# U! r- R( W. D7 }0 p' P9 K! B
3 U' o) m. \+ K$ @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ c' q+ G6 i; s- f# b+ `% m
- #define STATIC_SHIFT 3
, N& E5 p+ l* v3 }% X - #define TCINTEN_SHIFT 20/ D$ p% M$ t+ Q
- #define ITCINTEN_SHIFT 21
3 n I' l7 T$ t0 `0 b - #define TCCHEN_SHIFT 22# a- w' d& L1 N7 W% z: A
- #define ITCCHEN_SHIFT 23- [3 @4 p: ^: T# K6 D7 d! J
4 B) F2 i4 Q' Q$ L8 T/ J" s/ V- static volatile int irqraised1 = 0;
0 H1 a4 w) M8 P9 c' K2 u K5 C - static volatile int irqraised2 = 0;
9 W; p+ ^: e% X% f0 m3 N' U [6 ]2 w - , Z. }0 X* V: a: r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; q7 G" h/ G! i) j z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 s# r9 G$ _1 B8 }& o8 e; h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. E5 r d$ I1 A6 A6 v9 r - / s& L c x3 |2 K) v" ^% I9 H
- dma_addr_t dmaphyssrc1 = 0;
+ |) w* }+ f1 ~! I1 n3 L - dma_addr_t dmaphyssrc2 = 0;
! E' K( E9 m$ P - dma_addr_t dmaphysdest1 = 0;
! e: M2 K. r; G) C! s% f+ Z - dma_addr_t dmaphysdest2 = 0;7 f: R, o' b5 |7 ?4 ^
: i& v& Q0 }; i# w- char *dmabufsrc1 = NULL;
9 _, N6 o9 x" C5 o8 J0 j# x& h - char *dmabufsrc2 = NULL;8 s2 a5 G$ N' ^3 N6 z
- char *dmabufdest1 = NULL;; E$ D a" Q; S7 i5 ~
- char *dmabufdest2 = NULL; B6 `2 h$ F# Y( j
- , }7 E/ R9 o. ~
- static int acnt = 512;
% w% F. B) j% H - static int bcnt = 8;1 r2 y$ U; D5 M& B
- static int ccnt = 8;
! a5 _( F5 k9 s% ^0 q0 f$ O& O
% `6 T# L# k! @1 {- module_param(acnt, int, S_IRUGO);
, e' R$ D Y3 K) E - module_param(bcnt, int, S_IRUGO);
2 _6 J" O$ u. Y$ A0 o% P( B/ J - module_param(ccnt, int, S_IRUGO);
复制代码 4 w# }. f& Y& |$ V) n1 x2 U
, F, A2 U* i/ B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 X& f$ | z" p6 earm-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 T( T" ^2 J$ z r% v. Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- q, K T4 ~7 p3 A# {% l
2 E6 X! I C7 m& L4 z
" z3 G$ H e1 @- Z2 E. Q |
|