|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 Z6 r+ ~; m1 D+ f- [code]EDMA sample test application+ E5 K) A; D" h. c3 h8 ?3 R* }
- /*2 u" P e2 |/ t! v: J4 K& e
- * edma_test.c
5 t$ G5 ]" p- ?: Q" Q$ l - *
# y- Z4 I! Q$ \- ~6 B# d - * brief EDMA3 Test Application K+ k/ O0 {) x4 ~7 \
- *
- d& A7 s2 ^2 {1 j: T; m - * This file contains EDMA3 Test code.
) ]* p w3 g2 b3 f* t! T - *
/ m! Z1 @3 A2 ^* \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! H, j# f9 Y! v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ {* Y6 U7 [7 p5 L; L7 h0 p - * TO CHANGE.- y# I p4 ?6 u9 _. w
- *, a! k9 [/ o1 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% S1 m% ~) F6 ~( k
- *+ d6 k% y8 }& P1 R+ T
- * This program is free software; you can redistribute it and/or
% `) M/ M# A }) l - * modify it under the terms of the GNU General Public License as2 D/ U9 I& X2 K8 n2 Q
- * published by the Free Software Foundation version 2.
, H6 m* q/ I2 u3 R - *4 M% r# _2 G3 L+ ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 k3 p: I1 {7 {6 K) _, F: o - * kind, whether express or implied; without even the implied warranty
) Q, ?; }3 h/ _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 j4 F2 b- r6 ?9 t5 x. D9 b
- * GNU General Public License for more details.! y9 x: _; C) M$ p/ w
- */
$ S6 M5 K" ?: G+ m, R3 _
. H! ^ k7 W' ~. i2 h- #include <linux/module.h>9 K' S9 |2 U5 A1 E2 {
- #include <linux/init.h>
6 V+ e# Z3 Z1 x" s - #include <linux/errno.h>
- U# f; h1 m; x( V I$ g - #include <linux/types.h>
, J: U' a* f2 x% ] - #include <linux/interrupt.h>
% \, W) b4 h; F& w - #include <asm/io.h>- C4 V2 q# {" y8 U. K& C
- #include <linux/moduleparam.h>
* P& S1 W) v8 b - #include <linux/sysctl.h>$ c0 |1 P, s# L- C
- #include <linux/mm.h>
; E' K8 M. @8 ^( J0 @ - #include <linux/dma-mapping.h>8 y0 Y2 v4 p! ~9 i2 v5 Q
- , [" L( v0 P8 X( O0 M; \
- #include <mach/memory.h>
% a F+ s- {% w, _: l - #include <mach/hardware.h>
6 y3 a0 B3 K$ M! K6 g9 _ - #include <mach/irqs.h>
. g, f! V8 v% e ]5 }4 i7 x6 } - #include <asm/hardware/edma.h>+ K$ b( a$ V$ m
3 Q; v7 p: t% e1 x. n- #undef EDMA3_DEBUG, p! T+ i% X1 n4 X
- /*#define EDMA3_DEBUG*/
2 s# ?3 \& R3 C" o, {/ ~
# m/ Q$ @' U0 K! w1 S8 I# Z- #ifdef EDMA3_DEBUG! t, n3 o, }$ o# y- L* S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! L% { J9 |, g! C# H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 ?: l' U: x6 D7 ~! W. A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): d! t4 Q- |& ^, {
- #else
7 O n3 A6 A- b* V/ o1 p - #define DMA_PRINTK( x... )
; [2 l; i1 [# `/ J - #define DMA_FN_IN
& j* F+ g: Y/ ?6 S6 g - #define DMA_FN_OUT
3 R: x8 G+ g) J5 K7 B* N# ^ - #endif0 |- \" e0 _$ D1 B5 y1 w
- ! V& X, d# ^' |, C, b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& e9 ]$ w& o% X( ~2 A" H8 {! }( O
- #define STATIC_SHIFT 3
7 x; S j, z% g! n. A' u& n# u. p* k - #define TCINTEN_SHIFT 204 h! i* _- a, H
- #define ITCINTEN_SHIFT 219 h1 @0 {# I9 o% N3 I! M( [
- #define TCCHEN_SHIFT 22
( X8 C5 H: s' t* |; Y - #define ITCCHEN_SHIFT 23
; y$ O7 N4 e6 H0 j* _+ }
- R! O5 T. w$ `3 n0 O3 P* Q- static volatile int irqraised1 = 0;1 p l) s2 I4 F) j& J1 a
- static volatile int irqraised2 = 0;3 Q. |! H+ h. `1 U. t! {
9 r# F' k2 }( n9 ~, `, o& X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% z' O! }) J5 D- J3 w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: O( A% t7 k) j; o% \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" A3 D: ]! W8 J9 {, L; M$ U - 0 o$ `' H: R! O5 {7 c4 Z
- dma_addr_t dmaphyssrc1 = 0;% Y3 o% }, j! Q9 B
- dma_addr_t dmaphyssrc2 = 0;( C. o; x; g6 x9 E. I; e1 S
- dma_addr_t dmaphysdest1 = 0;* \# B! U: K6 u1 ]6 E) e
- dma_addr_t dmaphysdest2 = 0;2 y9 ^( i& e% u- ^1 `; O
- & Q5 [! @8 L0 k0 H
- char *dmabufsrc1 = NULL;
& E) o3 r9 l; k - char *dmabufsrc2 = NULL;+ D7 ?( {7 S7 N% k6 ^& `, K
- char *dmabufdest1 = NULL;* t6 L: s" m8 \: C
- char *dmabufdest2 = NULL;
& K/ g) |9 W$ c6 N& C! k2 P6 j: Z
* n. U6 Z7 c- d3 i" S! r2 l- static int acnt = 512;
! Z; e! @; [: r1 C5 D$ R - static int bcnt = 8;
5 N7 N7 y! s' @% c - static int ccnt = 8;
+ `3 x: I' |+ {7 g
x9 K H+ c) N- u5 y- module_param(acnt, int, S_IRUGO);
1 E k4 D4 X8 X- h O - module_param(bcnt, int, S_IRUGO);0 s7 v# t& y [
- module_param(ccnt, int, S_IRUGO);
复制代码
] s6 Z |, l& G6 V- S: i3 d8 j7 f/ @7 u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ |+ `2 V; b9 g/ k) }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ H/ b/ g6 y3 y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' E% S3 v( V! n: ~. H+ l" f1 V. R1 ~" A# d, r P5 z% f
- d+ C* v0 a& H0 A3 f' t
|
|