|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % p: w& F/ t! `; Z+ M
- [code]EDMA sample test application' U0 p2 X; e/ b8 j$ g
- /*
, s( z4 M+ t$ k$ \ - * edma_test.c. R1 c ~! q! Y. ~( }! |
- *: C3 g7 B: D; d3 A
- * brief EDMA3 Test Application
/ b5 X# b2 K4 B5 I$ A" r( W/ T7 b - *
* `' [4 x; j/ r) R" h3 l( @4 Q M$ Z" P - * This file contains EDMA3 Test code.2 ]; L/ f& c7 i* x
- *
9 k% V9 r- {' C; g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: H6 @% i" P+ k% ]/ T( m }' E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 m, m n9 k) v; m
- * TO CHANGE.) W. J' Z& \% ]. y& \+ f9 S: d
- *
9 v H# I( J% K' ^! Y. G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ V1 E1 `- b0 u' H/ v - *
' \' s8 S5 o* ^1 O+ ~/ l - * This program is free software; you can redistribute it and/or
; L9 Q% W- w E0 u% J7 S1 t - * modify it under the terms of the GNU General Public License as* Y% r. O }+ a+ k# }/ G
- * published by the Free Software Foundation version 2.
- T: b" C5 i8 d9 ]) Q4 a4 J. @/ p - *
! T" m# z0 a1 b7 y( Z- K2 V8 c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ]9 N; [+ ~: r B5 v& r; v
- * kind, whether express or implied; without even the implied warranty! n0 u" L* t$ @8 J5 \& A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 |, b* e8 w! w" ~3 R. r - * GNU General Public License for more details.
( M2 k. Q2 p1 y7 x% v - */- O6 X! h6 ~. ?6 P; t/ j
4 i! C6 f( n' M1 @2 R/ ]- #include <linux/module.h>
]( y- B* e5 Q - #include <linux/init.h>3 k8 [) O; `0 Y5 K$ r
- #include <linux/errno.h>$ V# d! h- _ y6 t7 \ i
- #include <linux/types.h>/ i, N# M) G r: C e5 e
- #include <linux/interrupt.h>
- T/ f L* R5 [" E. \3 f - #include <asm/io.h>1 B* W8 e( \$ B+ z* u
- #include <linux/moduleparam.h>
! v, |0 X' r( f8 O+ M - #include <linux/sysctl.h>2 c! Z3 P; w$ `* l9 u* u8 g
- #include <linux/mm.h>9 a1 |: `# U: `# Z! v. m/ q9 X" K
- #include <linux/dma-mapping.h>" B6 Y5 }" T1 H5 \, \
/ w& a$ I% C9 R' z& {' ^- #include <mach/memory.h>
S# W' R! N' v0 x, D - #include <mach/hardware.h>
2 Y _9 O/ o8 y, Y$ l0 J. `% X- E4 f) j - #include <mach/irqs.h>
: O: }4 k* }! w; x1 i - #include <asm/hardware/edma.h>
- V3 p, p3 w- X. N2 R
$ y' T. d: F+ K6 k: v" n- #undef EDMA3_DEBUG. m6 r* k8 h9 k O# s2 c' h
- /*#define EDMA3_DEBUG*/% H! d' ?& u4 k
- & r/ I+ E+ F; c5 |4 R0 {9 r
- #ifdef EDMA3_DEBUG
8 l9 L$ Y1 `' B) _' W$ h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 \3 i. T+ z0 r5 e$ r7 T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); ^. F: T0 I0 y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 @( u8 c2 w# P5 e- R' g
- #else _& A2 p8 o# V( A
- #define DMA_PRINTK( x... )% Z4 `1 K! \' S! [( F, i
- #define DMA_FN_IN! {( x* k' i6 m# S/ A3 Z$ ~
- #define DMA_FN_OUT0 A9 C0 g. J* T' `. ]) l5 z
- #endif
2 i7 ^" e/ R3 J+ e
8 E0 P' G# x! ~+ b& {6 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 c# k4 s: r; J' K9 q - #define STATIC_SHIFT 3
9 F# Q, [( {- v1 o/ h - #define TCINTEN_SHIFT 20
8 F+ n1 D" E. u& H5 a - #define ITCINTEN_SHIFT 21
. L& |& G8 B! p w- L( \ - #define TCCHEN_SHIFT 22
) I3 S+ P( @2 D6 S. ]8 [ - #define ITCCHEN_SHIFT 234 l% @9 A; i9 \7 m, b. w8 O
, A4 \5 z3 g U: p2 H' V- static volatile int irqraised1 = 0;/ A' f' P( p5 Y$ }* s
- static volatile int irqraised2 = 0;
8 i: u' Z) d; A! D1 h" n1 v4 _* `
) \! Z& Q9 e, Q5 \+ e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 J1 @$ x/ i7 G7 [; X3 I9 Z3 k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 o; t/ S0 Z) s* \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ }4 d/ E7 R" q( Q9 I) ^6 i5 z) O
- / S3 [" q/ V1 P/ b b% _
- dma_addr_t dmaphyssrc1 = 0;8 g0 D# Q8 p v# J5 o
- dma_addr_t dmaphyssrc2 = 0;
2 g3 u; A0 |2 ]/ S3 V6 N - dma_addr_t dmaphysdest1 = 0; ^9 y' i2 V( c% Q1 m
- dma_addr_t dmaphysdest2 = 0;
9 E: R! `1 G0 r4 p5 l/ S) p - O4 Y) K0 X0 v8 t f( {
- char *dmabufsrc1 = NULL;" v2 q& A+ w2 d U6 M
- char *dmabufsrc2 = NULL;
. p7 r& z* l; m3 Z& Z - char *dmabufdest1 = NULL;0 [9 G8 D# c# O/ U" C
- char *dmabufdest2 = NULL;
. r) t2 j! ^: ]1 R& e/ J0 u C
' W5 k1 v* a3 u' T- static int acnt = 512;
, N6 X! |/ L8 l0 N! e. X4 G4 Q% f5 w - static int bcnt = 8;
8 [7 h, F8 F% T8 w* E - static int ccnt = 8;
6 ?3 ?& \* r8 y: Q( q1 L - 6 g# i2 s6 e* A
- module_param(acnt, int, S_IRUGO);
4 \3 b$ O. W7 _6 a# I - module_param(bcnt, int, S_IRUGO);
4 s- [+ \3 y2 R8 } - module_param(ccnt, int, S_IRUGO);
复制代码 & p" S: b9 w* ]5 y5 _* M
?7 W, D$ W6 r9 f% j/ v% z* w! F2 ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' c" F& [1 }% y* i( a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: `( Z" ?# n5 j2 [- y+ _. ^0 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 d& G) q# p3 O {* Z
4 L$ ]& s2 M5 T: r8 T4 n+ O4 O! y- T* j/ M, C. f
|
|