|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ e- P: a) {% f8 Z- [code]EDMA sample test application- N) C+ B& A+ y, C
- /*6 k% t( j2 `- j# p K/ W3 ]) T
- * edma_test.c& h# u# P* A6 U9 |& _
- *) Q& a; |2 e5 } J
- * brief EDMA3 Test Application
$ E4 Y; p0 O7 U9 d5 N; b - *
3 i% W& X, g) _ n - * This file contains EDMA3 Test code.2 J& @, z1 `1 H2 r6 }" _
- *4 c! i5 o% a2 s/ C% T3 }, ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! n, L7 X, p' N4 A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 O, u) Y* F% R5 k; J/ M u* q
- * TO CHANGE.( ~" Y/ i: h# a, M" v/ A) [
- ** j- ~. f( J% Y7 Z _; L4 p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
l; k- `8 K: R$ m0 E" y - *
- {( a" o- f1 j6 U) v - * This program is free software; you can redistribute it and/or+ b% J) k( ]$ z9 O5 o
- * modify it under the terms of the GNU General Public License as( F: F& ^3 D# N9 _& z2 o8 z
- * published by the Free Software Foundation version 2.0 \* g4 f, S3 C
- *
3 y' M0 `. v5 a% e" K6 v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 Z$ k. p) d5 L! M L' t2 a
- * kind, whether express or implied; without even the implied warranty
; g) H5 H5 p0 j" x% s( |" I% F9 G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: z f8 }1 O, q4 g u
- * GNU General Public License for more details.
2 P# J A7 L8 C0 X - */
% X2 p1 u4 x; y/ ~ e
9 j* u# Y% T; e/ @5 k( V- #include <linux/module.h>& k( C% v. p7 j& ~0 d- P& P
- #include <linux/init.h>
$ q9 @+ z- P3 h9 M$ |4 ~! ?1 y! | - #include <linux/errno.h>) w# E* L3 t! N1 C1 U+ x& F
- #include <linux/types.h>
* j1 V) A$ l) {) S" `# p" N - #include <linux/interrupt.h>
4 }4 \) E I$ a6 i, g/ g - #include <asm/io.h>
4 U$ f' }4 v, A0 u7 f - #include <linux/moduleparam.h>
5 b2 y. Q8 c/ B7 [% C8 d/ c% k - #include <linux/sysctl.h>1 M, v1 p0 X) Q- n! M* m, |
- #include <linux/mm.h>3 U$ [: @- ^ I# c4 [) r* e
- #include <linux/dma-mapping.h>: F. L% `2 K- [
* K/ i& k% q+ v* i2 C$ T3 ~- #include <mach/memory.h>/ \) p0 j' |+ s/ R4 A
- #include <mach/hardware.h>
" |2 ~* f7 r/ u; y - #include <mach/irqs.h>) G6 V4 @9 H6 R& C5 E. h
- #include <asm/hardware/edma.h>
5 [' N" K, w4 }0 _# D - 8 Q, m' Y- [. S) m& v: @
- #undef EDMA3_DEBUG
. E$ `3 c& H1 H) d. T - /*#define EDMA3_DEBUG*/7 E5 A7 @$ B' r8 S
" `: s( c) V5 c" f0 h/ h0 C+ r8 |- #ifdef EDMA3_DEBUG; q+ W5 H! F- D% a2 q' v7 A# w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& t/ P6 N0 ?- g& @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ T5 _- U" e) C" }+ Q# f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 m. a Q" V4 c1 X+ F - #else( T# a- G) R* X4 [+ c! u' q7 H
- #define DMA_PRINTK( x... )6 A2 p2 q3 t# j7 {6 c; P; A4 b M( i
- #define DMA_FN_IN4 {7 k* C4 o0 @5 E
- #define DMA_FN_OUT
) Z Q/ X% J; h; G6 M - #endif
: F4 v- e2 C( s a" X/ z# G q - & B7 o8 a+ q7 B' e+ f4 E. M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 E$ c. `9 x6 t
- #define STATIC_SHIFT 3
4 s' _5 ^' L0 j" C, j/ n+ { w - #define TCINTEN_SHIFT 207 r; y* K2 q# \7 |! r
- #define ITCINTEN_SHIFT 219 D3 P: Z+ u& b. a: F8 z( ]
- #define TCCHEN_SHIFT 22
" I: w% e9 {3 m# E6 N - #define ITCCHEN_SHIFT 23
/ [% x( ~6 J4 K) x, R B - C5 A& G8 v/ j1 f/ G; y
- static volatile int irqraised1 = 0;( ^1 p# R$ q! o5 H0 P9 \; j% w
- static volatile int irqraised2 = 0;
/ j( S8 F4 c& R+ I' C( K" G: t5 h
1 M4 g) G/ |/ b' N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, ~" z3 l/ _! q. X$ U1 z& `3 V1 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 F A% t8 f" Y" _3 z0 F) o5 v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. E4 K) n. u% S/ `* ~7 U$ N: O" w, |2 g
3 _- J" L# ~) Z% F- dma_addr_t dmaphyssrc1 = 0;' @/ [3 x9 E J9 g$ r& y& g2 S# t! o
- dma_addr_t dmaphyssrc2 = 0;
. }9 E8 t" L; Y; n7 R9 M - dma_addr_t dmaphysdest1 = 0;2 l' [/ i9 @/ |, j7 Q7 U* ?
- dma_addr_t dmaphysdest2 = 0;; J$ ]' ^" H; b/ C) D% u/ A' h( R
. w9 e. f. ?% }- char *dmabufsrc1 = NULL;
9 _) [. f$ Y$ u- I! I- B0 p - char *dmabufsrc2 = NULL;
y& c$ @4 W3 Y7 c1 F2 V" G - char *dmabufdest1 = NULL;
) P: o* y. k/ y# A - char *dmabufdest2 = NULL;. q) ?: B0 B4 K" j1 O0 s2 ?
- 1 x" l5 l3 I7 a9 _# a/ B, M
- static int acnt = 512;, o. a% @& c7 E5 s) ^8 `1 s" k# @
- static int bcnt = 8;
" m6 p* r% j: ]9 O# Q - static int ccnt = 8;" g, e. k; V; x3 }. k* {
r" y: n# Y5 G1 S* R& a8 I- module_param(acnt, int, S_IRUGO);
' P7 B) r# M, x( G - module_param(bcnt, int, S_IRUGO);
9 P: N; v+ b# m# d% X - module_param(ccnt, int, S_IRUGO);
复制代码 $ Z6 ^: B; A& u* v
0 t* w- T, n0 r" M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 a' L$ b& g. t& X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 h4 {' \2 y; b8 k4 u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 q4 ]" O% U( C p1 d% |+ a
. K9 M- Y: ]: w0 Q, m
5 a- u- [. f9 a; p8 E5 |
|
|