Ejemplo n.º 1
0
static unsigned int ds1302_readbyte(unsigned int addr)
{
	unsigned int val;

	set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK));

	set_dp(get_dp() | RTC_RESET);
	ds1302_sendbits(((addr & 0x3f) << 1) | RTC_CMD_READ);
	val = ds1302_recvbits();
	set_dp(get_dp() & ~RTC_RESET);

	return val;
}
Ejemplo n.º 2
0
static unsigned int ds1302_readbyte(unsigned int addr)
{
	unsigned int val;

	ds1302_reset();

	ds1302_start();
	ds1302_sendbits(((addr & 0x3f) << 1) | RTC_CMD_READ);
	val = ds1302_recvbits();
	ds1302_stop();

	return val;
}
Ejemplo n.º 3
0
static unsigned int ds1302_readbyte(unsigned int addr)
{
	unsigned int	val;
	unsigned long	flags;

	local_irq_save(flags);
	set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK);
	set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK));

	set_dp(get_dp() | RTC_RESET);
	ds1302_sendbits(((addr & 0x3f) << 1) | RTC_CMD_READ);
	set_dirp(get_dirp() & ~RTC_IODATA);
	val = ds1302_recvbits();
	set_dp(get_dp() & ~RTC_RESET);
	local_irq_restore(flags);

	return(val);
}
Ejemplo n.º 4
0
unsigned int ds1302_readbyte(unsigned int addr)
{
	unsigned int	val;
	unsigned long	flags;

#if 0
	printk("ds1302_readbyte(addr=%x)\n", addr);
#endif

	save_flags(flags); cli();
	*ds1302_dirp |= RTC_RESET | RTC_IODATA | RTC_SCLK;
	*ds1302_dp &= ~(RTC_RESET | RTC_IODATA | RTC_SCLK);

	*ds1302_dp |= RTC_RESET;
	ds1302_sendbits(((addr & 0x3f) << 1) | RTC_CMD_READ);
	*ds1302_dirp &= ~RTC_IODATA;
	val = ds1302_recvbits();
	*ds1302_dp &= ~RTC_RESET;
	restore_flags(flags);

	return(val);
}
Ejemplo n.º 5
0
static unsigned int ds1302_readbyte(unsigned int addr)
{
    unsigned int	val;
    unsigned long	flags;

#if 0
    printk("SnapGear RTC: ds1302_readbyte(addr=%x)\n", addr);
#endif

    save_flags(flags);
    cli();
    set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK);
    set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK));

    set_dp(get_dp() | RTC_RESET);
    ds1302_sendbits(((addr & 0x3f) << 1) | RTC_CMD_READ);
    set_dirp(get_dirp() & ~RTC_IODATA);
    val = ds1302_recvbits();
    set_dp(get_dp() & ~RTC_RESET);
    restore_flags(flags);

    return(val);
}