;******************************************************************************
;
;   (C) Copyright MICROSOFT Corp., 1993
;
;   Title:	ssdefs.inc - Socket Services definitions
;
;==============================================================================
;
; These are definitions of Socket Services constants and structures
;

; Function Opcodes
SSFn_GET_ADP_CNT	equ	80h

SSFn_GET_SS_INFO	equ	83h
SSFn_INQ_ADAPTER	equ	84h
SSFn_GET_ADAPTER	equ	85h
SSFn_SET_ADAPTER	equ	86h
SSFn_INQ_WINDOW 	equ	87h
SSFn_GET_WINDOW 	equ	88h
SSFn_SET_WINDOW 	equ	89h
SSFn_GET_PAGE		equ	8Ah
SSFn_SET_PAGE		equ	8Bh
SSFn_INQ_SOCKET 	equ	8Ch
SSFn_GET_SOCKET 	equ	8Dh
SSFn_SET_SOCKET 	equ	8Eh
SSFn_GET_STATUS 	equ	8Fh
SSFn_RESET_SOCKET	equ	90h

SSFn_INQ_EDC		equ	95h
SSFn_GET_EDC		equ	96h
SSFn_SET_EDC		equ	97h
SSFn_START_EDC		equ	98h
SSFn_PAUSE_EDC		equ	99h
SSFn_RESUME_EDC 	equ	9Ah
SSFn_STOP_EDC		equ	9Bh
SSFn_READ_EDC		equ	9Ch
SSFn_GET_VENDOR_INFO	equ	9Dh
SSFn_ACK_INTERRUPT	equ	9Eh
SSFn_PRIOR_HANDLER	equ	9Fh
SSFn_SS_ADDR		equ	0A0h
SSFn_ACCESS_OFFSETS	equ	0A1h

SSFn_VEND_SPECIFIC	equ	0AEh
SSFn_CARD_SERVICES	equ	0AFh

SS_INT			equ	1Ah

; Return Codes
SUCCESS		equ	00h	; no error - superfluous - [CY] => error
BAD_ADAPTER	equ	01h	; specified adapter does not exist
BAD_ATTRIBUTE	equ	02h	; specified attribute is invalid
BAD_BASE	equ	03h	; specified base system memory address invalid
BAD_EDC		equ	04h	; specified EDC generator is invalid

BAD_IRQ		equ	06h	; specified IRQ level is invalid
BAD_OFFSET	equ	07h	; specified PCMCIA card offset is invalid
BAD_PAGE	equ	08h	; specified page is invalid
READ_FAILURE	equ	09h	; unable to complete read request
BAD_SIZE	equ	0Ah	; specified window size is invalid
BAD_SOCKET	equ	0Bh	; specified socket does not exist

BAD_TYPE	equ	0Dh	; window type specified is not available
BAD_VCC		equ	0Eh	; specified vcc power level index is invalid
BAD_VPP		equ	0Fh	; specified vpp1/2 power level index invalid

BAD_WINDOW	equ	11h	; specified window does not exist
WRITE_FAILURE	equ	12h	; unable to complete write request

NO_CARD		equ	14h	; no card in socket
BAD_FUNCTION	equ	15h	; function not supported by socket services
BAD_MODE	equ	16h	; processor mode not supported
BAD_SPEED	equ	17h	; specified speed unavailable
BUSY		equ	18h	; SS unable to process this request - try later

; defined data types
ADAPTER		TYPEDEF	BYTE
BASEADDR	TYPEDEF WORD
BCD		TYPEDEF	WORD
COUNT		TYPEDEF	BYTE
EDC		TYPEDEF	BYTE
FLAGS8		TYPEDEF	BYTE
FLAGS16		TYPEDEF	WORD
FLAGS32		TYPEDEF	DWORD
IRQ		TYPEDEF	WORD
COFFSET		TYPEDEF	WORD
WPAGE		TYPEDEF	BYTE
PWRINDEX	TYPEDEF	BYTE
RETCODE		TYPEDEF	BYTE
WSIZE		TYPEDEF	WORD
SOCKET		TYPEDEF BYTE
SPEED		TYPEDEF	BYTE
WINDOW		TYPEDEF	BYTE
SKTBITS 	TYPEDEF WORD

PWRENTRY	STRUCT
PowerLevel	FLAGS8	?
ValidSignals	FLAGS8	?
PWRENTRY	ENDS

CHARTBL		STRUCT
		UNION
AdpCaps		FLAGS16	?
SktCaps		FLAGS16	?
		ENDS
ActiveHi	FLAGS32	?
ActiveLo	FLAGS32	?
CHARTBL		ENDS

MEMWINTBL	STRUCT
MemWndCaps	FLAGS16	?
FirstByte	BASEADDR ?
LastByte	BASEADDR ?
MinSize		WSIZE	?
MaxSize		WSIZE	?
ReqGran		WSIZE	?
ReqBase		WSIZE	?
ReqOffset	WSIZE	?
Slowest		SPEED	?
Fastest		SPEED	?
MEMWINTBL	ENDS

IOWINTBL	STRUCT
IOWndCaps	FLAGS16	?
FirstByte	BASEADDR ?
LastByte	BASEADDR ?
MinSize		WSIZE	?
MaxSize		WSIZE	?
ReqGran		WSIZE	?
AddrLines	COUNT	?
EISASlot	FLAGS8	?
IOWINTBL	ENDS

; power level bitmasks

PWR_VCC 	EQU	10000000B
PWR_VPP1	EQU	01000000B
PWR_VPP2	EQU	00100000B

; adapter capability bitmasks

AC_IND		EQU	0000000000000001B
AC_PWR		EQU	0000000000000010B
AC_DBW		EQU	0000000000000100B

; adapter state

AS_POWERDOWN	EQU	00000001B
AS_MAINTAIN	EQU	00000010B

; generic window capability bitmasks

WC_COMMON	EQU	00000001B
WC_ATTRIBUTE	EQU	00000010B
WC_IO		EQU	00000100B
WC_WAIT		EQU	10000000B

; memory and I/O window capability bitmasks

WC_BASE		EQU	0000000000000001B
WC_SIZE		EQU	0000000000000010B
WC_WENABLE	EQU	0000000000000100B
WC_8BIT		EQU	0000000000001000B
WC_16BIT	EQU	0000000000010000B
WC_BALIGN	EQU	0000000000100000B
WC_POW2		EQU	0000000001000000B

; memory window (page) capability bitmasks

WC_CALIGN	EQU	0000000010000000B
WC_PAVAIL	EQU	0000000100000000B
WC_PSHARED	EQU	0000001000000000B
WC_PENABLE	EQU	0000010000000000B
WC_WP		EQU	0000100000000000B

; I/O window capability bitmasks

WC_INPACK	EQU	0000000010000000B
WC_EISA		EQU	0000000100000000B
WC_CENABLE	EQU	0000001000000000B

; Generic window state

WS_IO		EQU	00000001B
WS_ENABLED	EQU	00000010B
WS_16BIT	EQU	00000100B

; memory window state

WS_PAGED	EQU	00001000B

; I/O window state

WS_EISA		EQU	00001000B
WS_CENABLE	EQU	00010000B

; page state

PS_ATTRIBUTE	EQU	00000001B
PS_ENABLED	EQU	00000010B
PS_WP		EQU	00000100B

; IRQ level bit-masks

IRQ_0		EQU	0000000000000001B
IRQ_1		EQU	0000000000000010B
IRQ_2		EQU	0000000000000100B
IRQ_3		EQU	0000000000001000B
IRQ_4		EQU	0000000000010000B
IRQ_5		EQU	0000000000100000B
IRQ_6		EQU	0000000001000000B
IRQ_7		EQU	0000000010000000B
IRQ_8		EQU	0000000100000000B
IRQ_9		EQU	0000001000000000B
IRQ_10		EQU	0000010000000000B
IRQ_11		EQU	0000100000000000B
IRQ_12		EQU	0001000000000000B
IRQ_13		EQU	0010000000000000B
IRQ_14		EQU	0100000000000000B
IRQ_15		EQU	1000000000000000B

; IRQ level bitmasks (high word of 32-bit mask)

IRQ_NMI		EQU	0000000000000001B
IRQ_IO		EQU	0000000000000010B
IRQ_BUSERR	EQU	0000000000000100B

; IRQ state bitmasks

IRQ_HIGH	EQU	01000000B
IRQ_ENABLED	EQU	10000000B

; Socket bitmasks

SBM_WP		EQU	00000001B
SBM_LOCKED	EQU	00000010B
SBM_EJECT	EQU	00000100B
SBM_INSERT	EQU	00001000B
SBM_BVD1	EQU	00010000B
SBM_BVD2	EQU	00100000B
SBM_RDYBSY	EQU	01000000B
SBM_CD		EQU	10000000B

SBM_LOCK	EQU	00010000B
SBM_BATT	EQU	00100000B
SBM_BUSY	EQU	01000000B
SBM_XIP		EQU	10000000B

; interface bitmasks

IF_MEMORY	EQU	00000001B
IF_IO		EQU	00000010B

; EDC definitions

EC_UNI		EQU	00000001B
EC_BI		EQU	00000010B
EC_REGISTER	EQU	00000100B
EC_MEMORY	EQU	00001000B
EC_PAUSABLE	EQU	00010000B

EC_WRITE	EQU	00000010B

ET_CHECK8	EQU	00000001B
ET_SDLC16	EQU	00000010B
