|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& e W0 `. L$ j: M! ~- [code]EDMA sample test application1 n$ ?- a3 w- g. {
- /*1 S* H/ T J/ p: x+ ]* W# J6 L9 ]
- * edma_test.c- p8 S/ [9 J3 Y
- *
" ]7 p# u. `8 V - * brief EDMA3 Test Application
, [4 d- e8 S0 E! o - *
) b6 G% B7 L2 J - * This file contains EDMA3 Test code.6 ]5 F- l7 ^/ K, B$ `% p
- *
3 v0 K2 a. u6 D! b, ~* E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& @$ L4 z7 A& ]- [( s6 P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 @, g/ l" D, Y% x) O - * TO CHANGE.' P0 p4 u: t0 J# Q8 A4 z
- *
1 g! y, x6 V7 e: t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. f& K! c+ {- E- T% p5 H - *
8 q$ `+ g5 z$ u9 u' { - * This program is free software; you can redistribute it and/or! U$ Y) L) j% X" m1 y8 u3 X
- * modify it under the terms of the GNU General Public License as
& }: h$ V% R# F+ V [2 c2 W - * published by the Free Software Foundation version 2.+ B$ X* T0 Y# @8 G
- *1 z0 \+ T* q; y; C+ _+ B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ V- d2 y" B2 ^ [ P& a- Q+ z
- * kind, whether express or implied; without even the implied warranty" N* c7 m ?4 O8 p* l: F) B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. V, U2 C. ]' B6 C& C' X* i1 D4 s - * GNU General Public License for more details.& @. r" w, Y. |3 s5 V
- */
" @/ `! W; T1 D9 e8 g$ f+ w
i& X3 \+ K' q) d) Y- #include <linux/module.h>; h% z6 L; O) b; X0 Z4 u* [; T: _
- #include <linux/init.h>
: V) D) b# y3 X( E. D - #include <linux/errno.h>
& ?* F% V9 d8 K! E- D5 t1 X$ H - #include <linux/types.h>
6 \' [ A; l/ f/ ~' b* a' A - #include <linux/interrupt.h>
! v* R5 S; w$ _& ?$ p0 D - #include <asm/io.h># \4 _" z* n, k9 g8 J/ g
- #include <linux/moduleparam.h>! A: O% ?2 y: {# L. k. o
- #include <linux/sysctl.h>4 n9 {9 c, J8 A a
- #include <linux/mm.h>
7 s# l# ]* X4 |: \& P0 |9 | - #include <linux/dma-mapping.h>
* n* |7 m# H2 K3 l7 U5 f - . W! i/ S) X6 t; S- n j
- #include <mach/memory.h>0 s9 Q& M) F* I2 P
- #include <mach/hardware.h>6 d( e- h( U3 P' d
- #include <mach/irqs.h>, ^2 X. d/ ?$ \( {5 e6 b5 n: @
- #include <asm/hardware/edma.h>1 [. N* a# `0 c9 r) l7 A
- 4 {8 Q) X& h, v0 j: B
- #undef EDMA3_DEBUG" c: J3 |8 d( X) C9 J1 c6 J' M
- /*#define EDMA3_DEBUG*/( a X1 M. ^" |: f" `8 s/ m
- 8 y4 F+ ^9 o5 V L
- #ifdef EDMA3_DEBUG! ~' M/ x9 u' ?% t" N7 T) }3 M C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ T. y: Z6 X4 \9 M8 x! D: i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# t6 w& |9 X) R- Q4 l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* F/ d, P- ^. A7 N* k+ s4 l/ ~ - #else
+ z# [: q5 K1 [- U+ J! H1 ` - #define DMA_PRINTK( x... )1 J) K2 F" Z& Y6 {4 r8 H
- #define DMA_FN_IN+ A; U3 J% |' C* @( p( Z
- #define DMA_FN_OUT# S6 v' X% l9 j1 G
- #endif! S, ^( _7 j/ f ^0 Y0 g, P' L
/ _6 F3 t* t m6 f' j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* ]) [6 {4 F" `" e0 f7 h* X - #define STATIC_SHIFT 3* J3 E# T" V. u2 F$ q" r
- #define TCINTEN_SHIFT 205 }8 U5 N; a; u( G# p7 o1 t
- #define ITCINTEN_SHIFT 21
7 p1 v) L1 P! n! T - #define TCCHEN_SHIFT 22! A; w9 Q! B4 c& o) [4 @# v7 l
- #define ITCCHEN_SHIFT 23
% S2 ^5 p: {; ~. Y; M1 R; ]" T
: _ j5 U, j# B- static volatile int irqraised1 = 0;7 Q; e+ ? b9 F
- static volatile int irqraised2 = 0;
. i' t+ H) |! Z7 Q. h5 e1 O( P - . s/ w( ?# L+ b: P) ]$ d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
j& E, M$ M. P ~1 c& X e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r d' j; h; E) q+ b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) H# g( H) N( {* k$ J( K6 f
- . M& _4 Y* e5 `+ U- y* s
- dma_addr_t dmaphyssrc1 = 0;2 ~; ]% z1 Q4 ~/ D
- dma_addr_t dmaphyssrc2 = 0;
8 D1 t# p$ u; E7 Q! I - dma_addr_t dmaphysdest1 = 0;& d- r6 \+ F% e; O* Q3 v
- dma_addr_t dmaphysdest2 = 0;8 N% Q( k) Q6 \9 i* @
( h: r. T4 R/ i( r- char *dmabufsrc1 = NULL;( |0 H6 e2 c* P5 y- G' a& A9 c. t. C
- char *dmabufsrc2 = NULL;# n6 ~) }$ W \' k+ {9 e
- char *dmabufdest1 = NULL;
8 o- z* q% F! `7 Z+ ]5 }: a: H - char *dmabufdest2 = NULL;+ `1 s% [8 Y; ]0 N: @% r
3 U) I! T; ^: A$ q- m7 r' f& @7 Q8 g- static int acnt = 512;" s4 q! [# \# L* T
- static int bcnt = 8;
) J& d u5 g% E! I, ] - static int ccnt = 8;2 Y1 R% z( a, [6 I
- # o! H l1 [; j9 u1 i* l% c$ b
- module_param(acnt, int, S_IRUGO);7 ^ K7 m K$ h/ D9 [
- module_param(bcnt, int, S_IRUGO);
! ?0 |# v" ?9 V" o# Y - module_param(ccnt, int, S_IRUGO);
复制代码 1 B6 W* x4 h0 p# n
9 N/ D7 Z9 C- W7 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, b x# w' d" d+ m, }. b6 q% P I3 f' i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 C; Q" C. C7 P6 H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 {! h9 c2 v3 b: S' m8 u4 M0 s& q
[* { F+ I% K* Z
$ m4 f8 n, v1 j! ~ |
|