|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 `; b' d4 }+ t+ f' d2 K3 {- [code]EDMA sample test application5 X) b# r# D9 b& d: K
- /*% W: m1 v+ I& _; q% I+ h
- * edma_test.c9 ?. l/ u! k, A q
- *& r7 F6 \* _1 n& W' G
- * brief EDMA3 Test Application' K# W S+ @4 R9 ]3 g$ y+ d( ?
- *% {: m; S" X9 T0 r6 o
- * This file contains EDMA3 Test code.( ?# _7 }: c; K1 m& E( A4 Y
- *
) _7 S8 h9 e6 d) _ Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% q+ O* C3 V0 ]) @! `# { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 a/ U3 c/ n! ~7 V - * TO CHANGE.
9 i$ A) M0 ?' x; { - *' ~2 b+ W* i9 l" {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 P$ p9 Y6 O& V7 U* d0 c7 R
- *
, M( |* g2 U6 h# _) S" [! Y; ^1 R - * This program is free software; you can redistribute it and/or& j: w {8 H5 l. f3 d- n0 ?
- * modify it under the terms of the GNU General Public License as5 Y5 z& ^- o5 i5 J: V" @
- * published by the Free Software Foundation version 2.
" K3 P* O3 d4 V; ? - *# M4 I) ~3 k2 \7 @: c* N, B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! ^/ O$ N3 A0 H - * kind, whether express or implied; without even the implied warranty5 T) i6 Z8 D. \% a9 p; {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' }) S! \3 W7 S% u% Y0 Q5 p - * GNU General Public License for more details.
' |$ H) K' N) E% R E - */& v. }% ~ @6 }
- . Q$ B9 A( S S- O2 Z- G" L7 O( @
- #include <linux/module.h>
5 C: r6 T" q6 _+ ~ - #include <linux/init.h>
& J* t! W# w7 ?2 _3 E, M" i - #include <linux/errno.h>
& r5 [; p+ r" ^% ~% A# L9 l: S3 U - #include <linux/types.h>
& Y! ] h1 `5 J3 A V! b - #include <linux/interrupt.h>
|4 X4 E6 l+ a% v - #include <asm/io.h>
- l2 G, I- k& r5 E0 F - #include <linux/moduleparam.h>
9 K/ y! ?2 a9 l! D$ Y7 S7 ~& X - #include <linux/sysctl.h>
" U/ i7 y/ { d - #include <linux/mm.h>3 K" k; e( x2 Q- e
- #include <linux/dma-mapping.h>
( r6 z/ E* Y* g0 D, c+ A" t, n
, A# @7 Q& C% M4 x- #include <mach/memory.h>5 Z$ l# q. t7 M0 `* d. `: f
- #include <mach/hardware.h>
; C8 d' K o, ?% z# v - #include <mach/irqs.h>
; X Z; u7 B* C U) U - #include <asm/hardware/edma.h>7 M* N1 q) v) N- w. b. T& u
( g1 t/ m8 q6 y' u+ B- #undef EDMA3_DEBUG; Y% w7 w! N# U: I6 Q( `; h
- /*#define EDMA3_DEBUG*/
! k) p9 G/ y5 V$ j6 x- ?% l
# @# ~/ j/ I; O+ R9 h- #ifdef EDMA3_DEBUG- | H4 N, e( A% L0 u5 y/ i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): U5 [' D; C% `- w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 d* h8 M( Y) l: Z: R3 t3 N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), D" ^2 m: ~ [% x: e
- #else% A% I: O8 W0 o, ]+ f, X" j
- #define DMA_PRINTK( x... )# ^& Z# ]4 r5 U
- #define DMA_FN_IN ]# f# E( K% S
- #define DMA_FN_OUT
& }6 V& v& P, p0 n; h - #endif
! M; A4 n1 U8 e6 O# e1 f P+ A
: c3 T: Q# F, j2 F4 i4 z! B$ ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) Z) r+ y7 M: C" S* X) o! A5 K* F
- #define STATIC_SHIFT 3! @1 Q/ M( U' W t9 a H) C1 N# U
- #define TCINTEN_SHIFT 209 h# B4 |0 q3 _$ P
- #define ITCINTEN_SHIFT 21, n6 g6 @% C+ F' u' C* b" g
- #define TCCHEN_SHIFT 22
" N" z, ~- e: ^) z7 w - #define ITCCHEN_SHIFT 23% L/ a# j0 n( }- p4 Y; `
- ( a: f* S" U" A. B
- static volatile int irqraised1 = 0;. ]4 H4 M$ ]0 x2 W) l# E3 n) \
- static volatile int irqraised2 = 0;% Q7 N% y7 A5 l& x% P" l. ~
7 J3 @% a: [3 O2 n! F9 t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 b1 f" b! x2 Y$ g5 G ~7 W) h! C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" e& `( _9 ]1 H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- I+ V1 p3 i0 o8 j, U8 J9 w; X5 v
: E3 i1 X3 [8 R7 P" s z, u- dma_addr_t dmaphyssrc1 = 0;" q$ y4 U- r" ?
- dma_addr_t dmaphyssrc2 = 0;
9 t- X" g) {: T8 | - dma_addr_t dmaphysdest1 = 0;
, I; s& Y& z; u2 A - dma_addr_t dmaphysdest2 = 0;) }* J& @) R+ {( N! F8 G s
- , J! c" d+ y" ^) S; Z9 y1 v* o% k& o
- char *dmabufsrc1 = NULL;* g t G. I: \8 \. O
- char *dmabufsrc2 = NULL;$ K& F- [" J9 ^/ p1 {
- char *dmabufdest1 = NULL;
. U, c: o( V/ Q7 m0 \5 v - char *dmabufdest2 = NULL;6 n/ A& B, a! k; {( w {5 B
- E5 C) r2 @- | C- static int acnt = 512;6 I! n/ b+ `! G$ M
- static int bcnt = 8;3 u. f& l1 d( H- j5 q. B
- static int ccnt = 8;/ r' B( p! v4 D. r, k' Y! M
: a; N9 Z! u6 N# S* ~" k( x! W! c- module_param(acnt, int, S_IRUGO);4 K5 e( A' m6 X5 E7 Z
- module_param(bcnt, int, S_IRUGO);1 l# K5 y8 B# {
- module_param(ccnt, int, S_IRUGO);
复制代码
8 |* [/ D+ s& r1 Q7 P) E' c1 d* E; C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* M% Q$ q- g9 r3 k" A/ Z6 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( J( m: |. A) w& X8 [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) y7 l, j1 i! `7 {' f+ U; u8 s! E3 \7 }" [1 S
@/ y E' `% ?# d+ ^
|
|