|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 u, \4 d% V6 ^
- [code]EDMA sample test application8 O1 z) s4 E% @6 ~
- /*1 h; }& Q5 m" j: k9 t
- * edma_test.c
- R- \- Z) |9 w5 X9 x - *
( O3 r; M @. j4 t - * brief EDMA3 Test Application5 c5 A" U$ R% b* e' a
- *4 ?: F+ F1 u& p
- * This file contains EDMA3 Test code.
! x/ o: N. d% ~/ ~1 ^ - *3 B4 [! b* z0 [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, d T! d: w* Z- S i: r7 t2 @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 n* ]' J8 v% \& k1 k) l3 c - * TO CHANGE.
G' R% q% v* k4 [2 T - * L' `% }: w% b4 g+ s! R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 H: u! x0 |! d2 K; i - *7 R: [0 H% `; b6 ^; n0 w
- * This program is free software; you can redistribute it and/or
$ M. j* m* e# T" e) D: ~$ M2 {3 Z - * modify it under the terms of the GNU General Public License as8 I; V* R# s6 m9 M# U
- * published by the Free Software Foundation version 2.( P! S( U- W& z/ }
- *, Z2 \5 ]3 i! E- D' n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 @1 ?0 _+ [- t
- * kind, whether express or implied; without even the implied warranty
& J- a6 z) s/ [% d9 C* g- t) o2 D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 ` V/ z( s6 V - * GNU General Public License for more details.
. K; Q1 S% }5 @ - */
& v6 S1 k; W W9 l
" S/ `: D% n, `( I0 f+ R6 k: U- #include <linux/module.h>& t5 G! s" b" G# \' L( ?$ e
- #include <linux/init.h>% v; m9 x. ~# J* P' d9 b
- #include <linux/errno.h>% P6 L7 I; Y7 B. v$ G/ x( o
- #include <linux/types.h>
* [$ v& F) ^7 H - #include <linux/interrupt.h>& h5 s$ R: z8 K/ y6 l
- #include <asm/io.h>- h5 G% L+ r' I2 H s" [+ x
- #include <linux/moduleparam.h>6 y- |& V2 j# R; p( y/ P& a! m
- #include <linux/sysctl.h>% ]8 \2 {. m$ J# }+ n: H- ^
- #include <linux/mm.h>
0 j% h! X" ^; G8 _4 N - #include <linux/dma-mapping.h>) f5 l9 }+ x# y# w" t9 f/ |
- 4 r- _3 x( V/ s& R9 w/ D/ [
- #include <mach/memory.h>$ G3 @' l. O+ `! G7 @
- #include <mach/hardware.h>$ l& l# o4 L* V
- #include <mach/irqs.h>4 Q7 e& e3 c7 k& J4 d2 l$ A# Q
- #include <asm/hardware/edma.h>) T6 g, g; g7 ^" o( J( ]
# d4 k. \+ Q& y% i b6 r8 m- #undef EDMA3_DEBUG, n5 e* c: \4 I9 a, p5 b" j% f
- /*#define EDMA3_DEBUG*/1 d1 j2 d$ g% H( C( Z3 V
/ j2 `& D8 R+ T- #ifdef EDMA3_DEBUG
( L% X8 M" A4 b" W% K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 c* _! Z, B. q F$ k! l, n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% t; r4 U1 ]% S0 \- [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" m3 y N2 _4 x% F, f5 V - #else3 H+ S, j% D4 C7 m
- #define DMA_PRINTK( x... )' X" o. y! D- ]5 i; ?" _
- #define DMA_FN_IN1 i! P5 G4 Q# D0 c
- #define DMA_FN_OUT6 R' N9 p1 A' [, e9 u; D; I% a
- #endif
3 A c. d) Q1 L4 m2 _& W% W! v - 4 t/ S9 z" Y6 \; N' q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 Z( \4 t& J+ r: M! O; {8 t - #define STATIC_SHIFT 3
. ?, t6 `* \: k6 @" q# C* e - #define TCINTEN_SHIFT 20
8 p8 S6 `: M% w1 k2 T - #define ITCINTEN_SHIFT 21
+ B4 L- V4 ~& b) H" @0 F - #define TCCHEN_SHIFT 22' P( {; I$ m" p! ^
- #define ITCCHEN_SHIFT 23
! {/ C. S3 z! t - + q# Y7 s( c- ]+ }0 T
- static volatile int irqraised1 = 0;
0 [( a% q! E4 Q, I7 L$ S - static volatile int irqraised2 = 0;
2 r" x: e; q9 J6 m; D3 M - % D: J- x0 ?9 R3 x" l5 J& A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ~% A" b) K2 I) D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) S! ~% A1 L) F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
v6 W7 l5 A" T8 W+ T' |
! Q# m! T% x& O- dma_addr_t dmaphyssrc1 = 0; D+ r7 l1 [1 u$ P# X
- dma_addr_t dmaphyssrc2 = 0;, J- k. e- q0 p. {, o. v3 N
- dma_addr_t dmaphysdest1 = 0;( l/ X! `" [7 w; B
- dma_addr_t dmaphysdest2 = 0;! a7 }6 D2 }, n
2 f3 Q) K7 j; [) ^- char *dmabufsrc1 = NULL;
) K$ C+ X. o1 E4 c D' W6 \* x - char *dmabufsrc2 = NULL;- w, [3 ?& A, V2 d5 l
- char *dmabufdest1 = NULL;2 z F$ v$ n F" W
- char *dmabufdest2 = NULL;
}5 ~" l G/ ?6 T% X
. U( K+ i) N( X$ C: ]/ i- static int acnt = 512;
, f7 D2 Z% o9 s) w" ~: h' w - static int bcnt = 8;
7 u' v7 d4 z: K, I# f - static int ccnt = 8;8 R& y( d" a$ l" q2 f
- 2 R9 L: H$ N: H; a9 Q! H
- module_param(acnt, int, S_IRUGO);/ S, g H1 ?7 H3 V- G
- module_param(bcnt, int, S_IRUGO);9 Y) v1 G; ] H* R* p% A: {" q
- module_param(ccnt, int, S_IRUGO);
复制代码
, c- p) n* u- g8 ?+ ]3 r5 g& d& G2 h4 r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) {! B7 D. a2 {& F$ f9 p( ]
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 y- {; u0 V: j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 ]) Q% W" u& G2 G3 }. I( ?; N
0 R j' F, O5 u' \7 G9 \0 x1 U+ s) \. U8 i
|
|