class::hal::Drive

class hal::Drive
  : public hal::Device

The Drive class is used for debugging and diagnosing Drive devices (as defined in sos/dev/drive.h).

On production systems, the Drive is completely managed by the filesystem that lives on the drive. The OS build can dictate whether the underlying drive is made available to applications or not (and set the permissions).

This class mainly exists in developing new drivers for flash devices that are implementing the sos/dev/drive.h driver interface.

#include <sapi/hal.hpp>

Drive d;
d.open("/dev/drive0");
DriveInfo info = d.get_info();
d.close();

Members

Drive()
int erase_blocks(

u32 start,
u32 end
) const

int erase_device() const
DriveInfo get_info() const
int initialize() const
bool is_busy() const
int powerdown() const
int powerup() const
int protect() const
int reset() const
int unprotect() const

Details

Drive()

int erase_blocks(

u32 start,
u32 end
) const

Erases blocks on the drive.

Parameters

  • start An address containing the first block to erase

  • end An address containing the last block to erase


int erase_device() const

Erases the drive.


DriveInfo get_info() const

Returns a DriveInfo object that is populated with the infomration from the drive.


int initialize() const

Initializes the drive.


bool is_busy() const

Returns true if the drive is busy.


int powerdown() const

Powers down the drive.


int powerup() const

Powers up the drive.


int protect() const

int reset() const

int unprotect() const

X

Thanks for Coming!

Subscribe to news and updates