$compact optimize(3) debug pw(79) rom /*********************************************************************** ** ** ** ** ** OBJECTIVE : To demonstrate how one can send or receive a ** ** MULTIBUS-II signal (a 4 byte data-less message) ** ** to a remote agent using the Nucleus Communication ** ** Service of the iRMX II/III Operating Systems. ** ** ** ** ** ** USAGE: ** ** ** ** This program can be executed on any MULTIBUS-II board ** ** running the iRMX II/III Operating Systems. ** ** The board must be situated in slot CLIENT$PSB$SLOT, where ** ** CLIENT$PSB$SLOT and SERVER$PSB$SLOT are defined in utils.lit. ** ** ** ** ** ** ALGORITHM : 1. Enable in-line exception handling feature. ** ** ** ** 2. Send a signal to the agent in slot ** ** SERVER$PSB$SLOT. ** ** ** ** 3. Wait for an acknowledge signal from agent ** ** running in slot SERVER$PSB$SLOT. ** ** ** ** 4. Display "SIGNAL ACKNOWLEDGED" message to console.** ** ** ** 5. Repeat steps 2 - 5 ** ** ** ** ** ***********************************************************************/ client: DO; $INCLUDE (utils.lit) $INCLUDE (utils.ext) $INCLUDE (:RMX:inc/nuclus.ext) $INCLUDE (:RMX:inc/bios.ext) $INCLUDE (:RMX:inc/eios.ext) $INCLUDE (:RMX:inc/hi.ext) $INCLUDE (:RMX:inc/udi.ext) DECLARE eh_handler EX_HANDLER_STRUCT, inbuffptr POINTER, port$info$struc SIG_PORT_INFO_STRUCT, port$tkn TOKEN, server$socket DWORD, socket DWORD, status WORD, trans$id WORD, message (*) BYTE DATA (32,'Signal Has Been Sent To Server',CR,LF,0), message2 (*) BYTE DATA (38,'Signal Has Been Received From Server',CR,LF), response$p(255) BYTE, control$ptr(20) BYTE, count BYTE, server$socket$ovl STRUCTURE (psb$slot WORD, port$id WORD) AT (@server$socket); /********************************************************************** ************************ MAIN PROGRAM BEGINS ************************* **********************************************************************/ main: /* Enable in-line exception handling */ CALL rq$get$exception$handler(@eh_handler,@status); eh_handler.mode = 0; CALL rq$set$exception$handler(@eh_handler,@status); /* Create the communication port object for this board */ port$info$struc.message$id = SERVER$PSB$SLOT; /* Destination Board */ port$info$struc.reserved1 = 0; port$info$struc.type = SIGNAL$SERVICE; /* Transport Protocol */ port$info$struc.reserved2 = 0; port$info$struc.flags = FIFO$PORT$QUEUEING; port$tkn = rq$create$port (0, @port$info$struc,@status); CALL check$exception( @(14,'rq$create$port'), status); DO count = 0 TO 5; /* Print the signal message on the terminal. */ CALL rq$c$send$co$response(nil,0,@message,@status); CALL check$exception( @(21,'rq$c$send$co$response'), status); /* Send a signal to the Server */ CALL rq$send$signal(port$tkn,@status); CALL check$exception( @(14,'rq$send$signal'), status); /* Receive a signal response from the server */ CALL rq$receive$signal(port$tkn,WAIT$FOREVER,@status); CALL check$exception( @(17,'rq$receive$signal'), status); /* Print the response message on the terminal. */ CALL rq$c$send$co$response(nil,0,@message2,@status); CALL check$exception( @(21,'rq$c$send$co$response'), status); END; /* DO count = 0 TO 5 */ /* Clean up */ CALL rq$delete$port(port$tkn, @status); CALL check$exception( @(14,'rq$delete$port'), status); /* Exit gracefully */ CALL rq$exit$io$job(0,NIL, @status); CALL check$exception( @(14,'rq$exit$io$job'), status); END client; /* End of module */