#ifndef _CS_HARDWARE_DOT_H_ #define _CS_HARDWARE_DOT_H_ //=========================================================================== // // $Date: 2004/03/24 14:49:15 $ // $Revision: 1.8 $ // // DESCRIPTION: defines hardware dependant values for the console server products // // // $Log: cs_hardware.h,v $ // Revision 1.8 2004/03/24 14:49:15 billf // added a new sentinel card type e_fiber - for the fiber NIC interface (used by cardd) // // Revision 1.7 2003/09/16 16:30:05 billf // modem reset bit changed to lsb (0x01) // // Revision 1.6 2003/09/15 17:16:39 billf // modem reset address changed to 1Ah, // console & modem ID changed to 2 & 1 // // Revision 1.5 2003/09/10 18:28:57 billf // added a test IS_SENTINEL_MODEM_INSTALLED // returns TRUE if the modem is installed // // Revision 1.4 2003/09/08 20:07:57 billf // added constant for the board type address and the modem reset bit // // Revision 1.3 2003/07/17 14:16:26 billf // renamed power_1 and power_2 to power_right and power_left // // Revision 1.2 2003/07/09 16:31:35 billf // added POWER_ON_SETTING, defined as ~0 // used when initializing power status // // Revision 1.1.1.1 2003/03/17 15:27:03 billf // Initial import // // // // //=========================================================================== #include "platform.h" #define _DB_BLOCK_BASE_ADDRESS (0x200d0000L) #define _DB_DTEDCE_BASE (0x1100) #define _DB_LCD_CMD (0x1118) #define _DB_BUTTON_ADDRESS (_DB_LCD_CMD+2) #define _DB_MODEM_RESET (_DB_LCD_CMD+2) #define _DB_BOARD_TYPE_BASE (0x1111) #define _DB_MODEM_RESET_BIT (0x01) // Sentinel card types (read from 0x1111 thru 0x1113) typedef enum e_card_type {e_port=0, e_modem=1, e_console=2, e_fiber=3, e_missing=15} te_card_type; // mask out individual port id's from a byte #define EVEN_PORT_ID(val) ((val) & 0x0f) #define ODD_PORT_ID(val) (((val) >> 4) & 0x0f) // read 2 port id's #define READ_BOARD_ID(slot) ((byte)(inb(_DB_BOARD_TYPE_BASE + ( ( (slot)&0x07) /2) ))) #define IS_SENTINEL_MODEM_INSTALLED ((EVEN_PORT_ID(READ_BOARD_ID(4))) == e_modem) // define dtedce settings typedef enum {UART_OFF=0, UART_DTE=0x01, UART_DCE=0x02, UART_INVALID=0x3} te_UART_DTEDCE; typedef union { U8 as_byte; struct { //LSB U8 port0:2; U8 port1:2; U8 port2:2; U8 port3:2; } as_bits; } type_dtedce_mode; typedef union { U8 as_byte; struct { U8 button_up:1; U8 button_left:1; U8 button_right:1; U8 button_down:1; U8 button_select:1; U8 _status_unused:1; U8 power_right:1; U8 power_left:1; } as_bits; } type_cs_status_byte; // 0 means button is pressed #define BUTTON_UP_MASK 0x01 #define BUTTON_DOWN_MASK 0x08 #define BUTTON_LEFT_MASK 0x02 #define BUTTON_RIGHT_MASK 0x04 #define BUTTON_CENTER_MASK 0x10 #define BUTTON_MASK (BUTTON_UP_MASK | BUTTON_DOWN_MASK | BUTTON_LEFT_MASK | BUTTON_RIGHT_MASK | BUTTON_CENTER_MASK) // 0 means power is off #define POWER_ON_SETTING (~0) #define POWER_LEFT_MASK 0x80 #define POWER_RIGHT_MASK 0x40 #define POWER_MASK (POWER_RIGHT_MASK | POWER_LEFT_MASK) #define POWER_LOSS(x) ((x) == 0) #if 1 // returns 1 if button is pressed #define READ_BUTTONS ((~inb (_DB_BUTTON_ADDRESS)) & BUTTON_MASK) // returns 0 if power is off #define READ_POWER_STATUS ((inb (_DB_BUTTON_ADDRESS)) & POWER_MASK) #define READ_STATUS (inb (_DB_BUTTON_ADDRESS)) #else // returns 1 if button is pressed #define READ_BUTTONS (0) // returns 0 if power is off #define READ_POWER_STATUS (~0 & POWER_MASK) #define READ_STATUS (~0 & POWER_MASK) #endif #endif