|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 t" Y- t4 m$ h+ j. H9 ?- F5 ~
- [code]EDMA sample test application! P, B5 M C+ W% \5 ~
- /*7 k+ g5 B/ K* s9 f1 q5 j( _ t
- * edma_test.c
: w: L. k6 V7 n7 _; T3 g5 J - *- N# ?! q& J% h# t# H# j2 K) d
- * brief EDMA3 Test Application
" |3 p; `% m, d" h( q* y. ? - *
0 k8 k- h7 S9 _" u* l b8 } - * This file contains EDMA3 Test code.- o) ?0 A% b* C' f) I
- *
; o% o' Z: W$ e2 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 X9 Z8 J& _1 x) v! ^. z/ ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; k2 c$ t6 k0 v& j T7 o
- * TO CHANGE.$ B I) ^! W+ A2 h! g% n( F
- *( M* R% d( F% G: U/ Z O0 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; ~, ]8 o, c/ f# w# Q. I* D
- *
. L0 ]+ d( z) S6 c: c. @2 r - * This program is free software; you can redistribute it and/or8 Y* O! \9 x5 K5 n8 {) i: t5 q
- * modify it under the terms of the GNU General Public License as
) y5 [" L- I* f% V x8 Y - * published by the Free Software Foundation version 2.
4 k0 w3 v4 }- O! s$ P/ g - *
3 C6 R# }8 B: A: a& t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" R/ S7 m$ j4 L& H
- * kind, whether express or implied; without even the implied warranty" z+ R) z, B7 {( B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ P, ~( n- w( g1 g( _' c - * GNU General Public License for more details., g* ^4 z& F' i- w8 Z4 h2 G
- */
( Z* [) H# U6 i
/ j" p! P1 M, T1 o- #include <linux/module.h># Z ~/ J* ^4 `% X7 `7 w% V
- #include <linux/init.h>
5 f- d9 G4 o# C1 [ - #include <linux/errno.h>! C. r, D4 H4 i+ n" ]0 ^( x
- #include <linux/types.h>5 h: B) o8 G6 U) q9 Z, o
- #include <linux/interrupt.h># x. W* _, L- [- E# q, `
- #include <asm/io.h>
1 H3 U1 H3 C% v0 ] - #include <linux/moduleparam.h>
* |2 e1 F6 A3 b+ p - #include <linux/sysctl.h>5 g4 S' w0 t; ~
- #include <linux/mm.h>! t. V. Y2 Q+ D+ A6 K7 j
- #include <linux/dma-mapping.h>
6 |: O% U# i1 ^* N7 Z! w( t
2 H- j- G2 R. c# R- e- #include <mach/memory.h>% O2 ]5 V `$ Z: T' _' G
- #include <mach/hardware.h>
q6 `) E9 z2 |- i: a- a9 u - #include <mach/irqs.h>
, L& k4 o, n5 q" q7 [& j+ ^, x8 D - #include <asm/hardware/edma.h>! `( C' K8 h' V3 L, B' N
- 3 t( R4 K2 z b6 q1 f* C) l0 ^
- #undef EDMA3_DEBUG
5 u+ o( w" Y! f8 C( d - /*#define EDMA3_DEBUG*/ g8 ]8 g. a3 n! l( ?. A' f) r# L! J
, m8 b! X* }: L' A' \8 \' ~& J- #ifdef EDMA3_DEBUG6 X" Y Q6 m/ }4 {& a3 u; l% F+ [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- L" R# E* O+ \" b9 j8 d& U4 o$ e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, S8 `9 y V/ }7 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). x8 k! x5 k) C7 y" x r6 e8 v
- #else# P: N' l/ F7 @
- #define DMA_PRINTK( x... )) y1 y% A, ^3 }- v0 a# v" l
- #define DMA_FN_IN
5 d0 u5 c6 [* I, g - #define DMA_FN_OUT
! {( a# e( A: J' ~, j/ D+ r9 q. P& P - #endif
9 P: k0 B9 _- y - , ?4 A. m& j9 p0 Q6 X( n; Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# z- R* G) J1 G* w7 e5 v - #define STATIC_SHIFT 3& v) U. X5 B) D6 u9 T4 n1 K% @' M; {0 C
- #define TCINTEN_SHIFT 20, Z) K4 _- _# @, J4 S7 _' U0 K V
- #define ITCINTEN_SHIFT 21
# F; m& t* w8 @# k5 r4 a - #define TCCHEN_SHIFT 22
' t0 k( r. ^0 V+ m9 X - #define ITCCHEN_SHIFT 23
0 s7 F$ ?9 ]! j9 h b: G' B) A1 A
% o6 j Z6 r% ~0 x- u2 z1 C/ [- static volatile int irqraised1 = 0;0 n6 G& A" x3 c7 F6 Q
- static volatile int irqraised2 = 0;
( B. b5 n& M9 r9 c; a v: R
4 k) q9 h( K$ z- J0 I$ o& }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* p: g5 p! I- a1 w5 h! Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ [/ ~% w/ F7 f( [% Z* t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 t4 G+ N. x Z" S* x0 N, U. e
1 J$ ]$ J; I1 H- dma_addr_t dmaphyssrc1 = 0;
! K. ?% R" T; W - dma_addr_t dmaphyssrc2 = 0;
" V3 T: n* C/ ]' E& q1 G - dma_addr_t dmaphysdest1 = 0;
/ k# ^# d2 P$ ]. ^4 x2 C4 C - dma_addr_t dmaphysdest2 = 0;
* o+ X6 p0 t6 y* `. X - 8 N/ E% M$ y2 a0 I! c% S
- char *dmabufsrc1 = NULL;5 F4 p: P# r/ i0 g4 x2 x
- char *dmabufsrc2 = NULL;$ z; ?8 I# R7 U( ^ B0 {
- char *dmabufdest1 = NULL;
- J! Y+ i4 Y$ B2 E- X* e, k' p - char *dmabufdest2 = NULL;
a6 e' o! U' m) ~6 z0 e P
+ m! m0 I# ]! ]: B+ K0 l1 M# M- static int acnt = 512;; | h8 B, ]6 R0 { |4 i: ]
- static int bcnt = 8;' p6 P; D; l: v' M- R) _3 f0 g. h; m
- static int ccnt = 8;6 X; p) L9 P1 v1 E9 h9 m3 ^4 d
- ) o( D* _. ~8 T% G# W2 a4 t
- module_param(acnt, int, S_IRUGO);
& T/ |8 J' _) U. _ - module_param(bcnt, int, S_IRUGO);0 D' m- T+ W7 Z0 j! n7 \4 T3 o# g
- module_param(ccnt, int, S_IRUGO);
复制代码 6 b6 c, S$ n' {& M: @! ]: `
7 V8 q7 t" Z; m6 u% q9 F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) [8 I r! [+ C I% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
q/ g5 a' v; j Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ H/ h0 Z& p" V0 l) Q
4 I7 {8 O5 K4 x+ [% G; I
& W& i+ T; z6 Q+ {# K# W |
|