System Installation
RUBY-D716VG2AR User’s Manual
3-20
printf("unknown
GPIO
pin
direction
in
EC\n");
break;
case
7:
tmp
=
EC_GetRamByte(EC_PIN7_CTL_ADDR);
if( tmp & 0x80 )
*io_direction
=
1;
else if ( tmp & 0x40 )
*io_direction
=
0;
else
printf("unknown
GPIO
pin
direction
in
EC\n");
break;
case
8:
tmp
=
EC_GetRamByte(EC_PIN8_CTL_ADDR);
if( tmp & 0x80 )
*io_direction
=
1;
else if ( tmp & 0x40 )
*io_direction
=
0;
else
printf("unknown
GPIO
pin
direction
in
EC\n");
break;
default:
printf("unsupport pin number when read pin
direction\n");
}
return
0;
}
int gpio_readdirection (int gpio_set, unsigned char *io_direction)
{
int
i;
unsigned char data, temp, temp2;
switch (gpio_set)
{
case 1:
return 0;
case 2:
*io_direction = 0;
for (i = 0; i < 8; i++)
{
gpio_readpindirection (2, i+1, &data);
*io_direction |= (data << i);
}