|
|
1.1 root 1: /*
1.1.1.3 root 2: Hatari - fdc.h
3:
1.1.1.12 root 4: This file is distributed under the GNU General Public License, version 2
5: or at your option any later version. Read the file gpl.txt for details.
1.1 root 6: */
7:
1.1.1.3 root 8: #ifndef HATARI_FDC_H
9: #define HATARI_FDC_H
10:
1.1 root 11:
1.1.1.13! root 12: /* Values for the Size byte in the Address Field of a sector */
! 13: #define FDC_SECTOR_SIZE_MASK 0x03 /* Only bits 0-1 of the Sector size in the ID field are used by the WD1772 */
! 14:
! 15: #define FDC_SECTOR_SIZE_128 0 /* Sector size used in the ID fields */
! 16: #define FDC_SECTOR_SIZE_256 1
! 17: #define FDC_SECTOR_SIZE_512 2
! 18: #define FDC_SECTOR_SIZE_1024 3
! 19:
! 20:
! 21: /* These are some standard GAP values to format a track with 9 or 10 sectors */
! 22: /* When handling ST/MSA disk images, those values are required to get accurate */
! 23: /* timings when emulating disk's spin and index's position. */
! 24: /* Those values are also use to build standard sector in STX disk images when */
! 25: /* track contains only the sector data and no sector info. */
! 26: #define FDC_TRACK_LAYOUT_STANDARD_GAP1 60 /* Track Pre GAP : 0x4e */
! 27: #define FDC_TRACK_LAYOUT_STANDARD_GAP2 12 /* Sector ID Pre GAP : 0x00 */
! 28: #define FDC_TRACK_LAYOUT_STANDARD_GAP3a 22 /* Sector ID Post GAP : 0x4e */
! 29: #define FDC_TRACK_LAYOUT_STANDARD_GAP3b 12 /* Sector DATA Pre GAP : 0x00 */
! 30: #define FDC_TRACK_LAYOUT_STANDARD_GAP4 40 /* Sector DATA Pre GAP : 0x4e */
! 31: #define FDC_TRACK_LAYOUT_STANDARD_GAP5 0 /* Track Post GAP : 0x4e (to fill the rest of the track, value is variable) */
! 32: /* GAP5 is 664 bytes for 9 sectors or 50 bytes for 10 sectors */
! 33:
! 34: /* Size of a raw standard 512 byte sector in a track, including ID field and all GAPs : 614 bytes */
! 35: /* (this must be the same as the data returned in FDC_UpdateReadTrackCmd() ) */
! 36: #define FDC_TRACK_LAYOUT_STANDARD_RAW_SECTOR_512 ( FDC_TRACK_LAYOUT_STANDARD_GAP2 \
! 37: + 3 + 1 + 6 + FDC_TRACK_LAYOUT_STANDARD_GAP3a + FDC_TRACK_LAYOUT_STANDARD_GAP3b \
! 38: + 3 + 1 + 512 + 2 + FDC_TRACK_LAYOUT_STANDARD_GAP4 )
! 39:
! 40:
! 41: #define FDC_IRQ_SOURCE_COMPLETE (1<<0) /* IRQ set after completing a command */
! 42: #define FDC_IRQ_SOURCE_INDEX (1<<1) /* IRQ set when COND_IP is set and index is reached */
! 43: #define FDC_IRQ_SOURCE_FORCED (1<<2) /* IRQ was forced by a previous Dx command with COND_IMMEDIATE */
! 44: #define FDC_IRQ_SOURCE_HDC (1<<3) /* IRQ set by HDC */
! 45: #define FDC_IRQ_SOURCE_OTHER (1<<4) /* IRQ set by other parts (IPF) */
! 46:
! 47:
1.1.1.11 root 48: extern void FDC_MemorySnapShot_Capture ( bool bSave );
1.1.1.13! root 49: extern void FDC_Init ( void );
! 50: extern void FDC_Reset ( bool bCold );
1.1.1.11 root 51: extern void FDC_SetDMAStatus ( bool bError );
1.1.1.3 root 52:
1.1.1.13! root 53: extern void FDC_SetIRQ ( Uint8 IRQ_Source );
! 54: extern void FDC_ClearIRQ ( void );
1.1.1.11 root 55: extern void FDC_InterruptHandler_Update ( void );
1.1.1.3 root 56:
1.1.1.13! root 57: extern void FDC_Drive_Set_BusyLed ( Uint8 SR );
! 58: extern int FDC_Get_Statusbar_Text ( char *text, size_t maxlen );
! 59: extern void FDC_Drive_Set_Enable ( int Drive , bool value );
! 60: extern void FDC_Drive_Set_NumberOfHeads ( int Drive , int NbrHeads );
! 61: extern void FDC_InsertFloppy ( int Drive );
! 62: extern void FDC_EjectFloppy ( int Drive );
! 63: extern void FDC_SetDriveSide ( Uint8 io_porta_old , Uint8 io_porta_new );
! 64: extern int FDC_GetBytesPerTrack ( int Drive );
! 65:
! 66: extern int FDC_IndexPulse_GetCurrentPos_FdcCycles ( Uint32 *pFdcCyclesPerRev );
! 67: extern int FDC_IndexPulse_GetCurrentPos_NbBytes ( void );
! 68: extern int FDC_IndexPulse_GetState ( void );
! 69: extern int FDC_NextIndexPulse_FdcCycles ( void );
! 70:
! 71: extern Uint8 FDC_GetCmdType ( Uint8 CR );
! 72:
1.1.1.11 root 73: extern void FDC_DiskController_WriteWord ( void );
74: extern void FDC_DiskControllerStatus_ReadWord ( void );
75: extern void FDC_DmaModeControl_WriteWord ( void );
76: extern void FDC_DmaStatus_ReadWord ( void );
1.1.1.13! root 77: extern int FDC_DMA_GetModeControl_R_WR ( void );
! 78: extern void FDC_DMA_FIFO_Push ( Uint8 Byte );
! 79: extern Uint8 FDC_DMA_FIFO_Pull ( void );
! 80:
! 81: extern void FDC_Buffer_Reset ( void );
! 82: extern void FDC_Buffer_Add_Timing ( Uint8 Byte , Uint16 Timing );
! 83: extern void FDC_Buffer_Add ( Uint8 Byte );
! 84: extern Uint16 FDC_Buffer_Read_Timing ( void );
! 85: extern Uint8 FDC_Buffer_Read_Byte ( void );
! 86: extern Uint8 FDC_Buffer_Read_Byte_pos ( int pos );
! 87: extern int FDC_Buffer_Get_Size ( void );
! 88:
1.1.1.11 root 89: extern void FDC_DmaAddress_ReadByte ( void );
90: extern void FDC_DmaAddress_WriteByte ( void );
91: extern Uint32 FDC_GetDMAAddress ( void );
92: extern void FDC_WriteDMAAddress ( Uint32 Address );
93:
94: extern void FDC_FloppyMode_ReadByte ( void );
95: extern void FDC_FloppyMode_WriteByte ( void );
1.1.1.3 root 96:
97: #endif /* ifndef HATARI_FDC_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.