#include "precomp.h"
#include <debug.h>
Go to the source code of this file.
|
static BOOLEAN NTAPI | ReadyForWrite (PCONTROLLER_INFO ControllerInfo) |
|
static BOOLEAN NTAPI | ReadyForRead (PCONTROLLER_INFO ControllerInfo) |
|
static NTSTATUS NTAPI | Send_Byte (PCONTROLLER_INFO ControllerInfo, UCHAR Byte) |
|
static NTSTATUS NTAPI | Get_Byte (PCONTROLLER_INFO ControllerInfo, PUCHAR Byte) |
|
NTSTATUS NTAPI | HwSetDataRate (PCONTROLLER_INFO ControllerInfo, UCHAR DataRate) |
|
NTSTATUS NTAPI | HwTurnOffMotor (PCONTROLLER_INFO ControllerInfo) |
|
NTSTATUS NTAPI | HwTurnOnMotor (PDRIVE_INFO DriveInfo) |
|
NTSTATUS NTAPI | HwSenseDriveStatus (PDRIVE_INFO DriveInfo) |
|
NTSTATUS NTAPI | HwReadWriteData (PCONTROLLER_INFO ControllerInfo, BOOLEAN Read, UCHAR Unit, UCHAR Cylinder, UCHAR Head, UCHAR Sector, UCHAR BytesPerSector, UCHAR EndOfTrack, UCHAR Gap3Length, UCHAR DataLength) |
|
NTSTATUS NTAPI | HwRecalibrateResult (PCONTROLLER_INFO ControllerInfo) |
|
NTSTATUS NTAPI | HwReadWriteResult (PCONTROLLER_INFO ControllerInfo) |
|
NTSTATUS NTAPI | HwRecalibrate (PDRIVE_INFO DriveInfo) |
|
NTSTATUS NTAPI | HwSenseInterruptStatus (PCONTROLLER_INFO ControllerInfo) |
|
NTSTATUS NTAPI | HwReadId (PDRIVE_INFO DriveInfo, UCHAR Head) |
|
NTSTATUS NTAPI | HwFormatTrack (PCONTROLLER_INFO ControllerInfo, UCHAR Unit, UCHAR Head, UCHAR BytesPerSector, UCHAR SectorsPerTrack, UCHAR Gap3Length, UCHAR FillerPattern) |
|
NTSTATUS NTAPI | HwSeek (PDRIVE_INFO DriveInfo, UCHAR Cylinder) |
|
NTSTATUS NTAPI | HwConfigure (PCONTROLLER_INFO ControllerInfo, BOOLEAN EIS, BOOLEAN EFIFO, BOOLEAN POLL, UCHAR FIFOTHR, UCHAR PRETRK) |
|
NTSTATUS NTAPI | HwGetVersion (PCONTROLLER_INFO ControllerInfo) |
|
NTSTATUS NTAPI | HwDiskChanged (PDRIVE_INFO DriveInfo, PBOOLEAN DiskChanged) |
|
NTSTATUS NTAPI | HwSenseDriveStatusResult (PCONTROLLER_INFO ControllerInfo, PUCHAR Status) |
|
NTSTATUS NTAPI | HwReadIdResult (PCONTROLLER_INFO ControllerInfo, PUCHAR CurCylinder, PUCHAR CurHead) |
|
NTSTATUS NTAPI | HwSpecify (PCONTROLLER_INFO ControllerInfo, UCHAR HeadLoadTime, UCHAR HeadUnloadTime, UCHAR StepRateTime, BOOLEAN NonDma) |
|
NTSTATUS NTAPI | HwReset (PCONTROLLER_INFO ControllerInfo) |
|
NTSTATUS NTAPI | HwPowerOff (PCONTROLLER_INFO ControllerInfo) |
|
VOID NTAPI | HwDumpRegisters (PCONTROLLER_INFO ControllerInfo) |
|
◆ Get_Byte()
Definition at line 158 of file hardware.c.
176{
178
180
181 for(
i = 0;
i < 5;
i++)
182 {
184 break;
185
187 }
188
190 {
193 }
194 else
195 {
196 INFO_(FLOPPY,
"Get_Byte: timed out trying to write\n");
199 }
200}
VOID NTAPI HwDumpRegisters(PCONTROLLER_INFO ControllerInfo)
static BOOLEAN NTAPI ReadyForRead(PCONTROLLER_INFO ControllerInfo)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define KeStallExecutionProcessor(MicroSeconds)
#define READ_PORT_UCHAR(p)
#define STATUS_UNSUCCESSFUL
Referenced by HwGetVersion(), HwReadIdResult(), HwReadWriteResult(), HwRecalibrateResult(), HwSenseDriveStatusResult(), and HwSenseInterruptStatus().
◆ HwConfigure()
Definition at line 703 of file hardware.c.
724{
727
728 TRACE_(FLOPPY,
"HwConfigure called\n");
729
731
736
737 for(
i = 0;
i < 4;
i++)
739 {
740 WARN_(FLOPPY,
"HwConfigure: failed to write the fifo\n");
742 }
743
745}
static NTSTATUS NTAPI Send_Byte(PCONTROLLER_INFO ControllerInfo, UCHAR Byte)
#define COMMAND_CONFIGURE
Referenced by InitController().
◆ HwDiskChanged()
Definition at line 785 of file hardware.c.
797{
800
802
803 TRACE_(FLOPPY,
"HwDiskChanged: read 0x%x from DIR\n",
Buffer);
804
806 {
808 {
809 INFO_(FLOPPY,
"HdDiskChanged - Model30 - returning TRUE\n");
811 }
812 else
813 {
814 INFO_(FLOPPY,
"HdDiskChanged - Model30 - returning FALSE\n");
815 *DiskChanged =
FALSE;
816 }
817 }
818 else
819 {
821 {
822 INFO_(FLOPPY,
"HdDiskChanged - PS2 - returning TRUE\n");
824 }
825 else
826 {
827 INFO_(FLOPPY,
"HdDiskChanged - PS2 - returning FALSE\n");
828 *DiskChanged =
FALSE;
829 }
830 }
831
833}
struct _CONTROLLER_INFO * PCONTROLLER_INFO
#define DIGITAL_INPUT_REGISTER
#define DIR_DISKETTE_CHANGE
struct _CONTROLLER_INFO * ControllerInfo
Referenced by DeviceIoctlPassive(), ReadWritePassive(), and ResetChangeFlag().
◆ HwDumpRegisters()
◆ HwFormatTrack()
Definition at line 611 of file hardware.c.
632{
635
636 TRACE_(FLOPPY,
"HwFormatTrack called\n");
637
639
642 Buffer[2] = BytesPerSector;
645 Buffer[5] = FillerPattern;
646
647 for(
i = 0;
i < 6;
i++)
649 {
650 WARN_(FLOPPY,
"HwFormatTrack: unable to send bytes to floppy\n");
652 }
653
655}
#define COMMAND_FORMAT_TRACK
#define COMMAND_HEAD_NUMBER_SHIFT
_In_ ULONG _In_ ULONG SectorsPerTrack
◆ HwGetVersion()
Definition at line 749 of file hardware.c.
762{
764
766
768 {
769 WARN_(FLOPPY,
"HwGetVersion: unable to write fifo\n");
771 }
772
774 {
775 WARN_(FLOPPY,
"HwGetVersion: unable to write fifo\n");
777 }
778
779 INFO_(FLOPPY,
"HwGetVersion returning version 0x%x\n",
Buffer);
780
782}
static NTSTATUS NTAPI Get_Byte(PCONTROLLER_INFO ControllerInfo, PUCHAR Byte)
Referenced by InitController().
◆ HwPowerOff()
Definition at line 1010 of file hardware.c.
1020{
1021 TRACE_(FLOPPY,
"HwPowerOff called on controller 0x%p\n", ControllerInfo);
1022
1024
1026}
#define DATA_RATE_SELECT_REGISTER
#define WRITE_PORT_UCHAR(p, d)
Referenced by Unload().
◆ HwReadId()
◆ HwReadIdResult()
Definition at line 864 of file hardware.c.
883{
886
888
889 for(
i = 0;
i < 7;
i++)
891 {
892 WARN_(FLOPPY,
"ReadIdResult(): can't read from the controller\n");
894 }
895
896
899
900
902 {
903 WARN_(FLOPPY,
"ReadId didn't return last command success\n");
905 }
906
907
909 {
910 WARN_(FLOPPY,
"ReadId didn't find an address mark\n");
912 }
913
914 if(CurCylinder)
916
917 if(CurHead)
919
921}
#define SR0_LAST_COMMAND_STATUS
#define SR1_CANNOT_FIND_ID_ADDRESS
Referenced by RWDetermineMediaType(), and RWSeekToCylinder().
◆ HwReadWriteData()
Definition at line 322 of file hardware.c.
351{
354
356
357
359
360
363 else
365
367
372 Buffer[5] = BytesPerSector;
376
377
378 for(
i = 0;
i < 9;
i++)
379 {
380 INFO_(FLOPPY,
"HwReadWriteData: Sending a command byte to the FIFO: 0x%x\n",
Buffer[
i]);
381
383 {
384 WARN_(FLOPPY,
"HwReadWriteData: Unable to write to the FIFO\n");
386 }
387 }
388
390}
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
#define COMMAND_WRITE_DATA
#define COMMAND_READ_DATA
Referenced by ReadWritePassive().
◆ HwReadWriteResult()
Definition at line 462 of file hardware.c.
477{
480
482
483 for(
i = 0;
i < 7;
i++)
485 {
486 WARN_(FLOPPY,
"HwReadWriteResult: unable to read fifo\n");
488 }
489
490
493
494
497
499}
Referenced by ReadWritePassive().
◆ HwRecalibrate()
◆ HwRecalibrateResult()
Definition at line 394 of file hardware.c.
409{
412
414
416 {
417 WARN_(FLOPPY,
"HwRecalibrateResult: Unable to write the controller\n");
419 }
420
421 for(
i = 0;
i < 2;
i++)
423 {
424 WARN_(FLOPPY,
"HwRecalibrateResult: unable to read FIFO\n");
426 }
427
428
429 INFO_(FLOPPY,
"HwRecalibrateResult results: ST0: 0x%x PCN: 0x%x\n",
Buffer[0],
Buffer[1]);
430
431
432
433
434
435
436
438 {
439 WARN_(FLOPPY,
"HwRecalibrateResult: PCN not 0\n");
441 }
442
443
445 {
446 WARN_(FLOPPY,
"HwRecalibrateResult: Failed to complete the seek\n");
448 }
449
450
452 {
453 WARN_(FLOPPY,
"HwRecalibrateResult: Seeked to track 0 successfully, but EC is set; returning failure\n");
455 }
456
458}
#define COMMAND_SENSE_INTERRUPT_STATUS
#define SR0_EQUIPMENT_CHECK
#define SR0_SEEK_COMPLETE
Referenced by Recalibrate(), and RWDetermineMediaType().
◆ HwReset()
Definition at line 973 of file hardware.c.
983{
984 TRACE_(FLOPPY,
"HwReset called\n");
985
986
988
989
991 {
993 INFO_(FLOPPY,
"HwReset: Setting Enable bit\n");
996
998 {
999 WARN_(FLOPPY,
"HwReset: failed to set the DOR enable bit!\n");
1002 }
1003 }
1004
1006}
#define DOR_DMA_IO_INTERFACE_ENABLE
Referenced by InitController().
◆ HwSeek()
Definition at line 659 of file hardware.c.
671{
675
676 TRACE_(FLOPPY,
"HwSeek called for cyl 0x%x\n", Cylinder);
677
679
683
684 for(
i = 0;
i < 3;
i++)
686 {
687 WARN_(FLOPPY,
"HwSeek: failed to write fifo\n");
689 }
690
691
695
697
699}
#define KeDelayExecutionThread(mode, foo, t)
CM_FLOPPY_DEVICE_DATA FloppyDeviceData
Referenced by ResetChangeFlag(), and RWSeekToCylinder().
◆ HwSenseDriveStatus()
Definition at line 287 of file hardware.c.
299{
302
304
305 TRACE_(FLOPPY,
"HwSenseDriveStatus called\n");
306
309
310 for(
i = 0;
i < 2;
i++)
312 {
313 WARN_(FLOPPY,
"HwSenseDriveStatus: failed to write FIFO\n");
315 }
316
318}
#define COMMAND_SENSE_DRIVE_STATUS
Referenced by DeviceIoctlPassive().
◆ HwSenseDriveStatusResult()
◆ HwSenseInterruptStatus()
◆ HwSetDataRate()
◆ HwSpecify()
Definition at line 925 of file hardware.c.
946{
949
951
952
953
954
957
958
959 WARN_(FLOPPY,
"HWSPECIFY: FIXME - sending 0x3 0xd1 0x2 to FIFO\n");
960
961 for(
i = 0;
i < 3;
i++)
963 {
964 WARN_(FLOPPY,
"HwSpecify: unable to write to controller\n");
966 }
967
969}
Referenced by InitController(), and RWDetermineMediaType().
◆ HwTurnOffMotor()
◆ HwTurnOnMotor()
Definition at line 245 of file hardware.c.
257{
261
263
264
266
269
278
281
283}
#define DOR_FLOPPY_MOTOR_ON_A
#define DOR_FLOPPY_MOTOR_ON_D
#define DOR_FLOPPY_MOTOR_ON_C
#define DOR_FLOPPY_MOTOR_ON_B
Referenced by StartMotor().
◆ ReadyForRead()
Definition at line 85 of file hardware.c.
97{
99
102
105
107}
#define MSR_DATA_REG_READY_FOR_IO
Referenced by Get_Byte().
◆ ReadyForWrite()
◆ Send_Byte()
Definition at line 111 of file hardware.c.
130{
132
134
135 for(
i = 0;
i < 5;
i++)
136 {
138 break;
139
141 }
142
144 {
147 }
148 else
149 {
150 INFO_(FLOPPY,
"Send_Byte: timed out trying to write\n");
153 }
154}
static BOOLEAN NTAPI ReadyForWrite(PCONTROLLER_INFO ControllerInfo)
Referenced by HwConfigure(), HwFormatTrack(), HwGetVersion(), HwReadId(), HwReadWriteData(), HwRecalibrate(), HwRecalibrateResult(), HwSeek(), HwSenseDriveStatus(), HwSenseInterruptStatus(), and HwSpecify().