|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 l8 n2 k$ v; E1 U$ s) {9 N4 Q- [code]EDMA sample test application7 X9 M3 O8 R1 b1 G! n# K3 q& M
- /*
5 b) `4 D3 X. d - * edma_test.c
( s# f4 C& {' L - *
% a7 f' a; X/ [( y9 i$ o - * brief EDMA3 Test Application; v. x# `+ ~' T( N. a4 Q
- *5 u" L7 ?9 k3 b) a4 |1 M
- * This file contains EDMA3 Test code.
8 n0 Z; z% R' _+ \( ~ - *
# m& m% p3 ^* m9 ~0 a" f- l- I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' @0 J0 P2 d. o0 Z/ J( C n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. i0 T8 q8 B+ [0 \2 @$ ? - * TO CHANGE.
9 i! e% u0 h; x% `; l* Z - *
9 y6 i7 A; }/ a0 o5 r* m* j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. A2 c( D4 x4 P) e
- *
! g: a& {) Y; |) T/ {! D$ `' V - * This program is free software; you can redistribute it and/or/ B" y# v* }. o
- * modify it under the terms of the GNU General Public License as& g- O3 s9 k& L) M6 @
- * published by the Free Software Foundation version 2.
. T/ |4 H) f& t, | - *5 a0 g# v, a0 S, |2 _ Q7 w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; R% U6 S: t& e: Y7 R. P - * kind, whether express or implied; without even the implied warranty# z" U! O5 ~6 N! Y5 Z( c- m8 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 J% d, v: F/ G0 y8 l3 X2 I - * GNU General Public License for more details. }9 j! a$ \* C Q/ o. ?% U) _3 y
- */+ s" k2 G* P! Q6 L3 d
- ) S8 B5 \7 C1 ?0 X/ p
- #include <linux/module.h>
6 K7 g$ P# }4 z5 @ - #include <linux/init.h>& C. S: ?0 Q( P% ^4 n' `" X
- #include <linux/errno.h>
+ [- \2 Q/ | j/ i# r" [ - #include <linux/types.h>6 H$ s0 A( r/ p# p; g) K
- #include <linux/interrupt.h>: x: ^) q. Z6 l' z' {% w
- #include <asm/io.h>* A5 X+ e# j0 T8 q0 [
- #include <linux/moduleparam.h>
7 O! Q2 N/ I1 }* V L, x - #include <linux/sysctl.h>
" d& e+ h7 L3 R - #include <linux/mm.h>: e9 \. c; x% H/ ? t
- #include <linux/dma-mapping.h>
6 V( S1 @- M& ~ - / l( h& d! a5 `& b/ X8 @
- #include <mach/memory.h>& }) G6 N- S2 _# y8 `' Y
- #include <mach/hardware.h>$ s; i9 `- N- G# l9 z0 i3 C
- #include <mach/irqs.h>
. s' p8 v" G0 T8 X S - #include <asm/hardware/edma.h>
- c, ~- K& m' u! P9 V' C$ r
; k# ^0 G$ N- F! V( Q9 x: l- #undef EDMA3_DEBUG: S6 Z: k( G0 \+ b5 P6 e
- /*#define EDMA3_DEBUG*/
- \0 U! ?) L9 c+ d, Q" K - 5 k) o: z) _/ D. D# }# f
- #ifdef EDMA3_DEBUG
" P" h N3 L/ Y5 D! V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! T9 ^4 r. G1 ~* n# u, _/ p4 W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 B7 L4 S$ m: r' P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 e- c# O. ~( Q, { - #else
% B g6 o* p- a - #define DMA_PRINTK( x... )
9 A! j& q7 u' t1 I6 Q8 J; \, S - #define DMA_FN_IN! @7 C! _8 N3 Y" r+ v6 {3 c5 Z
- #define DMA_FN_OUT$ l' t, J2 b- }5 m
- #endif
- x- Y2 ?; `- ?$ | - 0 P: v( l3 S- E+ I$ X# z& g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- E+ L7 N# z2 e2 ?9 [
- #define STATIC_SHIFT 3
$ b0 {% k/ i; L+ a3 x - #define TCINTEN_SHIFT 20
/ i" _& j3 ~- U9 Q2 @) @) R; y - #define ITCINTEN_SHIFT 217 N- e, c# C4 a
- #define TCCHEN_SHIFT 22
; O' G Z! E8 {! v j - #define ITCCHEN_SHIFT 23
4 X6 d2 L3 y2 u. F. e. F - ! q7 T! p, ?. R. f+ h
- static volatile int irqraised1 = 0;
H% U, d0 P% I. i) O$ ~ - static volatile int irqraised2 = 0;( X/ b0 K* Z' q& m
9 a$ J' q) X* y/ r- s* d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ~3 U7 Y" Y/ M- h4 `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. g4 Z; j9 p$ m6 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N; b5 u6 w2 D0 B4 b. s3 W
9 y4 X( m3 Q! K1 ^" _8 Q5 E+ z( x, q- dma_addr_t dmaphyssrc1 = 0;
+ n4 H+ N# \) u; a, z/ C8 }$ K$ A - dma_addr_t dmaphyssrc2 = 0;( D: {# X' d/ }3 V
- dma_addr_t dmaphysdest1 = 0;
4 m( e! e! q8 P - dma_addr_t dmaphysdest2 = 0;: s/ ?; b! G- t$ e! ~6 j8 @! f- I
; s* C, C; Y* h9 [# v' A5 C, D& c- char *dmabufsrc1 = NULL;$ X' ^' r% } j4 F/ _
- char *dmabufsrc2 = NULL;4 d1 F. D# c7 g
- char *dmabufdest1 = NULL;
5 o/ D2 s9 T% V0 k- V. Y9 l" F - char *dmabufdest2 = NULL;5 P+ ~5 q( t P& l& R
2 [* @% G* M, I3 M7 r7 w# r7 n- static int acnt = 512;" q' N9 G* C% h$ |) @% h
- static int bcnt = 8;
% p- L& a: C# ^( K. c2 i - static int ccnt = 8;; R) B$ r( @( b
- 0 E2 d+ v. a4 o$ w
- module_param(acnt, int, S_IRUGO);& g, N' g7 `& Q7 L+ b9 _6 b
- module_param(bcnt, int, S_IRUGO);
8 r, P3 R; r4 I$ ]: i+ C - module_param(ccnt, int, S_IRUGO);
复制代码 % d- p* W+ C2 j: `4 b
3 k7 f+ s; _9 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 Q* x* f) e$ f: `3 i; M. C6 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' i) B7 t- W; Q# c/ D- ^: k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 E N0 \2 \( T4 ^
8 f5 u0 @- Z; S5 {2 y# N# [0 Q0 k- E! m; P% J2 D, ]8 n' w
|
|