|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : K4 w$ {2 S" a. V/ }3 R, h
- [code]EDMA sample test application" x6 p0 X6 b" W* n. S- t8 s. Z
- /*+ u, `1 ?! V; b
- * edma_test.c
$ N, c8 C1 Y$ [0 u- m - *
! O! V$ e) X, k0 b6 ?2 k - * brief EDMA3 Test Application
: N" g. g- q. l6 i0 ~# l - ** _) g+ \: J& c+ V: L6 A: Y' u
- * This file contains EDMA3 Test code.5 M" m: D$ H% C
- *$ ~1 R9 ]" I+ i( S0 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 Y: f$ Z- d3 ~, b8 y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' e/ m& E u( C
- * TO CHANGE.# Z4 m [* s) `/ I2 `
- *" Z0 H, |5 u7 T& _9 o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 F$ k! F9 \0 s: S2 n% `
- *
% _, j2 L# z( H: ?# V9 C) i) j9 h - * This program is free software; you can redistribute it and/or
; b. P) z$ ?' l; z, h - * modify it under the terms of the GNU General Public License as3 h1 R/ r- ]* L( E* x) U
- * published by the Free Software Foundation version 2. J C$ v+ J- {: a/ f) m
- *
; J& ^7 p6 D5 m% j9 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
|) V9 H& ?. k( G6 Q s - * kind, whether express or implied; without even the implied warranty
7 @9 W$ j. e$ u& U1 S3 J: r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# s' X/ Q) k5 r. V8 g" H) ~( N0 K1 V - * GNU General Public License for more details.) i; A- @/ [( Z, i
- */4 [* t1 ~/ b, b. q: ^1 }2 A3 T
* ?0 }* P7 j- Y$ N6 |6 Y/ z- #include <linux/module.h>
^8 k5 q8 g$ v) u* M - #include <linux/init.h>
- k/ h/ W$ e) c+ C( U5 R - #include <linux/errno.h>4 `& \4 ~ @) p: x! G+ P% a
- #include <linux/types.h>
) v5 W+ B: H* F1 C- a- Q - #include <linux/interrupt.h>/ P+ ]7 Q0 R& P0 g0 X
- #include <asm/io.h>% c' [( k* g- L) i. U
- #include <linux/moduleparam.h>4 A- X+ j! D; ^6 n8 Q2 D; \. Z
- #include <linux/sysctl.h># M# G" I v9 R& ?6 n& g8 {
- #include <linux/mm.h>, M0 B J2 _9 }; ^0 A
- #include <linux/dma-mapping.h>4 b7 D4 a2 A9 b5 `9 s
- 0 P" k' m- C$ Y7 T: p8 E$ x! L+ R# w, l
- #include <mach/memory.h>
6 M) ?5 O- \8 s; }, W - #include <mach/hardware.h>
. A. [; p$ E7 L( @: N3 ^! L - #include <mach/irqs.h>' [+ ]* p7 W4 r9 [: ^
- #include <asm/hardware/edma.h>, R" a. b f; D3 z4 T- m4 A
- 4 M4 {+ X* t8 _
- #undef EDMA3_DEBUG
& V. F+ z# u( k - /*#define EDMA3_DEBUG*/
! p7 E! c% y$ ?$ M. y' D
" G# I5 Y$ R) M$ `$ w* v a- #ifdef EDMA3_DEBUG; Q( R7 v) d/ }. @' L+ d* r4 J( |0 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 |# _% u4 K! w; O4 Z1 l- Y$ h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* _# o' R; M, K; p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 Y# e) I h- r4 v) { - #else
4 V4 r0 _1 v- S5 r: y7 l) \* q. i" u7 b - #define DMA_PRINTK( x... )
% j3 \$ t. S, R6 r5 y - #define DMA_FN_IN) g6 @2 {" m; P/ I' L4 F" h2 }
- #define DMA_FN_OUT0 G4 ]+ R6 @% b$ J
- #endif0 k+ |) t7 ?! B
% a C; w6 B5 ?, i" G X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: c: R; A' t( ~5 f. R6 w$ g - #define STATIC_SHIFT 3" Z4 J2 b b7 g) U
- #define TCINTEN_SHIFT 20
# a0 W! v; W1 f% S* m - #define ITCINTEN_SHIFT 21
2 p& `( O/ R# J, w - #define TCCHEN_SHIFT 22
) D% e$ q7 s% d3 A - #define ITCCHEN_SHIFT 236 e1 V/ y5 R( L# M u5 [6 \
7 p( a9 H t c# i' c' k! d, g1 k- static volatile int irqraised1 = 0;
: M2 j$ {3 x: y6 U! d+ T - static volatile int irqraised2 = 0;
: ?* d; L) b! v) ]' z$ J2 N7 Y - 6 V* A% L3 R) p- q: |; O$ a$ j; a* x1 Q a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ t! b- v ~) r1 U* j2 b. V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Z, J/ ~7 u# ?) U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" p1 d6 K( T( n - - f! {4 k" @2 |1 T
- dma_addr_t dmaphyssrc1 = 0;
?2 p3 }& t2 F5 o - dma_addr_t dmaphyssrc2 = 0;
4 j' K N. Y" V - dma_addr_t dmaphysdest1 = 0;/ ?. c/ q5 B( [$ [! N: c
- dma_addr_t dmaphysdest2 = 0;
1 z! A6 ?9 ~2 N9 b2 r F
" G- L' x+ V" N) m) y% h- char *dmabufsrc1 = NULL;
* x- U+ N& k" V9 E - char *dmabufsrc2 = NULL;: V$ {0 V& k! h8 y- e
- char *dmabufdest1 = NULL;( G% T9 a0 O! D, e( E
- char *dmabufdest2 = NULL;$ b" |; j% N7 b3 T
- f5 R) Y+ L$ }1 O! p
- static int acnt = 512;: n$ b' P6 ] J' ~' d" e; h) f$ M( G# C
- static int bcnt = 8;' N, M2 f6 [( y6 {% ?4 k2 s
- static int ccnt = 8;: O: T1 Z/ Y; o8 Q
- 0 G7 v* p4 h* N1 A$ W' x
- module_param(acnt, int, S_IRUGO);
* D) a4 j2 V/ ]" k5 e - module_param(bcnt, int, S_IRUGO);
' M: J+ C9 U% C - module_param(ccnt, int, S_IRUGO);
复制代码
/ A* s! t& p1 b+ S, u/ C. k) c
! @; b" b9 b U+ o1 C% G$ R% l, K$ P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 A/ A! t3 u& M, o0 A" A8 V; y* N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* w: I+ A0 j4 M# H( R/ [* `# U5 X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% U. m* {; ?4 O, [' ^
6 \, X) d% b- O/ j& s7 U8 o7 R3 l- K
* @! X2 u2 @# C. m0 }$ P6 f |
|