MicrOS
harddisk_header.c File Reference
#include "harddisk_header.h"

Functions

int8_t __harddisk_soft_reset_port (uint16_t control_port)
 Perform soft reset for given control_port. More...
 
void __harddisk_400ns_delay (uint16_t control_port)
 Makes 400ns delay. More...
 
int8_t __harddisk_bsy_poll (uint16_t control_port)
 Pools BSY bit until clears. More...
 
void __harddisk_get_pointers (HARDDISK_ATA_MASTER_SLAVE type, HARDDISK_ATA_BUS_TYPE bus, const HARDDISK_STATE **state, const harddisk_identify_device_data **data)
 Gets pointers to hard disk data. More...
 

Variables

harddisk_states harddisk_current_states
 Current states of all hard drives. More...
 
harddisk_configuration harddisk_current_configuration
 Current configuration of harddisk. More...
 

Function Documentation

◆ __harddisk_400ns_delay()

void __harddisk_400ns_delay ( uint16_t  control_port)

Makes 400ns delay.

Makes 400ns delay by checking drive status 15 times. User after switching type of drive in bus.

Parameters
portPort for do delay.

◆ __harddisk_bsy_poll()

int8_t __harddisk_bsy_poll ( uint16_t  control_port)

Pools BSY bit until clears.

Pools BSY bit until clears, if pooling takes too long exits with error.

Parameters
portPort for pooling.
Returns
1 if success, -1 if error

◆ __harddisk_get_pointers()

void __harddisk_get_pointers ( HARDDISK_ATA_MASTER_SLAVE  type,
HARDDISK_ATA_BUS_TYPE  bus,
const HARDDISK_STATE **  state,
const harddisk_identify_device_data **  data 
)

Gets pointers to hard disk data.

Sets state to proper state and data from harddisk_states structure to proper values for given harddisk and bus type.

Parameters
typeType of harddisk.
busType of bus.
statePointer to state.
busPointer to data.

◆ __harddisk_soft_reset_port()

int8_t __harddisk_soft_reset_port ( uint16_t  control_port)

Perform soft reset for given control_port.

Soft reset should set bit SRST in Device Control Register for 5 us.

Parameters
control_portControl port to perform reset
Returns
1 if success, -1 if error

Variable Documentation

◆ harddisk_current_configuration

harddisk_configuration harddisk_current_configuration

Current configuration of harddisk.

◆ harddisk_current_states

harddisk_states harddisk_current_states

Current states of all hard drives.