|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 v8 a5 n O2 m/ y* X+ E
- [code]EDMA sample test application% C2 B) m4 v1 X, T( d3 G, W
- /*
6 I* p) c6 A1 s6 j2 G7 P, k! r - * edma_test.c7 V# H$ U! S V: S4 q
- *
6 M- T1 J* f' O9 }: n - * brief EDMA3 Test Application/ k- ~) W; m e+ w& Z
- *9 f* t5 g( X& ]- m
- * This file contains EDMA3 Test code. m6 t, o P* o6 _6 \6 r G
- *0 q- f; R% L8 i: X3 N8 f# F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 G6 q& O$ q# A/ W5 B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) d" j8 C# |/ f4 b4 g
- * TO CHANGE.' B G0 r& @& O4 r
- *
, _) r7 m( `0 T+ q" [; Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 X" M) Y0 j5 X S" d! J. l
- *, E7 @3 y1 ?& A3 l
- * This program is free software; you can redistribute it and/or" J7 \" q; l% T* y
- * modify it under the terms of the GNU General Public License as0 f+ k+ ^6 \* N: d( G; x
- * published by the Free Software Foundation version 2.' G6 V. D' @8 a$ T! D5 X
- *9 L4 M; ~$ {% G* l0 C0 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' |: T/ ?3 e! r( v - * kind, whether express or implied; without even the implied warranty
7 O, N( b: |. w0 v5 M+ y9 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% w. R; k M# P- r3 b% R - * GNU General Public License for more details.$ Z1 y5 d" L/ c. U# w4 v
- */
0 h! E$ O# f( x! C2 \; }! O - 6 Q( r/ e* ?8 ~
- #include <linux/module.h>! L3 U. b# [( _, e* U1 ]
- #include <linux/init.h>/ P& t. i' X/ n8 I* y2 R: W
- #include <linux/errno.h>
' t6 D' k) Q* n9 ]2 m7 w - #include <linux/types.h>
" H7 `/ M& }+ P% M - #include <linux/interrupt.h>
& ^* O, u/ A7 Q% e) X/ G) e, q1 ]- v - #include <asm/io.h>
& J+ K) n" b+ k) n - #include <linux/moduleparam.h>
6 B J4 \5 r1 G. A/ c/ B, d - #include <linux/sysctl.h>
) W" r* @3 q- Q5 w7 v! v7 a7 Q - #include <linux/mm.h>
# O& M, L O. r3 o/ e5 c' t - #include <linux/dma-mapping.h>
" V) F) X3 O& L* w
/ n% X4 R/ r- W$ `+ g4 ]8 K- #include <mach/memory.h>, }/ e& Y5 ], C" f
- #include <mach/hardware.h>: c0 i" D$ [) k2 X0 o. u$ b
- #include <mach/irqs.h>
; k) i5 j) J) h0 w8 p5 t5 N! y - #include <asm/hardware/edma.h>( J. w, i" c/ X: p% ?; q
4 b% O8 f4 j, Y! n7 _9 [- #undef EDMA3_DEBUG" S5 W% U; z( ?
- /*#define EDMA3_DEBUG*// n; Z' q- ^! V# y. \/ G
. m* q' D* B8 ~7 A' @- #ifdef EDMA3_DEBUG. }% o3 g# e* C* a# D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 D- @/ q/ h7 G' V( m1 w5 ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) m) w7 R1 G* f; `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 {, z1 ^# {4 d Y+ E: d - #else
2 D) G7 V1 l' B% N% r - #define DMA_PRINTK( x... )
8 ?8 H0 D( s3 U" I0 E - #define DMA_FN_IN
. A9 n: q0 C8 ~& u* h$ e3 _# H - #define DMA_FN_OUT2 [( Y6 @& i" }" S, J+ u$ _- S0 d
- #endif+ P4 N6 f( q2 r: F) z
* O$ I* f, F$ E5 U+ \- E4 F- c n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ o9 }/ R. [" m* ?& C1 l - #define STATIC_SHIFT 3) h& y" i' a0 L b/ K" I
- #define TCINTEN_SHIFT 20; J3 `/ e- t% ~& t( _
- #define ITCINTEN_SHIFT 21- j N! F6 f7 W3 T
- #define TCCHEN_SHIFT 229 A3 ~( P' T e: k: m4 H
- #define ITCCHEN_SHIFT 23
8 k# G0 K* v( t9 l" F8 Q - , ] v$ j' N x" ^4 |
- static volatile int irqraised1 = 0;
( [2 b. j Y+ B# n9 }% q - static volatile int irqraised2 = 0;
# q7 Q5 D; O6 y8 z) s* d! ?7 M
; v5 K4 T- K$ c# v& i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 s& m% X. f) H. E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 d3 L4 r: x& \" |) O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: k, e) A% a0 H' K( g$ a0 m3 X. z
! `9 g* M2 }/ S' S6 Z5 R! L3 g& I- dma_addr_t dmaphyssrc1 = 0;
7 R& \! T! u9 N7 y; J - dma_addr_t dmaphyssrc2 = 0;
$ D$ Z6 i/ p$ ?( J - dma_addr_t dmaphysdest1 = 0;0 n2 S, [$ y% @9 n+ `& [. Y" k
- dma_addr_t dmaphysdest2 = 0;
& a5 }- U/ u* z1 m! s1 y" b' H
/ n( ^% q9 K& p- char *dmabufsrc1 = NULL;
4 ^4 |$ R" s: E3 P - char *dmabufsrc2 = NULL;; L, f* p. [- \ }4 s# L
- char *dmabufdest1 = NULL;
4 {$ b6 z2 v- n( ?; a - char *dmabufdest2 = NULL;
& P& Z$ l9 ~4 G+ d - - D- S8 V) z( R
- static int acnt = 512;$ T' w7 h( a: c
- static int bcnt = 8;+ F" A1 i y1 d
- static int ccnt = 8;
9 {" @9 b; _; a: D3 e
]6 |/ I- P7 e4 ~+ i2 s* D- module_param(acnt, int, S_IRUGO);1 ^4 O: W# u9 L8 X, H
- module_param(bcnt, int, S_IRUGO); ^# o; N4 ?$ T
- module_param(ccnt, int, S_IRUGO);
复制代码 ; H! x. X- N2 J. w3 z
1 v+ t7 d8 e" x6 F; @' ~0 J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 C2 {" C% P1 j5 m. }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! S/ m) l+ m2 c# b, w) A& ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* F3 A9 p: h9 O9 E8 l1 K4 f4 }8 ?) ^1 r# E, f& g" k9 ^. i$ K
0 A! b8 b% b& I. y! Z: o" m) S. _ |
|