Exemple #1
0
static int sh_eth_bb_mdio_tristate(struct bb_miiphy_bus *bus)
{
	struct sh_eth_dev *eth = bus->priv;
	int port = eth->port;

	outl(inl(PIR(port)) & ~PIR_MMD, PIR(port));

	return 0;
}
static void sh_eth_mii_bus_release(int port)
{
	/* Read direction, clock is low */
	outl(0, PIR(port));
	udelay(1);
	/* Read direction, clock is high */
	outl(1, PIR(port));
	udelay(1);
	/* Read direction, clock is low */
	outl(0, PIR(port));
	udelay(1);
}
Exemple #3
0
static int sh_eth_bb_set_mdc(struct bb_miiphy_bus *bus, int v)
{
	struct sh_eth_dev *eth = bus->priv;
	int port = eth->port;

	if (v)
		outl(inl(PIR(port)) | PIR_MDC, PIR(port));
	else
		outl(inl(PIR(port)) & ~PIR_MDC, PIR(port));

	return 0;
}
//Main Function
int main(void)
{
lcd_port_config();

lcd_init();
	unsigned char x;
	
	PIR();
	
	while(1)
	{
		
		x = PINL &0xFF;
		
		if(x) //switch is not pressed
		{
			
			lcd_cursor(1,1);
			lcd_string("Human Detected    ");
		}
		else
		{
			lcd_cursor(1,1);
			lcd_string("Empty Space    ");
		}
		
	}
}
static void sh_eth_mii_read_phy_bits(int port, u32 *val, int len)
{
	int i;
	u32 pir;

	*val = 0;
	for (i = len - 1; i >= 0; i--) {
		/* Read direction, clock is high */
		outl(1, PIR(port));
		udelay(1);
		/* Read bit */
		pir = inl(PIR(port));
		*val |= (pir & 8) ? 1 << i : 0;
		/* Read direction, clock is low */
		outl(0, PIR(port));
		udelay(1);
	}
}
Exemple #6
0
static int sh_eth_bb_get_mdio(struct bb_miiphy_bus *bus, int *v)
{
	struct sh_eth_dev *eth = bus->priv;
	int port = eth->port;

	*v = (inl(PIR(port)) & PIR_MDI) >> 3;

	return 0;
}
/*
 * Bits are written to the PHY serially using the
 * PIR register, just like a bit banger.
 */
static void sh_eth_mii_write_phy_bits(int port, u32 val, int len)
{
	int i;
	u32 pir;

	/* Bit positions is 1 less than the number of bits */
	for (i = len - 1; i >= 0; i--) {
		/* Write direction, bit to write, clock is low */
		pir = 2 | ((val & 1 << i) ? 1 << 2 : 0);
		outl(pir, PIR(port));
		udelay(1);
		/* Write direction, bit to write, clock is high */
		pir = 3 | ((val & 1 << i) ? 1 << 2 : 0);
		outl(pir, PIR(port));
		udelay(1);
		/* Write direction, bit to write, clock is low */
		pir = 2 | ((val & 1 << i) ? 1 << 2 : 0);
		outl(pir, PIR(port));
		udelay(1);
	}
}
bool SafeCheck(int matrix[N][N], int row, int col, int num) // Checks if it is safe for a number to get placed.
{
    return !PIR(matrix, row, num) &&
           !PIC(matrix, col, num) &&
           !PIB(matrix, row - row%3 , col - col%3, num);
}
//Function to Initialize PORTS
void port_init()
{
	lcd_port_config();
	LED();
	PIR();
}