|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ t& F% C5 X2 Y6 U" n8 V; n& x- [code]EDMA sample test application1 i" s' O) n7 K! l3 s0 ^
- /*
7 l m$ |" F: t* x: X! {; N1 M - * edma_test.c8 O3 Z% X9 }6 k# `. ]% Z5 E: m
- *
; u; A& T" q: e4 c, ? - * brief EDMA3 Test Application
, P1 h) w" O5 X4 v3 j1 `' y" Q - *
9 q: d' ]( _1 w1 ` j' @/ m. T. T6 ? - * This file contains EDMA3 Test code.
0 P, T5 J: n' f" b - *3 Q6 P' P, `5 X2 e1 t7 O8 z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' K# \) c3 N1 }! _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 Q; d$ e3 @- P; W) Q - * TO CHANGE.
& B+ R* ~ b5 I1 }" _* k - *
; W6 u. \% I. X& g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) M0 t* N$ t( q1 m& p
- *
, y) m# e' u$ v0 W& w" ? - * This program is free software; you can redistribute it and/or5 o4 G8 F+ ^+ l( v+ b& h
- * modify it under the terms of the GNU General Public License as' T# I ?3 [4 o2 b+ S, S
- * published by the Free Software Foundation version 2. B1 G% a! \2 R4 t1 ^6 a v
- *
% y/ P n4 D$ G# b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ X) ?% S2 z4 V% }( ]. a6 y' w - * kind, whether express or implied; without even the implied warranty+ a" {) B n0 B) w; Y! Y9 [& Y ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ M+ |% K2 x) D" k( ?
- * GNU General Public License for more details.
: Y# }& Y9 B- Z/ I, k) o8 c - */ x5 t2 e8 m0 k ?
# W0 f0 Y; H! O) d- #include <linux/module.h>7 d; s: z$ p; x$ k$ z
- #include <linux/init.h>
0 A: P8 d3 b6 c* s& P+ m - #include <linux/errno.h>
2 a; T B4 y3 L0 x/ } - #include <linux/types.h>
' d$ ~# h# z6 d, ]; l8 G0 { - #include <linux/interrupt.h>; z, Z' V) c/ s# _8 E$ z
- #include <asm/io.h>
8 t2 [. T% `" K2 Q9 m' M# r - #include <linux/moduleparam.h>
. C8 e' N: ~& v1 O" J& S - #include <linux/sysctl.h>
7 \0 R+ `) u! u! } - #include <linux/mm.h>- _3 W1 r" S" g; @9 {1 ]
- #include <linux/dma-mapping.h>
( ~: m* v$ G, u( O: J) O - ) B( E! X6 H% W8 Q
- #include <mach/memory.h>
2 p3 q3 R# e2 z - #include <mach/hardware.h>
- t8 t+ Z" N5 r* N* `, w. I - #include <mach/irqs.h>, }7 [* K- `7 e+ c! ]
- #include <asm/hardware/edma.h>
9 y. A3 I4 q' Z5 }. Y
P4 {' i" d% t) t9 ]5 u- G- #undef EDMA3_DEBUG" u( }. Q1 D+ ^8 l- S1 Q0 d' U
- /*#define EDMA3_DEBUG*/5 Z4 W- W# C e5 a! J$ n7 Q
- ( }9 f, y) e3 x7 G. x9 y: a% |
- #ifdef EDMA3_DEBUG
, X/ w4 T1 }$ q4 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ D: V7 Z ]9 ]8 v' x$ Q. K; X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, l/ b# I& f7 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& u1 ?/ s' D1 b6 {
- #else
; o! ~! H* V: |6 v8 l# G7 w8 Y# l - #define DMA_PRINTK( x... )8 \$ ~' Z2 Q3 Q4 p2 E, s, U
- #define DMA_FN_IN5 _9 B: o) S, D% T
- #define DMA_FN_OUT+ f* N$ B# N! Y6 }& [( C
- #endif
& g! C! s' B% b$ g - 2 j; B* H: |, W z+ [1 e- Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# R2 w* m1 @ y+ ?& ^
- #define STATIC_SHIFT 3
7 b8 u* q( P5 Z$ V; \* Q, f7 v8 A5 ? - #define TCINTEN_SHIFT 20
* w$ ?, i7 O; r7 L& V' s3 ~ - #define ITCINTEN_SHIFT 21( D: g7 ]7 {2 Y6 [$ A0 H7 y
- #define TCCHEN_SHIFT 224 o8 T* j; \1 f2 f* v6 [6 t6 C
- #define ITCCHEN_SHIFT 23
' f3 n3 E. V" d- M. ~ - . H U7 T& D; |
- static volatile int irqraised1 = 0;
& K8 A, ^- M2 M5 I3 _) u! H - static volatile int irqraised2 = 0;* p* v7 t* x6 t+ j+ F- [* o
7 u9 z* `1 Z6 d9 T) c! V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. _& A- O7 z2 Y+ H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' k8 k# Z$ f) f% \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ }' P1 E2 |4 b' Z ]5 A) E* E: P - ) b8 D% L6 u5 D3 b. J# A. S( @
- dma_addr_t dmaphyssrc1 = 0;! C# x' e- K) ~0 a: s% Y4 i
- dma_addr_t dmaphyssrc2 = 0;. ]; i& k7 A8 r1 q
- dma_addr_t dmaphysdest1 = 0;* K: ]' f' z) w* V) d! ?1 f; [0 o
- dma_addr_t dmaphysdest2 = 0;1 Z: N3 D5 q' E4 o7 {; Q. H1 ^
- , Q9 D8 b4 `, i9 h, C
- char *dmabufsrc1 = NULL;' w1 v. G9 |2 Z, b
- char *dmabufsrc2 = NULL;' I7 ?" k! v; R# {/ T
- char *dmabufdest1 = NULL;& L- b8 ~' y2 ^
- char *dmabufdest2 = NULL;
" W/ a8 ~7 f* @7 T7 W M* x) K
4 D0 U1 u0 U. v9 g2 }' z' v6 ~- static int acnt = 512;7 E9 y; h0 {- y! B7 T
- static int bcnt = 8;
0 T! i' C3 @( r' c- @2 o7 F - static int ccnt = 8;
6 i; V% ~( ^; }" G6 e/ j% }9 \5 r - - g/ T' b3 v8 @" w- n
- module_param(acnt, int, S_IRUGO);# [7 N& k4 N6 \* W5 W% d
- module_param(bcnt, int, S_IRUGO);
& T% C0 }% a% u0 G s. ` - module_param(ccnt, int, S_IRUGO);
复制代码
* N% n8 M. a, h" b! ~
. `: Q' T1 g/ J( }& p+ ^! q- n/ j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ~) ]1 [) V) f% A2 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 G0 C$ r |- N7 `2 _% z* q$ A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 _% V, H r. M% p. l+ r# F% }
# q% P8 m+ y5 O( e' _, h
8 \9 O8 r+ B% D% s Q |
|