msm6000io.h
来自「在高通的手机平台下,一个下载手机.bin文件到手机的flash中的工具,包含PC」· C头文件 代码 · 共 324 行
H
324 行
#ifndef MSM6000IO_H
#define MSM6000IO_H
/*===========================================================================
MSM6000 REGISTER INPUT/OUTPUT HEADER FILE
DESCRIPTION
This file contains the input and output macro definitions to support reading
and writing from/to MSM registers in the msm6000.
Copyright (c) 2002 by QUALCOMM, Incorporated. All Rights Reserved.
===========================================================================*/
/*===========================================================================
EDIT HISTORY FOR FILE
This section contains comments describing changes made to this file.
Notice that changes are listed in reverse chronological order.
$Header: L:/src/asw/MSM6000/vcs/msm6000io.h_v 1.3 12 Aug 2002 19:32:46 cryan $
when who what, where, why
-------- --- ----------------------------------------------------------
03/09/01 djd Added macro MSM_OUTHM_NO_INTLOCK.
11/10/00 rmd Added support for ASB shadow registers.
10/28/00 rmd Defined MSM_F_END to SEARCH2_POSITION_LOW_RH
10/23/00 rmd Initial Revision
===========================================================================*/
#include "msm6000shdw.h"
#include "msm6000asb.h"
/*---------------------------------------------------------------------------
MACRO MSM_OUT
This macro outputs a specified value to a specified port. All 8 bits of the
port are written (i.e., the port is not buffered by software).
---------------------------------------------------------------------------*/
#define MSM_OUT( io, val ) (void) outp( io, (int) val)
/*---------------------------------------------------------------------------
MACRO MSM_OUTM
This macro outputs a specified value, qualified by a specified mask, to
a specified port address. Only the bits corresponding to the mask are
actually affected; other bits retain their previous values. To do this,
an image is maintained of the previous value written to the port which
is then combined with the new value.
Uses TASKLOCK/TASKFREE.
---------------------------------------------------------------------------*/
#ifdef FEATURE_16BIT_SHADOW_REG
#define MSM_OUTM( io, mask, val) \
INTLOCK();\
MSM_image_H[MSM_INX (io)] = (MSM_image_H[ MSM_INX (io) ] & (word)(~(mask))) | \
((word)((val) & (mask)));\
(void) outp( io, (byte)MSM_image_H[ MSM_INX (io) ]);\
INTFREE();\
#else
#define MSM_OUTM( io, mask, val) \
INTLOCK();\
MSM_image[ MSM_INX (io) ] = (MSM_image[ MSM_INX (io) ] & (byte)(~(mask))) | \
((byte)((val) & (mask)));\
(void) outp( io, MSM_image[ MSM_INX(io) ]);\
INTFREE();\
#endif /*FEATURE_16BIT_SHADOW_REG*/
/*---------------------------------------------------------------------------
MACRO MSM_OUTM_IL
This macro outputs a specified value, qualified by a specified mask, to
a specified port address. Only the bits corresponding to the mask are
actually affected; other bits retain their previous values. To do this,
an image is maintained of the previous value written to the port which
is then combined with the new value.
Uses INTLOCK/INTFREE.
---------------------------------------------------------------------------*/
#ifdef FEATURE_16BIT_SHADOW_REG
#define MSM_OUTM_IL( io, mask, val) \
INTLOCK();\
MSM_image_H[ MSM_INX (io) ] = (MSM_image_H[ MSM_INX (io) ] & (word)(~(mask))) | \
((word)((val) & (mask)));\
(void) outp( io, (byte)MSM_image_H[ MSM_INX(io) ]);\
INTFREE()
#define MSM_OUTWM_IL( io, mask, val) \
INTLOCK();\
MSM_image_H[ MSM_INX (io) ] = (MSM_image_H[ MSM_INX (io) ] & (word)(~(mask))) | \
((word)((val) & (mask)));\
(void) outpw( io, (byte)MSM_image_H[ MSM_INX(io) ]);\
INTFREE()
#else
#define MSM_OUTM_IL( io, mask, val) \
INTLOCK(); \
MSM_image[ MSM_INX (io) ] = (MSM_image[ MSM_INX (io) ] & (byte)(~(mask))) | \
((byte)((val) & (mask)));\
(void) outp( io, MSM_image[ MSM_INX(io) ]);\
INTFREE()
#define MSM_OUTWM_IL( io, mask, val) \
INTLOCK(); \
MSM_image[ MSM_INX (io) ] = (MSM_image[ MSM_INX (io) ] & (byte)(~(mask))) | \
((byte)((val) & (mask)));\
(void) outpw( io, MSM_image[ MSM_INX(io) ]);\
INTFREE()
#endif /*FEATURE_16BIT_SHADOW_REG*/
/*---------------------------------------------------------------------------
MACRO MSM_STROBEM
This macro outputs a specified value, qualified by a specified mask, to
a specified port address. Only the bits corresponding to the mask are
actually affected; other bits retain their previous values. The current
mask is not updated, so the next write will not be effected by the value
'val'. To do this, an image is maintained of the previous value written
to the port which is then combined with the new value. This macro uses
the image for registers which are not related to the fingers so IT MUST
ONLY BE USED FOR WRITING TO PORTS WHICH ARE NOT RELATED TO THE FINGERS.
---------------------------------------------------------------------------*/
#ifdef FEATURE_16BIT_SHADOW_REG
#define MSM_STROBEM( io, mask, val ) \
INTLOCK( ); \
(void) outp( io, (byte)((MSM_image_H[ MSM_INX(io) ] & (word)(~(mask))) \
| (word)((val) & (mask)))); \
INTFREE( )
#else
#define MSM_STROBEM( io, mask, val ) \
INTLOCK( ); \
(void) outp( io, (MSM_image[ MSM_INX(io) ] & (byte)(~(mask))) \
| (byte)((val) & (mask))); \
INTFREE( )
#endif /*FEATURE_16BIT_SHADOW_REG*/
/*---------------------------------------------------------------------------
MACRO MSM_STROBEM_H
This macro outputs a specified 16-bits value, qualified by a specified mask, to
a specified port address. Only the bits corresponding to the mask are
actually affected; other bits retain their previous values. The current
mask is not updated, so the next write will not be effected by the value
'val'. To do this, an image is maintained of the previous value written
to the port which is then combined with the new value. This macro uses
the image for registers which are not related to the fingers so IT MUST
ONLY BE USED FOR WRITING TO PORTS WHICH ARE NOT RELATED TO THE FINGERS.
---------------------------------------------------------------------------*/
#ifdef FEATURE_16BIT_SHADOW_REG
#define MSM_STROBEM_H( io, mask, val ) \
INTLOCK( ); \
(void) outpw( io, (MSM_image_H[ MSM_INX(io) ] & (word)(~(mask))) \
| (word)((val) & (mask))); \
INTFREE( )
#endif /*FEATURE_16BIT_SHADOW_REG*/
/* This macro is not used in MSM3 */
/*---------------------------------------------------------------------------
MACRO MSM_F_OUTM
This macro outputs a specified value, qualified by a specified mask, to
a specified port address. Only the bits corresponding to the mask are
actually affected; other bits retain their previous values. To do this,
an image is maintained of the previous value written to the port which
is then combined with the new value. This macro uses the image for ports
which are related to the fingers and sets up the finger page port, so
IT MUST ONLY BE USED FOR WRITING TO PORTS WHICH ARE RELATED TO THE FINGERS.
---------------------------------------------------------------------------*/
#define MSM_F_OUTM( finger, io, mask, val ) \
INTLOCK( );\
(void) outp( DMOD_F_PAGE, 1<<(finger) );\
MSM_fimage[ finger ][ MSM_FINX(io) ] = \
(MSM_fimage[ finger ][ MSM_FINX(io) ] & ((byte)(~(mask)))) \
| (byte)( (val) & (mask) ); \
(void) outp( io, MSM_fimage[ finger ][ MSM_FINX(io) ] ); \
INTFREE( )
/*---------------------------------------------------------------------------
MACRO MSM_OUTH
This macro outputs a specified value to a specified port. All 16 bits of the
port are written (i.e., the port is not buffered by software).
---------------------------------------------------------------------------*/
#define MSM_OUTH( io, val ) (void) outpw( io, (word) val)
/*---------------------------------------------------------------------------
MACRO MSM_OUTHM_NO_INTLOCK
This macro outputs a specified value, qualified by a specified mask, to
a specified port address. Only the bits corresponding to the mask are
actually affected; other bits retain their previous values. To do this,
an image is maintained of the previous value written to the port which
is then combined with the new value. This is used to output to 16bit locations.
The image maintained is also 16bits. Interrupt locking is not done by this
macro -- the calling function must already have interrupts locked.
---------------------------------------------------------------------------*/
#ifdef FEATURE_16BIT_SHADOW_REG
#define MSM_OUTHM_NO_INTLOCK( io, mask, val) \
MSM_image_H[MSM_INX(io)] = (MSM_image_H[ MSM_INX( io ) ] & (word)(~(mask))) | \
((word)((val) & (mask)));\
(void) outpw( io, ((word)MSM_image_H[ MSM_INX( io ) ]));\
#else
#define MSM_OUTHM_NO_INTLOCK( io, mask, val) \
MSM_image_H[io##_INX] = (MSM_image_H[io##_INX] & (word)(~(mask))) | \
((word)((val) & (mask)));\
(void) outpw( io, ((word)MSM_image_H[io##_INX ]));\
#endif /*FEATURE_16BIT_SHADOW_REG*/
/*---------------------------------------------------------------------------
MACRO MSM_OUTHM
This macro outputs a specified value, qualified by a specified mask, to
a specified port address. Only the bits corresponding to the mask are
actually affected; other bits retain their previous values. To do this,
an image is maintained of the previous value written to the port which
is then combined with the new value. This is used to output to 16bit locations.
The image maintained is also 16bits.
---------------------------------------------------------------------------*/
#ifdef FEATURE_16BIT_SHADOW_REG
#define MSM_OUTHM( io, mask, val) \
INTLOCK( );\
MSM_OUTHM_NO_INTLOCK( io, mask, val); \
INTFREE( )
#else
#define MSM_OUTHM( io, mask, val) \
INTLOCK( );\
MSM_OUTHM_NO_INTLOCK( io, mask, val); \
INTFREE( )
#endif /*FEATURE_16BIT_SHADOW_REG*/
/*---------------------------------------------------------------------------
MACRO MSM_IN
This macro reads and returns the value from a specified port. NO mask is
applied to the read value.
---------------------------------------------------------------------------*/
#define MSM_IN( io ) (byte) inp( io )
/*---------------------------------------------------------------------------
MACRO MSM_INM
This macro reads and returns the value from a specified port. The mask is
applied to the read value. The bits that do not correspond to the mask are
returned as zero.
---------------------------------------------------------------------------*/
#define MSM_INM( io, mask ) ( inp( io ) & (mask) )
/*---------------------------------------------------------------------------
MACRO MSM_INH
This macro reads and returns the 16 bit value from a specified port. NO mask is
applied to the read value.
---------------------------------------------------------------------------*/
#define MSM_INH( io ) (word) inpw( io )
/*---------------------------------------------------------------------------
MACRO MSM_INHM
This macro reads and returns the value from a specified port. The mask is
applied to the read value. The bits that do not correspond to the mask are
returned as zero. This is used to read 16bit I/O ports
---------------------------------------------------------------------------*/
#define MSM_INHM( io, mask ) ( inpw( io ) & (mask) )
/*---------------------------------------------------------------------------
MACRO MSM_OUTW
Writes a value out to a 32-bit wide (word) MSM register.
Does NOT use/update the shadow buffer.
---------------------------------------------------------------------------*/
#define MSM_OUTW( io, val ) (void) outpdw( io, (dword) val)
/*---------------------------------------------------------------------------
MACRO MSM_OUTWM
Writes a masked value out to a 32-bit wide (word) MSM register.
Uses/updates shadow buffer.
---------------------------------------------------------------------------*/
#define MSM_OUTWM( io, mask, val) \
INTLOCK( );\
MSM_image_H[MSM_INX(io)] = (MSM_image_H[ MSM_INX( io ) ] & (dword)(~(mask))) | \
((dword)((val) & (mask)));\
(void) outpdw( io, ((dword)MSM_image_H[ MSM_INX( io ) ]));\
INTFREE( )
/*---------------------------------------------------------------------------
* MACRO MSM_INW
*
* Reads a 32-bit value from an MSM register.
* Does NOT use/update the shadow buffer.
*---------------------------------------------------------------------------*/
#define MSM_INW( io ) (dword) inpdw( io )
/*---------------------------------------------------------------------------
*MACRO MSM_INWM
*
*Reads a masked 32-bit value from an MSM register.
*Does NOT use/update the shadow buffer.
*---------------------------------------------------------------------------*/
#define MSM_INWM( io, mask ) ( inpdw( io ) & (mask) )
#endif /*MSM6000_H*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?