|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) i/ z: w. t$ q5 Y: B! A- [code]EDMA sample test application) l% j% V ?6 `5 J3 X% h. ?
- /*2 J2 U3 v7 r5 T) _
- * edma_test.c" z6 C2 D# I0 K+ @# q( C3 b
- *+ ^* N4 h) \ O, A7 A& B) b0 d1 u* S* g
- * brief EDMA3 Test Application
# `1 p+ ]+ b( \( ^# p - *
" V9 C5 x/ m# [* N4 _. b* X - * This file contains EDMA3 Test code.2 s5 D0 M# c( y7 |6 b
- *
* b" m" s0 M, c% f8 X9 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 p/ G& W( a" f6 W( f5 _" X" {. r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" { Y1 g; B% ~) I
- * TO CHANGE.% H* V( J3 V; o/ H
- *
# B+ p& v6 D" i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 s2 g+ A1 e- k6 W - *# ]& |6 A2 J4 L" e2 J3 @
- * This program is free software; you can redistribute it and/or
$ m& d# S- G, e1 ? - * modify it under the terms of the GNU General Public License as2 J1 i3 `0 M6 Y% h3 n2 l% c; d
- * published by the Free Software Foundation version 2.
7 i/ n' M/ i( b6 e/ p |- ` - *
8 y/ k7 E2 w- S7 y2 d# ]' k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% n _& v+ A7 r - * kind, whether express or implied; without even the implied warranty: ` v) r( B7 H5 V3 M- D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 n: a* F Q- U - * GNU General Public License for more details.
N1 P' P4 }. y - */
" F% m; v3 F5 l: {/ `9 P! X - 4 q! Y- W+ {8 u4 E# N3 ^! w, o
- #include <linux/module.h>
" f1 {& K( g0 W. ^! ]" o - #include <linux/init.h>' G$ i4 x G$ R7 G, A/ ^
- #include <linux/errno.h>
. g% ~ z8 I" B6 N5 _& H/ f - #include <linux/types.h>' c: t! H. q3 ?0 l5 r1 b" B
- #include <linux/interrupt.h>
9 `6 P' Y) D+ I - #include <asm/io.h>
8 ^+ U$ }- i: P4 R3 h7 n) N) A - #include <linux/moduleparam.h>
6 E( k6 d; ^6 H- }1 n( \' t - #include <linux/sysctl.h>% A; E6 Z; v7 x. \2 X, a
- #include <linux/mm.h>. Y' C/ {9 n: \
- #include <linux/dma-mapping.h>2 [3 E, R$ q2 g8 U3 }
* C/ ^( E" r% f- #include <mach/memory.h>
: E5 Z" n" P1 m+ V3 w. z - #include <mach/hardware.h>0 Z* }! a3 G9 x/ Z! W' Y: ?" k6 x( P
- #include <mach/irqs.h># R V0 b8 T' M+ `4 T
- #include <asm/hardware/edma.h>
+ q& e: e3 l" I - 1 I" b8 A1 U& A+ N
- #undef EDMA3_DEBUG
8 ?7 q: R! |6 ]+ P - /*#define EDMA3_DEBUG*/
" n0 C( d# M' q
8 d5 Y' N+ t( Q, u3 }8 G+ h7 Z- #ifdef EDMA3_DEBUG; j! M; o0 H: Q1 O: I' A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 ]5 t$ i. [+ }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 d+ x: e- H3 S: a: T- ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 c1 o6 {- U( G1 J( ?7 q - #else
; U% w; h0 H$ `! Z8 Z' f9 G - #define DMA_PRINTK( x... )) w) y6 [2 c# X! x5 D8 S/ M. t
- #define DMA_FN_IN
& D/ K9 T! L# P% A - #define DMA_FN_OUT
3 _; L/ \0 X1 u' P0 I3 j; E - #endif1 O. r+ ^6 H6 i- r i) Z
: o4 D; ~4 J5 g2 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768) c# [4 A0 ]/ ?( _. P+ m, a
- #define STATIC_SHIFT 3
6 t) h: B# h0 h5 D0 C4 N) x3 t - #define TCINTEN_SHIFT 20
; c; h7 b( t; x% a/ a2 y - #define ITCINTEN_SHIFT 21. ], v K: K, q0 P7 e4 X
- #define TCCHEN_SHIFT 22
* I" [* f0 n; R - #define ITCCHEN_SHIFT 235 j9 y; y/ Y U5 Y% H& E
9 L3 R! F4 U3 l0 Q# z9 g; k/ x6 ]0 W8 J- static volatile int irqraised1 = 0;
# g9 ~7 }0 P6 i! C+ | - static volatile int irqraised2 = 0;
; T$ ~: U8 `$ Z- j - 0 S# Z% X' X& H) D4 L9 |* q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, }& I: Z( ]4 k+ y; ^! K: |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# j7 x5 u3 |. {% Z& ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, F: l8 u, J1 a: P) k
- 2 A' X( \5 B/ @! p
- dma_addr_t dmaphyssrc1 = 0;
Q Q/ x/ _/ u' O6 B9 ~ - dma_addr_t dmaphyssrc2 = 0;" k! z5 l0 E H6 V
- dma_addr_t dmaphysdest1 = 0;- s( C% U( ~5 y5 [" c9 d
- dma_addr_t dmaphysdest2 = 0;3 X" X4 b; \3 y { m' {
- ( q$ x/ O, @1 e$ [3 `% Y2 N+ f: x
- char *dmabufsrc1 = NULL;0 B2 @; K6 @9 R5 g8 D4 k' R. O
- char *dmabufsrc2 = NULL;- J! C2 L+ J, n
- char *dmabufdest1 = NULL;
2 L/ A5 j1 t8 ~- ?! g - char *dmabufdest2 = NULL;
1 J- L; K" d+ d+ H2 H# W1 H8 r
6 e1 ~* y! _5 U% e: B- static int acnt = 512;# l! f5 w& Z1 N
- static int bcnt = 8;: I. p: D2 C# p3 y2 f8 G
- static int ccnt = 8;
7 D# F; ~9 j8 c$ J
+ ~: z6 Z9 a. K' W A3 j% f C- module_param(acnt, int, S_IRUGO);9 L5 F; d& D* ?4 g7 L9 [
- module_param(bcnt, int, S_IRUGO);
7 K$ q" m0 p+ o5 g, } - module_param(ccnt, int, S_IRUGO);
复制代码
* p$ b$ q" B9 ^3 n, [
) E2 z, X2 H' }( I# [1 @ A$ N- L E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: g( Z# D" c' P: @2 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ U2 ]6 x/ [% [" B0 n+ m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ~# L/ ?% }& A
( p- V/ f D* T" j; u# M# q' _) N7 P& I6 }) S7 V6 [8 s
|
|