|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% t2 }3 U, M1 s) b% q& q- [code]EDMA sample test application, k K+ h% o9 q+ ^! ]& D% v
- /*
7 ]8 y: r/ _. h+ l3 U; Y2 Z - * edma_test.c& J% y7 r# o! A
- *
9 X' C' X3 O1 @ - * brief EDMA3 Test Application0 d" {0 b& \/ [% P. e ?0 @
- *+ Z8 L5 k2 Q2 M
- * This file contains EDMA3 Test code.
! [3 `6 P5 R3 V' d1 h4 r - *
! ~: e |( @( w5 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ i- W5 m! x# L: [$ M9 o8 n, l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( Z8 p g5 H' f1 t
- * TO CHANGE.
j0 S7 n3 Q/ q. a* R& C' c - *
* V, U% ?" l0 z4 B2 e9 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; R, F2 H# l- k" H& Y, T [1 [ - * R6 b I: D: j4 c
- * This program is free software; you can redistribute it and/or9 P4 ?8 Z/ a7 _( i ^2 U8 y8 Y
- * modify it under the terms of the GNU General Public License as
/ e {) k) |9 o6 m0 n, g; Q3 ` - * published by the Free Software Foundation version 2.
" W; o+ e( ^* S* ? - *
; b; J0 h+ X9 r" H5 V4 a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 k/ ?6 w3 _3 k7 j - * kind, whether express or implied; without even the implied warranty& b. L5 A- ?2 @" n2 k$ ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 o/ f3 s. t4 i2 D. y, n ` - * GNU General Public License for more details.
- T6 I" v& \( y( a" e- E - */
$ c9 J' X; H' {: \) v% E0 p
' G8 J0 u/ Q( q9 e- #include <linux/module.h>/ R2 T/ J! u1 h7 R/ ]
- #include <linux/init.h>
7 Y5 v3 a, V) s, M* ~ - #include <linux/errno.h> Y7 p8 ~5 G J- G
- #include <linux/types.h>
7 O5 ~/ j, w6 {! A5 r' l& m/ u - #include <linux/interrupt.h>
# E" c# k3 f) V/ ` - #include <asm/io.h>
) n3 r }7 D$ m# L5 ]# l. H - #include <linux/moduleparam.h>8 a6 W/ T4 V f! `- a
- #include <linux/sysctl.h>
; q: Y6 X0 j, D' T& E& @ - #include <linux/mm.h>) e# v) z4 A, b0 r+ ~' ?) b+ Q
- #include <linux/dma-mapping.h>7 _* C. z+ q& @6 ?
* e5 |; [5 R3 z* a! o6 m- #include <mach/memory.h>
) ~; x$ Y! a. s - #include <mach/hardware.h>
. _; R5 ~. }6 c/ ^ - #include <mach/irqs.h>) ]1 B; ]3 u$ H6 `0 j
- #include <asm/hardware/edma.h>! p: L, u! {( _+ [; @& P0 c1 _
- " _: c* j$ F; X: @% I" y
- #undef EDMA3_DEBUG9 ]4 W3 A3 s$ M( o* c
- /*#define EDMA3_DEBUG*/
- Q$ E6 k. t j0 {; } - 2 j8 p7 b0 a2 p4 y) k0 w- `& F% G) X
- #ifdef EDMA3_DEBUG
* F8 j9 F. d; a# s4 K. U; S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 t: V5 b1 ]% t& e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ W! m* E6 j7 A$ Z" b4 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 E2 h2 N: i' N5 B% [2 ` {" s - #else/ E- q# w) ^6 |# F2 m5 W
- #define DMA_PRINTK( x... )6 Y, Z" Y( y$ O- C! e. k+ i
- #define DMA_FN_IN
1 s- i8 g/ ~& e7 c! f - #define DMA_FN_OUT
+ `3 f+ | m V5 l" K' O - #endif
C2 D) v. k7 v" n5 O0 C - / e$ W3 E0 x2 j" d& T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); M5 L& C) t' h! j5 F4 c
- #define STATIC_SHIFT 3; a7 d" O; A# p5 V, }- C! j
- #define TCINTEN_SHIFT 20: L. J8 Q5 p2 e- k, c% T
- #define ITCINTEN_SHIFT 21
$ h I! y' Z6 b - #define TCCHEN_SHIFT 22$ ~3 D6 M0 k7 @, V+ {" b
- #define ITCCHEN_SHIFT 230 N7 W2 g. j/ |: q3 T# e L
: v2 `$ y4 m+ I' k# O& K- static volatile int irqraised1 = 0; R6 U6 R" M! s6 T" w- f% V# @
- static volatile int irqraised2 = 0;
* b7 t: P2 O+ c9 h
1 ?0 C M5 F$ q# O5 P- @$ j4 j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ]( E% [- V" J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' g! b+ }/ p% H$ F1 h" s* t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 U5 i. Y- P9 L# H( q1 a/ E
3 Y" T2 L o8 {8 D# O- dma_addr_t dmaphyssrc1 = 0;* \! y& G; B* \) ~
- dma_addr_t dmaphyssrc2 = 0;
5 B' Q- k9 D; ]; p. o8 {3 W6 H+ v) v - dma_addr_t dmaphysdest1 = 0;
. R/ O' c* r: U& ~% ~8 b - dma_addr_t dmaphysdest2 = 0;
2 M; w. E7 l3 n' C7 |$ z
: I2 \3 n) i% T# b: A/ M1 ~# ~- char *dmabufsrc1 = NULL;$ `& L! N: x" V! J" [
- char *dmabufsrc2 = NULL;
r0 ?: e$ ~# t# t% @! x2 k - char *dmabufdest1 = NULL;
7 {$ y' E- o7 Q( L! l% a - char *dmabufdest2 = NULL;
5 ^6 U) K, l6 L* m1 V" d* A6 V - # K* U5 [5 j$ c$ b- [ R
- static int acnt = 512;
6 }; P' m1 X0 h - static int bcnt = 8;9 N" d# X/ n' Z X0 o7 E+ F
- static int ccnt = 8;
( n. c' a8 r8 N1 R - : a: @- g% o* G* @7 F
- module_param(acnt, int, S_IRUGO);9 k, P0 b& ]) V3 Q) E& r
- module_param(bcnt, int, S_IRUGO);7 `8 |/ ^ S% t6 V+ y4 g; x
- module_param(ccnt, int, S_IRUGO);
复制代码 & c/ F9 ]' G) b$ o: i4 d! T
) ^4 s1 }) `0 N! Q8 x$ P9 y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ x% q- n5 f1 I% L" C) x& O: larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: X# B) f6 }, L- M3 j" U8 C) B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: c* X/ k( T" m+ x; U6 J
7 ~9 g" H- S( O6 w1 x
% [ `% B" {6 p& Y8 Z/ U! S$ `! j |
|