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:286

◆ 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:719

◆ 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:742

◆ floppy_read()

void floppy_read ( )

Reads one or more sectors from the device.

Source
blkdev/flp_drv.inc:877

◆ 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:882

◆ floppy_write()

void floppy_write ( )

Writes one or more sectors to the device.

Source
blkdev/flp_drv.inc:871

Variable Documentation

◆ _info

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

◆ _operation

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

◆ _sectors_todo

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

◆ _userdata

dd _userdata
Initial value
?
Source
blkdev/flp_drv.inc:744
Initial value
?
Source
blkdev/rd.inc:185

◆ 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:244

◆ End_5

label End_5

DEBUGF 1,' ok
'.

Source
blkdev/flp_drv.inc:138

◆ End_6

label End_6

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

Source
blkdev/flp_drv.inc:172

◆ 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:442

◆ 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:63

◆ FDC_H

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

◆ FDC_N

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

◆ FDC_R

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

◆ FDC_ST0

DB FDC_ST0

Operation result block.

Initial value
?
Source
blkdev/flp_drv.inc:60

◆ FDC_ST1

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

◆ FDC_ST2

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

◆ FDC_Status

DB FDC_Status

Operation completion code with the floppy disk drive controller.

Initial value
?
Source
blkdev/flp_drv.inc:47

◆ FDCDataInput

label FDCDataInput

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

Source
blkdev/flp_drv.inc:149

◆ FDCDataOutput

label FDCDataOutput

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

Source
blkdev/flp_drv.inc:112

◆ FDCInterrupt

label FDCInterrupt

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

Source
blkdev/flp_drv.inc:180

◆ FDD_Head

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

◆ FDD_IntFlag

DB FDD_IntFlag

Interrupt flag from floppy disk drive.

Initial value
?
Source
blkdev/flp_drv.inc:49

◆ 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:74

◆ FDD_Sector

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

◆ FDD_Time

DD FDD_Time

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

Initial value
?
Source
blkdev/flp_drv.inc:51

◆ FDD_Track

DB FDD_Track

Sector coordinates.

Initial value
?
Source
blkdev/flp_drv.inc:55

◆ FDD_Type

db FDD_Type

Drive number.

Initial value
0
Source
blkdev/flp_drv.inc:53

◆ FDDMotorOFF

label FDDMotorOFF

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

Source
blkdev/flp_drv.inc:319

◆ 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:217

◆ FDDMotorON_1

label FDDMotorON_1

◆ FDDMotorON_B

label FDDMotorON_B

◆ floppy1_name

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

◆ floppy2_name

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

◆ floppy_functions

label floppy_functions

◆ floppy_media_flags

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

◆ 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:705

◆ flp_label

rb flp_label

Label and ID of inserted floppy disk.

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

◆ flp_number

db flp_number

1- Floppy A, 2-Floppy B

Initial value
0
Source
blkdev/flp_drv.inc:699

◆ GetByteFromFDC

label GetByteFromFDC

Get byte from data port.

Source
blkdev/flp_drv.inc:168

◆ GetStatusInfo

label GetStatusInfo

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

Source
blkdev/flp_drv.inc:659

◆ 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:80

◆ n_sector

dd n_sector

temporary save for sector value

Initial value
0
Source
blkdev/flp_drv.inc:698

◆ 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:700

◆ OutByteToFDC

label OutByteToFDC

Write byte to data port.

Source
blkdev/flp_drv.inc:133

◆ read_chs_sector

label read_chs_sector

◆ ReadRepCounter

DB ReadRepCounter

Read operation repetition counter.

Initial value
?
Source
blkdev/flp_drv.inc:68

◆ 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:460

◆ 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:524

◆ RecalibrateFDD

label RecalibrateFDD

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

Source
blkdev/flp_drv.inc:352

◆ RecalRepCounter

DB RecalRepCounter

Recalibration operation repetition counter.

Initial value
?
Source
blkdev/flp_drv.inc:70

◆ save_chs_sector

label save_chs_sector

◆ save_timer_fdd_motor

label save_timer_fdd_motor

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

Source
blkdev/flp_drv.inc:278

◆ 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:395

◆ 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:198

◆ TickCounter

dd TickCounter

Timer tick counter.

Initial value
?
Source
blkdev/flp_drv.inc:45

◆ timer_fdd_motor

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

◆ TryAgain

label TryAgain

◆ TryAgain_1

label TryAgain_1

◆ WaitFDCInterrupt

label WaitFDCInterrupt

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

Source
blkdev/flp_drv.inc:190

◆ 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:564

◆ 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:626