|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # S" |3 R3 U/ U7 z# k
- [code]EDMA sample test application
. {( l" @) O0 u, {. h& K9 t - /*- b' j# w" D4 l3 ]0 \" D; `' H6 `, ]0 N
- * edma_test.c
$ }% Z$ x+ u$ q - *
& L7 l0 \/ a; ]8 D, w - * brief EDMA3 Test Application3 h' s' x& @' r, |; H" x
- *8 @ k2 }7 M O
- * This file contains EDMA3 Test code.
; T0 H: G" W0 r- } - *
" Y" k! w+ \ I+ ^, X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' R1 i0 k$ u% Q. q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT r7 X- E6 t, g1 u1 R, O
- * TO CHANGE.) p8 y# X2 t% w9 ? v
- *
& E5 H1 X5 m$ `2 U. b6 T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ D: X8 n0 I2 z% f1 [ H# Z4 P - *
" {3 j2 z P* a0 F - * This program is free software; you can redistribute it and/or
- ~/ Z J$ K1 u3 K - * modify it under the terms of the GNU General Public License as
4 ~7 U) Q S6 m# ?$ ?) ~ - * published by the Free Software Foundation version 2.
5 V- ` F; m7 p3 T1 ?9 O& o( i - *. B2 T8 n3 M7 W* d" V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 R0 G& T% p8 @8 P - * kind, whether express or implied; without even the implied warranty
$ o; w; _% e! v) E) H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, U5 j1 {$ B# K
- * GNU General Public License for more details.
8 [8 f+ @' c4 U) Z" F* D- X4 Z9 l - */2 V8 R% T$ h( @4 Q6 v; W. H' X
- 7 Z0 g4 Y: S3 f! V( e9 K. e' i
- #include <linux/module.h>
6 N: h. K/ b m6 I& w: d( o$ n - #include <linux/init.h>
5 r9 l' H t' E( `$ a! L" T' v - #include <linux/errno.h>
, e4 z0 `: d9 G0 h7 G - #include <linux/types.h>
- y; L$ M) [! M- i" S - #include <linux/interrupt.h>
, c9 t1 a: Q! s2 d, A5 y - #include <asm/io.h>
6 k9 W9 d0 B7 B+ p! K. e - #include <linux/moduleparam.h>
/ J. X. f& S! Y1 Z G% C4 G- ~6 c' T: T - #include <linux/sysctl.h>
4 t. p& L: E) X R) A - #include <linux/mm.h>
. U# ~2 `6 {$ c- x4 m - #include <linux/dma-mapping.h>
: q) P; t9 p; j% A* Z# O6 t e - U, h) E/ x8 b/ t
- #include <mach/memory.h>
5 s. r) U0 l# W# s - #include <mach/hardware.h>/ c: a; ]) v6 T$ Y8 M8 w3 L- i" L
- #include <mach/irqs.h>, a: Z, q! i# P5 ?' T8 I% w
- #include <asm/hardware/edma.h>, }$ J1 V$ R' Q+ A5 i0 M
6 [* t% d, f5 @7 B/ U- #undef EDMA3_DEBUG
5 j7 J d! O1 P N/ s0 q - /*#define EDMA3_DEBUG*/; K2 {; _9 O6 u( S8 `
4 ]$ {5 m; @. Q* b2 K1 B) @2 h1 I- #ifdef EDMA3_DEBUG2 u0 h% N6 m) K( e. E! [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 u" r* V3 R2 D; O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): G) |# }! k, f; ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 R" @! Q) X! w* S
- #else
# {3 k0 K0 ^: V% g+ H) w; w- \ - #define DMA_PRINTK( x... )+ ~0 g0 y! [" e3 l! K
- #define DMA_FN_IN
# F r1 ~2 f9 p- O1 G/ a6 D2 g - #define DMA_FN_OUT; [! L3 g/ @1 j- h+ }2 p
- #endif6 H# x' x8 N1 I4 ^, q" X
- - }& h, q5 b5 S2 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 p) X& y+ t0 ]! f; ?& @5 @ - #define STATIC_SHIFT 3. h0 k# b' z! p& D( T- p; m
- #define TCINTEN_SHIFT 20
) G. ?& F3 i1 ^/ ?6 i' n - #define ITCINTEN_SHIFT 212 J6 X- ~* G8 X N6 Y4 |" ^3 R
- #define TCCHEN_SHIFT 22
8 g$ y& D3 }9 f8 [4 l* a - #define ITCCHEN_SHIFT 23: \, E R9 B( i' e
5 W7 I9 ^$ N: z- static volatile int irqraised1 = 0;
" j2 X* N+ i( A' |/ y! O# a- J - static volatile int irqraised2 = 0;
5 U$ f9 F' Y8 s5 \; ^% D
* i5 l1 }! ]3 ?8 D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' K+ v: K- @& J1 a- i# ~/ b$ {6 P6 K8 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ~3 ~- C! P' S1 X( ~ z: P* Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 i* T X) o) X* o0 P
& k# D* O, g) U( H- dma_addr_t dmaphyssrc1 = 0;) F; t$ E/ u7 x& V! m5 P
- dma_addr_t dmaphyssrc2 = 0;
6 g+ ?5 `4 e7 p3 f - dma_addr_t dmaphysdest1 = 0;3 ?& {. G$ p7 u, i
- dma_addr_t dmaphysdest2 = 0;
% s" @7 u2 F6 r2 p& d - + [, ?1 `) ?5 H* V. I; r
- char *dmabufsrc1 = NULL;
" w3 @: c& s4 h0 S$ M- \- O - char *dmabufsrc2 = NULL;! t; t3 C9 V2 z6 B$ m
- char *dmabufdest1 = NULL;) V" V$ M, I; Y! C7 Z% N3 B1 d. R5 e
- char *dmabufdest2 = NULL;. \% V7 J. |1 l# _6 j% Q% v
- $ m m2 }; Z' t# y7 k
- static int acnt = 512;! q0 Y2 r7 ^8 v# B
- static int bcnt = 8;
4 y: V+ T V$ z% B" u$ m+ b2 y - static int ccnt = 8;; @9 n) J# z i! c0 O/ `* d
- - T' _' C4 ~2 L. a$ L* t O0 H
- module_param(acnt, int, S_IRUGO);+ o; M% w' N8 r, V/ e( l$ e- @
- module_param(bcnt, int, S_IRUGO);
4 m+ y& g) S9 Z$ B1 Y - module_param(ccnt, int, S_IRUGO);
复制代码
. e; z3 t7 J& A i# D8 J8 v# e6 H+ d0 D, d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, R H; U1 H" p* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* ^3 ]! l O+ d9 @+ F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ b z) q H: J
, l4 K, J" B" P u
5 o. f. `$ b" T& b2 L+ ` |
|