📄 rdio.c
字号:
/*-----------------------------------------------------------------------------------
Copyright (c), Philips Semiconductors Gratkorn
外部IO读写函数库,只被M500AuC.c调用.
--------------------------------------------------------------------------------------*/
#include <rdio.h>
#include <main.h>
///////////////////////////////////////////////////////////////////////////////
// Module Definitions
///////////////////////////////////////////////////////////////////////////////
#define GetRegPage(adr) (0x80 | (adr>>3))
unsigned char xdata ini _at_ 0x7f00; // move base address to 0x7f00
unsigned char xdata *GpBase = &ini; // redirect pointer to base address
///////////////////////////////////////////////////////////////////////////////
// Open Reader Communication
///////////////////////////////////////////////////////////////////////////////
char OpenIO(void)
{
GpBase = &ini;
P2_7 = 0; // Enable the CS for RC500
return 0x00;
}
///////////////////////////////////////////////////////////////////////////////
// Close Reader Communication
///////////////////////////////////////////////////////////////////////////////
void CloseIO(void)
{
GpBase = 0xff00;
P2_7 = 1; // disable the CS for RC500
}
///////////////////////////////////////////////////////////////////////////////
// G E N E R I C W R I T E
///////////////////////////////////////////////////////////////////////////////
void WriteIO(unsigned char Address, unsigned char value)
{
WriteRawIO(Address,value); // write value at the specified
// address
}
///////////////////////////////////////////////////////////////////////////////
// G E N E R I C R E A D
///////////////////////////////////////////////////////////////////////////////
unsigned char ReadIO(unsigned char Address)
{
static unsigned char c;
c = ReadRawIO(Address); // read value at the specified
// address
return c;
}
#ifndef SEC_NO_MICORE
///////////////////////////////////////////////////////////////////////////////
// W R I T E S E V E R A L M E M O R Y L O C A T I O N S
///////////////////////////////////////////////////////////////////////////////
void WriteIOBlock(unsigned char *Addr_Data, unsigned short len)
{
static unsigned short cnt;
for (cnt = 0; cnt < len; cnt++)
{
// write value at the specified address
WriteRawIO(Addr_Data[cnt*2],Addr_Data[cnt * 2 + 1]);
}
}
///////////////////////////////////////////////////////////////////////////////
// R E A D S E V E R A L M E M O R Y L O C A T I O N S
///////////////////////////////////////////////////////////////////////////////
void ReadIOBlock(unsigned char* Addr_Data, unsigned short len)
{
static unsigned short cnt;
for (cnt = 0; cnt < len; cnt)
{
Addr_Data[cnt*2 + 1] = ReadRawIO(Addr_Data[cnt*2]);// read value at the
// specified address
}
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -