|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( X* I9 x) s' V0 A9 \& y+ W- [code]EDMA sample test application ]+ @* g3 o6 g4 `* L
- /*
+ i0 M( [, Z, y - * edma_test.c
) ]6 G3 @( ~2 S- F) R# Q# t - *
; Y1 `$ ^2 `% d - * brief EDMA3 Test Application3 u( d: Y V1 e8 [ R- n Q5 ?
- ** {) U- ~3 Z. j
- * This file contains EDMA3 Test code.
5 M! s! Y. {: C - *
' F6 s- ^: ~, a# e0 a+ T6 a. {) ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 C9 t' r. x' J9 _! D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 r! f* V. A; {7 q
- * TO CHANGE.$ e) b% J8 F% C" `; G* T! p
- *
* P- x0 Q/ S; [3 |+ K x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 _% @: A1 d( j, I' k+ Z
- *
- \+ c* j2 X1 l( i& j- e - * This program is free software; you can redistribute it and/or
, S) a5 k% X) o+ w% @4 H - * modify it under the terms of the GNU General Public License as
. r: H- I. b: n' d5 p; @* S - * published by the Free Software Foundation version 2.
- D" a0 H9 @+ C* L - *
: _! ]) c% D6 ]$ X. y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 g0 x6 Q! h3 Q$ t$ [ - * kind, whether express or implied; without even the implied warranty
4 N* u/ ^5 p+ f3 ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- L" X% c* D$ a" `
- * GNU General Public License for more details.
4 o5 E4 a0 ~' Q* T% K/ N: L - */
6 D. U6 m5 }$ J
' w; l2 S6 q0 T, R; Y6 {& U6 \- #include <linux/module.h>
6 x x9 X0 j5 F5 y - #include <linux/init.h>+ A& \; S$ d$ v: R% N. U
- #include <linux/errno.h>
8 C, N- `1 }. Z. N3 _- k$ Z2 I4 v# g - #include <linux/types.h>
9 ?) p) k: o' S% X - #include <linux/interrupt.h>. ]9 y% c/ f$ W8 I8 O
- #include <asm/io.h>% U9 L5 j) @" e# H9 U8 R
- #include <linux/moduleparam.h>
; Y2 h. G+ @5 c8 M; b- [4 d |0 G - #include <linux/sysctl.h>
. x* K6 q. z. v- H# n1 G1 [) M - #include <linux/mm.h>
! d; H5 C1 {0 ^7 O8 _9 I# E - #include <linux/dma-mapping.h>! T& R2 _5 U" \
) @* P; f4 g% J' S- K- #include <mach/memory.h>5 U' S& u, g# a
- #include <mach/hardware.h>
% ]/ {8 k: H" c( \5 s: j4 b* A - #include <mach/irqs.h>
5 b0 d+ p, f* e Z - #include <asm/hardware/edma.h>$ u& B% M7 E- w6 w/ d# l) |
- q. @" N. K' A4 b/ P a5 C" m- #undef EDMA3_DEBUG2 e4 M! y6 y) I# Z! X+ H
- /*#define EDMA3_DEBUG*/
: T$ D7 i% a; A) i# I - / h5 V& |8 G6 D7 T
- #ifdef EDMA3_DEBUG
7 B U+ q2 g. {. q* c/ t7 m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& z- X! ]* y9 A g- h& ^3 _. V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' @( ^$ i1 X. K1 O5 y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
{) X7 V: h5 t! E - #else
; u7 G$ ~0 S7 D! \9 q9 ] - #define DMA_PRINTK( x... )7 J+ R5 k* F5 ^6 _7 M
- #define DMA_FN_IN1 E4 H4 d2 F) h5 {. J
- #define DMA_FN_OUT8 m1 P# f4 M4 x: o9 j
- #endif1 {0 C8 h' u4 X' ?1 l" b. S: J
* o% q8 q; k8 c6 B4 ]6 A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 L9 g6 b% _5 z9 [3 [, E# H - #define STATIC_SHIFT 39 n) n T/ H8 V
- #define TCINTEN_SHIFT 203 {2 R" X+ a, i z! S% c
- #define ITCINTEN_SHIFT 21
6 E: J: D) {3 e# c6 ~# s3 U! t: u - #define TCCHEN_SHIFT 22
+ u, X' }6 y" L8 }9 W" ~/ B& x - #define ITCCHEN_SHIFT 23! V: x. T8 ?' t" q* ?! w/ m
0 {( f+ i* y4 g- static volatile int irqraised1 = 0;
/ }$ _( w( W" j - static volatile int irqraised2 = 0;- ~1 {' v: z( W7 s# R
0 S2 l9 k. P; p$ _( j& j! N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ p; U9 W+ g( E R0 ]+ R0 l" l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 S7 `, p! q7 J z0 l& ]. z1 d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
d8 H( [, H; h- |* V - / J5 f8 R3 f5 B: a; M
- dma_addr_t dmaphyssrc1 = 0;; C" i d& c6 e4 p. ?. t3 ?
- dma_addr_t dmaphyssrc2 = 0;
' j5 b v" V, f& R0 B - dma_addr_t dmaphysdest1 = 0;6 a6 G1 s7 q O% S; d9 ~- T9 ~) E
- dma_addr_t dmaphysdest2 = 0;
" Y% c; M0 p8 L% L o3 s- B+ _0 A
) J# ^1 w o, U- n% I6 G7 F- char *dmabufsrc1 = NULL;' d# r3 M8 m" C. K' Z" B2 S
- char *dmabufsrc2 = NULL;
; p$ @% I2 t. L$ V+ R6 l# c - char *dmabufdest1 = NULL;/ h: p1 Q8 m, R
- char *dmabufdest2 = NULL;; n+ ]- {( M! b7 T0 T% K; S- V! R
4 @( K9 W, F) L1 `$ D ]8 r7 T' `0 J- static int acnt = 512;! g1 g8 a6 e# b) C |1 Y' {
- static int bcnt = 8;' M% g/ b9 P. v( D/ o* _* J
- static int ccnt = 8;
5 w8 I# `9 l5 [6 [, E - 8 k8 O- W: A6 d, {$ ^
- module_param(acnt, int, S_IRUGO);
& C. F( \* p* | - module_param(bcnt, int, S_IRUGO);1 [. j h% |5 v
- module_param(ccnt, int, S_IRUGO);
复制代码 ; G$ K8 ]" J- D/ n
/ X- N( X6 `; L9 G! z+ g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 x" y, T! h, \ v1 N& {5 u7 y4 Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; p2 G- \2 a: @5 @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' w" P, m3 ?6 ?0 \7 X" D
9 W8 d1 t' _, }9 W5 ?+ P
0 ]8 [" A# _; |8 F# B |
|