diff options
| author | Harley Travis <harleytravis123@outlook.com> | 2026-06-27 11:23:35 -0500 |
|---|---|---|
| committer | Harley Travis <harleytravis123@outlook.com> | 2026-06-27 11:23:35 -0500 |
| commit | b6ba4cafe95ee3e6eca548ea61f295e2899834d0 (patch) | |
| tree | 56dcf91d4b9c56d968157ca07ebc8068f2b22c14 /Kernel/BlkDev/DskFDC.HC | |
| parent | cc4b91b110769c35fd0e5cc3a7403f2ffc84f5dd (diff) | |
| download | templeos-floppy-driver-b6ba4cafe95ee3e6eca548ea61f295e2899834d0.tar.gz | |
Update FDCReadByte and FDCSendByte
FDCReadByte and FDCSendByte have been updated to store the MSR contents into a separate variable for readability. They also now Yield; when polling to prevent the OS from feezing.
Diffstat (limited to 'Kernel/BlkDev/DskFDC.HC')
| -rw-r--r-- | Kernel/BlkDev/DskFDC.HC | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Kernel/BlkDev/DskFDC.HC b/Kernel/BlkDev/DskFDC.HC index 9b14e4e..53cdccb 100644 --- a/Kernel/BlkDev/DskFDC.HC +++ b/Kernel/BlkDev/DskFDC.HC @@ -61,36 +61,40 @@ U8 FDCReadByte(CBlkDev *bd) { // Read byte from FDC. - U8 byte; // The byte read + U64 byte,msr; // The byte read, and the MSR contents F64 timeout; // Timeout variable timeout = tS()+3.0; // 3 second timeout while (TRUE) { - if (InU8(bd->base0+FDC_MSR_DSR)>>6==3) { + msr=InU8(bd->base0+FDC_MSR_DSR); + if (msr>>6==3) { byte=InU8(bd->base0+FDC_DATA); return byte; } if (tS()>timeout) { throw('BlkDev'); } + Yield; } } U0 FDCSendByte(CBlkDev *bd,U8 byte) { // Send byte to FDC. - + U64 msr; // MSR contents F64 timeout; // Timeout variable timeout=tS()+3.0; // 3 second timeout while (TRUE) { - if (InU8(bd->base0+FDC_MSR_DSR)>>6==2) { + msr=InU8(bd->base0+FDC_MSR_DSR); + if (msr>>6==2) { OutU8(bd->base0+FDC_DATA,byte); return; } if (tS()>timeout) { throw('BlkDev'); } + Yield; } } |
