Go to the documentation of this file.
18 #include <FreeNOS/User.h>
42 unsigned int year, month, day, hour, min, sec = 0, time;
86 time =
mktime(year, month, day, hour, min, sec);
87 n =
snprintf(tmp, size <
sizeof(tmp) ? size :
sizeof(tmp),
"%u", time);
102 return (val & 0x0f) + (val >> 4) * 10;
#define RTC_STATUS_A
Offset in CMOS for the status A register.
#define CMOS_YEARS_OFFS
Assume that a two-digit year is after 2000.
virtual FileSystem::Result initialize()
Initialize the time device.
#define RTC_YEAR
Offset in the CMOS for the current year.
unsigned bcd2bin(unsigned char val)
Convert from binary coded decimal to binary form.
Abstract device class interface.
Time(const u32 inode)
Constructor.
unsigned long mktime(const unsigned int year, const unsigned int month, const unsigned int day, const unsigned int hour, const unsigned int min, const unsigned int sec)
Copyright (C) 2009 Coen Bijlsma.
#define RTC_HOURS
Offset in the CMOS for the current number of hours.
#define RTC_DAY_OF_MONTH
Offset in the CMOS for the current day of the month.
#define RTC_UIP
Update in progress flag.
#define RTC_BCD
Time/date in binary/BCD flag.
#define RTC_STATUS_B
Offset in CMOS for the status B register.
Abstract Input/Output buffer.
unsigned int u32
Unsigned 32-bit number.
unsigned int Size
Any sane size indicator cannot go negative.
String m_identifier
Unique identifier for this Device.
virtual FileSystem::Result read(IOBuffer &buffer, Size &size, const Size offset)
Read time.
Result
Result code for filesystem Actions.
#define RTC_MONTH
Offset in the CMOS for the current month.
FileSystem::Result write(const void *buffer, const Size size, const Size offset=ZERO)
Write bytes to the I/O buffer.
#define RTC_PORT(x)
The base I/O port of the CMOS.
#define RTC_MINUTES
Offset in the CMOS for the current number of minutes.
unsigned char readCMOS(unsigned char addr)
Returns the value stored at the given address from the CMOS.
int snprintf(char *buffer, unsigned int size, const char *fmt,...)
Write a formatted string into a buffer.
#define RTC_SECONDS
Offset in the CMOS for the current number of seconds.
Arch::IO m_io
Port I/O object.