|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / `8 `% n( }; a+ e
- [code]EDMA sample test application
; o. s' P- }# f6 S3 e3 k/ k" M! S - /*8 U% z& }5 T1 f6 p
- * edma_test.c
8 X: f$ u' f5 t - *& I; Z% W) K- q# e; a7 H
- * brief EDMA3 Test Application- F0 c o* t6 p
- ** `: x1 w7 I) l$ H, z! [* w
- * This file contains EDMA3 Test code.
# y8 b2 O4 f: E7 a8 P& f - *
1 T/ q: V/ Y4 _) K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 q8 Z! f) W6 }" Q9 a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: X) I$ Q7 }0 o2 a( H2 A - * TO CHANGE.1 {3 H2 |; \8 g& c |
- *
" U2 F, F. G- j1 t. D* G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; z( Z" ]8 N: m" a, o. b6 X
- *5 k- N6 Y7 r" R
- * This program is free software; you can redistribute it and/or2 h$ `9 M, H" i( F9 F7 ?7 e" q
- * modify it under the terms of the GNU General Public License as
7 k; Q4 G) q( }( ^$ c - * published by the Free Software Foundation version 2.& x( \' v7 L/ ?
- *
$ ^. A: e& ~. k+ v9 v1 R# g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; D+ k2 k9 B+ l5 h/ Z
- * kind, whether express or implied; without even the implied warranty. S9 |4 F5 I, y) ~# p8 v. u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 x2 i, a$ O% _! O0 A. N$ i - * GNU General Public License for more details.. G2 c& ?6 }5 t
- */4 d8 C, \- C3 @9 y
: O; [0 |* E6 k. p- `5 w- #include <linux/module.h>
7 @* ?$ n8 _/ n. a4 F6 _' l - #include <linux/init.h>: ]. z: z5 x2 t! ?6 Y$ a& ?
- #include <linux/errno.h>" \1 |% l* I2 g
- #include <linux/types.h>
$ L% Y- p; B* L2 B% h% ` - #include <linux/interrupt.h>
" Y Z+ K9 V8 N: G* ? - #include <asm/io.h>
- o( U6 K4 k, Z! @- h - #include <linux/moduleparam.h>
! U& P% t- s0 O1 i3 G4 J* b+ ^ - #include <linux/sysctl.h>
" R; @( d$ Y9 X, H: L - #include <linux/mm.h>
& d; u9 |; b8 X# k9 L* M - #include <linux/dma-mapping.h>. T# i" c+ ?! b+ C3 _
: i1 |' S" }" f* g: T+ {' r- #include <mach/memory.h>
5 l) U) l. T% V, H- m - #include <mach/hardware.h>% I4 b( r* h% K# R$ c" Y" t$ \! d, R
- #include <mach/irqs.h>0 H0 ~& W2 t% x
- #include <asm/hardware/edma.h>
( b. d2 T0 c( }; b2 }4 w3 @9 J9 o
! | m( _; T/ d8 b6 q5 G- #undef EDMA3_DEBUG& }2 T) `/ }& l& e$ f7 X
- /*#define EDMA3_DEBUG*/% c- {5 e0 I% T. t% O" N
- 7 s7 b2 I3 |1 m4 }6 x4 e! G
- #ifdef EDMA3_DEBUG, ?7 `; Y4 t# a6 l0 I; Q) J& Q9 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; V! @% }. N! e! H2 \$ [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 W& y* n3 v3 w# [9 `/ a2 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 l) V' l$ L& ~" q1 U& Y m - #else6 ~. n$ r) U, C9 ^5 g
- #define DMA_PRINTK( x... )' e: z$ u k: s! A3 F; ^8 Q
- #define DMA_FN_IN. K6 t# L2 R$ Y% d ` z
- #define DMA_FN_OUT
+ @7 D( Z% C _0 i: N c9 A - #endif) H2 F0 x- x7 l! a
$ e- i4 I" i: Y# y% y1 e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( D: h. c N0 b; r& }/ a4 |! B+ S
- #define STATIC_SHIFT 3* B* P6 Q) _, h1 _" [
- #define TCINTEN_SHIFT 20
/ p, W9 }9 O6 ?+ v- v8 T, E2 X - #define ITCINTEN_SHIFT 21
% S! B1 n! P; K1 e - #define TCCHEN_SHIFT 22
+ _! V/ s1 \1 D1 s' W - #define ITCCHEN_SHIFT 23
0 _* l( R/ C' u. _! o
- h+ V3 s2 m/ u+ {- static volatile int irqraised1 = 0;
! O/ n6 `6 H# w1 r$ o6 D+ B - static volatile int irqraised2 = 0;; n7 G& L! ?8 ]. {
+ A! l7 U$ {; ~* ~% g2 `; g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; B# i# N$ L. |: i5 T5 N9 F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ X4 b* J5 w1 L; \3 T3 B; j3 t9 M. } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* o+ t9 S0 E0 v( }) U
- : {" e" i; d! t. t- x1 z
- dma_addr_t dmaphyssrc1 = 0;! w W3 ~ ^& K2 ?5 v* t5 H2 l
- dma_addr_t dmaphyssrc2 = 0;
3 G. v& r. Q, v3 B( H, n0 Z - dma_addr_t dmaphysdest1 = 0;% Q' G: c& q6 e) k
- dma_addr_t dmaphysdest2 = 0;- l Q& F' Z& h" ~* c6 ]" N
- 6 S; @+ ~# r# w/ W5 l. h; m
- char *dmabufsrc1 = NULL;( e" J* n: J# K: f
- char *dmabufsrc2 = NULL;
9 J- W9 |9 `/ n9 Y/ } - char *dmabufdest1 = NULL;0 }, z- e, R- {1 b& P
- char *dmabufdest2 = NULL;
/ {/ Q+ M* }9 a" m& Z) H
4 p$ t8 O9 V/ u7 Z- static int acnt = 512;5 y6 h( N7 r7 f; N5 I3 A' c
- static int bcnt = 8;
; H0 g1 g; U1 k - static int ccnt = 8;4 L+ v! M/ t6 t0 Q$ c
- ; |- I3 O0 d2 Y" z: f3 v
- module_param(acnt, int, S_IRUGO);9 r7 b( [* e& G2 {$ w8 d3 v
- module_param(bcnt, int, S_IRUGO);
1 u5 x. k# m5 ~ V/ f0 J" k - module_param(ccnt, int, S_IRUGO);
复制代码
) I" i! e' h* v7 @( L% c: K1 I9 u2 e p5 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, l, Q; c& f. l& `2 ? @2 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# @3 P) h! I0 U5 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" N, ?4 G- t p
( Y) Z4 g0 P0 C. W6 w) z$ R7 [5 @3 k. x, u( f4 N+ c1 r) d* A- r# G% _' A
|
|