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.

}<br />

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

case ( STDBY_INIT ) : / / t o a l l o w c o n f i g u r a t i o n r e l o a d<br />

w i t h o u t t h e n e c e s s i t y t o go b a c k t o STDBY<br />

c u r r _ s t a t e =INITIALIZING ;<br />

/ / do something<br />

c u r r _ s t a t e =STDBY_INIT ;<br />

break ;<br />

default :<br />

i n v a l i d T r a n s i t i o n ( a c t i o n ) ;<br />

} break ;<br />

case TEST :<br />

switch ( c u r r _ s t a t e ) {<br />

case STDBY :<br />

c u r r _ s t a t e =TESTING ;<br />

/ / do something<br />

c u r r _ s t a t e =STDBY ;<br />

break ;<br />

default :<br />

i n v a l i d T r a n s i t i o n ( a c t i o n ) ;<br />

} break ;<br />

case CFG:<br />

switch ( c u r r _ s t a t e ) {<br />

case STDBY_INIT :<br />

c u r r _ s t a t e =CONFIGURING;<br />

/ / do something<br />

c u r r _ s t a t e =CONFIGURED;<br />

break ;<br />

default :<br />

i n v a l i d T r a n s i t i o n ( a c t i o n ) ;<br />

} break ;<br />

Listing 5.1: Extract <strong>of</strong> <strong>the</strong> switch-case structure representing <strong>the</strong> FSM.<br />

5.2.3 Handling <strong>of</strong> Incoming Configurations<br />

<strong>The</strong> configurations are created by <strong>the</strong> CommandCoder <strong>of</strong> <strong>the</strong> ICL and sent via a DIM<br />

command channel to <strong>the</strong> <strong>FEE</strong><strong>Server</strong> core. <strong>The</strong> data structure <strong>of</strong> <strong>the</strong> configurations was<br />

described in section 4.4. This section gives an overview how <strong>the</strong> configurations are processed<br />

inside <strong>the</strong> <strong>FEE</strong><strong>Server</strong>.<br />

Each time <strong>the</strong> <strong>FEE</strong><strong>Server</strong> core receives a configuration, it calls <strong>the</strong> function<br />

CEStateMachine::triggerTransition(char * _cfdat) from library trdCE. This function contains<br />

<strong>the</strong> FSM logic described in <strong>the</strong> last section and represents <strong>the</strong> main control function <strong>of</strong><br />

<strong>the</strong> control engine.<br />

First <strong>the</strong> function opens <strong>the</strong> SCSN Bus interface via <strong>the</strong> mutex mechanism (see section<br />

5.3.2) to have exclusive SCSN access during <strong>the</strong> whole configuration process and not to be<br />

disturbed by <strong>the</strong> second thread. Afterwards, function string triggerTransition (char * ) evaluates<br />

<strong>the</strong> variable hd_maker (compare figure 4.19 on page 46) <strong>of</strong> <strong>the</strong> received configuration.<br />

This field contains <strong>the</strong> requested transition. If <strong>the</strong> transition is not allowed in <strong>the</strong> current<br />

state, <strong>the</strong> FSM switches to state ERROR. O<strong>the</strong>rwise <strong>the</strong> corresponding transitioned<br />

state is set. In case <strong>of</strong> <strong>the</strong> transition from STANDBY to STDBY_INITIALIZED or in case <strong>of</strong><br />

55

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

Saved successfully!

Ooh no, something went wrong!