|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( T4 R5 b3 i' y
- [code]EDMA sample test application
* n9 L! ]- z8 Q9 j O& w# D+ M - /*
3 e8 |' J8 U7 Y' H# K& { - * edma_test.c
! J8 Z- m, ?3 _' A5 L7 G - *5 W- R* y+ h' y0 F, x
- * brief EDMA3 Test Application
9 S, ~" G* R$ ~0 n - *
6 [" Y7 S0 z9 X- o - * This file contains EDMA3 Test code.
8 R, D* t& u2 u! L - *9 u7 S, U$ w; g9 O5 w) N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ E4 e+ m: y) M0 W" X" I( U+ D2 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) i- F' p3 e8 O1 U0 h
- * TO CHANGE.3 S( G" Q' i6 l/ T% V
- *7 k' Q2 v; C3 S* J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// i6 O6 X- m! H! U
- *+ g' c) y% ^% q/ n& D2 I
- * This program is free software; you can redistribute it and/or
8 F( x7 _5 q' d* Z3 K' E - * modify it under the terms of the GNU General Public License as
8 _4 ]. a; T, D* T$ L3 V4 m( \ - * published by the Free Software Foundation version 2.
: A1 `7 O0 c2 P9 W% ^6 P - *
3 z3 j7 |/ B* ?/ D8 ?% U' P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& v' ?. H! E$ v - * kind, whether express or implied; without even the implied warranty
6 ~1 G2 I1 o5 n- Q/ J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' A* M4 o' S; \5 }( a% r
- * GNU General Public License for more details.
( t8 e, n. [% P$ p4 t/ |* ] - */8 i7 N/ [6 u G9 s8 o [9 e
- 7 E2 R1 U7 Y& M
- #include <linux/module.h>
2 d5 B8 e: g9 L+ v2 f - #include <linux/init.h>
( H5 x8 i; U4 y& M& U( T" U - #include <linux/errno.h>: y; k) k( L( Z8 B( s, y
- #include <linux/types.h>
5 ~. z5 d3 u6 R A - #include <linux/interrupt.h>
3 Q" d, Z( {- A: j& g! u$ N6 j- U - #include <asm/io.h>
G5 u$ q4 g- w - #include <linux/moduleparam.h>
: a8 h. S9 a' F6 J: D8 G% q - #include <linux/sysctl.h>
6 u4 y8 Z% L) ^* O. u - #include <linux/mm.h>
( E& E' ^$ h6 Z6 ]$ k - #include <linux/dma-mapping.h>! ^2 ?+ e. T, ]; A0 r0 i5 S
- + g+ y7 b+ ^ L$ e8 J, o% F g' B
- #include <mach/memory.h>7 F u7 V1 @+ Z" ]# e
- #include <mach/hardware.h>
6 m3 t% l9 Y- B. v Q5 v - #include <mach/irqs.h>% q' X9 d+ X! b1 x* ?
- #include <asm/hardware/edma.h>
1 z0 d9 Z9 N, l) l
; i' y a) q$ g9 k- #undef EDMA3_DEBUG
! h# |, T) J( P( V9 O3 x - /*#define EDMA3_DEBUG*/% c- b8 ^, Z# r4 a" a4 I
- ' ^6 u1 n- s0 w! V
- #ifdef EDMA3_DEBUG
% X* x# t! D5 I. R8 I# H2 W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% E. b; A/ a V3 V% s; a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ [6 ^' R' p1 n9 D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 T' X& J& ?+ u( R2 z9 \5 F7 D - #else
2 ? J- q `6 _% A - #define DMA_PRINTK( x... )/ v% d& z0 J# S# _# L5 p8 r
- #define DMA_FN_IN
, ~5 v3 S- ~9 O8 `) R" k - #define DMA_FN_OUT
( q# a7 u S. v8 ~* o+ i7 W, e - #endif M: P0 Z2 i1 E. h1 W7 n# r7 ?
b- g9 E, ]) ?* W) \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 M$ L- {- x1 d& t3 r
- #define STATIC_SHIFT 30 Q% A# z. x- x- ~: R( |1 q$ H( \6 A6 f
- #define TCINTEN_SHIFT 208 c( @ }. S. {, e6 B
- #define ITCINTEN_SHIFT 21
/ ?# e# ^- ?+ h6 M1 e2 @$ X - #define TCCHEN_SHIFT 22
+ b/ r- S: W! g/ O4 B - #define ITCCHEN_SHIFT 23
- K( f/ m6 w5 { w$ g - / q( }% e0 a" ^; b9 }0 d
- static volatile int irqraised1 = 0;5 Y$ m( k5 T0 I) _- K: R
- static volatile int irqraised2 = 0;# f; s m+ ?1 }3 r
- 9 O0 @8 E! j6 y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: \, q! `, Y; D! t6 ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# F& ?+ O- N" e8 S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ [$ J; M1 ]! e5 C. Z - * J* j- M2 U% z. W
- dma_addr_t dmaphyssrc1 = 0;7 ?8 B! a ?" y" O- K
- dma_addr_t dmaphyssrc2 = 0;) ~8 \& P0 S+ f% D( s, C1 I: l1 [7 V6 I$ P
- dma_addr_t dmaphysdest1 = 0;: U% B9 v6 C( f+ \. v2 `
- dma_addr_t dmaphysdest2 = 0;% D$ i% u% Z5 W" Z+ j- _& F
; Z3 B$ {9 [2 I1 }. w- char *dmabufsrc1 = NULL;
- i' M$ r( p' U, d6 f - char *dmabufsrc2 = NULL;6 O$ t( T3 @5 s' s; m& D& K6 @
- char *dmabufdest1 = NULL;
5 c3 n9 V M6 \/ |* D$ j+ N - char *dmabufdest2 = NULL;( h' i) s1 g9 P+ x5 P
- & j, Y( j; Y9 @
- static int acnt = 512;
. G1 x6 ?0 l0 d l$ q - static int bcnt = 8;
; M) H& h* g2 w) G, m5 G1 @ - static int ccnt = 8;
/ z4 s4 h8 h6 }% G1 h7 b# g. ^ - 0 @! _$ K" p. Q0 P4 L' B5 b
- module_param(acnt, int, S_IRUGO);; S ^. e( ^4 ^, m; e8 P% S# E
- module_param(bcnt, int, S_IRUGO);
3 b' w9 Q( I# X5 c' t, { c3 Z - module_param(ccnt, int, S_IRUGO);
复制代码
$ R l! j; `% h# h& R/ Y! H5 R9 D! s6 r0 G4 c3 J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
G4 W& c" h2 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) a+ e6 ]* s# X: I+ ? q; k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
L1 E5 e1 p6 d0 e' C3 I* M" R1 {" s! D' x) I4 q
$ g( g7 ^% T8 K% |) r+ | |
|