/*FILE HEADER****************************************************************
 *
 *  File Name           : $Id$
 *  RCS Revision Number : $Revision: 1.1 $
 *  Last Modified       : $Date: 94/10/28 09:25:42 $
 *  Last Modified By    : $Author: scoudray $
 *  CSCI Name           : Execution Sequencer
 *  Environment         : CTIX C Compiler
 * 
 *  History             :
 *      19-Feb-1991    Sylvain Desrochers       Original release
 *
 *
 *END FILE HEADER************************************************************/

#ifdef MAKEHS
#include <dy4std.h>
#endif

/****************************************************************************
 *
 *  Comment: 
 *      Literal and structure definition to be used with the
 *      Execution Sequencer which are needed by the customer
 *      to interface with this CSCI.
 *
 ****************************************************************************/

#define ES_SIGNATURE                      0xFEDCBA99
#define ES_NO_MATCH_KEY                   ((uint16) 0xFFFF)

/************************************************************************
 * 
 * CCB Commands.
 * 
 ************************************************************************/
#define ES_EXECUTE_PID_SID                ((uint32) 0x01)
#define ES_EXECUTE_ADDRESS                ((uint32) 0x02)
#define ES_EXECUTE_JUMP_TABLE             ((uint32) 0x03)

/************************************************************************
 * 
 * CCB Completion Codes (errors and warnings).
 * 
 ************************************************************************/
#define ES_WAIT_COMPLETION                ((uint32) 0xFFFFFFFF)
#define ES_NO_ERROR                       ((uint32) 0x00000000)
#define ES_INVALID_COMMAND                ((uint32) 0x00000021)
#define ES_UNEXPECTED_EXCEPTION           ((uint32) 0x00000022)
#define ES_PID_SID_NOT_IN_CIT             ((uint32) 0x00000023)

/************************************************************************
 * 
 * Reserved Primary IDs
 * 
 ************************************************************************/
#define ES_END_PID                        ((uint8) 0x00)
#define ES_ES_PID                         ((uint8) 0x01)
#define ES_CSS_PID                        ((uint8) 0x02)
#define ES_CLD_PID                        ((uint8) 0x03)
#define ES_GPM_PID                        ((uint8) 0x04)
#define ES_SLD_PID                        ((uint8) 0x05)
#define ES_APP_PID                        ((uint8) 0x06)
#define ES_SSP_PID                        ((uint8) 0x07)
#define ES_DTI_PID                        ((uint8) 0x08)
#define ES_FPSP_PID                       ((uint8) 0x09)
#define ES_BURNIN_PID                     ((uint8) 0x0a)
#define ES_SCSI_PID                       ((uint8) 0x0b)
#define ES_ETHERNET_PID                   ((uint8) 0x0c)

/************************************************************************
 * 
 * Reserved Secondary IDs
 * 
 ************************************************************************/
#define ES_IDLE_SID                       ((uint8) 0x00)
#define ES_HOST_CARD_SID                  ((uint8) 0x00)
#define ES_PSEUDO_APP_SID                 ((uint8) 0x00)
#define ES_SLD_68000_SID                  ((uint8) 0x01)
#define ES_FORTH_SID                      ((uint8) 0x01)


/************************************************************************
 * 
 * Location Monitor ISR enable masks.
 * 
 ************************************************************************/

#define ES_NO_ISR            0x00
#define ES_ISR_CALL_MASK     0x01
#define ES_ISR_BOOT_MASK     0x02
#define ES_ISR_KEEP_MASK     0x04

/************************************************************************
 * 
 * Command Control Block Structure
 * 
 ************************************************************************/

#define ES_CCB_PARAMETERS 20

typedef struct es_ccb
{
   uint32 signature; 
   uint32 command; 
   uint32 command_attribute; 
   uint32 completion_code; 
   uint32 number_of_parameters; 
   uint32 return_value;
   uint32 parameters[ES_CCB_PARAMETERS];
} es_ccb_struct;

/************************************************************************
 * 
 * CSCI Information Table 
 * 
 ************************************************************************/
typedef struct es_cit_entry 
{
   uint8  pid;
   uint8  sid;
   uint16 reserved1;
   uint32 (*entry_point)(int x, ...);
   uint32 *((*jump_table)(int x, ...));
   uint32 main_data;

   uint32 base_of_rom;
   uint32 end_of_rom;
   uint32 base_of_ram;
   uint32 end_of_ram;

   uint32 (*lm_isr)(uint32 lm_value);
   uint16 lm_isr_reserved;
   uint8  lm_isr_enable;
   uint8  lm_isr_priority;
   uint32 cm_number;
   uint32 cm_variant;

   uint32 number_of_parameters;
   uint32 reserved2;
   uint32 reserved3;
   uint32 reserved4;
} es_cit_entry_struct;

#define NUM_CIT_ENTRIES 11

typedef struct es_cit
{
   uint32 signature;
   uint32 cm_integration_number;
   uint32 cm_integration_variant;
   uint8  day;
   uint8  month;
   uint16 year;
 
   void   (*auto_lm_isr)(void);
   es_cit_entry_struct *(*get_cit_entry)(uint8 pid, uint8 sid);
   uint32 reserved3;
   uint32 reserved4;

   es_cit_entry_struct csci[NUM_CIT_ENTRIES];
} es_cit_struct;

/*
 * Macro to call the function "Get_cit_entry" from outside of the ES.
 * The calling CSCI must have the constant "SPC_CIT_BASE" declared
 * in their linker.spc file to be 0x100 bytes from the base of ROM.
 */
extern es_cit_struct SPC_CIT_BASE;
# define Get_cit_entry (*(SPC_CIT_BASE.get_cit_entry))


/* End of file. */

