KolibriOS kernel
flp_drv.inc File Reference

Functions

void check_fdd_motor_status_has_work ()
 ***************************************** CHECK THE MOTOR SHUTDOWN DELAY * More...
 
void floppy_init ()
 This function is called in boot process. It creates filesystems /fd and/or /fd2, if the system has one/two floppy drives. More...
 
void floppy_querymedia ()
 Returns information about disk media. Floppy drives do not support insert notifications, DISK_NO_INSERT_NOTIFICATION is set, the disk subsystem calls this function before each filesystem operation. If the media has changed, return error for the first call as signal to finalize work with old media and the true geometry for the second call. Assume that media is (possibly) changed anytime when motor is off. More...
 
void floppy_read_bootsector ()
 
void floppy_write ()
 Writes one or more sectors to the device. More...
 
void floppy_read ()
 Reads one or more sectors from the device. More...
 
void floppy_read_write (dword userdata, dword buffer, qword start_sector, dword numsectors_ptr)
 Common part of floppy_read and floppy_write. More...
 

Variables

label give_back_application_data_1
 
label take_data_from_application_1
 
dd TickCounter
 Timer tick counter. More...
 
DB FDC_Status
 Operation completion code with the floppy disk drive controller. More...
 
DB FDD_IntFlag
 Interrupt flag from floppy disk drive. More...
 
DD FDD_Time
 The moment of the beginning of the last operation with FDD. More...
 
db FDD_Type
 Drive number. More...
 
DB FDD_Track
 Sector coordinates. More...
 
DB FDD_Head
 
DB FDD_Sector
 
DB FDC_ST0
 Operation result block. More...
 
DB FDC_ST1
 
DB FDC_ST2
 
DB FDC_C
 
DB FDC_H
 
DB FDC_R
 
DB FDC_N
 
DB ReadRepCounter
 Read operation repetition counter. More...
 
DB RecalRepCounter
 Recalibration operation repetition counter. More...
 
db fdd_motor_status
 Memory area for storing the readed sector FDD_DataBuffer: times 512 db 0 ;DB 512 DUP (?) More...
 
dd timer_fdd_motor
 
label Init_FDC_DMA
 ************************************** INITIALIZATION OF DMA MODE FOR FDD * More...
 
label FDCDataOutput
 *********************************** WRITE BYTE TO FDC DATA PORT * Parameters: * AL - byte to write. * More...
 
label TestRS
 
label OutByteToFDC
 Write byte to data port. More...
 
label End_5
 DEBUGF 1,' ok
'. More...
 
label FDCDataInput
 ****************************************** READ BYTE FROM FDC DATA PORT * Procedure doesnt have input params. * Output : * AL - byte read. * More...
 
label TestRS_1
 
label GetByteFromFDC
 Get byte from data port. More...
 
label End_6
 DEBUGF 1,'K : FDCDataInput: x
',al. More...
 
label FDCInterrupt
 ********************************************* FDC INTERRUPT HANDLER * More...
 
label WaitFDCInterrupt
 ******************************************* WAIT FOR INTERRUPT FROM FDC * More...
 
label TestRS_2
 Wait for the floppy disk interrupt flag to be set. More...
 
label End_7
 
label FDDMotorON
 *********************************** Turn on the motor of drive "A:" * More...
 
label FDDMotorON_B
 
label FDDMotorON_1
 
label dT
 wait 0.5 s More...
 
label fdd_motor_on_B
 
label fdd_motor_on
 
label save_timer_fdd_motor
 ***************************************** SAVING TIME STAMP * More...
 
label check_fdd_motor_status
 
label end_check_fdd_motor_status_1
 
label end_check_fdd_motor_status
 
label FDDMotorOFF
 ********************************** TURN OFF MOTOR OF DRIVE * More...
 
label FDDMotorOFF_1
 
label FDDMotorOFF_2
 
label FDDMotorOFF_A
 
label FDDMotorOFF_B
 
label RecalibrateFDD
 ******************************* RECALIBRATE DRIVE "A:" * More...
 
label SeekTrack
 ***************************************************** TRACK SEARCH * Parameters are passed through global variables: * FDD_Track - track number (0-79); * FDD_Head - head number (0-1). * Result of operation is written to FDC_Status. * More...
 
label Err
 Track not found. More...
 
label Exit
 
label ReadSector
 ******************************************************* READING A DATA SECTOR * Parameters are passed through global variables: * FDD_Track - track number (0-79); * FDD_Head - head number (0-1); * FDD_Sector - sector number (1-18). * Result of operation is written to FDC_Status. * If the read operation is successful, the contents * of the sector will be written to FDD_DataBuffer. * More...
 
label Err_1
 
label Exit_1
 
label ReadSectWithRetr
 ******************************************************* READ SECTOR (WITH RETRY OF OPERATION ON FAILURE) * Parameters are passed through global variables: * FDD_Track - track number (0-79); * FDD_Head - head number (0-1); * FDD_Sector - sector number (1-18). * Result of operation is written to FDC_Status. * If the read operation is successful, the contents * of the sector will be written to FDD_DataBuffer. * More...
 
label TryAgain
 
label ReadSector_1
 
label Exit_2
 
label Err_3
 
label WriteSector
 ******************************************************* WRITE DATA SECTOR * Parameters are passed through global variables: * FDD_Track - track number (0-79); * FDD_Head - head number (0-1); * FDD_Sector - sector number (1-18). * Result of operation is written to FDC_Status. * If the write operation is successful, the contents * of FDD_DataBuffer will be written to the sector * More...
 
label Err_2
 
label Exit_3
 
label WriteSectWithRetr
 ******************************************************* WRITE SECTOR (WITH REPEAT ON FAILURE) * Parameters are passed through global variables: * FDD_Track - track number (0-79); * FDD_Head - head number (0-1); * FDD_Sector - sector number (1-18). * Result of operation is written to FDC_Status. * If the write operation is successful, the contents * of FDD_DataBuffer will be written to the sector * More...
 
label TryAgain_1
 
label WriteSector_1
 
label Exit_4
 
label Err_4
 
label GetStatusInfo
 ********************************************* GET INFORMATION ABOUT THE RESULT OF THE OPERATION More...
 
label floppy_functions
 
rb floppy_media_flags
 
dd n_sector
 temporary save for sector value More...
 
db flp_number
 1- Floppy A, 2-Floppy B More...
 
db old_track
 old value track More...
 
rb flp_label
 Label and ID of inserted floppy disk. More...
 
MUTEX floppy_mutex
 Hardware does not allow to work with two floppies in parallel, so there is one mutex guarding access to any floppy. More...
 
db floppy1_name
 
db floppy2_name
 
dd _userdata
 
dd _info
 
label read_chs_sector
 
label save_chs_sector
 
label calculate_chs
 
label no_seek_track_1
 
dd _sectors_todo
 
db _operation
 

Function Documentation

◆ check_fdd_motor_status_has_work()

void check_fdd_motor_status_has_work ( )

***************************************** CHECK THE MOTOR SHUTDOWN DELAY *

Source
blkdev/flp_drv.inc:288

◆ floppy_init()

void floppy_init ( )

This function is called in boot process. It creates filesystems /fd and/or /fd2, if the system has one/two floppy drives.

Source
blkdev/flp_drv.inc:721

◆ floppy_querymedia()

void floppy_querymedia ( )

Returns information about disk media. Floppy drives do not support insert notifications, DISK_NO_INSERT_NOTIFICATION is set, the disk subsystem calls this function before each filesystem operation. If the media has changed, return error for the first call as signal to finalize work with old media and the true geometry for the second call. Assume that media is (possibly) changed anytime when motor is off.

Source
blkdev/flp_drv.inc:744

◆ floppy_read()

void floppy_read ( )

Reads one or more sectors from the device.

Source
blkdev/flp_drv.inc:879

◆ floppy_read_bootsector()

void floppy_read_bootsector ( )

◆ floppy_read_write()

void floppy_read_write ( dword  userdata,
dword  buffer,
qword  start_sector,
dword  numsectors_ptr 
)

Common part of floppy_read and floppy_write.

Source
blkdev/flp_drv.inc:884

◆ floppy_write()

void floppy_write ( )

Writes one or more sectors to the device.

Source
blkdev/flp_drv.inc:873

Variable Documentation

◆ _info

dd _info
Initial value
?
Source
blkdev/flp_drv.inc:747

◆ _operation

db _operation
Initial value
?
Source
blkdev/flp_drv.inc:887

◆ _sectors_todo

dd _sectors_todo
Initial value
?
Source
blkdev/flp_drv.inc:886

◆ _userdata

dd _userdata
Initial value
?
Source
blkdev/flp_drv.inc:746
Initial value
?
Source
blkdev/rd.inc:186

◆ calculate_chs

label calculate_chs

◆ check_fdd_motor_status

label check_fdd_motor_status

◆ dT

label dT

wait 0.5 s

Source
blkdev/flp_drv.inc:246

◆ End_5

label End_5

DEBUGF 1,' ok
'.

Source
blkdev/flp_drv.inc:140

◆ End_6

label End_6

DEBUGF 1,'K : FDCDataInput: x
',al.

Source
blkdev/flp_drv.inc:174

◆ End_7

◆ end_check_fdd_motor_status

label end_check_fdd_motor_status

◆ end_check_fdd_motor_status_1

label end_check_fdd_motor_status_1

◆ Err

label Err

Track not found.

Source
blkdev/flp_drv.inc:444

◆ Err_1

◆ Err_2

◆ Err_3

◆ Err_4

◆ Exit

◆ Exit_1

◆ Exit_2

◆ Exit_3

◆ Exit_4

◆ FDC_C

DB FDC_C
Initial value
?
Source
blkdev/flp_drv.inc:65

◆ FDC_H

DB FDC_H
Initial value
?
Source
blkdev/flp_drv.inc:66

◆ FDC_N

DB FDC_N
Initial value
?
Source
blkdev/flp_drv.inc:68

◆ FDC_R

DB FDC_R
Initial value
?
Source
blkdev/flp_drv.inc:67

◆ FDC_ST0

DB FDC_ST0

Operation result block.

Initial value
?
Source
blkdev/flp_drv.inc:62

◆ FDC_ST1

DB FDC_ST1
Initial value
?
Source
blkdev/flp_drv.inc:63

◆ FDC_ST2

DB FDC_ST2
Initial value
?
Source
blkdev/flp_drv.inc:64

◆ FDC_Status

DB FDC_Status

Operation completion code with the floppy disk drive controller.

Initial value
?
Source
blkdev/flp_drv.inc:49

◆ FDCDataInput

label FDCDataInput

****************************************** READ BYTE FROM FDC DATA PORT * Procedure doesnt have input params. * Output : * AL - byte read. *

Source
blkdev/flp_drv.inc:151

◆ FDCDataOutput

label FDCDataOutput

*********************************** WRITE BYTE TO FDC DATA PORT * Parameters: * AL - byte to write. *

Source
blkdev/flp_drv.inc:114

◆ FDCInterrupt

label FDCInterrupt

********************************************* FDC INTERRUPT HANDLER *

Source
blkdev/flp_drv.inc:182

◆ FDD_Head

DB FDD_Head
Initial value
?
Source
blkdev/flp_drv.inc:58

◆ FDD_IntFlag

DB FDD_IntFlag

Interrupt flag from floppy disk drive.

Initial value
?
Source
blkdev/flp_drv.inc:51

◆ fdd_motor_on

label fdd_motor_on

◆ fdd_motor_on_B

label fdd_motor_on_B

◆ fdd_motor_status

db fdd_motor_status

Memory area for storing the readed sector FDD_DataBuffer: times 512 db 0 ;DB 512 DUP (?)

Initial value
0
Source
blkdev/flp_drv.inc:76

◆ FDD_Sector

DB FDD_Sector
Initial value
?
Source
blkdev/flp_drv.inc:59

◆ FDD_Time

DD FDD_Time

The moment of the beginning of the last operation with FDD.

Initial value
?
Source
blkdev/flp_drv.inc:53

◆ FDD_Track

DB FDD_Track

Sector coordinates.

Initial value
?
Source
blkdev/flp_drv.inc:57

◆ FDD_Type

db FDD_Type

Drive number.

Initial value
0
Source
blkdev/flp_drv.inc:55

◆ FDDMotorOFF

label FDDMotorOFF

********************************** TURN OFF MOTOR OF DRIVE *

Source
blkdev/flp_drv.inc:321

◆ FDDMotorOFF_1

label FDDMotorOFF_1

◆ FDDMotorOFF_2

label FDDMotorOFF_2

◆ FDDMotorOFF_A

label FDDMotorOFF_A

◆ FDDMotorOFF_B

label FDDMotorOFF_B

◆ FDDMotorON

label FDDMotorON

*********************************** Turn on the motor of drive "A:" *

Source
blkdev/flp_drv.inc:219

◆ FDDMotorON_1

label FDDMotorON_1

◆ FDDMotorON_B

label FDDMotorON_B

◆ floppy1_name

db floppy1_name
Initial value
'fd',0
Source
blkdev/flp_drv.inc:715

◆ floppy2_name

db floppy2_name
Initial value
'fd2',0
Source
blkdev/flp_drv.inc:716

◆ floppy_functions

label floppy_functions

◆ floppy_media_flags

rb floppy_media_flags
Initial value
2
Source
blkdev/flp_drv.inc:699

◆ floppy_mutex

MUTEX floppy_mutex

Hardware does not allow to work with two floppies in parallel, so there is one mutex guarding access to any floppy.

Initial value
Source
blkdev/flp_drv.inc:707

◆ flp_label

rb flp_label

Label and ID of inserted floppy disk.

Initial value
15*2
Source
blkdev/flp_drv.inc:703

◆ flp_number

db flp_number

1- Floppy A, 2-Floppy B

Initial value
0
Source
blkdev/flp_drv.inc:701

◆ GetByteFromFDC

label GetByteFromFDC

Get byte from data port.

Source
blkdev/flp_drv.inc:170

◆ GetStatusInfo

label GetStatusInfo

********************************************* GET INFORMATION ABOUT THE RESULT OF THE OPERATION

Source
blkdev/flp_drv.inc:661

◆ give_back_application_data_1

label give_back_application_data_1

◆ Init_FDC_DMA

label Init_FDC_DMA

************************************** INITIALIZATION OF DMA MODE FOR FDD *

Source
blkdev/flp_drv.inc:82

◆ n_sector

dd n_sector

temporary save for sector value

Initial value
0
Source
blkdev/flp_drv.inc:700

◆ no_seek_track_1

label no_seek_track_1

◆ old_track

db old_track

old value track

Initial value
0
Source
blkdev/flp_drv.inc:702

◆ OutByteToFDC

label OutByteToFDC

Write byte to data port.

Source
blkdev/flp_drv.inc:135

◆ read_chs_sector

label read_chs_sector

◆ ReadRepCounter

DB ReadRepCounter

Read operation repetition counter.

Initial value
?
Source
blkdev/flp_drv.inc:70

◆ ReadSector

label ReadSector

******************************************************* READING A DATA SECTOR * Parameters are passed through global variables: * FDD_Track - track number (0-79); * FDD_Head - head number (0-1); * FDD_Sector - sector number (1-18). * Result of operation is written to FDC_Status. * If the read operation is successful, the contents * of the sector will be written to FDD_DataBuffer. *

Source
blkdev/flp_drv.inc:462

◆ ReadSector_1

label ReadSector_1

◆ ReadSectWithRetr

label ReadSectWithRetr

******************************************************* READ SECTOR (WITH RETRY OF OPERATION ON FAILURE) * Parameters are passed through global variables: * FDD_Track - track number (0-79); * FDD_Head - head number (0-1); * FDD_Sector - sector number (1-18). * Result of operation is written to FDC_Status. * If the read operation is successful, the contents * of the sector will be written to FDD_DataBuffer. *

Source
blkdev/flp_drv.inc:526

◆ RecalibrateFDD

label RecalibrateFDD

******************************* RECALIBRATE DRIVE "A:" *

Source
blkdev/flp_drv.inc:354

◆ RecalRepCounter

DB RecalRepCounter

Recalibration operation repetition counter.

Initial value
?
Source
blkdev/flp_drv.inc:72

◆ save_chs_sector

label save_chs_sector

◆ save_timer_fdd_motor

label save_timer_fdd_motor

***************************************** SAVING TIME STAMP *

Source
blkdev/flp_drv.inc:280

◆ SeekTrack

label SeekTrack

***************************************************** TRACK SEARCH * Parameters are passed through global variables: * FDD_Track - track number (0-79); * FDD_Head - head number (0-1). * Result of operation is written to FDC_Status. *

Source
blkdev/flp_drv.inc:397

◆ take_data_from_application_1

label take_data_from_application_1

◆ TestRS

◆ TestRS_1

label TestRS_1

◆ TestRS_2

label TestRS_2

Wait for the floppy disk interrupt flag to be set.

Source
blkdev/flp_drv.inc:200

◆ TickCounter

dd TickCounter

Timer tick counter.

Initial value
?
Source
blkdev/flp_drv.inc:47

◆ timer_fdd_motor

dd timer_fdd_motor
Initial value
0
Source
blkdev/flp_drv.inc:77

◆ TryAgain

label TryAgain

◆ TryAgain_1

label TryAgain_1

◆ WaitFDCInterrupt

label WaitFDCInterrupt

******************************************* WAIT FOR INTERRUPT FROM FDC *

Source
blkdev/flp_drv.inc:192

◆ WriteSector

label WriteSector

******************************************************* WRITE DATA SECTOR * Parameters are passed through global variables: * FDD_Track - track number (0-79); * FDD_Head - head number (0-1); * FDD_Sector - sector number (1-18). * Result of operation is written to FDC_Status. * If the write operation is successful, the contents * of FDD_DataBuffer will be written to the sector *

Source
blkdev/flp_drv.inc:566

◆ WriteSector_1

label WriteSector_1

◆ WriteSectWithRetr

label WriteSectWithRetr

******************************************************* WRITE SECTOR (WITH REPEAT ON FAILURE) * Parameters are passed through global variables: * FDD_Track - track number (0-79); * FDD_Head - head number (0-1); * FDD_Sector - sector number (1-18). * Result of operation is written to FDC_Status. * If the write operation is successful, the contents * of FDD_DataBuffer will be written to the sector *

Source
blkdev/flp_drv.inc:628