FreeNOS
Public Member Functions | Private Member Functions | Private Attributes
ATAController Class Reference

AT Attachment (ATA) Host Controller Device. More...

#include <ATAController.h>

Inheritance diagram for ATAController:
Device File

Public Member Functions

 ATAController (const u32 inode)
 Constructor. More...
 
virtual FileSystem::Result initialize ()
 Configures the ATA controller. More...
 
virtual FileSystem::Result read (IOBuffer &buffer, Size &size, const Size offset)
 Read bytes from a drive attached to the ATA controller. More...
 
virtual FileSystem::Result interrupt (const Size vector)
 Process ATA interrupts. More...
 
- Public Member Functions inherited from Device
 Device (const u32 inode, const FileSystem::FileType type)
 Constructor. More...
 
virtual ~Device ()
 Destructor. More...
 
virtual const StringgetIdentifier () const
 Get unique device identifier. 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

void pollReady (bool noData=false)
 Polls the Regular Status register. More...
 

Private Attributes

List< ATADrive * > drives
 Drives detected on the ATA bus. More...
 
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...
 

Detailed Description

AT Attachment (ATA) Host Controller Device.

Definition at line 262 of file ATAController.h.

Constructor & Destructor Documentation

◆ ATAController()

ATAController::ATAController ( const u32  inode)

Constructor.

Parameters
inodeInode number

Definition at line 41 of file ATAController.cpp.

References Device::m_identifier.

Member Function Documentation

◆ initialize()

FileSystem::Result ATAController::initialize ( )
virtual

◆ interrupt()

FileSystem::Result ATAController::interrupt ( const Size  vector)
virtual

Process ATA interrupts.

Parameters
vectorInterrupt number.
Returns
Result code

Reimplemented from Device.

Definition at line 153 of file ATAController.cpp.

References INFO, and FileSystem::Success.

◆ pollReady()

void ATAController::pollReady ( bool  noData = false)
private

Polls the Regular Status register.

Parameters
noDataDon't wait for the ATA_STATUS_DATA flag to set.

Definition at line 159 of file ATAController.cpp.

References ATA_BASE_CMD0, ATA_REG_STATUS, ATA_STATUS_BUSY, ATA_STATUS_DATA, m_io, and File::status().

Referenced by initialize(), and read().

◆ read()

FileSystem::Result ATAController::read ( IOBuffer buffer,
Size size,
const Size  offset 
)
virtual

Read bytes from a drive attached to the ATA controller.

Parameters
bufferInput/Output buffer to output bytes to.
sizeMaximum number of bytes to read on input. On output, the actual number of bytes read.
offsetOffset inside the file to start reading.
Returns
Result code

Reimplemented from File.

Definition at line 101 of file ATAController.cpp.

References ATA_BASE_CMD0, ATA_CMD_READ, ATA_REG_ADDR0, ATA_REG_ADDR1, ATA_REG_ADDR2, ATA_REG_CMD, ATA_REG_COUNT, ATA_REG_DATA, ATA_REG_SELECT, ATA_SEL_MASTER_28, IOBuffer::bufferedWrite(), CEIL, drives, List< T >::first(), ATADrive::identity, FileSystem::IOError, List< T >::isEmpty(), m_io, pollReady(), IdentifyData::sectors28, and FileSystem::Success.

Field Documentation

◆ drives

List<ATADrive *> ATAController::drives
private

Drives detected on the ATA bus.

Definition at line 315 of file ATAController.h.

Referenced by initialize(), and read().

◆ m_io

Arch::IO ATAController::m_io
private

Port I/O object.

Definition at line 318 of file ATAController.h.

Referenced by initialize(), pollReady(), and read().


The documentation for this class was generated from the following files: