23.11.2012 Views

The FEE Server Control Engine of the ALICE-TRD - Westfälische ...

The FEE Server Control Engine of the ALICE-TRD - Westfälische ...

The FEE Server Control Engine of the ALICE-TRD - Westfälische ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5 <strong>The</strong> <strong>FEE</strong><strong>Server</strong> <strong>Control</strong> <strong>Engine</strong><br />

<strong>of</strong> SCSN commands. Each list entry is a struct, containing <strong>the</strong> SCSN command, <strong>the</strong> <strong>ALICE</strong><br />

ID <strong>of</strong> <strong>the</strong> destination MCM, a memory address in <strong>the</strong> MCM and a data field. <strong>The</strong> destination<br />

MCM is ei<strong>the</strong>r a single MCM, a group <strong>of</strong> MCMs (board mergers, half chamber mergers,<br />

etc.) or all MCMs (broadcast). <strong>The</strong> second parameter is <strong>the</strong> number <strong>of</strong> elements in <strong>the</strong><br />

list and <strong>the</strong> last one is <strong>the</strong> linkpair to use. <strong>The</strong> last parameter can be omitted. In this case<br />

a loop runs over all linkpairs. <strong>The</strong> function void execute(struct * cfdat_command, unsigned<br />

, int) controls <strong>the</strong> conversions. It calls processCmds(struct cfdat_command * , unsigned) for<br />

<strong>the</strong> creation and sending <strong>of</strong> <strong>the</strong> SCSN frames. <strong>The</strong> function loops through <strong>the</strong> list <strong>of</strong> commands<br />

and calls <strong>the</strong> matching conversion function for each SCSN command type. <strong>The</strong><br />

conversion functions basically all do <strong>the</strong> same.<br />

In <strong>the</strong> list <strong>of</strong> SCSN commands <strong>the</strong> target MCMs or MCM groups are identified by extended<br />

<strong>ALICE</strong> IDs. Before sending <strong>the</strong> commands, <strong>the</strong> class SCSNBus has to convert <strong>the</strong><br />

IDs to <strong>the</strong> corresponding slave ID / link /linkpair information. An MCM always belongs<br />

to <strong>the</strong> same linkpair but <strong>the</strong> link and <strong>the</strong> slave ID depend on <strong>the</strong> bridging status <strong>of</strong> <strong>the</strong><br />

linkpair. Fur<strong>the</strong>rmore, MCM groups addressed by an extended <strong>ALICE</strong> ID have to be expanded<br />

to a list <strong>of</strong> individual MCMs because <strong>the</strong> SCSN Bus supports only <strong>the</strong> addressing<br />

<strong>of</strong> individual MCMs or broadcasts by design.<br />

<strong>The</strong>refore <strong>the</strong> conversion functions first convert <strong>the</strong> extended <strong>ALICE</strong> ID to a list <strong>of</strong> slave<br />

IDs for an unbridged linkpair. If <strong>the</strong> extended <strong>ALICE</strong> ID addresses an MCM or a MCM<br />

group which is not <strong>the</strong> currently active linkpair, <strong>the</strong> list is empty and <strong>the</strong> next command<br />

in <strong>the</strong> command list is processed. In case <strong>of</strong> a single MCM which is in <strong>the</strong> linkpair or <strong>the</strong><br />

broadcast address, <strong>the</strong> list contains only one slave ID, in all o<strong>the</strong>r cases <strong>the</strong> list contains<br />

more <strong>the</strong>n one slave ID.<br />

Afterwards <strong>the</strong> conversion function calls const RoutingInfo * SCSNBusBridge::querySlave<br />

(int) for each slave ID in <strong>the</strong> list to convert <strong>the</strong> just determinded default slave ID to <strong>the</strong><br />

current slave ID <strong>of</strong> <strong>the</strong> MCM. If <strong>the</strong> linkpair where <strong>the</strong> MCM belongs to is not bridged<br />

and link 0 <strong>of</strong> <strong>the</strong> linkpair is not damaged, <strong>the</strong> default slave ID and <strong>the</strong> current slave ID <strong>of</strong><br />

<strong>the</strong> MCM are identical (compare section 5.3.1). Based on <strong>the</strong> information in <strong>the</strong> command<br />

list and on <strong>the</strong> information from const RoutingInfo * querySlave(int) <strong>the</strong> frames are created<br />

and stored toge<strong>the</strong>r with additional information in <strong>the</strong> send buffer.<br />

<strong>The</strong> send buffer is an array <strong>of</strong> <strong>of</strong> type FramesToSend (see listing 5.4) and has a fixed size.<br />

Each element <strong>of</strong> <strong>the</strong> array stores all data <strong>of</strong> one frame. <strong>The</strong> frame itself is stored in <strong>the</strong><br />

variable <strong>the</strong>_frame. <strong>The</strong> o<strong>the</strong>r variables contain informations necessary to send <strong>the</strong> frame<br />

correctly and to check <strong>the</strong> returning frame later.<br />

66<br />

typedef s t r u c t {<br />

i n t cmd_seq_no ; / / Command s e q u e n c e number , p a r t i c u l a r l y<br />

i m p o r t a n t f o r b r o a d c a s t r e a d s<br />

i n t frame_no ; / / Frame number<br />

i n t fd_w ; / / No . o f F i l e h a n d l e r ( l i n k ) where t h i s frame<br />

s h o u l d be w r i t t e n<br />

i n t fd_r ; / / No . o f F i l e h a n d l e r ( l i n k ) where t h i s frame<br />

s h o u l d be r e a d from when r e t u r n i n g<br />

i n t hopcount ; / / E x p e c t e d h o p c o u n t e r when frame has r e t u r n e d<br />

i n t expt_source ; / / E x p e c t e d s o u r c e b i t when frame has r e t u r n e d<br />

unsigned e x t a l i _ i d ; / / <strong>ALICE</strong> ID o f t h e t a r g e t s l a v e<br />

unsigned o r i g _ i d ; / / <strong>ALICE</strong> ID from t h e incomming command l i s t .<br />

For s i n g l e MCMs t h i s i s e q u a l t o e x t a l i _ i d but f o r mcm groups<br />

b o t h v a l u e s d i f f e r s

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!