|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# D/ `, A+ P$ [3 g4 i; D- f- [code]EDMA sample test application% @( z% _+ b0 {/ C( d, S
- /*
, F. X. {: @0 m+ o! x. `3 J/ i - * edma_test.c
! ?0 a+ d6 ~( x- u( S - *! k0 p; m% @- p: i8 j1 \
- * brief EDMA3 Test Application9 d6 v) i- l: X% k _6 z- E. j
- *0 D r: Z4 H1 W/ k$ H8 z1 ~- K4 \
- * This file contains EDMA3 Test code.
. `- ~( J# \+ a+ P - *
* P; s* S2 I9 X9 t& ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, I3 w# l0 {0 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" r1 D# S* v |- T2 W3 W5 D
- * TO CHANGE.
0 q- ^' \7 ]3 D! T/ \ - *
7 L. q8 y# {- R, [6 e' B" V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 V4 w/ c" o' `" f# k I
- *$ ?9 s6 P% L6 G' u5 i& b9 \' O
- * This program is free software; you can redistribute it and/or
) N) U1 s# ^$ {0 ]; L - * modify it under the terms of the GNU General Public License as+ d2 P; M1 O: Z! x" ?4 G9 }/ Q
- * published by the Free Software Foundation version 2.5 j: D; q; E, y8 a
- *
' ^3 f4 y9 W/ m$ G% U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# O) S7 F' q4 ~
- * kind, whether express or implied; without even the implied warranty
* w& i: d+ t, G7 f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ ?, @. I1 w1 F6 q2 q - * GNU General Public License for more details.
: x. o9 j' e Q% m" E2 V5 a - */
* d: ?& ?. r" K" e$ l& K7 Y
; d! c* E7 A5 P- #include <linux/module.h>
2 M: t' U+ ^* U I - #include <linux/init.h>" {! n6 J3 V$ D* K( u& x' G* J
- #include <linux/errno.h>% Q- k* Z6 x- N+ M
- #include <linux/types.h>5 F. |: Z; ?* k! y: Y+ S
- #include <linux/interrupt.h>* {, Q2 i1 r, g# h( R" v% j" z' T
- #include <asm/io.h>
( e7 l6 y. d: x6 | - #include <linux/moduleparam.h>
; I' m1 a8 ^( ]5 H! M - #include <linux/sysctl.h>% M, G( I( ~9 |# r; o
- #include <linux/mm.h>
9 C7 G2 g' s4 P3 C* j4 G - #include <linux/dma-mapping.h>
! R7 ~- ? c/ p4 |$ [0 E6 J& [% b
( D% ~( B1 n, [; x! u" f: }- #include <mach/memory.h>5 z4 R3 l* s9 i4 o
- #include <mach/hardware.h>
. w( A* I* B) H/ o9 z& P - #include <mach/irqs.h>2 C! {6 r% S! \5 Q- [
- #include <asm/hardware/edma.h>
& {% }0 y8 r# P! J# d
1 A+ T/ r1 j- N" m0 e w- #undef EDMA3_DEBUG
" H, G! i! G$ j! R& v9 u v" B5 g - /*#define EDMA3_DEBUG*/
6 X7 I! b8 [* o A" d% R
) I# t4 V& p; B9 ~' e/ Y0 b$ C- #ifdef EDMA3_DEBUG
! M4 J$ Q! f6 X1 O- y) w6 D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ^1 q0 y4 n3 s% _+ d g% C- I- p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ r1 [! N7 A4 C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( E4 Z- f# K( Q( d - #else
/ a8 s7 {5 H5 q; H+ I. @0 g - #define DMA_PRINTK( x... )
' H% j( } f' K+ h' p - #define DMA_FN_IN
3 Y% S7 B# X4 j2 j - #define DMA_FN_OUT. q" _* G! ^% E; |- V
- #endif
7 w) V2 l; K% k( u0 h
+ @( }& q( T7 J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) p$ H: i' v( v2 ?6 ] - #define STATIC_SHIFT 3- {! ?- Z4 K! M e) W) S- k/ G$ f
- #define TCINTEN_SHIFT 20
2 P4 s( F* W9 e. b - #define ITCINTEN_SHIFT 21) O8 k/ ~* t( W, [
- #define TCCHEN_SHIFT 22) }5 {# }1 S# @
- #define ITCCHEN_SHIFT 23; A# Z* _- v" e1 e. c- {* b
9 L; j. G, N1 U7 f5 u- static volatile int irqraised1 = 0;
7 u1 u# V# E6 w) [- A/ V - static volatile int irqraised2 = 0;
! F( f, S8 b4 w% I0 N - $ F4 ~& N8 A5 C5 N) c8 N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w! S* T$ L* s* ~# w/ _1 z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ n+ y; |2 h& D& g# f( i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' `4 A! t5 d& C9 f% V
3 ^ M3 M* I3 [6 b8 ]% Y& H3 z- dma_addr_t dmaphyssrc1 = 0;
: q* k0 z; P* W- T7 V - dma_addr_t dmaphyssrc2 = 0;
7 [ L$ j0 V) X0 c* } - dma_addr_t dmaphysdest1 = 0;$ W* C7 e4 E9 K3 _! B* y8 s5 T2 e
- dma_addr_t dmaphysdest2 = 0;* Q `) X4 n6 C6 y& d# R1 F$ a! p
- $ t7 I- i2 V( k3 o6 e) C
- char *dmabufsrc1 = NULL;
' q, A# k. J L - char *dmabufsrc2 = NULL;
. a1 V! Q5 L8 X& ^! a I - char *dmabufdest1 = NULL;# X+ c3 p4 B- \$ v/ ]. i
- char *dmabufdest2 = NULL;
q) I5 d Q x1 ?% C; b
" `2 w7 |& B: u; ?8 I% K" Y- static int acnt = 512;$ G( r! k. ]! O# `9 a
- static int bcnt = 8;
" m- }0 \. `9 g) ` - static int ccnt = 8;
- U) H, f8 ]" K4 e3 z
: d4 t$ d9 D7 U5 K( w) W% e- module_param(acnt, int, S_IRUGO);
% n+ L5 F0 }8 c. E9 l" \ - module_param(bcnt, int, S_IRUGO);3 C0 L2 o6 I8 q- G/ w5 @5 ~
- module_param(ccnt, int, S_IRUGO);
复制代码
@: i5 ^9 C; @& o
: F- ~ s8 ]6 V: ~5 T4 e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 I2 F$ ~$ a( i+ U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ A& C0 O g1 U: \$ }' y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. F W K$ ~3 u+ @: ~0 F8 J
8 b: S) X0 Z. y& J& A2 f4 ~ d$ @ l3 l6 l
|
|