• Aucun résultat trouvé

12.5-6 Examples Using Nucleus Communications Service Calls

Dans le document OPERATING SYSTEMDOCUMENTATION intel' (Page 144-188)

This section provides a conceptual explanation of most of the examples provided with the Operating System, The examples provide a more complete understanding of message

passing as it relates to the Extended iRMX II Operatirig System. Each example includes a \v/

brief description of the operatiori of the example and all of the PL/M 286 code for the example.

All of the examples in this chapter are provided with the iRMX II Operating System. The MULTIBUS Il examples discussed here are located in the path

/RMX286/DEMO/PLM/MB2/ÌNTRO. For a complete diagram of the iRMX II directory strucîùrg see the Operator\ Guide to the Hunan Interface manual. When you are ready to examine these examples, type:

ATTACHFTLE /FJfl.286 /DW|O /pt-rf/MB2lTNTRO <CR>

to attach to the dtectory containing the example prograrns. To geoel ate tlìe execùtable modules for these examples rype:

SUBMIT COMPILE <CR>

These two commands must be q,ped in on both host terminals, assuming that each host has its own disk.

Most of the examples use an external fle called DCOM.EXT and a literal file called DCOM.LIT. Both of these files are presented at the end of this chapter.

The examples in this chapter are presented in an order similar to their use in a real system. The examples step you through the following concepts;

1. Scannlng the system to determifle what boards are in the system. This example runs independendy of all the other modùles.

2. Crcating a data traúspof protocol port to use in message passing. This example runs indeDendendv of all îhe other modules.

12-16 Nucleus Usefs Guide

EXTENDED iRMX@ II MULTIBUS@ N SYSTEMS

3, S€nding an RSYP message to another board and waiting lor a reply. This module must be run with example 4 io this list or with example 7 in this list.

4. Arcwerlng an RSVP message from the receiving board. This module must be run with example 3 in this list.

5. Sending a data chain message. This example must be run with example 6 in this list.

6. Receivlng a daúa chaln messate. This example must be run ì/rith example 5 in this list.

7. Sending a fragmented message. This exampl€ must be run with example 3 in this list.

The examples listed above make ceÍain assumptions about the locations of the host boards in îhe MULTTBUS II ststem that they run on. The Figure 12-4 shows the required physical locations of the host boards (agents) in the system.

(Chassis not to scale)

M e m o r y F o r H o s t in S l o t 5

H O S T B O A R D I N S L O T 5

M e m o r v F o r H o s t in - S l o t 1 H O S T B O A R D I N S L O T 1 C S M B o a r d

Figure l2-4. Physical Location of Boards in the Example

È

Nucleus Uset's Guide t2-17

EXTENDED iRMX@ II MÙLTIBUS@ II SYSTEMS

The MULTIBUS II examples dtectory also contains a larger example that is not shown in

this chapter. This example implem€tts a "name server", a progam that permits the \--,,.

dynamic cataloging of all ports oeated in a system. A later s€ction of this chapter discusses this example.

'12.5.6.1 Inlerconnect Space Example

Before passing messages between agenîs (boards) ir your system you rieed to determine what boards are in your system and the message addresses for the boards (host$id or cardslot number for boards on the iPSB bus.) You may also need to read or write the contents of a particular interconnect iegister. Writing a board scanner task allows you to dynamically determine host IDs, board g?e, and multiple occurrences (instances) of a boaÌd type.

This s€ction pres€nts an €xample of g€tting the iotercorìnect inforination for an entire system. The example pedorms the board scan, getting the slot number and board type of

each board in the system and places the information into an array of structures called

sys_map. When the board scan is completg sys_map is displayed on the console soeen.

Figure 12-5 presents a board-scanning algorithm. The "reads" in the Figure 12-5. Board Scanning Algorithm refer to the RQ$GET$INTERCONNECT system call. For a map or template of a particular board's interconnect registers, refer to the board's hardware reference manual.

FoR i = 0 to number of slots minus 1 D O ;

R e a d b o a r d i's vendor ID register;

IF vendor ID c 0 then D O ;

R e a d board i's class and subclass ID retisters , / * D e t e r n i n e b o a r d t ) ? e * / W r i L e E h e b o a r d i n f o r m a t í o n ínto the syslem map

E N D ; E L S E ;

Write 'enpty' into the sys_nàp for thè sloc nuber 'J

E N D ;

C e t l D o f loca1 hosc E N D ;

FoR i - 0 to n(lrnber of slots ninus 1 D O :

P r i n t s l o t n u m b e r s and board È)?es to console screen E N D ;

Figue l2-5. Board Scanning Agorithm

t2-18 Nucleus Uset's Guide

EXTENDED IRMX@ II MULTIBUS@ tr SYSTEMS

In the fourth line of the board scariner algorithm, a vendor ID of 0 (for iPSB hosts only) indicates that either the board was manufactuîed by a non-licensed vendor or the cardslot is empty. Ifyou are also scanning the iLBX II bus, replace the 0 with oFFFFH.

To run the board scanner example type:

rc <cR>

t2-19 Nucleus Uset's Guide

EXTENDED iRMI(@ II MI]LTIBUS@ II SYSIEMS

The following figure is an implementation of the board scanner algorithm.

9 t i t l e ( ' 1 c - scan interconnect space and prlnt r0ap of systen, ) S e o n D a c c

IN1EL CORPORATION PROPR]EÎARY INFORMATION Ittis software is supplled under Che tenns of a license agreement or nondísclosure agreenent nith lnCel Corporacion and nay not be copieat or disclosed except ln accordance lrith the terns of that agreenent.

C o p y r i g h t I n t e l C o r p o r a t i o n 1987, 1988

a l 1 r í o h i c r è a a n ' a . l

* For lntel custoDels licensed for the lRlO{ II operatíng

* System under an Intè1 Software License Agreenent, rhis source code and

* o b j e c t c o d e deríved therefrorn are licensed for use on a stngle central

* processing unit for inte1:nal use on1y. Necessary backup copies and

* r o u l c i p l e users are permitted. O b j e c t C o d e derived fron rhis source code

* ls a Class I sofù,/ale produc! under the Intel Sofc\rare License Agreenent

* and is subject to the terns and condirions of rhar agreemenr

* Fol the ríght to make incorporacions, or ro transfer this soft\rare to \-7 : " third parties, c o n t a c t I n t e l c o r p o r a t í o n .

/********************:t************:k***********rt****:t*:t:t****************:trt**/

/********rt*rf************rt*rf***********************************)t*******

* MODULE NAI'fE: lcscan

*' DESCRIPTIoN: Scan the iPSB backplane, Record each board insrancè and \.-,-/

* slot nunìber in a system roap. Cet local host slot number

* a n d i d and record in systen nap. p r i n t systen nap on console.

****************,***rl***********rt*******************************!t******/

i c : D O ;

$ include (/rnx2 86/inclrmxptn. ext )

$ include (/rnx2 86/lnc/error. 1ít)

$include (err. ext)

Figùre t2-6. Irnplemenfation of a Board Scanner (continued)

t2-20 Nucleus Uset's Guide

EXTENDDD iRMX@ II MULTIBUS@ II SYSTEMS

DECTÀRE /* llterals */

MAXSmTS LITERALIY '20',

/* araxinum nìrnlber of slots */

VENDoRIDREG LITERALLY '00', ,/* 1o\d byre of vendoi 1d .reg */

BoARDIDREG LITERALLY '02H' , /* regiscer offsec of boàrd id */

BOARDIDI,EN LITERALLY '10', ./* nurnber of byres ín loard td */

BUFLEN LITEMLLY ,11,,

,/* length of boatd id rrox string */

I,oCAIIIoST LITERATLY '31', /* selects local host interconnect */

PSBCoNTROLREC I,ITERALLY tO6H, , /* psb control record valuè */

PSBSLOTIDOFF LITEMLLY ,02H'

, /* offset of slor id reg ín psb conrrol rec * NoEXCBPT LITERALLY '0', ,/* no exception handling by systen */

RECNoTFOLND LITERALLY ,oFFH,. /* indicates fnterconnecr record not found * map_struc LITÈRALLY , STRUCIURE(

Id(BUFLEN) BYTE, slot,nulr BYTE)' ; DECI-ARE

c o n _ t a b ( 1 6 ) b y t e I N I T I A L ( ' 0 ' , ' , ' s ' , ' 6 ' , , 7 , , ' 8 , , ' 9 " ' 4 " ' R " ' C ' . ' D " ' E " ' F . )

q c r l h i l i 1 a I ' f i n d z ó ^ ^ / / ì , \

* PROC NAME: find_record

* DESCRIPTION:

* Searches through thè interconnect space of rhe specified board

* (s1ot_nurber) until eíther the record type passed is found or the x EOT (end of tenpfate) record is fourd. If the record ls found,

* then its record type and offset are returned. If the EOT record

* is found, then oFFH is r€turned.

* CAIL: record found : find record ( slot_nunber, lecord_t]?e, rec_offse!_pÈr) j

* lNPfIs: slotlnumber Bltf containing slor number ól board

* r e c o i d _ t y p e B Y T E c o n u a í n i n ! r e c o r d t J . p e Lo find

* RETURNS: tecord_found byte indicating I'hettrer record was found

contains oFFlt (EoT record type) if record nor found)

* oUTPUTS: record_offset prr PoINîER to WORD offser of record found

***rt*rl*:l************rV*r!*:t********:t*****rt*******************************:t****/

Figure 12-6. Implementation ofa Board Scanner (continued)

Nucleus Use/s Guide 12.21

find_record: PRoCEDURE ( sloc_nunbe!, record_t)rye, rec_offset_ptr) SYTE ?uBLIc \-,, REENTRANT;

EXTENDED iRMXó II MIJLTIBUSo SYSTEMS

DECI-ARE

slot_nunlber BYTE,

record_type BYTE,

f ó ^ ^ € f c A i

r e c _ o f f s e t B A S E D r e c _ o f f s e c _ p r ! w o R D , rèóord_found B\1tE,

s t a t u s w o R D ; DECIARE

EOî_REC LITERAtLif 'oFl'll', /* end of template ]recotd */

HDRRECLENGTH LîTERAI-LY '2OH' , /* nunber of registers 1n header ì.ec */

RECLENREC LITERAI-LY '1'; /* recorà length reglster */ \--l

* Get record type for each lecord past che header

* r e c o r d u n t í l t h e s p e c i f i e d r e c o r d ls found

rec_offset : HDRRECI-ENGTH;

r e c o r d _ f o u n d - r q $ g e t $ t n t e r c o n n e c t ( s l o t _ n u n b e r , rec_offset, G s t a t u s ) ; C A L L e r r o r $ c h e c k ( 1 0 0 , s r a r u s )

DO IrttILE (record_founal o rècord_t)rpe) AND (record-found o EOT-REC); \--7

* Get offset fof next recorat by addÍng length of curreDt lecord

* to prevíous record offset (add 2 to accounlr for type and length

rec_offsef: = rec_offset + 2 + tq$get$interconnect(s1ot_nunber, rec_offser + RECLENREC , G s t a t u s ) ;

C A L I - e r r o r q c h e c k ( ll o , status); \ - - l

recold_found = rq$get$ interconnect ( slot_number, rec_offset, Gstatus);

C A L L e r r o r $ c h e c k ( 120 , status);

E N D ;

RETURN(record_f ound) ; END find_record;

Figue 12-6, Implementation of a Board Scanner (continued)

12-22 Nucleus Uset's Guide

EXTENDED iRMX@ II MULTBUS@ N SYSTEMS

$subtitle ( 'out_byte - prlnt a byce on the console,)

/*********!t*rt*****:!*:!*:!*****!t**********************************:!tr*:t**

* pRoC NAME: out_byte

* DESCRIPTIoN: tirlte the hex repres€ntacion of hex byte to the console.

* CALL| CALL out_byte (hex_byte)

* INPUT: hex_byce - byte whose hex value is to be printed

* CLOBALS :

*

*****************x************>t*:t************************************/

^ o u r b y r e : p r o c e d u r e ( h e x _ b y c e ) publíc:

DECI,ARE

hex_byte BYTE, h e x _ b u f ( 3 ) B Y T E , cur_byte BYTE,

status tloRD;

cuÌ_byte - shr (hex_byre, 4);

h e x _ b u f ( o ) - 2;

hex_buf( 1) : con_tab (cur_byce) ;

- cur_byte - hex,byte AND oFH;

hex_buf( 2) - con_reb (cur_byte) ;

c a l l r q c $ s e n d $ e o $ r e s p o n s e ( N I L , 0 , Ghex_buf, @srarus ) . END ouc_byre;

* - r - n r i n r

P L L r r L ' ! é P

/**********:l*:!***:l**,***tr*********)t*)t*****rt*************t<*)t*t<****rt*:t**

*

* PROC NAME: print_nap

*

* ABSTRACT: Write systen map to console

* CAI-L: CALL printmap ( sys_map_ptr ) ;

* INPUT: sys_map_pcr - pointei to systeú nap X GI,OBALS:

*

* CALLS: rqcssendseo$response, out_byte

**************************)t******)t*)t*)t*)t*****************************/

Figure 12-6. IDplementation of a Board Scanner (continued)

n-23

Nùcleùs Useds Guide

EXTENDED iRMXO II MULTIBUS€ II SYSTEMS

print_map: PROCEDURE(sys_map_ptr) PUBLIC; ..___/

DECI-ARE //,r parús */

sys_nap_ptr POINTER:

DECLARE /* Iocals */

sys_nap BASED sys_map_ptr(MAXSIiTS) map_srruc, /* systen map */

i BYIE, /* loca1 indèx */

status uoRD;

C A L L r q c $ s e n d $ e o $ r e s p o n s e ( N I L , 0 , G ( 2 , odh, oah) , €scarus ) ;

C A I L r q c $ s e n d $ e o $ r e s p o n s e ( N I L , 0 , @ ( 17 , , S Y S T E M | , f A P , , o d h , o a h ) , @s r a r u s ) ; c A r , r - r q c $ s e n d $ e o $ r e s p o n s e ( N I L , 0 , G ( 2 3 , , b o a r d s l o c , , O d h , O a h , O d h , O a h ) ,

@ s E a r u s ) ;

Do i = 0 ro MAXstoTs -1; \!-/

C A L L r q c $ s è n d g e o $ r e s p o n s e ( N T L , 0 , @sys_nap ( í ) . íd,Gsratus ) ; C A L L rqcgsendqeo$response ( N I L , 0 , @ ( 5 , , , ) , e s r a t u s ) ; CALL out_bytè ( sye_Í,ap ( i ) . s ror_ntllì) ;

C A L L r q c q s e n d $ e o $ r e s p o n s e ( N T L , 0 , @(2,oDH,oAh) , G s t a t u s ) ; E N D ;

END princ_map;

DUCI,ARE /* g|obaLs */

\-,

iPsB_slot BYTE, /* psb slor currenrly scanned *,/

s r a t u s i , ù o R D

count BYTE, ,/* index tnro id srring x/

vendor_id_1o BYTE, /* lorn'byte of vendor id */

vendor_id_hi BYTE,

id_char BYTE, /* char:acxer in board id */

local_slot BYTE, ,/* slot mrnrber of 1oca1 hosr */

psb_reg_off I{ORD, ,/x offset of psb control record */

r-tyPe 3YTE, /* record. type returned by ffnd_record */

sys_nap (uAxSmTS ) map_struc;/* map of boards ín syscen */

/* becin main */

C A L L s e t $ e x c e p t i o n ( N o E X C E P T ) ; DO lPSB_s1ot : 0 To MAXSLOTS - 1;

sys_map ( iPsB_slot) . slot_num : iPSB_s1ot;

v e n d o r _ i d _ l o = rq$get$ interconnect ( ipSB s1or, VENDORIDREG. @ s t a t u s ) ; C A L L error$check( 130, status);

Figure 12-6. Implementation ofa Board Scl|nnet (continued)

t2-24 Nucleus Uset's Guide

EXTENDDD iRMP IT MULTIBUS@ n sYsTEMs

* Only check status after first call to get$ lnterconnect,

* co seè íf call is confígured (no other error is rèturned

* by geE$interconnecÈ)

vendor_id_hi - rq$get$ tncerconnecr ( ipsB_s1or, VENDORIDREG+I, Gscacus);

C A L L error$check( 140, sratus);

DO I{4iILE (count < BoARDIDLEN);

id_char - rq9get$ interconnect ( iPSB_s1ot, BoARDIDREC+counc, @status) C A L L e r r o r $ c h e c k ( 150 , status); r_cype = fÍnd_record(IiCALI{OST,pSBCoNTROLREC,Gpsb_reg_off) ; II r_type o RECNoTF0UND THEN Do;

local_s1or = rqsget$ inrerconnecr (I.OCALHOST, psb_reloff + pSBSLOTIDoFP, E N D ;

E L S E

@status) ; CALL errorgcheck ( 160 , status);

loca1_slot = shÌ(1oca1_s1ot,3) ;

sys_nap(1oca1_slot) . slot_nun = Iocal_slor:

count - o;

D0 ilrItILE (count < BOARDIDLEN);

id_char - rqqget$interconnecr(IoCALHOS1, BOARDIDREC+couot, @srarus) ; CALI- error$check ( 170, srarus);

lF (íd_char <= ,!,) OR ( id_char >- ,),) THEN

Figùre 12-6. Implemenfation of a Board Scanner

12-25

EXIENDED iRM)@ II MULTIBUS@ II SYSTEMS

Figure 12-7. Sample Screen Output Fmm the Interconnect Example Figure 12-7 shows a sample output of the board scanner example.

12.5.6.2 Creating a Port for Message Sending and Receiving

Once you have ioformation on what boards are in your system, the next step is to create a pofi for message passing and associate a buffer pool with it. The following example creates a buffer pool, releases a number of 1K buffers to it, and then creates a data transport type port and returns a TOKEN to use as a reference to the port.

This module is not run from the Human Interface. it is called by the other modules described in this chapter.

12-26 Nucleus Useds Guide

EXTENDED iR]\fi@ II MULTIBUS@ II SYSTEMS

$tlt1e('crport - create a port end attach a buffer pool to ít,)

/*****************************************************************rl*r!***rt***

* INTEL CORPORATION PROPRIETARY INFORI{ATION

* This sofcl{Étte is supplieal unater the tenns of Ér

* llcense agreelnent or nondisclosule agreenenc wich

* l n t e 1 C o r p o r a t i o n and Ìnày not be copted or dtsclosed

* e x c e p t i n a c c o r d a n c e w l t h the terns of that €treemenc.

* C o p y r i g h t l n t e 1 Corporation 1987, 1988

* All rights resefied

* For Incel customers licensed for the íRlfl{ II Operating

* Systern under an Intel Software License Agreenenc, this source code and

* object code deríved therefron are licensed for use on e single central

* processlng unit for internal use only. Necessary backup copies and

* nultípte perlllitled. Object Code der:iwed fron this source code

* is a Class I sofu,/are product under the Intel Sofcxrare License Agreement

* and is subject to the terrÌs and conditions of that agreenent.

* Fo! the right to nake lncorporations, or to transfer thís softsare to

* c h l r d p e r È l e s , contacc Intel corpofatioo.

/***:l****rt*it***it*)t)t*rt*************************it*****:t**rt*******:t***********/

c r P o f c : D0;

tlncrude ( / rrú.y z ò 6/ l ncl rnxp rn . exr) I include (/Ìnx28 6/1nclerror. 1it)

$ i n c l u d e ( d c o n . 1 i t )

$ i n c l u d e ( e r r . e x t ) DECI.\RE

NOEXCEPT LITERATLY '0'i

/* no exception handling by system */

Figure 12-8. Creating a Data îlaùsport Protocol Port (continued)

Nùcleus Ilsefs Gùide t2-27

EXTENDED iRI{X@ II MULTIBUSo II SYSTEMS

l e J e c .

$ s u b t i t l e ( ' create$bufqpool ' )

**************.***************Jr*****

* PRoC NAMET crèategbufgpool

* DESCRIPîION: Creare a buffer pool \rirh rhe acrribures passed by che a11er. Create an 1n1r1a1 number of 1K buffers and

* release thero to the buffer pool. Return a coken for

* t h e buffer pool to the caller.

* CALL: bufgpoolgtok = creategbufgpool (nax_bufs , inir_nurD_bufs,

t t r s , s t a t u s _ P t f ) ;

* INPUîS: nax_bufs - naximtrll nxnber of buffers for buffer pool

* inít_num_1,ufs - ínitial nuDber of buffèrs for buffer

* P o o l ,

* attrs - buffer pool creairion atrributes \.--l

x status_ptr - poínts to a status word

* RETURNS: bufspoolgtok - token for newly created buffer pool

*********:t**************)t*********rt******************************>t*>t*/

create$buf$pool: PROCEDURE (nax_bufs , i ír_num_bufs, arrrs, stacus_ptr) TOKEN PUBLIC;

DECIARE /* Paraneters */

max_bufs WORD, /* maxirnunr nunber of buffers in buffer pool */

init_nw_bufs lrORD, /* tnitial number of buffers in pool */

attrs llORD, /* buffer pool creation atttibutes */

s t a t u s _ p t r P o I N T E R : , / * e x c e p t l o n p ó i n t e r * / DECI,ARE /* Local Variables *'/

status BASED srarus_ptr WORD ,

buf_pool îOREN, /* buffèr pool conplere with buffers *,/v

buf_tok ToKEN, /* buffeÌ token */

i UoRD; /* local index */

DECLARE /* Líxerals */

BUFSIZE LITERAI-LY '1024' , /* b!îfer sj-ze */

BI'LAGS IITERAI,LY '0108,;

,/* single buffet, don,r release *,/

buf_poo1 : rq$create$buffer$pool (nax_bufs , attrs, status_ptr);

CAIL errorqcheck( 10, stacus);

Figtlre l2-8. Creating a Data Transport Protocol Port (contirued)

72-28 Nucleus Useds cuide

EXIENDDD iRMX@ II MULTIBUS@ Il SYSTEMS

DO i : 1 to init_nutÌ_bufs;

buf_tok = lqgcreate$ segnent ( BUFS IZE, statrs_ptr);

CALL error$check(20, status) ;

CALL rqqreleasegbuffer (buf_poo1 , buf_rok, BFtAcS, srarus_prr);

CAIL error$check(30, status) ;

CAIL: dport$cok : ger$dporr (porr_nun, buf_pool_prr, b_aftrs, sratus_Ptr)

INPUTS: port_nur0 - port nunber asslgned to neÌ,r1y created port b_attls - buffer pool creation arÈiibutes

s c a t u s _ p t r - polnts ro sracus word

get$dport: PRoCEDURE (port_nun, bufu)oo1_ptr , b_arcrs , starus_?cr) ToKEN puBl-tc;

DECI,ARE

Figure l2-8. Crcating a Data TEnsport Protocol Port (continued)

Nucleus Usefs Guide 12-29

EXTENDED iRTD(@ II MIJLTIBUSO T SYSTBMS

DECLARE /* Lltèrals * / \_,.

NUU_TRANS LITERALLY '10', /* na-y nurlber outstandtng trens €t port */

DATACOM LITERALLY '2' , /* indícates data con port */

PFLAGS LITERALLY '0' , /* fifo, fragrnentation flags */

MAXBUFS LITERALLY '30', /* naxínun il buffers tn pool */

INITBUFS LITEMIIY '10'; /* initial nunber of buffèrs */

DECIARE /* Locals */

bpool BASED buf_pool_pcr ToKEN,

Port_t TOKEN, /x local por].- */

bufpool_c TOKEN, /* buîîex pool with inieial alloc of buffers */

port_info porc_ínfo_s,

loc_status WORD, /* local stacus nord */

status BASED status_Prr woRD; -_-/

/* BeCin tet$dpott */

port_info . port_id = port_nun;

port_lnfo. type - DATACoM;

porE tnfo. rrags - vlr-Acs;

port_t : rq$create$port (NUM_TRANS , €port_lnfo, stàtus_ptÌ);

CALL error9check(40, status) ;

bufpool_t - creategbuf$pool(IIAXBUFS, INIîBUrS, b_attrs, status_pÈr) ; CALL error$check(50, status) ;

bpool - bufpool_t;

CALL rqqattach9buffer$pool(bufpool_t, port_t, status_pÈr) ; CALL error$check(60, status) ;

RETURN porr_t;

END get$dport;

END crport;

\_,-/

Figùre U-8. Creating a Data Transport Prutocol Port

12-30 Nucleus Uset's Guide

EtrIENDED iRMX@ II MULTIBUS@ Il SYSTEMS

12.5,6.3 Sending Data Using RQ$SEND$RSVP

Now that you have information on the boards in the system and a data port you are ready to send data in message form. The next example illustrates one of the most cornmon message passing formats, the request/responsg typically used between two Extended iRMX tr hosts. Tlvo terms used îo describe the boards involved in request/response messages, are 9!949 which indicates the requesting board and sele! which indicates the responding board.

Figùre l2-9 shows the logical represeotation of the message-passing model for a request/rerponse transaction. A task on the client board initiates the hansaction by sending an RQ$SEND$RSVP call to a well-knom port ofl the seryer board. Because the ports on a remote board cannot be dynamically determined, this example assumes a port that is created on all boards as a starting point for message passing. Once you have a HOST$ID for a remote board you combine it with the PORT$ID of this ,'well-known"

po.t to create the socket for the destination of a message. When the server board

receives the message it replies with the RQ$SEND$REPLY call. The request/response messages continue until the data requested in th€ original RO$SEND$RSVP system call is received by the task on the client board.

For this example we are assuming the following:

. the port on the client board has a single buffer large enoùgh for the reqùested data . the port receiving the RSVP message is not being ùsed as a sirlk port

Figure 12-10 is ari algorithm for this transaction and Figùre 12-4 Ehows the physical location of the boards in a sysrem.

Nucleus Uset's Guide t23l

EXTE\DED iRVX@ II MTJLTTBUS€ U SYSTEMS

Operations that are transpaaènt to calling tasks

L E G E N D

Th6 task onths Cli€nt board issues an RQ$SEND$RSVP call. In an RSVP/R EPLY fansaction. th€

board that issuesth6 s6nd RSVP isth€ cli€nt;the board that r€pli€s is the;erver.

The Nucl6us Communication Servic€tumsthe inlormation in th€'RSVP'system callinto a messag€, and ssls up th€ buffer space for th6 sxp€cted reply.

Th€ MPC sends th6 messago across a m€€sage passing bus to the remote agerìr specifed in rho BSVP syst€m call.

The CPU on th€ s€N€r board r€coives a PIC interupi informing itthata MULTTBUS llm6ssage has The Nucleus Communication S€tuice onihe seNer boad dirgcts th€ message to the appropriat€ port {and ther€for€ task.)

Task 2 responds with an RO$SEND$REPLY system callthat corìtains information about the data being safi,

Th6 Nucleus Communication Seruic€ on ths s6N€a board turnsth€ information in tha RQ$SEND$REPLY call into a message that is sent bythe MPC.

fh€ m€s6age travols across ths msssage passing bus, an operation that is transpar€nt to th€ op€Éting systems on both boards.

Th€ ÀlPC on th€ clierìt board places the messag€ into ths buff€r that was set up in slep two, and thsn sends an ìnterrupt to th6 CPU, informing it of the completion of the m€ssage transaction,

The Nucleus Communication S€rvice on th6 clieÍt board directs the messag€ to th€ cor€ct task usìnglhs PORÍ$|0. The CPu on ths cli€nt board is 'aware' of onty th€ op€rations performed in steps 1 , 2 , 9 , a n d 1 0 .

Figure 12-9. An RSVP/REPLY Transaction betryeer T\yo Extended iRMlp II Hosts

12-32 Nucleùs Uset's Guide

EMENDED IRMX@ II MULTIBUS@ II SYSTEMS

C l i e n t board

CalI an external procedure called get$dport thar returns a TOKEN for the 1oca1 porr ro be used in rhe RegSEND$RSVP caII.

I n i t l a l i z e t h e s o c k e t structure, d e c l a r e d externally.

s e c the nessate slze co be zero length.

Equate che global variable rs\rp_size to che LITEML RSVPB (128 bytes.) l s s u e the RSVP systen call ustng rhe prevtously ínirialized v a r i a b l e s . Use the Rq$RECEM$REPLY sysrem call ro wait for an ans\.'er.

S e n d thé reply nessage, "This is a send$reply,,message" to the console screen.

Exlt froro the éxamD1e.

Ftgùe 12-10. Algorithrh for RQ$SENDSRSYP Exampte

Ca1l an excernal procedure, get$dport, that relurns a TO(EN to be used in thè RQ$RECEIVE and RQgSENDgREpLy calls.

PelforÍì an RQ$RECEM using rhe TOREN rerurned frorn ger$dporc

Perforo an RqSSEND$REPLY on successful conpletion of the RQ9RECEM I F the daca ar.riwes correcÈ1y. nsg_pcr I N I L

Retuh che buffer ro rhe buffer pool End server procedure

Ftgùre l2-ll AlgorithtÍ for Server Board

This example must be run with the folloli,ing example shown in Figure 12-13. To run these rwo examples, first on the host in slot five qrpe:

RC!'I,ISG <CR>

Then on the host in slot one type:

SNDRSV? <CR>

Nucleus Usels Guide t2-33

EXTENDED iRMX@ II MULTIBUSO II SYSTEMS

$ t i t Ì è ( ' s n d t s v p - initiaté e r e q u e s t - r è s p o n s e t r a n s a c t i o n ' )

/***5t******)l$t******:l*****************************************************)t*

* INTEL CORPORATION PRO?RIETARY INFOR}IATION

* T h i s s o f t u a r e i s s u p p l i e d u n d e r t h e terns of a - t t c e n s e a g r e e n e n t or nondísclosure atreeoenl vlth

* T h i s s o f t u a r e i s s u p p l i e d u n d e r t h e terns of a - t t c e n s e a g r e e n e n t or nondísclosure atreeoenl vlth

Dans le document OPERATING SYSTEMDOCUMENTATION intel' (Page 144-188)

Documents relatifs