FreeNOS
|
#include <Time.h>
Public Member Functions | |
Time (const u32 inode) | |
Constructor. More... | |
virtual FileSystem::Result | initialize () |
Initialize the time device. More... | |
virtual FileSystem::Result | read (IOBuffer &buffer, Size &size, const Size offset) |
Read time. More... | |
Public Member Functions inherited from Device | |
Device (const u32 inode, const FileSystem::FileType type) | |
Constructor. More... | |
virtual | ~Device () |
Destructor. More... | |
virtual const String & | getIdentifier () const |
Get unique device identifier. More... | |
virtual FileSystem::Result | interrupt (const Size vector) |
Called when an interrupt has been triggered for this device. More... | |
Public Member Functions inherited from File | |
File (const u32 inode, const FileSystem::FileType type=FileSystem::RegularFile, const UserID uid=ZERO, const GroupID gid=ZERO) | |
Constructor function. More... | |
virtual | ~File () |
Destructor function. More... | |
u32 | getInode () const |
Get inode number. More... | |
FileSystem::FileType | getType () const |
Retrieve our filetype. More... | |
virtual FileSystem::Result | write (IOBuffer &buffer, Size &size, const Size offset) |
Write bytes to the file. More... | |
virtual FileSystem::Result | status (FileSystem::FileStat &st) |
Retrieve file statistics. More... | |
virtual bool | canRead () const |
Check if the File has data ready for reading. More... | |
virtual bool | canWrite () const |
Check if the File can be written to. More... | |
Private Member Functions | |
unsigned char | readCMOS (unsigned char addr) |
Returns the value stored at the given address from the CMOS. More... | |
unsigned | bcd2bin (unsigned char val) |
Convert from binary coded decimal to binary form. More... | |
Private Attributes | |
Arch::IO | m_io |
Port I/O object. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Device | |
String | m_identifier |
Unique identifier for this Device. More... | |
Protected Attributes inherited from File | |
const u32 | m_inode |
Inode number. More... | |
const FileSystem::FileType | m_type |
Type of this file. More... | |
UserID | m_uid |
Owner of the file. More... | |
GroupID | m_gid |
Group of the file. More... | |
FileSystem::FileModes | m_access |
Access permissions. More... | |
Size | m_size |
Size of the file, in bytes. More... | |
System Time server.
This server is responsible for maintaining the global system time via the CMOS. A lot of this code comes from the linux kernel source, particularly from the file arch/x86/kernel/rtc.c.
Time::Time | ( | const u32 | inode | ) |
Constructor.
inode | Inode number |
Definition at line 27 of file Time.cpp.
References Device::m_identifier.
|
private |
|
virtual |
Initialize the time device.
Reimplemented from Device.
Definition at line 33 of file Time.cpp.
References FileSystem::Success.
|
virtual |
Read time.
buffer | Input/Output buffer to output bytes to. |
size | Maximum number of bytes to read on input. On output, the actual number of bytes read. |
offset | Offset inside the file to start reading. |
Reimplemented from File.
Definition at line 38 of file Time.cpp.
References bcd2bin(), CMOS_YEARS_OFFS, mktime(), readCMOS(), RTC_BCD, RTC_DAY_OF_MONTH, RTC_HOURS, RTC_MINUTES, RTC_MONTH, RTC_SECONDS, RTC_STATUS_A, RTC_STATUS_B, RTC_UIP, RTC_YEAR, snprintf(), FileSystem::Success, and IOBuffer::write().
|
private |
Returns the value stored at the given address from the CMOS.
addr | The address to read from the CMOS |
Definition at line 94 of file Time.cpp.
References m_io, and RTC_PORT.
Referenced by read().
|
private |