|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' M' V7 K6 w( s4 X8 U% B
- [code]EDMA sample test application* z. q8 K' L7 B# n- J# H( Z
- /*/ ~6 H ]4 O2 }! _
- * edma_test.c! ?+ D# n6 F+ c5 o: {2 C" D
- *5 _8 H/ i S: W
- * brief EDMA3 Test Application
+ k" f. o* k w, |/ b8 G" {3 A - *
7 {# S( ?8 H% k6 ^: ~. ^8 `. C - * This file contains EDMA3 Test code.
5 O: k | a/ e5 F( r7 Q - *
; k7 Y) r7 V/ _# C. B7 k1 \0 h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 ?. |' Z* G$ p0 p: ]" F( M. W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 R P$ o: |9 _6 _5 S0 S - * TO CHANGE.
9 x1 R' x5 S9 g) c3 l: Q - *
3 b8 e: E$ r4 E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
}: s& l$ u0 ?0 B" B1 u6 K X - *) K) D/ j ~9 ~7 B$ P: }- H5 Y9 _
- * This program is free software; you can redistribute it and/or/ |0 `; W1 t; P1 H3 q* Q
- * modify it under the terms of the GNU General Public License as
5 x. M; v7 O* K9 _8 B" q - * published by the Free Software Foundation version 2.( D" H- a$ {( F$ D( V/ l: T1 c
- * ~& v u" ]! f* t9 F7 |! ^" b0 `$ b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 _- w# Z. S/ Y4 I - * kind, whether express or implied; without even the implied warranty
; ?# F4 }& z' p, d+ w3 A& Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 w1 q6 T( K/ } {7 y+ ?7 I - * GNU General Public License for more details.' q3 f; q. k* i# ?' e
- */
6 A0 Y8 l/ I5 W) F0 K2 O
7 n* Z$ a; `% B, [1 Z# X- #include <linux/module.h>) C! _. G* v2 b3 D; }6 `
- #include <linux/init.h>
: L5 l9 ^1 |5 r/ b$ B1 m+ b - #include <linux/errno.h>
0 m# e& E) |7 f) K5 x - #include <linux/types.h>
3 S6 N& l/ e* u! P% J' m3 A - #include <linux/interrupt.h>4 w+ _& B5 h- N% W% f1 d
- #include <asm/io.h>
4 Y& [) \' g7 K) H% c - #include <linux/moduleparam.h>
% J8 {5 `* D3 C! Z- n - #include <linux/sysctl.h>, P4 F7 s( Y k2 E$ C
- #include <linux/mm.h>7 p C, V! y9 I. f& r
- #include <linux/dma-mapping.h>
# }) t" c! l L9 I# W. U - ' \5 Y$ N3 E2 {/ F. Q. i2 U
- #include <mach/memory.h>
; _; A8 y+ F9 r0 c5 F5 n - #include <mach/hardware.h>
3 [: v7 }$ A( V/ g8 C - #include <mach/irqs.h> f' S0 m3 U9 r+ f
- #include <asm/hardware/edma.h>3 n) q# }9 O7 u A& Z5 j. i4 p
% u: b" W2 v% `1 M" }5 n1 R- #undef EDMA3_DEBUG
$ h- \3 P1 A# j) p4 X7 a( ^) ?. F - /*#define EDMA3_DEBUG*/5 V& C+ o5 N% ]
: u7 k; Q- t7 T; [- H, r4 Y3 g- #ifdef EDMA3_DEBUG; P/ J( j+ P, i; A; m, Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 g' Q$ c/ Z( k1 p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 y" p" j& Y% @! E5 |0 T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), o' r' g7 }$ B( R
- #else
' f! f* e# v; P4 `3 w+ S) z2 J - #define DMA_PRINTK( x... )
% H5 G1 z, F/ z- r8 U& B! p - #define DMA_FN_IN- R# r8 q2 A- ?) ]8 Y; }! Y, o: i5 B
- #define DMA_FN_OUT
- a% W, _% x# u6 H, T7 G5 Q9 U - #endif+ ? Z6 m- f9 m6 _: x
" T' Q9 I h. ?- a, {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! ^; | n$ s+ i m
- #define STATIC_SHIFT 3$ i% P9 `# x+ O, K; l% R) j
- #define TCINTEN_SHIFT 203 y. w% Z/ L' b$ S; v: g
- #define ITCINTEN_SHIFT 21
1 w! s* \. M/ y5 V( j: v - #define TCCHEN_SHIFT 22" s5 R% l+ b/ h L/ w' J6 D" k. T8 a
- #define ITCCHEN_SHIFT 23
* k: p2 l) ]$ H/ v% X5 ^4 ]
9 u- x F' c6 V6 r9 v, }* V) b$ `1 M- static volatile int irqraised1 = 0;
" H6 Z8 \' ~% b, n - static volatile int irqraised2 = 0;/ u) _0 n$ p2 G7 f
. c! z: U7 G2 m* f/ D8 \4 `- b# W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! E$ f" Z' e2 V9 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- E2 \2 h ^1 B4 M; [) A& ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# v) }2 Y: Y0 K4 Q5 R9 a
- 1 \% F( h0 Q0 a0 T$ u3 x* H
- dma_addr_t dmaphyssrc1 = 0;$ m7 F4 g8 d: o3 D
- dma_addr_t dmaphyssrc2 = 0;& l& A4 [$ L# x0 [
- dma_addr_t dmaphysdest1 = 0;+ R* G: m# J0 o# s' U X
- dma_addr_t dmaphysdest2 = 0;
2 ^5 ~2 Z7 y' u4 d; e
# U, Y9 C* X' o/ h* r6 m- char *dmabufsrc1 = NULL;/ S: X$ C a0 Q4 x) E6 h
- char *dmabufsrc2 = NULL;
0 }0 v! s- v8 \8 Y+ t k! ? - char *dmabufdest1 = NULL; k/ K4 x) b5 g2 e& Y
- char *dmabufdest2 = NULL;1 E' }8 `$ t' g: N8 ~
- 5 `7 j9 A- x8 T% m
- static int acnt = 512;
& q; s, @* o+ Y# `8 L' T - static int bcnt = 8;' |) Y0 t3 s: C8 E( s7 @$ U
- static int ccnt = 8;
" [* e, _2 [7 p( k4 M - . A' f' N3 Q1 W; j9 T- K
- module_param(acnt, int, S_IRUGO);
( R% I q% o4 e/ Y! z - module_param(bcnt, int, S_IRUGO);& ? _8 m9 I ~: {8 @9 o& V
- module_param(ccnt, int, S_IRUGO);
复制代码
/ F" q: X0 ~0 r1 {4 }& X
. O7 i9 Y, h; q9 z9 R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 y/ ~8 _+ d" c/ M# ]; R/ Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# _" P. g* S$ q- N$ H$ R' A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: h6 r6 q1 O1 P! R3 ]/ t1 p8 D, F# T7 ^/ v/ a. m
5 |# T, X' D- }5 u1 i. l |
|