Go to bottom of page
5.1 INTRODUCTION . . . . . . . . . . . . . . . . . . . 5-1
5.2 INDIVIDUAL JOBS . . . . . . . . . . . . . . . . . 5-2
5.2.1 Main Job . . . . . . . . . . . . . . . . . . . . 5-2
5.2.2 Database Job . . . . . . . . . . . . . . . . . . 5-3
5.2.3 Message Job . . . . . . . . . . . . . . . . . . 5-4
5.2.4 Facility Job Structure . . . . . . . . . . . . . 5-4
5.2.5 Individual Facility Jobs . . . . . . . . . . . . 5-6
188.8.131.52 Virtual Camac Job . . . . . . . . . . . . . . 5-6
184.108.40.206 Timing Job . . . . . . . . . . . . . . . . . . 5-6
220.127.116.11 Klystron Job . . . . . . . . . . . . . . . . . 5-7
18.104.22.168 Magnet Job . . . . . . . . . . . . . . . . . . 5-7
22.214.171.124 BPM Job . . . . . . . . . . . . . . . . . . . 5-7
126.96.36.199 Status Job . . . . . . . . . . . . . . . . . . 5-7
188.8.131.52 Crate Job . . . . . . . . . . . . . . . . . . 5-8 CHAPTER 5 STRUCTURE OF MICROS UNDER IRMX
5.1 INTRODUCTION The Micro program running under iRMX is structured to take advantage of the multitasking environment. It contains separate jobs for each group of related functions such as magnet control or transparent Camac. These jobs perform commands received through the message service and use a shared common database. The functions associated with a particular job are grouped by the high order byte of the message function code. Network input is handled by two separate network server jobs: the database job for database updates, and the message job for messages. Most jobs contain only one task but it is possible for a job to have multiple tasks; for example, a separate interrupt task in the timing job services beam codes broadcast by the master pattern generator. Internal communication among the jobs uses iRMX mailboxes. All internal messages are in standard message service format. At initialization, each job calls the message service initialization routine MSG_INIT to create a mailbox and catalog it in the MSG_GLOBAL common block used by the message service. Each job has an associated Task_id in the range 0-127 which corresponds to the high order byte of
STRUCTURE OF MICROS UNDER IRMX Page 5-2 the function codes to be serviced by that job. This Task_id is also used as the index into the global common block arrays of data for all jobs. This is described in more detail in the section on IRMX Message Service Software. Within each job, network output to the VAX in the form of database updates or messages is performed through utility subroutines so that the details of the network communications are hidden from the user.
5.2 INDIVIDUAL JOBS
5.2.1 Main Job The main job is responsible for creating all of the individual jobs including the Database, Message, and Camac server jobs plus a list of additional jobs which are specified dynamically when the microjob is linked. When it starts up it catalogs a token for itself under the name MAINTASK, creates the three server jobs, and suspends itself. When the database job has received a full copy of the local database, it looks up the token for MAINTASK and awakens the main job. The jobs for the various facilities are not created until the local database has been received to guarantee that valid database information is available for initialization. When all facility jobs have been created, the main job merely suspends itself, as it has nothing further to do. The selection of jobs to be created by the main job is specified as an input parameter string to the command file LKBLOB, which creates a Fortran file USERJOBS.F86 with appropriate lines of code to create each desired job. This routine is then compiled and linked with the
STRUCTURE OF MICROS UNDER IRMX Page 5-3 microjob main routine and a library SUBJOB.LIB containing the prelinked individual facility jobs. The output file is MICRO.I86 which can be loaded into a micro cluster with a BOOT command.
5.2.2 Database Job The database server job has a reserved port in each micro for incoming data. After requesting a port token, the job issues a NET_READ with no timeout and no SLCNET interrupt specified and waits patiently for new database information. When the read completes, the data is stored directly in the micro's local copy of the database and the job issues a new read and waits. After the micro is booted, the database job waits for a full copy of the database to be received before waking up the main job. When it receives the first block of supertype 0 data, it begins to create the local copy of the database. When it receives the full supertype 3 data, it copies a time stamp from the VAX into another database location, sends an update to the VAX, releases the main job and sends an IPL complete message to the VAX. If it is unable to successfully get a full copy of its own database, it will send an error message to the VAX and wait for another try. Database updates from the micro to the VAX also use a single reserved port which is shared by all of the individual jobs. Each job performs its own updates using the shared port and a shared output buffer. Update requests from multiple jobs are synchronized by a semiphore.
STRUCTURE OF MICROS UNDER IRMX Page 5-4
5.2.3 Message Job The message server job also has a reserved port in each micro, used by incoming messages. After requesting a port token, the job gets a token for a memory segment and issues a NET_READ with no timeout and no SLCNET interrupt specified and waits patiently for a message. When the read completes, the job uses the high order byte of the function code to index an internal array containing tokens for the mailboxes of the individual facility jobs. If no token for that facility job is found, an error message is generated. If a valid mailbox is found, the job sends the token for the message to that mailbox. It then gets a token for a new memory segment and issues another read. If desired, some function codes may also be reserved for servicing directly by the message job, e.g. high order function code 0. If it is found necessary to allow deletion of old mailbox tokens, the message job may also establish its own mailbox to receive deletion request messages and check this mailbox after each network message. Outgoing messages are handled directly by the individual facility jobs. Each job has its own port for outgoing messages.
5.2.4 Facility Job Structure Each facility has a main routine with a unique name, e.g. MGNTMAIN, and a unique Task ID. The main routine sets the variable TASK_ID in the common block, MSGMAIL, to the high order function code it wishes to service, calls MSG_INIT to set up its message mailbox and port, and
STRUCTURE OF MICROS UNDER IRMX Page 5-5 performs any desired initialization. The job is now ready to accept request messages and perform appropriate actions. It starts its main loop which contains a call to MICRO_MBX to receive a message and a call to its driver routine to service the request. After acting upon a message the job returns to the call to MICRO_MBX to wait for another request. The utility routine MICRO_MBX issues a read to the mailbox and waits for a message. When a message is received, it is copied into the common block MSGMAIL and the memory segment which contained the message is deleted before returning to the main routine. In most applications, no timeout is specified and the job waits indefinitely for a new message. If desired a timeout may be specified on the call to MICRO_MBX and control is returned to the job after the appropriate time interval has expired. The driver routine decodes the low order byte of the function code, performs any appropriate actions, updates the VAX database if necessary, and sends a response message to the source of the request before returning. Database updates generated by each job use a common port which has been acquired by the reentrant routine, DBSEND_R. When an update is desired, the job calls a utility routine, MICRO_DBSEND, which internally determines the section of the database which has been modified and calls DBSEND_R. DBSEND_R waits at a semiphore for access to the DBSEND port and output buffer and queues a NET_WRITE to DBEX. The routine MICRO_DBSEND returns a status code to indicate if the write has completed successfully.
STRUCTURE OF MICROS UNDER IRMX Page 5-6 Response messages from each job use individual ports which are allocated by MSG_INIT. The job calls a utility routine, MMSG_SEND, with arguments specifying the destination, function code, data, and data length. ISS = MMSG_SEND(FUNCTION,DESTINATION,DATALEN,DATA) The routine queues a NET_WRITE for the appropriate VAX destination and returns only when the write is complete or when an internal timeout has expired. Error messages from each job use the individual response message port. When an error status is found, the job calls a utility routine ERR_SEND with arguments specifying the VMS error code, argument list, and number of arguments. ERR_SEND constructs a message with a function code Error_code and queues a NET_WRITE to Paranoia.
5.2.5 Individual Facility Jobs
184.108.40.206 Virtual Camac Job - The virtual camac job performs Camac operations requested directly by the VAX. It does not process Camac operations for the other jobs in the microcluster which have their own direct access to Camac. It may be used to bypass the normal software algorithms for diagnostic purposes or to execute Camac operations not provided by any of the existing facilities.
220.127.116.11 Timing Job - The Timing facility is responsible for the synchronization of devices on a pulse to pulse basis. It maintains the local copy of the Beam Matrix, initializes and programs pulsed
STRUCTURE OF MICROS UNDER IRMX Page 5-7 devices, and performs all operations necessary to configure the machine for the next beam as each beam code interrupt is received.
18.104.22.168 Klystron Job - The Klystron facility performs control and monitoring functions for the klystrons and subboosters. It downloads the Parallel Input Output Processors, transmits to them database values and function requests, and executes the closed loop phase setting algorithm.
22.214.171.124 Magnet Job - The Magnet facility is responsible for all closed loop analog control and monitoring. In addition to magnets, this includes stepping motors, attenuators and other miscellaneous devices with DAC control and ADC readback. Locally implemented algorithms include closed loop setting, device calibration, and magnet standardization.
126.96.36.199 BPM Job - The Beam Position Monitor facility reads the stripline position monitors and SLC toroid charge monitors. The BPM's are gated and processed in response to a command broadcast by the MPG. The BPM job reduces the data to transverse positions in millimeters and asynchronously transmits the data to the VAX using the Message services.
188.8.131.52 Status Job - The Status facility is responsible for monitoring of analog signals such as temperatures and vacuum gauges, and for monitoring and control of a wide variety of digital input and
STRUCTURE OF MICROS UNDER IRMX Page 5-8 output devices.
184.108.40.206 Crate Job - The Crate job monitors the Camac crates attached to each microcluster and reports whenever a crate is taken offline. When a crate is turned on, it detects the change of state, initializes Camac modules as needed, sends messages to other jobs to perform additional initialization, and reports the new status of the crate. When requested by the VAX, it can also exercise the crate verifier and report any problems detected.