|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( e0 l0 N- [! p8 Q; A( X- [code]EDMA sample test application2 H' [+ v5 V& ] k# [: C" C; A
- /* B. z, q& @% x/ O
- * edma_test.c
4 Q0 R4 |! y! Z2 Q1 O# w9 A: y - *
6 r" o T& G; c+ o1 ` - * brief EDMA3 Test Application
1 G- r: D" k$ @1 p* o2 n - *6 c, T+ M! I% ~
- * This file contains EDMA3 Test code.1 }) e+ P3 h* Q
- *
0 q* z' _( p+ l% A. k0 ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 o2 u) h! l5 j+ N- v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; W+ E8 _. a$ Z
- * TO CHANGE.
$ O* w s+ E" R ]0 q& a - *
+ i; {' H+ p; c% v& t* m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, u9 D) l% C* \- }8 v
- *
2 ` Q& U% t1 h - * This program is free software; you can redistribute it and/or2 w5 q& k! ]/ F7 z) X4 ~7 B, D
- * modify it under the terms of the GNU General Public License as$ t2 S. ]9 g" P( C3 h* o1 m% S
- * published by the Free Software Foundation version 2.. e8 K% q. d/ e1 @ o, J9 Z
- *
& K# S: d+ @0 v; h$ D' J! ^0 X' Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. s Y( k# y1 @. O
- * kind, whether express or implied; without even the implied warranty" i6 l8 y9 r Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ d2 P1 ^$ _0 i) R4 g
- * GNU General Public License for more details.
# v& }# E# T) b - */1 y/ F$ o! D& T7 b/ s- w
. e A" [8 t0 ]. t% l5 S- #include <linux/module.h>, f, K Z5 W# R& v! X( R
- #include <linux/init.h>) T( S5 ^) V. c! [3 u
- #include <linux/errno.h>
( K: S3 i4 ^- w& I/ Y - #include <linux/types.h>( P' [/ ~4 F: m; p
- #include <linux/interrupt.h>. [' h, b9 [: h6 {$ v9 `4 L
- #include <asm/io.h>
2 T! ?& D$ @6 `/ c# s - #include <linux/moduleparam.h>
8 _# _& E( E% e n; W: n - #include <linux/sysctl.h>& K% z0 ?) G; C. ~# d
- #include <linux/mm.h>8 U9 c! b9 s5 a4 w: ]
- #include <linux/dma-mapping.h> E4 L$ H& A9 J+ n+ M5 ^3 p
* N6 ?' R2 t9 E7 p& p5 z, h- #include <mach/memory.h>1 Q8 u" |) r) u- A! `6 {; s
- #include <mach/hardware.h>7 X8 ~) a( Z4 ?2 I( f
- #include <mach/irqs.h>
: l( z. x- n/ s% p" \* M8 H8 z - #include <asm/hardware/edma.h>
+ N$ R! r6 Z ]& i8 D
% `$ [4 T+ s8 f* }0 w D- #undef EDMA3_DEBUG+ j, m9 H* A) n" e
- /*#define EDMA3_DEBUG*/
. p& Y) Y% x1 y - & P0 U" Q0 [0 T! I j( D! ]/ s
- #ifdef EDMA3_DEBUG$ a0 t. Y' z3 b7 `- ^ e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ X/ U( [2 O) A. c J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! { Q: v1 h& I& ? r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 e2 n) _2 E u% i9 E$ |0 b - #else* n! r; E2 X9 ]; u6 m
- #define DMA_PRINTK( x... )" p0 \( o4 ?/ _: @0 n s
- #define DMA_FN_IN
, g& S; N; m! I1 ]; ]( o9 C - #define DMA_FN_OUT
* E9 x8 F, W% o2 p& k - #endif
5 B: M& E0 x _6 t e% X4 x - 4 `( n' H- V2 H# I& d# s) F! q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& s4 P4 \- B) a
- #define STATIC_SHIFT 35 P6 r3 ]# Q( y0 M G1 a
- #define TCINTEN_SHIFT 20
3 @. N7 x" i& H' n - #define ITCINTEN_SHIFT 21
3 E) O% l2 u( V% V0 w! m4 q - #define TCCHEN_SHIFT 22
; X- s+ i$ S- ^* K: A7 q - #define ITCCHEN_SHIFT 23( P' d$ x3 _6 @! f, H9 w
2 `& V$ S' y; E0 u w# x @- static volatile int irqraised1 = 0;
1 m% l& G n5 ? - static volatile int irqraised2 = 0;" D2 B r; P. F. R y
- : H' I3 {8 @+ @& q; l0 n# B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 W; n/ H/ U" e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, x9 |; \* B7 O! O* n3 f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
u& g" _1 b4 p - * d, `& e0 X5 Z% Q
- dma_addr_t dmaphyssrc1 = 0;
. a/ g* g* W' f5 h6 c8 i( K - dma_addr_t dmaphyssrc2 = 0;
: `* ^. }) Y" T, v3 O - dma_addr_t dmaphysdest1 = 0;
- C; n4 G& }0 H5 L0 W% i; l% i - dma_addr_t dmaphysdest2 = 0;; Z7 V0 T, B+ }5 O1 ]4 a1 |& `
- ! k* _" p$ L9 o# Z
- char *dmabufsrc1 = NULL;
( S2 T( ?& e8 b7 n; G1 a4 j - char *dmabufsrc2 = NULL;
" k" t9 O# l$ J4 f& k( E - char *dmabufdest1 = NULL;
0 [" Q7 d% p4 K- H5 B - char *dmabufdest2 = NULL;
' `% J- L n" s; a2 J - 6 u- v! Z {* P( k0 U; @
- static int acnt = 512;- Z3 e- L: r& |( d$ ^
- static int bcnt = 8;+ d: T0 Z: j0 n2 W, j
- static int ccnt = 8;- B, W, C: Q2 s& u6 P# H
- 7 j% Z7 Q/ }7 Z; F
- module_param(acnt, int, S_IRUGO);
4 j, W& }1 c$ V2 E& ~ - module_param(bcnt, int, S_IRUGO);
) H& z+ S9 x- c/ @* n! Y2 y - module_param(ccnt, int, S_IRUGO);
复制代码 6 {9 B( E* [. D8 Z7 B
0 T- V- ^3 t& o1 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# y' l6 x! R6 @% Y( E* ~8 ?% Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ I. `$ g7 ]7 H8 G3 g$ P' c5 L4 w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ }* u; y6 B4 g: \
" K1 J. X# t Z6 k& K. {: M0 H. \5 _5 O; S# s( R( O% p& p- h& e
|
|