|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 [" G. E1 v/ L. ?" R- [code]EDMA sample test application# y4 ^7 h) Q; x" S# L: r& F2 q0 k
- /*0 A3 H: `5 f% ^* }2 ~) l+ e7 \1 G
- * edma_test.c& @8 }. a* o D, R; \/ u& m
- ** _5 q3 Y" y% @8 Z
- * brief EDMA3 Test Application
. C S7 H. M' e9 f! F5 ^ - *
8 J5 N( E3 ~/ y2 e X+ t - * This file contains EDMA3 Test code.
0 }& a3 F* M. x1 C! C1 l - *' v% J7 h( o6 w6 Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ]7 z0 b) O0 F7 v6 T( D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, ]# m4 M" Z3 \8 g; H; r: X) G1 B, J; g* S - * TO CHANGE.
4 ~5 M2 N; t- V: P- k - *9 Z- Z- T; ]3 R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 ~1 [: p3 L6 M* {' a
- *
6 a5 E9 r' L0 ^3 c# ] - * This program is free software; you can redistribute it and/or
2 J8 V+ t7 \$ _; C1 M X - * modify it under the terms of the GNU General Public License as/ r9 h# Q/ M1 r K
- * published by the Free Software Foundation version 2.
& I! p7 G# L0 R& I. c7 f9 V - *: f w! {$ y# H& v4 {$ F) n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, d( ], z, z. `0 |4 I - * kind, whether express or implied; without even the implied warranty
- j) x/ p1 u5 {( J, G! s/ {1 M. L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
W4 O1 f2 Z3 b* M - * GNU General Public License for more details.% k2 k. j6 b! K% m5 m
- */- s, w, n% e* G8 W5 Y; w& x9 v
- ; |% U: L1 p* M( Y( N
- #include <linux/module.h>
. K3 b' Y/ N) @& m7 R6 K - #include <linux/init.h>
$ b0 z% K/ T0 \7 v# m( L - #include <linux/errno.h>' z9 W, E; d9 X. d# ]
- #include <linux/types.h>
5 F5 E0 i0 C& V5 M6 V - #include <linux/interrupt.h>5 p0 n1 ^" g& I0 [* x
- #include <asm/io.h>
j4 j2 Q2 p* Z9 L7 a - #include <linux/moduleparam.h>/ ]. w% S% H: I: [' q4 U
- #include <linux/sysctl.h>6 `% T4 d- r, q+ S+ a3 E
- #include <linux/mm.h>2 e1 E* q' {% f) E+ [% {* }
- #include <linux/dma-mapping.h> Y+ N8 \: w- W$ I5 n# h4 G
! O$ p: w5 Z U' J$ c- #include <mach/memory.h>
5 f) J% j& i5 v& V2 N6 Z - #include <mach/hardware.h>! k3 K+ z; ^ O. G& L
- #include <mach/irqs.h>: E4 M3 H: z9 U" [# E# X
- #include <asm/hardware/edma.h>
9 @ Z5 p4 `1 g$ \, ^% H+ R3 O - # W# z2 s: f( K' @' O6 Q4 q
- #undef EDMA3_DEBUG
! L( ^8 |, ?) i# c - /*#define EDMA3_DEBUG*/7 E6 Z* z4 M2 l* I% \3 _/ W
- $ _% H8 j3 A6 X/ W/ E2 H
- #ifdef EDMA3_DEBUG
! K* Z0 V1 v: M; D; @+ [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ w3 S' \0 C) e& X4 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 y7 z2 G0 B7 K3 J: e$ h2 H } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- I I/ M0 x4 Y) Y+ o: m. g - #else
$ l: M9 ?# |$ ~' S( _ - #define DMA_PRINTK( x... )
& P% T* T2 m9 q& ?2 k$ f# ?& a - #define DMA_FN_IN# U& Z7 _! a6 l/ ~
- #define DMA_FN_OUT( E. h7 Y# s* b5 r# ?/ Q2 h
- #endif
3 ^/ ~4 U& u: `0 \% m' M2 J s
4 c( T0 w! ]5 X6 z' [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ W; r" \. u% P$ Y1 o - #define STATIC_SHIFT 3
% Z7 C$ Z# L3 c8 i; e0 Y7 _+ }# Y - #define TCINTEN_SHIFT 20
# A; G5 i0 R( \/ e! |6 ], q3 r - #define ITCINTEN_SHIFT 21
3 s% i. k `9 w! |3 D - #define TCCHEN_SHIFT 22
7 G( g( T6 S; Q' x7 g5 o - #define ITCCHEN_SHIFT 23
2 c" d& x2 ?% O0 h1 D1 H' |' l" ]
/ n4 H! T; Y; O; ]2 N- static volatile int irqraised1 = 0;$ u3 M4 i) K- ^) F0 W$ h
- static volatile int irqraised2 = 0;
. e. P9 U+ ^1 \7 P) V
; I" J* P9 r6 h6 U6 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 g& j8 L0 ]* O& t9 O9 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" F- T/ e$ c: F9 Q: [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 u5 q+ D) s, J
( O# D' r/ B- T c7 x+ M- dma_addr_t dmaphyssrc1 = 0;$ Q# T; t3 }2 U, L. I, }0 W: M8 J: r
- dma_addr_t dmaphyssrc2 = 0;
. B) i2 m% q: ]8 _) N - dma_addr_t dmaphysdest1 = 0;! q1 b T. a8 i3 x' P; m* O
- dma_addr_t dmaphysdest2 = 0;4 r. O7 X9 z y6 U* R
6 L3 Y3 G S$ ] |. m- char *dmabufsrc1 = NULL;: c9 k4 Y% I+ a# {" N# F- |) \
- char *dmabufsrc2 = NULL;. T4 }. O& s$ D" o
- char *dmabufdest1 = NULL;
; \% L! b1 a# y1 s0 V; m: E2 E+ T - char *dmabufdest2 = NULL;9 I+ F% p' a& Z1 Y: e& d
- ( c' w9 H2 i" |; n6 I
- static int acnt = 512;
# { d! j8 \8 F) [/ Z' H& ?/ Y - static int bcnt = 8;
' x& V( N) c# _0 e% H - static int ccnt = 8;
& j5 ~$ [2 J$ A! q
6 @) L- K. z/ u' V+ f- module_param(acnt, int, S_IRUGO);8 d! i$ R; }3 Q2 N4 R" C
- module_param(bcnt, int, S_IRUGO);
1 e+ d/ h3 E% D4 N - module_param(ccnt, int, S_IRUGO);
复制代码
6 j' M! [; n6 t9 b5 S. J5 r2 D0 O
, Q* s; d, T, t0 ]: t6 V( F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% p& R, ~. S, S% a! l( n9 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% d2 Y f- m' h* G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) m0 b4 s$ ]" Z
7 W: c5 s6 S5 D0 b6 O0 C. q K- ]- G/ |. J# i
|
|