|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) E Y7 n8 Z9 R5 Q+ N4 |$ E# k
- [code]EDMA sample test application
8 R# g4 B8 a. e5 h - /*- P" [% P8 ?8 Y8 {. b( \
- * edma_test.c4 r3 |& U9 u# G+ K
- *, R" J3 e8 h0 v3 d
- * brief EDMA3 Test Application
" c, I3 a9 L2 [- D$ S: C" k) c0 D - *
9 `; f3 x- R. M4 ~ - * This file contains EDMA3 Test code.( W ]( A- N" f' l5 G$ @" n- }
- *# t. m$ F! c) s3 O5 \: h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: b% a, H& g5 H$ X$ K7 `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, q6 i4 w) c+ f9 \! { - * TO CHANGE.
" R# R& [. E* }2 [* }5 i" q - *) p% T. B( v( \, S5 |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 D$ I. c2 p! o/ D
- *% {# R& ?5 F7 h6 _# G1 Z
- * This program is free software; you can redistribute it and/or. H* a, T' e# B
- * modify it under the terms of the GNU General Public License as7 h( A( Q5 }' J% {. i
- * published by the Free Software Foundation version 2.
3 Z0 r% ~! a0 o% o5 u R- S - *1 {4 S" T5 g* C- q5 A% v, L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 |' O/ M+ k# x4 ?; K - * kind, whether express or implied; without even the implied warranty. w o# E# L7 ^ u h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 y5 K! A5 {# m* c+ H/ h
- * GNU General Public License for more details.9 ~4 v4 t- W) M6 v! E0 ^
- */
2 I3 c3 f+ D& ?9 u
8 O+ f$ q3 l u/ c, J& p" {. y; f- #include <linux/module.h>2 e# M4 V3 Y4 R* R3 c
- #include <linux/init.h>6 v% ?/ F( W. ?) k4 {
- #include <linux/errno.h>
/ j3 h% {% B1 [ - #include <linux/types.h>
$ u8 p1 y2 b6 O& I2 c$ q( i* z - #include <linux/interrupt.h>
9 G& z# K, k# x% [( I2 X: E - #include <asm/io.h>
8 z% P O1 L. D2 v; F1 M- Q% g7 e - #include <linux/moduleparam.h>/ T+ e+ C. q: `& a V+ y
- #include <linux/sysctl.h>
* F3 f( I* e. E+ t) L - #include <linux/mm.h>
( [+ C! L; _+ b) f/ }. b; i - #include <linux/dma-mapping.h>- ]4 a8 s7 Z# c6 J
" u! j6 w7 x( H) u. c- #include <mach/memory.h>
5 u2 @0 P2 N. }# ~$ E - #include <mach/hardware.h>% x- F6 T& w6 H$ J0 e0 V% _# _
- #include <mach/irqs.h>& }" h) e! q! U2 n5 R% r+ K- S
- #include <asm/hardware/edma.h>' `" B m0 M% c7 P9 n
% s" d+ M2 }2 q: [- #undef EDMA3_DEBUG
7 H5 z) u1 m& F& h5 r* N4 `2 s) C. @, x - /*#define EDMA3_DEBUG*/
; B6 {% u0 C1 u; h0 u* m9 x - % I$ n% l9 l* c
- #ifdef EDMA3_DEBUG7 U5 G6 h3 d! f$ Z0 [5 O/ s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; x4 N, b$ t: X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( I* l' f# J5 g' H- }) K" W5 P5 [, G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); J) T5 r4 S) m$ B$ M
- #else
3 H) ~; L, j; D0 | - #define DMA_PRINTK( x... )
) X/ e* A2 w8 R7 j6 S" A$ q" D - #define DMA_FN_IN2 B' S. q" e8 A% I' Q( R
- #define DMA_FN_OUT
, M, m* _& d; }( L - #endif9 e, O& _$ ~" {) t5 T% V
" C% ]) z9 s: f2 v- p3 T" X7 Y9 K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& m0 b! o5 Y6 \; j7 s* m9 T - #define STATIC_SHIFT 3
! N: X. k: }# x# d - #define TCINTEN_SHIFT 20$ {3 s" S# n* O+ i$ }; l0 J3 o4 m
- #define ITCINTEN_SHIFT 215 c1 A& ?- v6 r9 P% t* V
- #define TCCHEN_SHIFT 22
8 z% ?1 _1 J3 c% i8 D8 z - #define ITCCHEN_SHIFT 23$ c* z, _" ]0 j. f1 y" i
0 h- {5 J" e3 Q- static volatile int irqraised1 = 0;
M+ w$ Q9 S3 C0 K N8 D- k3 u - static volatile int irqraised2 = 0;! Z3 f" [; | }& |6 T( Q
- * p+ @7 {$ [6 e9 s- }2 Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r! F( `6 e% {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- n' p. T, {) |0 C5 J4 T3 v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. Y. d! p0 T' ?+ F
" f: H; u$ w, T7 C k: m& P- dma_addr_t dmaphyssrc1 = 0;
0 \9 G {7 e; _7 c' q% x - dma_addr_t dmaphyssrc2 = 0;
; d7 h% @- Z+ R1 l) c - dma_addr_t dmaphysdest1 = 0;
5 ^) o" a- w/ q' F - dma_addr_t dmaphysdest2 = 0;6 ~% U6 q; w2 o
0 C0 Z5 S9 M5 Z- char *dmabufsrc1 = NULL;: o: R8 m1 X# d
- char *dmabufsrc2 = NULL;
, ~7 z( A. z/ C. N - char *dmabufdest1 = NULL;' S+ B- z& h; N/ J
- char *dmabufdest2 = NULL;
7 i6 h- ]0 z# c
! Y' y) U" N1 A0 S: E" Y' W- static int acnt = 512;, T% f. m7 |9 [ w! G( P0 Z
- static int bcnt = 8;
5 {2 |$ y* p$ O - static int ccnt = 8;
( } D; M2 K2 w8 c0 @$ l - # a7 z! }% z. h4 R# f( l4 `" e" O
- module_param(acnt, int, S_IRUGO);
0 A( ]% k- ]4 c7 @6 N @; L - module_param(bcnt, int, S_IRUGO);
' ^" F$ V) r5 k2 o - module_param(ccnt, int, S_IRUGO);
复制代码
5 q' H1 Q, t' ? |8 w4 d9 H/ ?9 E! ?( H1 E! Q3 A/ d/ ?# i: l0 `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) l. @) b( V; ~: O. M" Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" E5 x% x/ O: j+ [% f; p3 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' [0 X8 d: M) Q5 k& K, P! Q
/ ~$ A8 ?2 S& W4 N
6 e/ v5 F! W: {. k: t+ C
|
|