|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 E4 B0 u9 A9 C2 `& x- [code]EDMA sample test application
, W4 `- F: f/ [+ G: r - /*2 _/ B+ W& I8 N( t; m
- * edma_test.c
5 C7 l8 p7 g8 p4 j5 A - *+ e: }/ r. r1 ~
- * brief EDMA3 Test Application% [2 V. _: }. k
- *0 `/ L! ]" q9 Q7 k+ p k* ?$ Q
- * This file contains EDMA3 Test code.
3 v. p O8 U |! U - *5 B# B' z4 _. ~( w# [1 q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 U- I( W/ p3 g3 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 u5 [) ~0 {3 x4 e - * TO CHANGE.
& p- K. D/ n" B) T. I - *" F' c7 i( Q% |4 U! H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: z* O9 |5 U4 m/ V6 T5 T Y" y k
- *1 @3 F( U8 z8 Z1 S3 B
- * This program is free software; you can redistribute it and/or
% p) `7 V+ I3 f. ]6 v2 i. }' | - * modify it under the terms of the GNU General Public License as
$ w$ g/ @5 h9 k! {6 L% K( b - * published by the Free Software Foundation version 2.; A' _, T |- U2 h; O8 i# ?; H! d
- *
& E( s: U# F$ h4 w$ P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, M! C9 C9 H* T - * kind, whether express or implied; without even the implied warranty
9 P, q3 e- T- w( `' v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 w# l' Z6 D9 f) [* H
- * GNU General Public License for more details.0 B. x( x* w; [
- */
& {5 ~& r! `( o3 A; l7 L - 8 Q. k: ^$ F6 U& C6 m0 G. B
- #include <linux/module.h>
; r# f m( {( R& U2 _ - #include <linux/init.h>6 g/ m9 r4 R2 c0 E
- #include <linux/errno.h>
r1 _( y) H" _0 p$ E0 m& E - #include <linux/types.h>
; V2 w* x% l7 X( N6 l/ x - #include <linux/interrupt.h>+ {% m9 d6 L ] V# p) o/ G$ f
- #include <asm/io.h>
6 H; A3 t f1 v" B; D - #include <linux/moduleparam.h>
# D% v( L% e0 y - #include <linux/sysctl.h>0 G/ F8 z% z9 F$ E: N
- #include <linux/mm.h>! r5 ^$ B; v; U
- #include <linux/dma-mapping.h>3 P- ]8 r- C% ^) r" J
- ( D, U1 s3 x- s0 F
- #include <mach/memory.h>& G8 T A- `1 g x
- #include <mach/hardware.h>
9 g& q$ V) l/ j Q6 v$ i7 I - #include <mach/irqs.h>6 l5 U- ?$ O0 b+ S$ F. w
- #include <asm/hardware/edma.h>
6 D- Q$ N, }+ N# w
7 Z* Z- W/ A0 }8 }& R! A9 \- #undef EDMA3_DEBUG
- x7 F' C2 Y" A) O' s! [ - /*#define EDMA3_DEBUG*/* l( z2 _7 R1 x. V9 X
- 5 {. \3 x5 H: Q) A4 B; W
- #ifdef EDMA3_DEBUG( x# Q1 M4 G5 U% f3 l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 V% B/ A# d9 P3 m- U9 o, F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 j! n0 s" ~; V: W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) T6 p* t- `$ x+ Y7 q' Q+ o ]/ j1 r - #else
& H# v8 y+ c, x( [8 v, h0 g - #define DMA_PRINTK( x... )+ o3 n$ x+ d' S! ~! i6 x' w% C/ E
- #define DMA_FN_IN
- I6 q, Q/ h' O8 W1 Z( E2 J& r, i - #define DMA_FN_OUT
8 S% D: D1 C% V6 o4 i& {$ t - #endif
( L6 w8 k3 K0 q
8 d1 n3 K8 z2 @2 {& ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- u" N: J$ W8 ` ^# ]$ h
- #define STATIC_SHIFT 3
$ N% [+ [! n, h" l2 \' N: u - #define TCINTEN_SHIFT 20, Y7 U2 r n2 M- X" z* G3 j8 ]
- #define ITCINTEN_SHIFT 21
9 u: T; h0 C; S9 c* y - #define TCCHEN_SHIFT 22) H& \1 n: k3 q7 V
- #define ITCCHEN_SHIFT 23- Q* U: W1 @5 t4 N8 K, M+ w
- 9 W$ v1 p. C1 y6 m
- static volatile int irqraised1 = 0;
; w* ~% X: q( {' J0 }9 I6 f; Q - static volatile int irqraised2 = 0;
2 \7 T: |( j$ W1 G5 K - : Q! W) U) g9 H/ b0 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( I$ M7 }& V- w/ H' a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" w/ |8 ?5 E, N$ q8 w1 ~4 b% ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. k# c, M& r4 n
- $ B) Z3 C$ x' v5 u3 g4 d6 k4 ^- [( U
- dma_addr_t dmaphyssrc1 = 0;
$ ^( {$ V4 U9 o% \/ \ - dma_addr_t dmaphyssrc2 = 0;
. M3 ^8 A% R T+ } - dma_addr_t dmaphysdest1 = 0;, t' p6 D& O7 ~1 i
- dma_addr_t dmaphysdest2 = 0;) N: c: ?+ u6 Y0 T- l6 e8 Z7 B4 Z
4 H) Z6 m1 Q1 ` P1 F) Z" h- char *dmabufsrc1 = NULL;
8 x! i4 x1 ]: J" z# G) D - char *dmabufsrc2 = NULL;1 U, N2 ^' t" x( u/ x( V, K
- char *dmabufdest1 = NULL;9 b/ {! d# c% G9 [
- char *dmabufdest2 = NULL;
# f. r8 C2 C, W' W! |' n
2 K, v3 X& j U; v$ P- static int acnt = 512;! B' U1 T R" H0 U; J: Q- T: p
- static int bcnt = 8;
3 t% r- D. g+ l/ M8 e - static int ccnt = 8;2 w+ P8 a/ w/ g% }4 p
4 }4 N* f$ a }9 g) }/ T, D- module_param(acnt, int, S_IRUGO);( y" ~( r+ W7 M* @$ J
- module_param(bcnt, int, S_IRUGO);
7 l6 S; x6 l+ Z' W# w5 { ]- G) A9 l - module_param(ccnt, int, S_IRUGO);
复制代码 2 o% o# }! |3 q0 F
) m$ d+ z. J8 F: F( c& _! n6 _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 h( D' {; Z. L6 G) d3 H! \$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ v: M+ x* c* V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, S3 C s- ]! m$ V: l4 S7 X
. ?0 C4 q, N" Y8 A: t3 J& x; I& ]$ T$ j9 ?$ L! @ E/ E* K8 [
|
|