Beispiel #1
0
u16 rtl_shift_in_bits(void __iomem *ioaddr)
{
	u8 x;
	u16 d, i;

	x = RTL_R8(Cfg9346);
	x &= ~(Cfg9346_EEDI | Cfg9346_EEDO);

	d = 0;

	for (i = 0; i < 16; i++) {
		d = d << 1;
		rtl_raise_clock(&x, ioaddr);

		x = RTL_R8(Cfg9346);
		x &= ~Cfg9346_EEDI;

		if (x & Cfg9346_EEDO)
			d |= 1;

		rtl_lower_clock(&x, ioaddr);
	}

	return d;
}
void rtl_shift_out_bits(int data, int count, void __iomem *ioaddr)
{
    u8 x;
    int  mask;

    mask = 0x01 << (count - 1);
    x = RTL_R8(Cfg9346);
    x &= ~(Cfg9346_EEDI | Cfg9346_EEDO);

    do {
        if (data & mask)
            x |= Cfg9346_EEDI;
        else
            x &= ~Cfg9346_EEDI;

        RTL_W8(Cfg9346, x);
        udelay(RTL_CLOCK_RATE);
        rtl_raise_clock(&x, ioaddr);
        rtl_lower_clock(&x, ioaddr);
        mask = mask >> 1;
    } while(mask);

    x &= ~Cfg9346_EEDI;
    RTL_W8(Cfg9346, x);
}
Beispiel #3
0
void rtl_eeprom_cleanup(void __iomem *ioaddr)
{
	u8 x;

	x = RTL_R8(Cfg9346);
	x &= ~(Cfg9346_EEDI | Cfg9346_EECS);

	RTL_W8(Cfg9346, x);

	rtl_raise_clock(&x, ioaddr);
	rtl_lower_clock(&x, ioaddr);
}