|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 U6 `( I6 w' D r5 A3 k
- [code]EDMA sample test application4 B. c8 _# J* P9 j( N& [0 S1 ?
- /*
6 l3 V( j# @, ^ - * edma_test.c3 _1 W) G4 O( V+ K8 n1 C
- ** i0 H+ A5 R1 H5 r& j/ P" g
- * brief EDMA3 Test Application
1 _: n( Z2 R A0 f# Q8 v, |! ?3 V - *
3 r D2 n% [& U% K+ g6 a) c - * This file contains EDMA3 Test code.
* ?% t& w0 N L5 p& F: [ - *
1 i- T' Q( P0 `1 ]0 v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 z& R! n1 E( {/ y" M3 A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( Z6 ~0 p7 ^/ v
- * TO CHANGE.' g* P8 c ?3 T+ C* m3 b/ D
- *8 }- a- x7 V5 p K4 L( q- D' b6 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 K) f- ?; W3 @! M; { - *. L3 U- a) M% V4 C7 s& A
- * This program is free software; you can redistribute it and/or; ^$ V- ]! a( o
- * modify it under the terms of the GNU General Public License as
- {/ }) L0 j0 l* @ - * published by the Free Software Foundation version 2.5 @- [5 m- ?2 Z2 d0 R+ Q- I3 D; H
- *
) N3 l* e& M# g- u4 j( U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 i& O& y" L7 V - * kind, whether express or implied; without even the implied warranty
( g$ v- R5 @# h# P) I& k8 y8 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) O2 j- p( S% @: x. i
- * GNU General Public License for more details.; x Z6 j L" Y3 i& y7 s+ B: p
- */, R" q- n& l8 Z, r' t4 a O
- 8 m" l/ V7 G9 V, `: R2 |5 M2 i# E
- #include <linux/module.h>
2 |! b- e9 q* [4 y - #include <linux/init.h>7 {4 n9 i) A( K8 s& t8 }* H
- #include <linux/errno.h>
+ i; Y `# i: I" U4 l* E* s - #include <linux/types.h>; ^6 E& [4 r: v J6 c
- #include <linux/interrupt.h>
' A& s. r' ?; _1 F E. h; S - #include <asm/io.h>7 ?" l# B7 B# L
- #include <linux/moduleparam.h>. v0 d2 {% ]$ o' O4 l7 u
- #include <linux/sysctl.h>, h1 [* G( q. ^& B& x% A6 i6 Z
- #include <linux/mm.h>
$ e0 m" c8 v% J- | - #include <linux/dma-mapping.h>3 V# Q Q. `9 c7 D8 F! C
- ) H; e7 L# ]7 k% G! c5 c: U
- #include <mach/memory.h>1 \0 n9 N( o6 F7 }5 Q7 ~
- #include <mach/hardware.h>
/ H/ N# L0 z1 G. R7 u" X l - #include <mach/irqs.h>! H4 u: t' U; M v, C
- #include <asm/hardware/edma.h>) y$ ^% ]1 S7 |3 [( y0 G
: y5 f+ z& E6 q, H- G- #undef EDMA3_DEBUG. f# j$ ?; z3 O4 v+ Q8 p3 h3 Q7 I6 U$ ~
- /*#define EDMA3_DEBUG*/$ [2 X& x. C3 A& c5 I- k
- ( |& }3 Y; A9 @5 D+ Y
- #ifdef EDMA3_DEBUG
# ?6 b- F2 D8 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) @- m/ S! V8 E% I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 s- { ]# `( m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( \0 M, ]0 p' }$ s$ \
- #else
; E2 A6 t- @5 ^- q; ]; \( C" p/ T - #define DMA_PRINTK( x... ): ?# C! \+ a, x, {0 Z0 b3 o0 M
- #define DMA_FN_IN' k' z* d! m7 _8 ^2 c5 ]
- #define DMA_FN_OUT8 {/ B4 x8 K9 m6 S+ L4 Q
- #endif
) ` w) R/ M+ d; s# b' d# f - " ~1 }2 o7 u* G$ [6 H6 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ U( h( q/ K' m5 D; R4 ^ - #define STATIC_SHIFT 3
1 h+ t/ L. q0 ^* ^; O - #define TCINTEN_SHIFT 20+ F% c6 R/ b4 Y ]( E
- #define ITCINTEN_SHIFT 21
! g7 t. G9 ~# v4 a C" n6 B3 \ - #define TCCHEN_SHIFT 227 B4 V: F& e6 e$ r$ B* W3 S
- #define ITCCHEN_SHIFT 232 I$ y- W% L: N: {
; r" p) e, o" S/ h1 c; {! u- a- static volatile int irqraised1 = 0;
7 H' H1 r4 E. ]2 P* b0 Y - static volatile int irqraised2 = 0;
# H, @, t3 I1 M% u5 n5 H
" L5 ?3 i, Y0 ^- P; [5 y: a1 s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 e3 d" h6 ^5 u) h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 `) l' D! |- R: d+ B7 R( r, d0 C7 `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) o ~: R, s Z2 Y
% v3 i. c" }+ P |* J/ N! w- dma_addr_t dmaphyssrc1 = 0;3 p6 O4 m- ]9 a c, s0 |% n
- dma_addr_t dmaphyssrc2 = 0;
' F' e/ q0 U3 c5 x; ^ - dma_addr_t dmaphysdest1 = 0;
' U) @( u. N4 B: [% {3 f8 G' X - dma_addr_t dmaphysdest2 = 0;
# s9 H7 [- `- T7 T. |
& k' ]0 x2 R+ Y! z, P( N# ^- char *dmabufsrc1 = NULL;
/ p. o* z7 W, `+ L - char *dmabufsrc2 = NULL;
% I5 V% B4 K- m/ I, p - char *dmabufdest1 = NULL;1 Z( y( n, F) ?6 H0 b2 w9 }
- char *dmabufdest2 = NULL;4 s' X6 r" L# [
- - F5 p5 t. Z$ V2 j `2 \4 {
- static int acnt = 512;
4 Z6 ? l2 R, t% r0 \ - static int bcnt = 8;
2 g Q* L' ]. o - static int ccnt = 8;& F: c6 r: `* \/ G) H
- $ Q' M) {3 [; n( N# ?' b
- module_param(acnt, int, S_IRUGO);
% Z% N% l* r( i& x' a! n l+ k - module_param(bcnt, int, S_IRUGO);
+ y0 r6 l% g7 h - module_param(ccnt, int, S_IRUGO);
复制代码
5 N! t4 l" s' r& D" `& x" F4 m V2 a( I/ e5 D2 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 G9 D0 _4 ]. w3 O& @2 I( Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ U& \: v' H ^! P s/ Y3 K7 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. d% }1 f. h6 K7 n
5 r) {$ ]6 J- ?* b$ q# K
* {$ I; Z" A& V0 m3 [ |
|