|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; T# B$ x: A2 v; C% A, r7 o- [code]EDMA sample test application1 g! k1 h& D2 S& Y# y
- /*/ b- I, C2 I8 [3 P' I# l( p- n9 _3 {
- * edma_test.c1 {' P, c o; G, {, J) |
- *
* g( i: h! |- y0 g Z - * brief EDMA3 Test Application
7 M6 k/ n7 }% l; q - *
" a% B/ a1 g, X+ Y! l - * This file contains EDMA3 Test code.
. m B% P4 Z! [' W$ e+ S" V: d - *
5 H. \& m3 a% X% u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 Z' q( X+ {% g( f! T2 y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' g+ P- Q1 D- h- r1 F
- * TO CHANGE.* R2 w8 ?: S$ g2 p) Y9 ~
- *
" v' F$ _( j$ q2 ? S. |8 ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 e- I% _8 X. y' l$ V( s
- *
[5 {$ l0 [0 s9 W. j: _, K0 Z - * This program is free software; you can redistribute it and/or
5 o' ~+ G+ g7 x6 O6 t, ] - * modify it under the terms of the GNU General Public License as
& @9 `, k2 F' U% [ - * published by the Free Software Foundation version 2.: {5 u- Z- c' d' k7 o6 o
- *# `6 F0 M6 q, h/ F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& _" f- m# d B3 Z) I2 ` - * kind, whether express or implied; without even the implied warranty
q, ~( \" K$ ]/ j( t; h0 |: Q m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. [' u; x- f# p - * GNU General Public License for more details.
2 y7 ^0 L. n( G, p$ E, } - */- s$ _0 _- _! T* K) U' @0 @
- / m" @9 \$ G8 V9 m6 D+ b: G. F# `
- #include <linux/module.h>3 |- m/ o1 ]9 y) n& d. G
- #include <linux/init.h>
3 ^! A' A1 ?' E - #include <linux/errno.h>
$ t* d- s( x. [- Z5 m6 d - #include <linux/types.h>
# b( _2 c; i0 g5 D2 `2 z9 { - #include <linux/interrupt.h>
8 ?9 w$ O# N# g- u( d+ ? - #include <asm/io.h>
4 N; \. Q2 v+ q4 W - #include <linux/moduleparam.h>: K. g$ m! d9 G k I. u
- #include <linux/sysctl.h>
* R! e0 t) e7 q7 |' ^ - #include <linux/mm.h>4 q4 D# o8 f) e& N* [
- #include <linux/dma-mapping.h>
4 P% J1 |2 ^- k+ M - b4 j B H8 B8 K" p
- #include <mach/memory.h>; a9 ?' s; B% D2 O6 C: n: m, m6 b
- #include <mach/hardware.h>
7 a& ~/ c9 F' E2 d - #include <mach/irqs.h>* Q `/ S1 E2 w% t) R/ s
- #include <asm/hardware/edma.h>
# n6 x, G( j/ {; e5 W2 e* P - ) }2 [# }, |1 l6 f; Z* k
- #undef EDMA3_DEBUG" u( |0 |# }1 ]% a4 d+ H" b
- /*#define EDMA3_DEBUG*/& ?# S& q! N- E
0 A; O! m9 h+ W+ b' V" J- #ifdef EDMA3_DEBUG
9 o/ T; \9 s3 U0 ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! K" q# H7 w- o! R* W6 X/ K5 X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 |8 b% U5 k4 T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: {! O/ H% q; z3 U - #else5 O }4 G' p. c- c `
- #define DMA_PRINTK( x... )
8 y' @. m! O4 I: D0 h - #define DMA_FN_IN+ f# Y. m, t9 {6 z5 U2 L
- #define DMA_FN_OUT
, u/ _' \! V& r. x9 U4 ] - #endif- { m8 t- z1 q, ^. t ~0 }" A
- 6 [5 B% U, U- Y3 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); D6 ]' Y, x0 E2 C1 p
- #define STATIC_SHIFT 3
0 M. l6 k' |! y6 \5 W8 w - #define TCINTEN_SHIFT 20
( x( ^/ p n' \0 N' A" M2 ] - #define ITCINTEN_SHIFT 21
/ A) I5 @. `. @" v/ e) j# _ - #define TCCHEN_SHIFT 22 I3 g0 n' S: @$ ~9 `: t
- #define ITCCHEN_SHIFT 23
0 j, z9 s& |9 X% w7 V
! V0 G2 ?) V( i9 `& Y6 ^- static volatile int irqraised1 = 0;$ r' f; E8 v2 G/ m9 I
- static volatile int irqraised2 = 0;; h, [ o- g! l7 Z4 n3 r
; k3 s& t# b5 p. e" G8 M- ]6 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ^7 ?0 x& `, N3 B) O) ]" }* w5 B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 K% G( [3 Z9 T1 E C/ q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ]( Y# x& U7 p
7 J k- O L1 H. M6 C- dma_addr_t dmaphyssrc1 = 0;) |9 @* S& ]3 s( y
- dma_addr_t dmaphyssrc2 = 0;
" p* y3 Y' W* ^( u - dma_addr_t dmaphysdest1 = 0;
; Z" v7 O% ~8 U - dma_addr_t dmaphysdest2 = 0;1 } `. N0 s, G5 r
6 T& [. Y# Q r- ^ v' ?- char *dmabufsrc1 = NULL;
: W2 `3 j% }% M: ]; S% W$ [0 ~ - char *dmabufsrc2 = NULL;
9 @1 [# ]1 w- L+ R; w/ ?% G) s - char *dmabufdest1 = NULL;
- Z C" S& O2 ^. T' y - char *dmabufdest2 = NULL;, e5 g' d N; [0 n: t
% {, d3 l/ [5 r- static int acnt = 512;1 a B; G* r1 M; u e# v) i1 H
- static int bcnt = 8;
z8 ?, j# `/ d4 Q" o. I7 O - static int ccnt = 8;7 H+ C" f1 t; ]1 S5 q4 V& m
- , [5 u/ ~+ d* {( N7 D. |7 l
- module_param(acnt, int, S_IRUGO);
9 f/ X4 ?/ }. n/ W/ V - module_param(bcnt, int, S_IRUGO);
2 m6 ~% R+ P5 |0 T# } - module_param(ccnt, int, S_IRUGO);
复制代码 1 x3 | g% o% U* e% `
/ q$ C" X. I1 j. N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 W) M* y9 z$ O; o# I! D, N9 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) R9 [$ ~2 c% L: Y; |8 s* v2 s( l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' B R" g @0 e! _4 T6 S( V+ L K0 d4 o4 `4 r
' L: A5 L' o/ \; s' [& v3 l, J' O
|
|