System Installation
RUBY-D716VG2AR User’s Manual 3-14
EC_WriteByte(EC_IO_BASE, 0x12);
EC_WriteByte(EC_IO_BASE+1, data);
}
unsigned char EC_GetRamByte (int address)
{
int addr_HighByte, addr_LowByte;
addr_HighByte = (address >> 8) & 0xFF;
addr_LowByte = address & 0xFF;
EC_WriteByte(EC_IO_BASE, 0x11);
EC_WriteByte(EC_IO_BASE+1, addr_HighByte);
EC_WriteByte(EC_IO_BASE, 0x10);
EC_WriteByte(EC_IO_BASE+1, addr_LowByte);
EC_WriteByte(EC_IO_BASE, 0x12);
return EC_ReadByte(EC_IO_BASE+1);
}
/* GPIO controll function */
int gpio_setpindirection (int pin_num, unsigned char io_direction)
{
unsigned char data;
unsigned char tmp;
switch (pin_num)
{
case 1:
if(io_direction)
{
tmp =
EC_GetRamByte(EC_PIN1_CTL_ADDR);
tmp = 0x84;
/*set input*/
tmp &= ~0x40;
EC_SetRamByte(EC_PIN1_CTL_ADDR, tmp);
}
else
{
tmp =
EC_GetRamByte(EC_PIN1_CTL_ADDR);
tmp = 0x40; /*set output*/
tmp &= ~0x80;