|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. V, O4 w8 \8 B9 F& H9 `0 s8 ]- [code]EDMA sample test application' w' q' {% T$ e' R% X P
- /*
( H7 B2 c/ h; w3 ], A+ Y h - * edma_test.c4 @9 T' U' m+ l) S7 o* |2 X
- *
; f% T" w1 }: @/ n% n& p3 m - * brief EDMA3 Test Application
# t/ y9 G( o# j5 f5 T - *+ C, V1 B! L5 [; j& w8 A1 }0 a- \
- * This file contains EDMA3 Test code./ o$ Z% r# U1 l v+ K: h* ^
- *
, u7 p1 d7 D/ O+ t2 g N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE o9 t* h; h5 r. j& V) p! b! k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ Y0 c9 x4 Z2 B& b1 D. ~
- * TO CHANGE.
1 f/ g% ~3 I3 K0 m0 r: n - *
. c, W" Q8 c* M* v1 J3 |: v1 w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 m6 D! \! X6 d, k9 N0 R
- *
; T6 B- M- x! ~% V0 O, L! | - * This program is free software; you can redistribute it and/or0 P$ \: ^" N: A& Q1 e; s
- * modify it under the terms of the GNU General Public License as
2 H9 {6 c" g# C) A. c+ }- e% { - * published by the Free Software Foundation version 2.9 j2 o: u. y9 L% @9 t, n: B
- *! ?' u; U& B5 w5 A' S* P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ q6 R$ h2 N) _6 \+ Q$ R# t - * kind, whether express or implied; without even the implied warranty
- v4 j' q0 c0 X0 X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! d# E; j V4 E7 E2 N1 {* Z
- * GNU General Public License for more details.
9 y+ U1 D" y- Z; E - */$ w6 M& E7 b* w. [
- & m; Z9 Z v( ~* i8 j& A; T
- #include <linux/module.h>& K2 R1 {/ r; p" I% J
- #include <linux/init.h>- M( M9 P/ k; {4 j+ S: d' Z
- #include <linux/errno.h>
" C( z/ {( A5 z3 @ - #include <linux/types.h>
) b/ B, h' f1 s$ l( o) c) m - #include <linux/interrupt.h>. h y0 p- J- O8 U2 Q0 y9 {! E
- #include <asm/io.h>
: h+ v- I; Q5 y2 k% E/ c9 i0 ` - #include <linux/moduleparam.h>
3 l5 S: v0 Z# x6 V! W1 X - #include <linux/sysctl.h>1 I2 K8 Z8 A3 W# w( q
- #include <linux/mm.h>+ r& ?( U( H; B+ @0 w8 Z, H* M& d
- #include <linux/dma-mapping.h>
3 [- I: c. a8 E# E - 8 q U' Y/ F" r3 a% o7 \5 s
- #include <mach/memory.h>
/ _ B$ i$ G: V - #include <mach/hardware.h>
# U+ ?$ L& V; }) r - #include <mach/irqs.h>
# I+ @4 {4 G$ \5 M* Y - #include <asm/hardware/edma.h>" ]( G/ i7 ^- l- P+ B0 @# v
- ! \- V- k" f L1 `6 e) c
- #undef EDMA3_DEBUG
6 U9 `3 N r0 h; I5 c; e - /*#define EDMA3_DEBUG*/
/ J, n$ c' o) I: z
+ I+ q1 I# M, T- #ifdef EDMA3_DEBUG( C; c/ z! q/ o, p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 C6 B9 ~4 s; K% D# k0 o% G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) D9 X% t* h# I) t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
k, @. T' {& N$ i9 \. F - #else
( h3 O/ B8 M4 |% g; T - #define DMA_PRINTK( x... )
; t9 L+ \+ o& q& u - #define DMA_FN_IN! Y4 y& D% D9 @' R3 k
- #define DMA_FN_OUT
" y5 t# S: s; V7 N4 J! Y - #endif
& N7 B0 A/ O9 e% B& P$ x/ n - 1 `) T, n5 I5 }8 F" L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% [! s5 l3 w# @: r8 [! x
- #define STATIC_SHIFT 3
$ Y& u) L4 A* t' A6 K - #define TCINTEN_SHIFT 20
" h; `8 K) K- K, w7 i1 s - #define ITCINTEN_SHIFT 21
' L3 ~. e u u2 l - #define TCCHEN_SHIFT 22/ D4 n% m/ b% w$ R. u, X
- #define ITCCHEN_SHIFT 23
( x! S: l+ N! m- n: k0 p$ N5 E - ) P$ M9 \% v$ b( N Q" ~4 {# ?
- static volatile int irqraised1 = 0;+ C1 [+ b# X. @- j& \2 b5 m' R
- static volatile int irqraised2 = 0;
$ {+ K8 K; t: d: { - - H5 A' u' m0 ^; J8 _* m; w' R3 R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 R- E1 b. e! a0 r7 G# {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 R; }7 M! b6 g5 Z) m% t6 I% A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- }8 @) ?7 l7 e7 N
. v5 Y" E6 y& e- dma_addr_t dmaphyssrc1 = 0; R2 I5 L2 v( l6 a3 Q5 \' c
- dma_addr_t dmaphyssrc2 = 0;3 B4 k( W! ~8 y2 i
- dma_addr_t dmaphysdest1 = 0;5 K' \8 t Z2 a2 v/ F0 F+ A
- dma_addr_t dmaphysdest2 = 0;
1 y* L4 S" X [* s, G - + Z, [ } B; A( y/ X/ t6 G
- char *dmabufsrc1 = NULL;1 A" e# h0 U7 h2 g9 Y) G
- char *dmabufsrc2 = NULL;
, N$ q/ i' I) U7 p! G: m4 X - char *dmabufdest1 = NULL;* D9 u6 D+ m; y$ I, g; U% n
- char *dmabufdest2 = NULL;- \) N1 c$ D& X8 q' k8 N
- , Z- ?. F' n( J0 U$ s
- static int acnt = 512;5 @& @* U, ^& D. U3 i
- static int bcnt = 8;2 ] ~+ ]" {, }& _& T
- static int ccnt = 8;
$ s% S a+ k5 z4 k$ ]; F# o - : j) V9 K! i2 o4 Q) k7 u1 m- ]' `" M
- module_param(acnt, int, S_IRUGO);
" `& Y! |4 g0 k/ j4 @ - module_param(bcnt, int, S_IRUGO);
8 j9 \4 q B5 d& _- c8 U - module_param(ccnt, int, S_IRUGO);
复制代码
) B; T' I1 m" P( a' i# a( J3 ~5 }: w5 }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, N& v0 ]; a9 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( Y! K% J7 G a# F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& R9 \; Q% f9 b2 b. V% i
* s, q8 V1 s) Q( a8 [6 t/ ^) ~# R7 @! `2 z. ^) y
|
|