|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 F- X% f* O) w8 X7 y/ M0 _- _
- [code]EDMA sample test application- T- m- W! e% f+ T
- /*
( L* G" w- t2 J - * edma_test.c+ L1 r* _! x$ @# D9 C9 j
- *
: z" I' O: F- @# W2 e/ L& S - * brief EDMA3 Test Application
/ e# i) S( N, N" S# Z - *
( | }. _' Y9 ?3 I+ o* j- c - * This file contains EDMA3 Test code.
9 C( |5 G$ N g' k - *
h+ V' G/ T4 E: p; ?3 Z! l! M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 H+ p+ u2 f4 E$ u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ C- A! i1 s6 {, [: e* H" s( n- T( \ - * TO CHANGE.6 q! q+ u% c# Z0 u
- *
" Q: P, e2 ~3 a. `! \4 l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( i. g% {2 A+ F8 a' g' I7 Z - *" ~7 V& U* b* m1 T. P2 N
- * This program is free software; you can redistribute it and/or7 \! a: l+ X0 j# X: f
- * modify it under the terms of the GNU General Public License as: h) F( R$ w' T/ l- _
- * published by the Free Software Foundation version 2.& T5 _/ w0 G$ `
- *( [# D: E3 E' U8 p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 h$ k5 h# G8 D0 n9 f - * kind, whether express or implied; without even the implied warranty' Q: g- [1 }0 K1 K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 F) X& L" ^& d - * GNU General Public License for more details.& T; s v4 m" @1 ~1 U7 K# u
- */. J# u5 {% r; z+ E! Q
- - Y. k. Q3 c9 v2 p: [ p
- #include <linux/module.h>
`% v( \4 N7 w2 c( N - #include <linux/init.h>) K% T3 Z9 ^+ w* V
- #include <linux/errno.h>
8 j0 h/ j; i, k$ l1 V - #include <linux/types.h>
' S- u# S. }/ X2 N) c - #include <linux/interrupt.h>
' s, Z. \2 D# _& `- @$ | - #include <asm/io.h>' H. g0 W# ?8 F* e2 k A8 e4 F
- #include <linux/moduleparam.h>' g! N' L+ G4 |6 f1 I% Z
- #include <linux/sysctl.h>- u% e+ V# L3 k8 N3 ?+ f4 ~
- #include <linux/mm.h>
+ g2 ^8 R9 D) o2 J8 F - #include <linux/dma-mapping.h>% i6 P* S# l- w1 [/ P! s3 ]# G
- / M% l5 H7 k5 u+ o" G' D8 `
- #include <mach/memory.h>
! e% i7 ^1 f. @1 W1 Q - #include <mach/hardware.h>. Z, I8 Y( {7 }) n! p; y
- #include <mach/irqs.h>% L9 w9 X+ ]. @! `+ z7 s% _
- #include <asm/hardware/edma.h>
6 U- R. _2 B# K2 c: e1 q$ N - . F4 {) n% g; _2 F, d
- #undef EDMA3_DEBUG
: e) r" k( S$ X& ?' E* P, d - /*#define EDMA3_DEBUG*// Z2 o8 b( {, Y, T) Y
I: x* I3 i3 t, `, T- [6 q- #ifdef EDMA3_DEBUG" X0 k2 Q _2 W8 E& a1 L: S- Y& d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( w+ b+ D: e- Z! g6 {& ^+ V6 S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. }# F' x/ M N8 Y9 Y" M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 U! J* }8 a: N( L) E
- #else
3 h' a; O+ h+ H - #define DMA_PRINTK( x... )
, M0 `9 B2 r5 p4 F - #define DMA_FN_IN) w5 u: f- m6 l
- #define DMA_FN_OUT( Y1 @3 G+ j; j6 s2 U
- #endif
. p: _: I' D+ B9 m' j2 W7 f7 ? - 0 m, q. X& _( Z- \! z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! x3 K7 M! o( h7 u
- #define STATIC_SHIFT 3
$ x$ g# m- H/ R4 {8 \ - #define TCINTEN_SHIFT 20/ C9 `$ b& X7 ]
- #define ITCINTEN_SHIFT 21' Y4 a; X( F8 W5 A0 ]* n( p1 M
- #define TCCHEN_SHIFT 22+ d- m' ^3 m9 Y: L( x
- #define ITCCHEN_SHIFT 23
2 r% Q* v5 b Q
4 s9 G6 _9 J" I. J) z6 }- static volatile int irqraised1 = 0;
6 u6 E) m* h' N4 S( w* P1 t; p7 O/ p$ ` - static volatile int irqraised2 = 0;
Q* z3 M, p" d - & d; s( g! P1 J! W$ v+ Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, `5 [6 N0 _( ]1 z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' P" C2 D* \5 I) J4 u( j! n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! d4 W7 r N+ ]1 ^# [
- . I3 Q2 Q; s& M% b
- dma_addr_t dmaphyssrc1 = 0;; y5 \7 w% _4 |% S* v, S% M% v4 j
- dma_addr_t dmaphyssrc2 = 0;
. r- i6 r6 d8 q. E* q - dma_addr_t dmaphysdest1 = 0;
8 f( |9 B+ q2 ]& A. c& c; l - dma_addr_t dmaphysdest2 = 0;
2 R* D, i+ ~5 G$ r% h% R - 4 y! M; k& l# G3 P/ F9 s6 ^1 C
- char *dmabufsrc1 = NULL;9 s% U, N& m3 \" f- ^. ]
- char *dmabufsrc2 = NULL;
Z9 ]" G, Y$ } - char *dmabufdest1 = NULL;
& w9 z, \- o* o, S - char *dmabufdest2 = NULL;
* _* h: u/ a9 L3 X
/ P% F: V4 ^* V' V- static int acnt = 512;! v! _; T8 c- S* g: s
- static int bcnt = 8;7 M) @9 r. S( [$ Y/ C
- static int ccnt = 8;, f" }, _/ m9 u( _, L
: V2 @. m! E* s+ Y7 Q9 s" z- module_param(acnt, int, S_IRUGO);$ b4 ~* K. q$ b* F5 O) ]+ Q; X" g
- module_param(bcnt, int, S_IRUGO);
$ {' M: S7 O _" b$ r) d) |7 x1 k - module_param(ccnt, int, S_IRUGO);
复制代码
W( ]$ v6 E* ~) M+ y9 a4 P' v1 R; D( J. k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- @1 W/ y( }$ h q+ v/ t! F6 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, }: R: j& t$ `' Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 K. W1 e! ?2 Y& y( Y5 F
, X, z( c* b) f9 w# V/ m
. ^. L& k& D Q4 S
|
|