|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 d$ e1 u9 L- D8 f
- [code]EDMA sample test application
/ i1 U; ^- L" U6 O7 R0 `0 w% I" i' N - /*
% H+ L9 W$ [0 m! }, [( r K - * edma_test.c
& Y, h$ @5 K$ W: v1 L1 D - *
- `# C% Z) {3 \3 T0 i- y - * brief EDMA3 Test Application
$ Y0 r$ l" Z" W1 e6 L; g" B - *; @! E7 H6 l4 T; `" h
- * This file contains EDMA3 Test code.
0 G: X9 O( ^" j8 v3 ^, [8 m6 M - *2 x* h- w0 M- \- x- b# j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! I- g" l3 ~2 X" r! G8 W9 m. Y, W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) ~6 h8 M- y5 k - * TO CHANGE.
w: o2 U4 F! x3 O8 |9 ^: V5 H - *
/ a7 r: @0 e" y% | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 J: h2 E7 G/ k! a; k
- *
0 ]2 c1 a8 N. U& X - * This program is free software; you can redistribute it and/or
1 Y9 \! c# V. H( r" j: Y. G) k) M - * modify it under the terms of the GNU General Public License as9 |; m5 l9 E3 q% p5 I% R
- * published by the Free Software Foundation version 2.# E$ i! e: I, Z& `( S7 G
- *
+ P9 |- S v3 q! t0 k5 Q0 v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% h6 V. d O. N7 @* c, \ - * kind, whether express or implied; without even the implied warranty9 `: Z c7 Y6 ]" ^ s! Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- [& b/ T& ?( \0 X
- * GNU General Public License for more details.
' f; T5 f5 ~6 o$ h: b - */4 G7 y7 D3 F5 u
- # j/ Q! p& A( [/ Z1 L7 b0 \$ e9 G
- #include <linux/module.h>
' m! W! N- i5 L3 g4 ~: r2 ^! K - #include <linux/init.h>
& \4 d* d1 F# K$ } - #include <linux/errno.h>
2 ?8 h# [2 A; o5 | - #include <linux/types.h>6 U+ w5 z' z" {7 P
- #include <linux/interrupt.h>0 r2 U! t& G M8 W x7 n) j; V
- #include <asm/io.h>/ U# `9 R" u t% B9 N# k3 L
- #include <linux/moduleparam.h>
. b$ g) l8 U7 l, B - #include <linux/sysctl.h>
" u" Y8 T' m8 g5 y9 n% h - #include <linux/mm.h>
1 R0 }- C/ e) T- u1 O# a' j - #include <linux/dma-mapping.h>; ?- X/ T& A0 z O$ v- h' z
; |. b2 U4 P/ b M- #include <mach/memory.h>
) I8 [3 v7 c6 s0 ^ - #include <mach/hardware.h>6 F2 y4 `8 y$ W- M8 A) Z! J
- #include <mach/irqs.h>& h+ i# G& E' s1 P3 P3 X
- #include <asm/hardware/edma.h>- N- W0 R6 A/ C, s+ |" m+ q5 S4 |
- ; k( S+ C+ N. O( Y
- #undef EDMA3_DEBUG
" ^* ~4 k6 |! g - /*#define EDMA3_DEBUG*/# F4 @ {; p/ f! b$ Q
- / B: b8 l! z6 @) Z5 l) N6 Z
- #ifdef EDMA3_DEBUG( c B0 E2 K" [+ O) l# x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 x$ d8 V, o6 Z, M! J7 I: ]. O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; K* V' t4 p- \4 @9 p3 m% E: X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. c$ Q- L! A: G" s - #else. s; i& K9 d3 D7 j
- #define DMA_PRINTK( x... )
7 ]0 K, r4 r* x# o8 Q* J3 ]* y - #define DMA_FN_IN* k$ J0 k3 d6 V8 s, a1 a
- #define DMA_FN_OUT
8 f! }' F5 \0 \- [. G2 F6 X - #endif
+ `5 R0 a9 M* R# v5 a% S6 Z2 z
! p2 W3 \2 q) s: {' B9 h {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 n$ w4 \7 B6 m3 e1 {0 j - #define STATIC_SHIFT 38 p, t; `1 I# o$ v
- #define TCINTEN_SHIFT 20
/ T5 E% q9 K, X; V% i6 @. Z! y: E - #define ITCINTEN_SHIFT 215 ^5 ^, k/ v* C" Q
- #define TCCHEN_SHIFT 222 H% Q1 ~" D# p: |9 ?( H; {
- #define ITCCHEN_SHIFT 231 ~, X6 K7 x% ^. h, @4 n, X! F
* {: q4 R8 u# b# J/ ?- static volatile int irqraised1 = 0;+ d4 X7 h8 {1 g/ l1 r2 p3 s) G
- static volatile int irqraised2 = 0;0 l, W7 |8 g* P. x1 \. O+ Y$ ?
! B/ U' s" ?! s3 k' q% i2 j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* f+ {* b+ W0 a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% P$ o7 Q9 a9 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 T" b4 Z) _2 ^4 d* s4 z! H, p' ]$ z" e5 k - # T S4 h- g* b5 _; C
- dma_addr_t dmaphyssrc1 = 0;; b& y g& }" ^. f
- dma_addr_t dmaphyssrc2 = 0;3 e% M" M/ Q& Q# Z3 Y
- dma_addr_t dmaphysdest1 = 0;! _- ^( v7 X6 V
- dma_addr_t dmaphysdest2 = 0;
& r6 w# K& A9 x0 w% c
4 y/ O& u: N9 C: d' ~" g, ^5 u- char *dmabufsrc1 = NULL;4 e2 j5 b. w# k2 R% H E' f
- char *dmabufsrc2 = NULL;
7 ?9 \6 g7 o6 b; J/ v6 N( k - char *dmabufdest1 = NULL;% Q7 u* G3 v, L
- char *dmabufdest2 = NULL;7 v3 R, T* \/ B# z
- $ B8 P4 b# w# o$ q1 h$ m$ C, S
- static int acnt = 512;
! g) S% d% e: u( z - static int bcnt = 8;7 T2 t5 T4 R: J C- Q" d0 |
- static int ccnt = 8;
! R$ P' A6 H' b3 i( p3 C4 s5 f
" u1 Q# y) t$ s7 n+ [- module_param(acnt, int, S_IRUGO);5 |6 s! l. j! O6 a; @: ]
- module_param(bcnt, int, S_IRUGO);: G, b' G" L' u V, m3 L4 Z
- module_param(ccnt, int, S_IRUGO);
复制代码 8 C% H0 W# b% D" w$ Z7 A! H
$ {3 v1 q9 i, ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: n6 V3 O, ^. c2 N) s0 L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; |. J a8 g1 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 g; L+ L( x: t5 y+ y" P* C% A
& h% X8 l$ `$ k0 Z5 G" b& T6 m
7 n, V6 A+ c/ b |
|