|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( R# o" z. V1 f4 z0 K- |# m: ?5 s- [code]EDMA sample test application' o. H8 A1 G& j" a3 P( @- ~
- /*) f4 w. U: ~# @) @" {) ^' D/ B
- * edma_test.c. Q* B# \3 k$ y3 x. E0 [
- *. ]0 I( ]* o& H( l, b% W6 D
- * brief EDMA3 Test Application
# H9 X' o8 x6 F# {$ l6 V K - *
; L- Z0 `9 ~' E# y) a& o - * This file contains EDMA3 Test code.
- P) M& R3 g. |0 j( l9 a- i1 o# q - *
1 y+ X M7 ^ O& S# ]$ ~7 R2 o. [3 I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 a9 G5 y0 t4 ?' k* n# ~- F! G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- a& p* x8 d2 O8 H - * TO CHANGE.
% q y: y- e3 d7 o; t; \! c* v# W - *; F m1 v9 S! S, \% W+ h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% {5 U$ p0 A6 y5 w1 w, l5 o
- *
- ]. L& C2 i" [( U2 t - * This program is free software; you can redistribute it and/or1 L3 X8 d5 C# n9 J$ [
- * modify it under the terms of the GNU General Public License as
. d; s! {. R9 ?* ^- |$ O - * published by the Free Software Foundation version 2.
+ Y ~& m: \1 F/ u- d - *
q! W. x& @7 b2 ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' h' ^, x: T% p j* s - * kind, whether express or implied; without even the implied warranty( |. `+ B1 V7 h5 G, p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" f: i0 g: s/ G" n8 x9 M
- * GNU General Public License for more details.; C4 L- U- P a+ a
- */
! i' f1 H8 z% M6 @! U3 P - * f+ i* u% L1 T8 B+ j
- #include <linux/module.h>1 X2 f+ Y! c' ^' t: K4 Q
- #include <linux/init.h>/ C9 v% u8 Y9 ~5 b6 J, U2 r
- #include <linux/errno.h>" F, ~/ f g) Z0 Q( v
- #include <linux/types.h>
s2 G, h$ t( o7 B: J5 E - #include <linux/interrupt.h>+ ` B4 W. a# L' ]- J$ E
- #include <asm/io.h>
! D j% z/ J2 [2 d+ C9 n - #include <linux/moduleparam.h>6 T, K' P+ D+ w& P' L
- #include <linux/sysctl.h>
5 d' i& L! I& e u1 W, D. H - #include <linux/mm.h>
/ G% Q. K$ i. {2 _! {+ X' p - #include <linux/dma-mapping.h>4 K9 P( L/ J" h( Q) t0 {
- # H! R- ]! S: Y3 R
- #include <mach/memory.h>
2 B. @5 B X" q I - #include <mach/hardware.h>8 F/ m' L* t: \& @& _3 v5 i% H5 |
- #include <mach/irqs.h>
" x0 V- J- X0 Z4 ?( z - #include <asm/hardware/edma.h>
$ q* e7 K1 }2 S T
' f8 X# C0 F6 L* A- N- #undef EDMA3_DEBUG
' @ O" m9 K$ u - /*#define EDMA3_DEBUG*/7 A& u& ^" T9 n+ L
- # I, _) T* Y- V7 X3 U
- #ifdef EDMA3_DEBUG! @( J, y' }3 C3 t* D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 i9 c7 l3 H4 s4 ?' T5 D- ^ T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' p% ^: {8 C& v; [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( k& q4 t: {: N! C. s
- #else
) p& ?6 {8 R) p& L, P - #define DMA_PRINTK( x... )
# j. a2 T( P2 E8 k- v2 j( z - #define DMA_FN_IN; z! n6 O1 S0 X" A! P4 \3 O
- #define DMA_FN_OUT7 i/ H: w6 q$ Q
- #endif4 j( U0 k! p! l, L. t$ c
6 M, Z9 w" j @: T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 a% t6 [5 j/ S4 l/ w6 `* C - #define STATIC_SHIFT 3
: ]5 p$ V3 ?" N# Y - #define TCINTEN_SHIFT 20
* G; |/ M% K8 U; E* y - #define ITCINTEN_SHIFT 21
% I' m% Y5 X s3 _3 V) f7 i - #define TCCHEN_SHIFT 22* R/ W' n. |* C4 J
- #define ITCCHEN_SHIFT 23
* f1 b8 u8 v( K% |2 t - 5 D Z, [" D# U2 H1 M5 M
- static volatile int irqraised1 = 0;
" g- X' ^! A. }" t6 l6 S1 ]; R - static volatile int irqraised2 = 0;$ o; k$ o/ @. ?& f$ k
- ; r# U. T/ Z" F, u- d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N; O* B) w" K% ~4 d$ a) O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, d0 N9 e/ z% ^0 Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 x" ?; ?& l Q/ a
: L0 n0 ]# O- y* \ u# r, L) E- dma_addr_t dmaphyssrc1 = 0;
0 c! t `' ?! k0 p - dma_addr_t dmaphyssrc2 = 0;
' { n0 H1 I* I- H - dma_addr_t dmaphysdest1 = 0; h( W f7 K* A
- dma_addr_t dmaphysdest2 = 0;1 X; r, v) `" d' _$ N
9 u5 g4 Y/ i. @. n# `- char *dmabufsrc1 = NULL;
& y- M& \$ L! R" p6 ~& T - char *dmabufsrc2 = NULL;
1 w; S) ?2 S* p - char *dmabufdest1 = NULL;" ~ c7 Z( j2 o; t
- char *dmabufdest2 = NULL;& E7 i" S3 o; [3 b7 Z. y
+ |) y7 J$ @: \8 H, A- static int acnt = 512;6 F) E" `0 D0 Z2 d9 W
- static int bcnt = 8;
) [! g5 |& D/ n0 x) g& R+ ~ @ - static int ccnt = 8;
. i t% a* Q: Z1 D! v - 9 r( {1 P5 O; g! _4 _9 Y" x
- module_param(acnt, int, S_IRUGO);
* A7 C- E6 v/ p! a+ W - module_param(bcnt, int, S_IRUGO);
3 O& ]/ I9 p$ x# N1 |9 ` - module_param(ccnt, int, S_IRUGO);
复制代码 # C! [/ {: ]: T4 Y1 N. x. P
1 C2 o3 ~7 I- o0 ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 ~$ M- w% P! xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 v4 {# x& X# c! | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 |: I, w% z. g1 V4 P
4 f1 ~" T5 }, _$ B: e! T5 V C/ A* e: S+ [* }/ k& Q* Q, `
|
|