📄 hd465memory.c
字号:
/*
Copyright(c) 1998,1999 SIC/Hitachi,Ltd.
Module Name:
memory.c
Revision History:
26th April 1999 Released
12th October 1999 Fixed minor bug
*/
/*****************************************************************************
* FUNCTION : PDCardReadAttrByte
* DESCRIPTION : This function should be called within a try/except
* statement in case the card is removed and the memory
* access results in a fault. Card services calls
* PDCardReadAttrByte within a try/except clause in its
* <f CardReadAttrByte> function.
* INPUTS :
* OUTPUTS : Returns the byte read.
* DESIGN NOTES :
* CAUTIONS :
*****************************************************************************/
UINT8 PDCardReadAttrByte(
PVOID pCardMem, /* Pointer to PC card attribute memory obtained from <f CardMapMemory> */
UINT32 uOffset) /* Offset into card's attribute memory */
{
UINT8 uByte;
PUCHAR pAttr = (PUCHAR)pCardMem;
pAttr += uOffset * 2;
uByte = *pAttr;
// if (uByte >= 0x20 && uByte <= 0x7F)
// DEBUGMSG(ZONE_PDD,(TEXT("PDCardReadAttrByte Address: %x \t Offset: %x \t Data: %x\t(%c)\r\n"),pCardMem,uOffset,uByte,uByte));
// else
// DEBUGMSG(ZONE_PDD,(TEXT("PDCardReadAttrByte Address: %x \t Offset: %x \t Data: %x\t(.)\r\n"),pCardMem,uOffset,uByte));
return uByte;
}
/*****************************************************************************
* FUNCTION : PDCardWriteAttrByte
* DESCRIPTION : This function should be called within a try/except
* statement in case the card is removed and the memory
* access results in a fault. Card services calls
* PDCardWriteAttrByte within a try/except clause in its
* <f CardWriteAttrByte> function.
* INPUTS :
* OUTPUTS :
* DESIGN NOTES :
* CAUTIONS :
*****************************************************************************/
VOID PDCardWriteAttrByte(
PVOID pCardMem, // @parm Pointer to PC card attribute memory obtained from <f CardMapMemory>
UINT32 uOffset, // @parm Offset into card's attribute memory
UINT8 uByte // @parm Byte to write
)
{
PUCHAR pAttr = (PUCHAR)pCardMem;
// if (uByte >= 0x20 && uByte <= 0x7F)
// DEBUGMSG(ZONE_PDD, (TEXT("PDCardWriteAttrByte Address: %x \t Offset: %x \t Data: %x\t(%c)\r\n"), pCardMem, uOffset, uByte, uByte));
// else
// DEBUGMSG(ZONE_PDD, (TEXT("PDCardWriteAttrByte Address: %x \t Offset: %x \t Data: %x\t(.)\r\n"), pCardMem, uOffset, uByte));
pAttr += uOffset * 2;
*pAttr = uByte;
DEBUGMSG(ZONE_PDD, (TEXT("PDCardWriteAttrByte ........\r\n")));
}
/*****************************************************************************
* FUNCTION : PDCardReadCmnByte
* DESCRIPTION : This function should be called within a try/except
* statement in case the card is removed and the memory
* access results in a fault. Card services calls
* PDCardReadCmnByte within a try/except clause in its
* <f CardReadCmnByte> function.
* INPUTS :
* OUTPUTS : Returns the byte read.
* DESIGN NOTES :
* CAUTIONS :
*****************************************************************************/
UINT8 PDCardReadCmnByte(
PVOID pCardMem, /* Pointer to PC card common memory obtained from <f CardMapMemory> */
UINT32 uOffset
)
{
UINT8 uByte;
PUCHAR pCmn = (PUCHAR)pCardMem;
pCmn += uOffset;
uByte = *pCmn;
// if (uByte >= 0x20 && uByte <= 0x7F)
// DEBUGMSG(ZONE_PDD, (TEXT("PDCardReadCmnByte Address: %x \t Offset: %x \t Data: %x\t(%c)\r\n"),pCardMem, uOffset, uByte, uByte));
// else
// DEBUGMSG(ZONE_PDD, (TEXT("PDCardReadCmnByte Address: %x \t Offset: %x \t Data: %x\t(.)\r\n"),pCardMem, uOffset, uByte));
DEBUGMSG(ZONE_PDD, (TEXT("PDCardReadCmnByte ........\r\n")));
return uByte;
}
/*****************************************************************************
* FUNCTION : PDCardWriteCmnByte
* DESCRIPTION : This function should be called within a try/except
* statement in case the card is removed and the memory
* access results in a fault. Card services calls
* PDCardWriteCmnByte within a try/except clause in its
* <f CardWriteCmnByte> function.
* INPUTS :
* OUTPUTS :
* DESIGN NOTES :
* CAUTIONS :
*****************************************************************************/
VOID PDCardWriteCmnByte(
PVOID pCardMem, // @parm Pointer to PC card common memory obtained from <f CardMapMemory>
UINT32 uOffset, // @parm Offset into card's common memory
UINT8 uByte) // @parm Byte to write
{
PUCHAR pCmn = (PUCHAR)pCardMem;
// if (uByte >= 0x20 && uByte <= 0x7F)
// DEBUGMSG(ZONE_PDD, (TEXT("PDCardWriteCmnByte Address: %x \t Offset: %x \t Data: %x\t(%c)\r\n"),pCardMem, uOffset, uByte, uByte));
// else
// DEBUGMSG(ZONE_PDD, (TEXT("PDCardWriteCmnByte Address: %x \t Offset: %x \t Data: %x\t(.)\r\n"),pCardMem, uOffset, uByte));
pCmn += uOffset;
*pCmn = uByte;
DEBUGMSG(ZONE_PDD, (TEXT("PDCardWriteCmnByte ........\r\n")));
}
/*****************************************************************************
* FUNCTION : PDCardReadIOByte
* DESCRIPTION : This function should be called within a try/except
* statement in case the card is removed and the memory
* access results in a fault. Card services calls
* PDCardReadIOByte within a try/except clause in its
* <f CardReadIOByte> function
* INPUTS :
* OUTPUTS : Returns the byte read.
* DESIGN NOTES :
* CAUTIONS :
*****************************************************************************/
UINT8 PDCardReadIOByte(
PVOID pCardMem, /* Pointer to PC card I/O space obtained from <f CardMapMemory> */
UINT32 uOffset)
{
UINT8 uByte;
PUCHAR pIO = (PUCHAR)pCardMem;
pIO += uOffset;
uByte = *pIO;
// if (uByte >= 0x20 && uByte <= 0x7F)
// DEBUGMSG(ZONE_PDD, (TEXT("PDCardReadIOByte Address: %x \t Offset: %x \t Data: %x\t(%c)\r\n"), pCardMem, uOffset, uByte, uByte));
// else
// DEBUGMSG(ZONE_PDD, (TEXT("PDCardReadIOByte Address: %x \t Offset: %x \t Data: %x\t(.)\r\n"), pCardMem, uOffset, uByte));
DEBUGMSG(ZONE_PDD, (TEXT("PDCardReadIOByte ........\r\n")));
return uByte;
}
/*****************************************************************************
* FUNCTION : PDCardWriteIOByte
* DESCRIPTION : his function should be called within a try/except
* statement in case the card is removed and the memory
* access results in a fault. Card services calls
* PDCardWriteIOByte within a try/except clause in its
* <f CardWriteIOByte> function.
* INPUTS :
* OUTPUTS :
* DESIGN NOTES :
* CAUTIONS :
*****************************************************************************/
VOID PDCardWriteIOByte(
PVOID pCardMem, // @parm Pointer to PC card I/O space obtained from <f CardMapMemory>
UINT32 uOffset, // @parm Offset into card's I/O space
UINT8 uByte) // @parm Byte to write
{
PUCHAR pIO = (PUCHAR)pCardMem;
// if (uByte >= 0x20 && uByte <= 0x7F)
// DEBUGMSG(ZONE_PDD, (TEXT("PDCardWriteIOByte Address: %x \t Offset: %x \t Data: %x\t(%c)\r\n"), pCardMem, uOffset, uByte, uByte));
// else
// DEBUGMSG(ZONE_PDD, (TEXT("PDCardWriteIOByte Address: %x \t Offset: %x \t Data: %x\t(.)\r\n"), pCardMem, uOffset, uByte));
pIO += uOffset;
*pIO = uByte;
DEBUGMSG(ZONE_PDD, (TEXT("PDCardWriteIOByte ........\r\n")));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -