|
|
DataMuseum.dkPresents historical artifacts from the history of: DANOSI |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DANOSI Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 20405 (0x4fb5)
Types: TextFile
Names: »EM02.ENV«
└─⟦623820077⟧ Bits:30010493 DVBS1.SW50070.rel.1.0-2 SW500700 MegaSwitch Development Toolset Rel 1.0 DISK 2/2
└─⟦this⟧ »PAXENV\EM02.ENV«
em02env;
(*-----------------------------------------------------------------*)
(* *)
(* entity management environment *)
(* *)
(* description: *)
(* the em02env defines the most common used constants, types and *)
(* routines used by modules containing entity management *)
(* *)
(* ver. date init changes *)
(* -------------------------------------------------------------- *)
(* - - 851128 oer initial version *)
(* 2.0 860515 oer second version *)
(* 2.1 880712 nrh option-bits introduced *)
(* 2.2 881011 oer new identifier names introduced *)
(* 2.3 890404 nrh more options *)
(* 2.4 890427 nrh names in zone.b changed *)
(* 2.5 900213 bb converted to RTP common *)
(* Param changed from frozen var to value in *)
(* Em_initialize *)
(* 2.6 900328 oer em_st_dupl_func and em_st_rep_res_lack ins *)
(* 2.7 900514 nrh fln.no now possible, em_init___rc introd. *)
(* a-field no_of_reorgs split into two. *)
(*-----------------------------------------------------------------*)
(*-------------------------------------*)
(* Version of em02env *)
(*-------------------------------------*)
type
lcp_identification = 0..maxint;
em_version_type = record
version : byte;
release : byte;
end;
const
em_version = em_version_type(: 2, 7 :);
\f
(*--------------------------------------*)
(* Options in the use of em-routines *)
(*--------------------------------------*)
const
reqbuf_bits = 3;
max_req_bufs = ( 1 shift reqbuf_bits) - 1;
type
em_options_type =
packed record
ncp_optional : boolean; -- true if module may run without ncp
spool_lgt : 0..maxint; -- length of spool buffer measured in bytes
soft_init : boolean; -- no hard_wait in em_initialize
user_req : boolean; -- all requests are given to user
user_poll : boolean; -- user must itself reply on em_poll
oper_types : boolean; -- user want oper types specified
abort_return : boolean; -- user want em_abort to return
mess_req_bufs : 0..max_req_bufs; -- number of request message headers
end;
const
em_rec_spool_lgt = 1000;
em_rec_options =
em_options_type(:
false, -- ncp_optional
em_rec_spool_lgt,
false, -- soft_init
false, -- user_req
false, -- user_poll
false, -- oper_types
false, -- ffu1
2 -- mess_req_bufs
:);
const
em_break_excep = pax_break_code + 1;
cause_lcp_only = -2;
(*-------------------------------------*)
(* Event bits *)
(*-------------------------------------*)
type
ev_bit =
( bit16, bit15, bit14, bit13, bit12, bit11, bit10, bit9,
bit8, bit7, bit6, bit5, bit4, bit3, bit2, bit1
); (* the nmc8000 bit numbering scheme *)
new_event_mask_type = set of 0..255;
em_old_to_new_type = array( ev_bit) of new_event_mask_type;
\f
(*-------------------------------------*)
(* Snooping *)
(*-------------------------------------*)
em_snoop_criteria = ( messages, all, answers);
user_snoop_criteria = array(1..4) of byte;
em_snoopspecs_type =
record
em_criteria : em_snoop_criteria; --a std em criteria as defined above
first_data : integer; --absolute position of first data to be snooped
max_data_lg : integer; --maximum length of data to be snooped
end;
\f
(*-------------------------------------*)
(* em zone type *)
(*-------------------------------------*)
type
em_a_type = -- the assignable part of zone
record
env_version : em_version_type; -- the version of the em zone
lib_version : em_version_type; -- the version of the procedures
options : em_options_type; -- the options assigned to the zone
em_ident : integer; -- the em identifier of the zone
curr_lost_count_ptr : integer; -- offset to counter-field in events-lost
-- -- in spool if last, else 0 (zero)
curr_events_in_spool : integer; -- no of events not send to ncp yet
no_of_events : integer; -- no of events generated and not lost
no_of_lost_events : integer; -- no of events generated, but lost
fln : byte; -- USERs typesize( drvbuftype)
no_of_reorgs : byte; -- no of reorganizations of spool
no_of_requests : integer; -- no of lcp-requests from ncp
no_of_answers : integer; -- no of lcp-answers generated
no_of_polls : integer; -- no of poll-request from ncp
em_inf5 : integer; -- status when em_initialize=false
snoopspecs : em_snoopspecs_type; -- specification of snoop function
message_stream : byte; -- the stream number for messages
event_stream : byte; -- the stream number for events
end;
em_b_type = -- buffer management part of zone
record
ncp : sempointer; -- main mailbox for the ncp
main : sempointer; -- main mailbox for the module
event_spool : reference; -- event spool buffer
event_buf_req : reference; -- request event header
help2_ref : reference; -- request event header, hard use
private_sem : mailbox; -- answer mailbox for hard waits
ev_spool_pool : pool;
header_pool : pool;
help1_ref : reference;
end;
em_zone_type =
record
event_mask : new_event_mask_type;-- the new event mask
em_snoop : user_snoop_criteria;-- a user defined snoop criteria
a : em_a_type;
b : em_b_type;
old_to_new : array( ev_bit) of ^new_event_mask_type; -- conv-mask
end;
\f
(*---------------------------------------*)
(* Inclusion and Exclusion of NMS *)
(*---------------------------------------*)
$if fln>0
function em_initialize(
$else
function em_initialize = em_init___rc(
$endif
var em_zone : em_zone_type; -- the em zone to be intiated
em_identifier : integer; -- the em identifier of the zone/module
em_mess_sem : sempointer; -- the answer mailbox of the buffers
em_mess_stream : byte; -- the u4 val of the mess request headers
ev_buf_stream : byte; -- the u4 val of the event request header
em_options : em_options_type; -- options for configuration
em_version : em_version_type; -- taken from this environment
em_init_mask : new_event_mask_type) -- the initial event mask
: boolean; -- result
external;
(*----------------------------------------------------------*)
(* The EM_INITIALIZE procedure prepares the em_zone for *)
(* use by initializing the zone variable and by making *)
(* the corresponding module a known LCP in NMS. *)
(* *)
(* The recommended options for configurating the em_zone is *)
(* given in this environment in EM_REC_OPTIONS. *)
(* Other options should only be used in special cases. *)
(* *)
(* The function shall be called before the process is able *)
(* to join the network management system, and it shall be *)
(* called in the initialization part of the module. *)
(* *)
(* The following results may be given : *)
(* *)
(* true: means successfull operation, the process may go on *)
(* *)
(*----------------------------------------------------------*)
procedure em_terminate(
var em_zone : em_zone_type;
cause : integer );
external;
(*---------------------------------------------------------------*)
(* The EM_TERMINATE procedure executes an orderly termination of *)
(* the em activities in the module,ie the procedure excludes the *)
(* module from the set of lcps administered by the ncp and closes*)
(* the em zone. *)
(* *)
(* If some event reports are contained in the eventspool, these *)
(* are sent to the ncp. *)
(*---------------------------------------------------------------*)
\f
procedure em_abort(
var em_zone : em_zone_type;
cause : integer);
external;
(*---------------------------------------------------------------*)
(* The EM_ABORT procedure executes an abrupting termination of *)
(* the em activities in the module, and the module is excluded *)
(* from the set of lcps administered by the ncp and the em zone *)
(* is closed. *)
(* *)
(* The event reports contained in the eventspool, are not garan- *)
(* teed to be sent to the ncp, before the em functionalities are *)
(* abrupted. *)
(*---------------------------------------------------------------*)
\f
(*----------------------------------------*)
(* Receiving Requests and sending Answers *)
(*----------------------------------------*)
const
em_st_user_16 = minint;
em_st_user_15 = 16384;
em_st_user_14 = 8192;
em_st_user_13 = 4096;
em_st_user_12 = 2048;
em_st_user_11 = 1024;
em_st_not_from_lcp = 512; -- used by eg NCP
em_st_rep_res_lack = 256; -- lack of repeatable resources
em_st_no_free_res = 128; -- no free resources available
em_st_dupl_func = 64; -- duplicate function
em_st_out_of_range = 32; -- out of range
em_st_illegal_state = 16; -- illegal state
em_st_data_error = 8; -- error found in supervisor data
em_st_lcp_unknown = 4; -- used by eg NCP
em_st_ill_em_oper = 2; -- illegal em_oper
em_st_successed = 0; -- the operation was executed sucessfully
type
em_message_type =
(
em_lcp_oper, -- the module must take care of the em operation
em_reset_stat, -- the module must reset all statistics
em_answered, -- the em procedure has sent the answer
em_changed, -- -do- and the zone has been changed
em_format_error, -- should be ignored by the module
em_report_state, -- the module must report its state in an event
em_poll, -- should be ignored
em_no_value, -- for internal use only, always ignored by module
em_break, -- the module must break its execution
em_spool_sent, -- (as if em_sent_eventspool has been called)
em_poll_request, -- if wanted, module must call em_answer_message
em_initialized, -- (soft-init only) the em_zone is ready
em_terminated, -- the em_zone cannot be made ready
em_lcp_control, -- the module takes care of control operation
em_lcp_sense, -- the module takes care of sense operation
em_lcp_getstat, -- the module takes care of getstat operation
em_lcp_getstat_clear, -- the module takes care of get&clear-stat operation
em_lcp_kernal); -- the module takes care of kernal operation
\f
function em_receive_message(
var em_zone : em_zone_type; -- the internal em_zone
var msg : reference; -- the message received from the ncp
var em_operation : byte; -- the em operation
var em_bytecount : integer ; -- the length of message data
var em_data_offset: integer; -- the offset of the message data
var em_max_bytecount: integer; -- max length of answer data
var em_status : integer) -- the status of the em operation
: em_message_type;
external;
(*------------------------------------------------------------*)
(* The EM_RECEIVE_MESSAGE handles the receivement of messages *)
(* from the ncp. *)
(* *)
(* The message is unpacked and if result <> em_lcp_oper then *)
(* msg reference is nil, and the em_receive_message has *)
(* taken care of all the actions concerning buffer management *)
(* and answer to the nmc. *)
(* The value of em_status is set to em_st_successed if the *)
(* message reference is not nil. *)
(* *)
(* The following results/actions may occur: *)
(* *)
(* em_lcp_oper : the module must take care of the oper *)
(* em_reset_stat : the module must zeroset all statistics *)
(* em_poll : should be ignored *)
(* em_answered : should be ignored *)
(* em_changed : should be ignored *)
(* em_format_error : should be ignored *)
(* em_report_state : the module must report its state *)
(* em_break : the module must call the exception *)
(* procedure or the em_terminate *)
(* em_spool_sent : should be ignored *)
(* em_poll_request : module shall call em_answer_message *)
(* em_initialized : (soft-init only) the em_zone is ready *)
(* em_terminated : the module may stop execution *)
(* *)
(*------------------------------------------------------------*)
procedure em_answer_message(
var em_zone : em_zone_type; -- the em zone
var msg : reference; -- the buffer to hold the answer
em_bytecount : integer; -- the bytecount used in answer
em_status : integer); -- the status used in answer
external;
(*-------------------------------------------------------*)
(* The EM_ANSWER_MESSAGE procedure forms an answer *)
(* message and returns this to the ncp. *)
(*-------------------------------------------------------*)
\f
(*------------------------------------------------*)
(* Generation and sending of Event Reports *)
(*------------------------------------------------*)
type
em_spool_result = (
parameter_error, -- error(s) in parameters
spool_no_room, -- events-lost may be generated
spooled, -- ok, spooled
not_ordered, -- not spooled because not ordered
lost_spooled, -- ok, lost-event spooled
em_no_ncp); -- there is no ncp in this node
function em_spool_event(
var em_zone : em_zone_type; (* the internal em_zone *)
ev_number : byte;
ev_bytecount : byte;
var event : reference;
ev_offset : integer;
ev_may_be_lost : boolean)
: em_spool_result;
external;
(*-----------------------------------------------------------*)
(* The EM_SPOOL_EVENT procedure moves an event from the *)
(* buffer placed at event reference into the event spool *)
(* of the em zone. *)
(* *)
(* At the time of spooling the event an ordering of an event *)
(* buffer is sent to the ncp. *)
(* *)
(* If the number of free bytes in the event spool is too *)
(* small to keep the event, the number of lost events in *)
(* the em zone is increased by one, and the event is dropped *)
(* *)
(* possible results : *)
(* *)
(* parameter_error errors in the parameters *)
(* spool_no_room event not spooled because spool is full *)
(* spooled event spooled *)
(* not_ordered event not spooled because not ordered *)
(* lost_spooled ok, lost-event spooled *)
(* em_no_ncp there is no ncp in this node *)
(*-----------------------------------------------------------*)
procedure em_send_eventspool(
var em_zone : em_zone_type; -- the internal em_zone
var msg : reference); -- the message received from the ncp
external;
(*-----------------------------------------------------------*)
(* The EM_SEND_EVENTSPOOL sends all spooled events to the ncp*)
(* and a free eventspool is disposed in the em_zone. *)
(* *)
(* The procedure should be called when a message is received *)
(* at the ev_buf_stream used in the call of em_initialize. *)
(*-----------------------------------------------------------*)
\f
procedure em_waithard_event(
var em_zone : em_zone_type; -- the internal em_zone
ev_number : byte; -- the event number to be sent
ev_bytecount : byte; -- the number of bytes in event data
var ref : reference; -- the internal buffer containing the event
ev_offset : integer); -- the offset for the event data at ref
external;
(*---------------------------------------------------------------*)
(* The EM_WAITHARD_EVENT procedure passivates the module until *)
(* the specified event has been sent to the ncp. *)
(* *)
(* The procedure should only be called when the module can be *)
(* passivated without disturbing the normal functionality. *)
(*---------------------------------------------------------------*)
function em_snooping(
var em_zone : em_zone_type;
var msg : reference
): boolean;
external;
(*-----------------------------------------------------------*)
(* The EM_SNOOPING function tests if an NMC has ordered *)
(* snoopevents from this module. *)
(*-----------------------------------------------------------*)
procedure em_snoop_event(
var em_zone : em_zone_type;
var msg : reference;
snoop_ident : alfa
);
external;
(*------------------------------------------------------------*)
(* The EM_SNOOP_EVENT procedure generates a snoop event if *)
(* em_snooping returns true (and there is room for the event) *)
(* calling sequence: *)
(* wait(ref, ....); *)
(* if em_snooping(em_zone, ref) then *)
(* if usertest(em_zone.em_snoop, ref) then *)
(* em_snoop_event(em_zone, ref, 'after wait '); *)
(*------------------------------------------------------------*)
\f
procedure em_old_to_new_mask(
var em_zone : em_zone_type;
em_old_to_new : em_old_to_new_type);
external;
(*------------------------------------------------------------*)
(* The EM_OLD_TO_NEW_MASK defines the correspondance between *)
(* the old event mask bits and the event numbers in the new *)
(* event mask. *)
(*------------------------------------------------------------*)
(*------------------------------------------------------------*)
(* *)
(* end of entity management environment *)
(* *)
(*------------------------------------------------------------*)
.