Annotation of coherent/f/usr/include.78/sys/fdc765.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * /usr/include/sys/fdc765.h
        !             3:  *
        !             4:  * Support 765-style controller for diskette and floppy tape
        !             5:  *
        !             6:  * Revised: Mon Jun 14 07:15:35 1993 CDT
        !             7:  */
        !             8: #ifndef __SYS_FDC765_H__
        !             9: #define __SYS_FDC765_H__
        !            10: 
        !            11: /*
        !            12:  * ----------------------------------------------------------------------
        !            13:  * Includes.
        !            14:  */
        !            15: 
        !            16: /*
        !            17:  * ----------------------------------------------------------------------
        !            18:  * Definitions.
        !            19:  *     Constants.
        !            20:  *     Macros with argument lists.
        !            21:  *     Typedefs.
        !            22:  *     Enums.
        !            23:  */
        !            24: 
        !            25: /* Port addresses */
        !            26: #define FDCDOR 0x3F2                   /* Digital output */
        !            27: #define        FDCDAT  0x3F5                   /* Data register */
        !            28: #define        FDCMSR  0x3F4                   /* Main status register */
        !            29: #define        FDCRATE 0x3F7                   /* Transfer rate (500,300,250 Kbps) */
        !            30:                                        /* 0=500 1=300 2=250 3=1000 Kbps */
        !            31: #define FDCCHGL 0x3F7                  /* Port where we read the disk */
        !            32:                                        /* changed line */
        !            33: 
        !            34: /* FDCDOR masks */
        !            35: #define        DORDS   0x03                    /* Drive select bits */
        !            36: #define        DORNMR  0x04                    /* Not master reset */
        !            37: #define        DORIEN  0x08                    /* Interrupt, DMA enable */
        !            38: #define        DORMS   0xF0                    /* Motor enables */
        !            39: 
        !            40: /* FDCDMSR masks */
        !            41: #define        MSRDB   0x0F                    /* Drive busy */
        !            42: #define        MSRCB   0x10                    /* Control busy */
        !            43: #define        MSRNDMA 0x20                    /* Not DMA */
        !            44: #define        MSRDIO  0x40                    /* Data direction */
        !            45: #define        MSRRQM  0x80                    /* Request for master */
        !            46: 
        !            47: /* FDCCHGL mask */
        !            48: #define DSKCHGD 0x80                   /* Diskette changed line bit. */
        !            49: 
        !            50: /* FDCRATE values (transfer rates) */
        !            51: #define FDC_RATE_500K  0
        !            52: #define FDC_RATE_300K  1
        !            53: #define FDC_RATE_250K  2
        !            54: #define FDC_RATE_1MEG  3
        !            55: /*
        !            56:  * Status Register 0 - Bit Definitions.
        !            57:  */
        !            58: #define        ST0_US0 0x01                    /* Unit Select 0 */
        !            59: #define        ST0_US1 0x02                    /* Unit Select 1 */
        !            60: #define        ST0_HD  0x04                    /* Head Address */
        !            61: #define        ST0_NR  0x08                    /* Not Ready */
        !            62: #define        ST0_EC  0x10                    /* Equipment Check */
        !            63: #define        ST0_SE  0x20                    /* Seek End */
        !            64: #define        ST0_IC  0xC0                    /* Interrupt code */
        !            65: #define        ST0_NT  0x00                    /* Normal Termination */
        !            66: 
        !            67: /*
        !            68:  * Status Register 1 - Bit Definitions.
        !            69:  */
        !            70: #define        ST1_MA  0x01                    /* Missing Address Mark */
        !            71: #define        ST1_NW  0x02                    /* Not writeable */
        !            72: #define        ST1_ND  0x04                    /* No Data */
        !            73:        /*      0x08 */                 /* Not used - always 0 */
        !            74: #define        ST1_OR  0x10                    /* Overrun */
        !            75: #define        ST1_DE  0x20                    /* Data Error */
        !            76:        /*      0x40 */                 /* Not used - always 0 */
        !            77: #define        ST1_EN  0x80                    /* End of Cylinder */
        !            78: 
        !            79: /*
        !            80:  * Status Register 2 - Bit Definitions.
        !            81:  */
        !            82: #define        ST2_MD  0x01                    /* Missing Address Mark in Data Field */
        !            83: #define        ST2_BC  0x02                    /* Bad Cylinder */
        !            84: #define        ST2_SN  0x04                    /* Scan Not Satisfied */
        !            85: #define        ST2_SH  0x08                    /* Scan Equal Hit */
        !            86: #define        ST2_WC  0x10                    /* Wrong Cylinder */
        !            87: #define        ST2_DD  0x20                    /* Data Error in Data Field */
        !            88: #define        ST2_CM  0x40                    /* Control Mark */
        !            89:        /*      0x80 */                 /* Not used - always 0 */
        !            90: 
        !            91: /*
        !            92:  * Status Register 3 - Bit Definitions.
        !            93:  */
        !            94: #define        ST3_US0 0x01                    /* Unit Select 0 */
        !            95: #define        ST3_US1 0x02                    /* Unit Select 1 */
        !            96: #define        ST3_HD  0x04                    /* Head Address */
        !            97: #define        ST3_TS  0x08                    /* Two Sides */
        !            98: #define        ST3_T0  0x10                    /* Track 0 */
        !            99: #define        ST3_RDY 0x20                    /* Ready */
        !           100: #define ST3_WP 0x40                    /* Write Protected */
        !           101: #define        ST3_FT  0x80                    /* Fault */
        !           102: 
        !           103: /*
        !           104:  * Controller Commands.
        !           105:  */
        !           106: #define        CMDSPEC 0x03                    /* Specify */
        !           107: #define CMDSDRV 0x04                   /* Sense drive status */
        !           108: #define        CMDRCAL 0x07                    /* Recal */
        !           109: #define CMDSINT 0x08                   /* Sense interrupt status */
        !           110: #define        CMDSEEK 0x0F                    /* Seek */
        !           111: #define        CMDWDAT 0x45                    /* Write data */
        !           112: #define CMDRDID 0x4A                   /* Read ID */
        !           113: #define        CMDFMT  0x4D                    /* Format track */
        !           114: #define        CMDRDAT 0x66                    /* Read data */
        !           115: 
        !           116: /* Look at minor # to see if target device is diskette or floppy tape. */
        !           117: #define FDC_DISKETTE(dev)      (((dev) & 0xC0) == 0)
        !           118: #define FDC_TAPE(dev)          (((dev) & 0xC0) == 0x40)
        !           119: 
        !           120: /*
        !           121:  * See if Read/Write command is in progress.
        !           122:  * If so, may not send another command yet.
        !           123:  */
        !           124: #define FDC_BUSY()     (inb(FDCMSR) & MSRCB)
        !           125: 
        !           126: /*
        !           127:  * These definitions are out of the usual order because they are for
        !           128:  * the FDC struct which follows.
        !           129:  */
        !           130: #define FDC_NUM_CMD_STAT       8
        !           131: #define FDC_NUM_INT_STAT       4
        !           132: 
        !           133: enum {
        !           134:        FDC_MOTOR_OFF = 0,
        !           135:        FDC_MOTOR_ON = 1
        !           136: };
        !           137: 
        !           138: enum {
        !           139:        FDC_HEAD_0 = 0,
        !           140:        FDC_HEAD_1 = 1
        !           141: };
        !           142: 
        !           143: struct FDC     {
        !           144:        /* Command status buffer, and how many valid entries contained. */
        !           145:        int             fdc_ncmdstat;
        !           146:        unsigned char   fdc_cmdstat[FDC_NUM_CMD_STAT];
        !           147: 
        !           148:        /* Interrupt status buffer, and how many valid entries contained. */
        !           149:        int             fdc_nintstat;
        !           150:        unsigned char   fdc_intstat[FDC_NUM_INT_STAT];
        !           151: };
        !           152: 
        !           153: /*
        !           154:  * ----------------------------------------------------------------------
        !           155:  * Functions.
        !           156:  *     Import Functions.
        !           157:  *     Export Functions.
        !           158:  *     Local Functions.
        !           159:  */
        !           160: 
        !           161: /*
        !           162:  * ----------------------------------------------------------------------
        !           163:  * Global Data.
        !           164:  *     Import Variables.
        !           165:  *     Export Variables.
        !           166:  *     Local Variables.
        !           167:  */
        !           168: extern struct FDC      fdc;
        !           169: 
        !           170: extern void            (*ftIntr)();
        !           171: extern void            (*flIntr)();
        !           172: 
        !           173: #endif /*__SYS_FDC765_H__*/

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.