|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , I) \( y/ ~( m9 U# d; h& B# K
- [code]EDMA sample test application8 K* K- U" |) D
- /*. U, B3 E0 _" b
- * edma_test.c
; N, u! J% m3 {1 U3 E! C - *
' \! a4 L' w! w) v8 j2 C! u - * brief EDMA3 Test Application( y+ ]) f, e9 N8 r0 U+ [
- *
$ N# u2 T7 k6 O+ O3 C; r - * This file contains EDMA3 Test code.+ r/ J: d3 `2 t3 a) o# ~
- *6 x9 j' c% X% @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" _2 p0 b; C& z5 C- Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 I/ x! r* i2 d' S$ o
- * TO CHANGE.
( Y" H5 M: a/ I/ F, r) o - * P! J# d$ A s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 y! X; K, t7 B2 g - ** f3 B. U! t$ d2 T( M
- * This program is free software; you can redistribute it and/or
, {! y/ U) A$ G" Z I# D: ^ - * modify it under the terms of the GNU General Public License as: ?( y. v4 [1 X& l' d: C; e- ]
- * published by the Free Software Foundation version 2.+ |' w8 v. z5 r# i4 m7 B" L8 o
- *
( e _- M& ^3 N) |1 p* Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. Q9 t7 _3 J% {: l) p, V, X k' t
- * kind, whether express or implied; without even the implied warranty [7 V' S& a! N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ D: q& ^. T/ Q$ M - * GNU General Public License for more details.
7 X! D" q- T d# `' V6 l - */4 p2 V/ }1 x- u! G6 h) W
- D; |) H- f0 L* ^2 L# d# j) P
- #include <linux/module.h>8 \8 |' I$ I8 l, F/ q6 l. A
- #include <linux/init.h>
7 H* }# n. b& _5 X% F - #include <linux/errno.h>
. a* l; i# I. k3 Z: | f* f - #include <linux/types.h>
+ m, v5 g" L D4 P' r' q - #include <linux/interrupt.h>4 O. o7 T! P6 n# K+ S; T
- #include <asm/io.h>0 h# }. a1 h( R* P+ ^- G
- #include <linux/moduleparam.h>
% ?) B- ~7 E, x2 J0 J$ Q0 c - #include <linux/sysctl.h>
; Q7 Q1 ?9 I# N7 o/ C - #include <linux/mm.h>/ z7 J5 k5 K7 q8 m1 _: k$ P
- #include <linux/dma-mapping.h>8 G/ f) k0 J1 d' ^! G
6 L3 R' w) d! Y3 h$ A9 b% \- #include <mach/memory.h>
' y. `* F) p$ B8 Q! a2 o - #include <mach/hardware.h>+ M4 r' g4 h% l
- #include <mach/irqs.h>
$ @, x& r! f% F( L - #include <asm/hardware/edma.h>
( `2 z- D, d$ Y0 m, P, J+ o. y
4 L+ c$ k) G! c- #undef EDMA3_DEBUG
0 P1 E( q4 Q# D. G, j - /*#define EDMA3_DEBUG*/
. }# P) N: ~( D T9 w8 V( r, n4 Q
' K' y+ z0 z# m& Z _5 e, o& x- #ifdef EDMA3_DEBUG
. Z( z6 a& e+ d( }0 F$ G) F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( a9 z( {* W* d. c' D0 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! z$ V9 A& b% s( h( d( J7 i$ S, t6 W# S9 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 o2 y( h3 i9 X- W! E/ L0 B5 N. D
- #else# t, g2 `9 Z; v. M6 O
- #define DMA_PRINTK( x... )' w4 k8 u' Q" A8 J1 u# ^9 |
- #define DMA_FN_IN7 i9 r+ m- G. Z
- #define DMA_FN_OUT
2 s9 Q1 G4 l I9 b( L6 e - #endif
% n6 r2 c* I: n9 h* s0 g1 k - * H. N( w0 i0 ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 d: h- ~' u& r+ F0 e& c4 ^
- #define STATIC_SHIFT 37 B9 \- H% ?4 _
- #define TCINTEN_SHIFT 20
* z. I# L; Y* q9 K, Y - #define ITCINTEN_SHIFT 21
0 d* F6 f' h3 d3 n$ N, Q - #define TCCHEN_SHIFT 22
" W x2 T2 q; Q1 U4 d& Q) D L2 h - #define ITCCHEN_SHIFT 23
6 D4 C% W4 \ T& ?+ O. e
# s. P; [- `( J, f3 K% T- static volatile int irqraised1 = 0;
+ m! y- G% |3 K. K$ I" k% z - static volatile int irqraised2 = 0;
% |2 G& W7 `2 i5 P D - " O, N' E1 ^$ M& X% R; J3 {# C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
]4 f l d$ @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 I- Z9 c4 p- B& D3 X* l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- X! {7 K. [+ H - 8 F* C1 n. a$ p/ e$ f, a+ g
- dma_addr_t dmaphyssrc1 = 0;$ r3 X, J' @* u& O' b& E [
- dma_addr_t dmaphyssrc2 = 0;
, E/ {4 [" T5 ^9 V - dma_addr_t dmaphysdest1 = 0;4 C! `1 B) P. P0 I' y& J
- dma_addr_t dmaphysdest2 = 0;
4 G7 i- @# w" @0 H& [( y
& }- H4 {$ I# }- char *dmabufsrc1 = NULL;6 e# s7 s4 M, H8 c4 N0 U
- char *dmabufsrc2 = NULL;/ ~ f, [1 a% o! \% A
- char *dmabufdest1 = NULL;* M# D' r" q% X W. C- }7 @
- char *dmabufdest2 = NULL;
/ U% |) P) n+ S9 ^/ C( k$ Z" o
9 `: f% x5 I4 x. ~- static int acnt = 512;6 O$ ^6 p1 g; A: v3 S8 b3 ]
- static int bcnt = 8;, T& U" H0 t- _3 [- `
- static int ccnt = 8;
N5 n1 q0 q' g9 V, }. f3 U1 n - 8 b4 k: v( A7 I( a0 _0 Z m
- module_param(acnt, int, S_IRUGO);3 s* A1 q; }3 x O# g
- module_param(bcnt, int, S_IRUGO);. O6 n/ e8 b6 ?8 c
- module_param(ccnt, int, S_IRUGO);
复制代码
4 y# ^3 ?" d! Z- q/ D1 W% [
* C, W! P7 |0 O( L3 E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ t% Z/ @* N' ?9 g$ Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: ^& B o: U# s# v! H5 @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 w" M [$ g. f* M+ @/ @# m5 s# g* K4 c! n3 [7 Q
, s& D) q1 i) G# b
|
|