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); }
static void ds1302_reset(void) { unsigned long flags; /* Hardware dependent reset/init */ local_irq_save(flags); set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK); set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK)); local_irq_restore(flags); }
static void ds1302_reset(void) { unsigned long flags; /* Hardware dependant reset/init */ save_flags(flags); cli(); set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK); set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK)); restore_flags(flags); }
static void ds1302_writebyte(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_WRITE); ds1302_sendbits(val); set_dp(get_dp() & ~RTC_RESET); local_irq_restore(flags); }
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); }
static void ds1302_writebyte(unsigned int addr, unsigned int val) { unsigned long flags; #if 0 printk("SnapGear RTC: ds1302_writebyte(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_WRITE); ds1302_sendbits(val); set_dp(get_dp() & ~RTC_RESET); restore_flags(flags); }