|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * Z# V6 `4 |0 b5 \, J
- [code]EDMA sample test application9 ]6 t3 K: h8 ]6 } e
- /*
( Z5 O! [; g. X3 e - * edma_test.c$ @) j9 _1 H& }: X
- *4 I$ c& t- ~- c/ ~
- * brief EDMA3 Test Application
& L8 z* }2 M. |) p; ~1 z: A1 u - *
3 X5 r% p! G+ E/ p- d. F( H, x - * This file contains EDMA3 Test code.8 W0 x9 f" D2 ?5 w
- *; {% O6 S# d; J& i2 u' G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 E: X$ U) v# p1 @9 X( e5 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ B D! o" j; P# s0 O3 ~: ? - * TO CHANGE.
; X8 M% U+ r7 j4 w9 O. n5 N - *; M# C6 H/ i. H2 _. }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. `0 ]4 a1 W4 o0 Q3 W' y- u - *
% X- v' B; K( Y - * This program is free software; you can redistribute it and/or
6 A) z' R. D1 Y% I* n3 F7 d" L- R - * modify it under the terms of the GNU General Public License as) S _; i9 p* T" ]
- * published by the Free Software Foundation version 2.
1 g! L/ D6 J$ A$ l7 O$ m5 D( b - *
, I, ]% Q/ t' P9 N" n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) W8 E0 n' x. \+ q2 t: P
- * kind, whether express or implied; without even the implied warranty
0 d% R, H& W# {( C D3 p, h- I! ?1 ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* P# p+ g2 E7 S1 C# J - * GNU General Public License for more details.8 W# x3 U. }4 E+ F, }) |
- */
* I% N$ b- I7 {! f0 \! p1 e$ ~0 e2 z
- n0 A! K- z7 l, U6 [ X- #include <linux/module.h>3 H* O# a1 Z* b% k
- #include <linux/init.h>
% K! x0 ^% U- `9 P9 Y) } - #include <linux/errno.h>
5 c. C9 X# B1 [' e/ a. B9 b, ` B - #include <linux/types.h>9 j7 F: B" m$ T# W
- #include <linux/interrupt.h>. j3 A. Y+ H" x# T: X1 k
- #include <asm/io.h>
- }5 I7 U8 a' u# r - #include <linux/moduleparam.h>
5 Y% |6 ^/ b) r8 n+ T - #include <linux/sysctl.h>
3 m4 L) U/ f% I [8 u - #include <linux/mm.h>
" o9 m/ A% \8 I - #include <linux/dma-mapping.h>& h7 Y) J9 v; v# A) C! R, f
- ! e+ o+ Q' `- S6 g% s
- #include <mach/memory.h>
7 \. V9 `. Z& S6 G - #include <mach/hardware.h>4 R; h8 G5 M0 x2 E! X
- #include <mach/irqs.h> @6 p5 \8 u5 p
- #include <asm/hardware/edma.h>
8 e* A7 ]9 l/ e2 {. a
3 a4 m, l& G4 w( D+ F- #undef EDMA3_DEBUG
+ q i5 m+ N# G0 `4 y2 h! h5 d1 p - /*#define EDMA3_DEBUG*/) q& G! `7 B6 u& |, e& f
- 2 T+ [4 I: x; [# ]* J
- #ifdef EDMA3_DEBUG
1 b" S7 U. H$ _2 q/ y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): t' R: W) U; T) z$ h# o$ D3 ]' g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ M% N# C; D4 D) Z2 L2 W: |2 B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), f! \7 G5 s# ?- j8 j; a3 N
- #else# F* K' [9 x# j8 O. p; Z! N
- #define DMA_PRINTK( x... )
9 x* p1 G; @3 v, s - #define DMA_FN_IN7 ]3 n# N; u8 [
- #define DMA_FN_OUT
& V7 j, Y' l3 O" K H( P& a3 I5 \ - #endif
9 W$ t2 V: E: m' Q
2 z% o0 [) p% c: H T: A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 E" B# N# M8 y6 H
- #define STATIC_SHIFT 3
9 a5 Q* ]* {8 s& T* ?7 u2 n% J - #define TCINTEN_SHIFT 20
4 l2 H* g* x' l# a: J* r' x - #define ITCINTEN_SHIFT 21
1 E0 _( y+ d6 H2 m - #define TCCHEN_SHIFT 22
* Z5 X/ Z L J - #define ITCCHEN_SHIFT 23' g- X- \& b* R( k) |& C
- , K5 j* n5 ^# z# \- g5 T
- static volatile int irqraised1 = 0;; ^2 T. D- N3 {' ~( h$ H
- static volatile int irqraised2 = 0;
6 |. u# i6 n6 o$ ^, Q$ D+ l - # e/ p! a3 V3 m( M) b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ C0 U. {& G) }& Y! | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i& Y9 g# q, j6 E. `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% T& T/ e* B V
& [7 ], J _* `) b6 d1 x. e- dma_addr_t dmaphyssrc1 = 0;6 v$ o, P0 d1 b8 e$ R
- dma_addr_t dmaphyssrc2 = 0;( H! c3 C! _2 w) K8 B
- dma_addr_t dmaphysdest1 = 0;9 m n; P2 p/ p, N/ a
- dma_addr_t dmaphysdest2 = 0;$ ]8 q3 E% d4 }* J: @$ D3 Z! r
- : d# g1 K. w7 i* h6 S
- char *dmabufsrc1 = NULL;" T0 w& b _- ~0 Z. a
- char *dmabufsrc2 = NULL;% s0 a9 b4 d8 e, w/ a) `
- char *dmabufdest1 = NULL;9 n/ @6 [) j& _; c- ~8 ^- X0 m
- char *dmabufdest2 = NULL;9 i0 y3 k# `( X# K% R& S
- 3 R/ v/ k2 _" h1 G( ]
- static int acnt = 512;9 w @5 J( f8 A) i$ I8 `
- static int bcnt = 8;
3 i0 v8 _2 l4 {" l6 H/ H - static int ccnt = 8;1 q4 } Z7 H8 L4 y3 b! Y+ B# o
% k% n/ L+ i' {( p- module_param(acnt, int, S_IRUGO);
# n h+ i7 x; v/ b( ?6 z - module_param(bcnt, int, S_IRUGO);7 D7 w( z1 Q" E& ~: k
- module_param(ccnt, int, S_IRUGO);
复制代码
# U- }4 r" @. h S- [
2 Z# s' B) a0 K' g' f. R, w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 r& s! \; a2 h' b1 q, U, a5 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 ~. g: z( z; y) {! J/ b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ J+ ^0 X3 B2 F/ c7 j
' U, _& J8 i5 n$ m( N2 O* C1 K G1 g2 h1 Y) Z
|
|