|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 _3 u, W7 e4 ]
- [code]EDMA sample test application
' c# m( [; m: P& Q4 K+ x4 m8 W* k% P - /*
% [2 }+ G S+ h; ^* ~ - * edma_test.c; j) ]2 M. w! I5 K+ x! r% A
- *( s0 \* o4 c* d% f; |5 H a+ f' ^
- * brief EDMA3 Test Application
6 u9 g0 k, N: w( e/ }; i3 D+ O. E - *8 k) `2 _6 `* |: f8 M! l
- * This file contains EDMA3 Test code.
; O w$ g) O+ m! Q p5 w7 f2 F - *
9 O! j" o8 n% [/ L) O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* W7 b' v B. h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; J+ O6 m' t+ z: @
- * TO CHANGE.
3 q8 E/ ~8 b* f9 ^; h - *
: f( `. y6 G& N1 z( \" f5 j" `8 V( X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 O3 M7 @! D6 B2 G1 ^1 Y6 N! I P
- *
J4 @, {* \ p' I) P; r - * This program is free software; you can redistribute it and/or. o* y4 r0 p+ ^# C; L- i$ R4 B
- * modify it under the terms of the GNU General Public License as
/ G. r# t) v& \ - * published by the Free Software Foundation version 2.6 ~$ H% G1 m$ b9 t
- *6 L: O# l2 ~# E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' V, |9 B3 b, M4 P
- * kind, whether express or implied; without even the implied warranty0 b- C& N% x) M$ n% h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 y8 g _' x" G; I* Y$ M5 ?
- * GNU General Public License for more details.5 o R% A. Q- [1 A7 B
- */1 G8 H1 }/ v. u; l6 B
- 2 q2 h- D1 U2 J8 j2 r1 t
- #include <linux/module.h>
2 E, p2 ?2 ?+ ?# `; W, K - #include <linux/init.h>
6 R' {- A4 L+ y; T - #include <linux/errno.h>$ P- N, S3 Z# c! z6 j
- #include <linux/types.h>
( S( h/ d' A) S& t$ m; C5 F/ I& o- X - #include <linux/interrupt.h>
9 {6 m; H% ?5 \5 l/ o2 m' p - #include <asm/io.h>0 E5 Y* |: {1 }( T4 X
- #include <linux/moduleparam.h>
, H8 O4 t0 I. P0 z7 o - #include <linux/sysctl.h>9 o/ v9 W) U0 t4 [; ^
- #include <linux/mm.h>5 ]2 j1 `- P3 }, V
- #include <linux/dma-mapping.h>1 A( @- s" y$ d. A, I; S. z
- 2 E7 u* W$ y- ]! K$ l: Z+ K3 a
- #include <mach/memory.h>
1 d- e7 O2 [' t! n( O w0 A1 s! h - #include <mach/hardware.h>
( V7 n: V4 A5 c: {9 b6 ] - #include <mach/irqs.h>
/ g5 |* i- S3 E( w, ^ - #include <asm/hardware/edma.h>
% F* i% {; V8 Z( a. c - % k9 K2 f/ ^4 {% P- ]
- #undef EDMA3_DEBUG
9 S- G0 l/ d: \, E1 B4 k - /*#define EDMA3_DEBUG*/
r) E V* Q9 f o2 o
& s8 k! a" G- I8 U+ g! l; ]# [, x6 G- #ifdef EDMA3_DEBUG
8 {( N- Z* O$ ?) _& b2 {( k4 v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( Z# F7 k# P! W. T4 d. B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) s- B/ k7 v* B" s3 H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* w! G/ G" Q! d. t# d
- #else
1 S) V+ A% a( Z8 Q# D- O# K3 d# }1 W - #define DMA_PRINTK( x... )
' G% d" l5 p' K! q - #define DMA_FN_IN
5 m3 |' a' W i5 j1 p- z9 f. a - #define DMA_FN_OUT& U$ P r8 `9 y' i+ t; B' l
- #endif
3 i1 N3 }+ T! a3 ^# L! O
: z3 n H- S; M$ r- p- #define MAX_DMA_TRANSFER_IN_BYTES (32768), Q5 u) {% m& H8 S
- #define STATIC_SHIFT 3( F7 V- M; Q; F1 x# a
- #define TCINTEN_SHIFT 20
# o& H: ^/ O0 Q - #define ITCINTEN_SHIFT 21
; ]% m/ i( K, k- O/ B% s* @ - #define TCCHEN_SHIFT 224 b6 e! e5 n0 ~: w$ M' Z7 t% d' y3 u
- #define ITCCHEN_SHIFT 237 b/ Q" I4 ?0 r
6 b' J0 B8 x. |4 y3 b! G% o$ G- static volatile int irqraised1 = 0;' f& \+ ^1 @! S
- static volatile int irqraised2 = 0;% z$ i: r% F) X: {3 D
( I$ t; t/ j% C6 c. U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ]3 X( a* N( s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 K3 x0 | U* T: V y d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 q, k0 C0 e* g& T l2 b7 u
- . a8 u) R0 B8 Q' k+ J! T1 a+ W
- dma_addr_t dmaphyssrc1 = 0;) h, k4 @8 j+ N: w$ W0 O7 T- Z
- dma_addr_t dmaphyssrc2 = 0;" c3 N0 K& ^1 V( w" O S2 l
- dma_addr_t dmaphysdest1 = 0;
) h' Q; z" ^! b$ Z! ^ - dma_addr_t dmaphysdest2 = 0;
% {. }' c% E6 l8 E) g5 n
# ^3 m* W, F( ~) B U* g! e8 L9 S- char *dmabufsrc1 = NULL;% O6 d8 C9 k5 e$ J8 g
- char *dmabufsrc2 = NULL;- }: ^9 u0 o/ F1 U, E) p' r. s2 v# I
- char *dmabufdest1 = NULL;' q* M$ t; }4 @( `& h
- char *dmabufdest2 = NULL; O7 e) P' N+ E2 h$ X3 Q
- ; f! `' _" H, z/ J& l8 t1 ^
- static int acnt = 512;/ y; W: r9 h! ^, A% N( j$ T, M
- static int bcnt = 8;
/ T7 V6 O- P3 p/ } - static int ccnt = 8;
. w$ i. B8 @+ `/ O
: \( t0 b, T, F; `- module_param(acnt, int, S_IRUGO);3 w2 Z, T. ]% L& I$ u2 \
- module_param(bcnt, int, S_IRUGO);! X: }+ h/ G( t( o# B$ U
- module_param(ccnt, int, S_IRUGO);
复制代码
) `5 M4 }8 W4 w; a: V `) a# {6 o6 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! e. q$ |. ~2 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; d; @ l L# Y- V, X" ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 p3 k. L# e! u2 C$ t ]3 M
6 u+ \% Z" h% o. A: q5 a
" n) ^- v3 f! P* e! U! ?; R
|
|