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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

<strong>the</strong>ir values are monitored by <strong>the</strong> control engine and published via DIM. In this state <strong>the</strong><br />

command INITIALIZE or <strong>the</strong> command TEST can be sent via <strong>the</strong> InterCom layer.<br />

Sending <strong>the</strong> command TEST runs one out <strong>of</strong> different tests to check <strong>the</strong> electronics.<br />

Which test is run is selected by additional data send toge<strong>the</strong>r with <strong>the</strong> TEST command.<br />

An overview <strong>of</strong> <strong>the</strong> different tests is given in section 5.4. During a test, <strong>the</strong> FSM is in state<br />

TESTING. After <strong>the</strong> test is finished <strong>the</strong> FSM switches back to STDBY or in case <strong>of</strong> a failure<br />

to state ERROR.<br />

If <strong>the</strong> command INITIALIZE is sent, <strong>the</strong> FSM switches to state INITIALIZING. During<br />

INITIALIZING <strong>the</strong> front end electronics are powered up. <strong>The</strong> control engine switches<br />

<strong>the</strong> power regulators <strong>of</strong> <strong>the</strong> readout boards on and all parts <strong>of</strong> <strong>the</strong> FERO get power. <strong>The</strong><br />

MCMs are reset to default values. After <strong>the</strong> initialization is finished, <strong>the</strong> FSM switches to<br />

state STDBY_INITIALIZED.<br />

When <strong>the</strong> FSM is in state STDBY_INITIALIZED <strong>the</strong> MCMs can be configured. <strong>The</strong><br />

command CONFIGURE starts <strong>the</strong> process. Toge<strong>the</strong>r with this command a configuration<br />

with about 2100 to 2500 commands is sent. Since <strong>the</strong> MCMs have no permanent<br />

internal memory all configurations and even <strong>the</strong> assembler program which runs on <strong>the</strong><br />

MCM CPUs have to be loaded after each power up. Most commands in <strong>the</strong> configuration<br />

write parts <strong>of</strong> <strong>the</strong> assembler program to <strong>the</strong> MCMs. During <strong>the</strong> configuration process <strong>the</strong><br />

FSM is in state CONFIGURING. When <strong>the</strong> MCMs are configured successfully, <strong>the</strong> FSM<br />

switches to state CONFIGURED.<br />

As shown in <strong>the</strong> FSM diagram <strong>the</strong>re are also transitions defined to go back to previous<br />

states. <strong>The</strong> command INITIALIZE can initiate a transition from CONFIGURED to<br />

STDBY_INITIALIZED, too. <strong>The</strong> command GO_STANDBY initiates <strong>the</strong> transition from<br />

STDBY_INITIALIZED to STDBY. During this transition <strong>the</strong> power regulators on <strong>the</strong><br />

ROBs are switched <strong>of</strong>f.<br />

<strong>The</strong> state ERROR is a special state. It cannot be reached by any usual transition. Each<br />

time an error occurrs – an invalid transition request, a hardware or s<strong>of</strong>tware error, or a<br />

failed test – <strong>the</strong> FSM switches to state ERROR. To get back to normal operation <strong>the</strong> transition<br />

command RESET has to be sent. Afterwards <strong>the</strong> FSM is in state STDBY regardless<br />

<strong>of</strong> <strong>the</strong> previous state. This behavior was chosen because in case <strong>of</strong> error any part <strong>of</strong> <strong>the</strong><br />

system can be in an undefined state. Going back to STDBY forces a complete reconfiguration.<br />

Maybe a complete reconfiguration is not necessary in all cases but separating<br />

different error conditions is difficult and error-prone. <strong>The</strong> advantage <strong>of</strong> a reconfiguration<br />

is a well defined configuration afterwards, independent <strong>of</strong> <strong>the</strong> error reason.<br />

Implementation <strong>of</strong> <strong>the</strong> finite state machine<br />

<strong>The</strong> FSM is implemented in function triggerTransition (char * _cfdat) <strong>of</strong> class<br />

CEStateMachine as a nested switch-case structure. <strong>The</strong> outer switch-case separates <strong>the</strong><br />

requested transition and <strong>the</strong> inner switch-case checks if <strong>the</strong> requested transition is defined<br />

in <strong>the</strong> current state. <strong>The</strong> current state <strong>of</strong> <strong>the</strong> FSM is stored in <strong>the</strong> class variable<br />

CEStateMachine::curr_state. Listing 5.1 shows an extract <strong>of</strong> <strong>the</strong> switch-case structure.<br />

54<br />

switch ( a c t i o n )<br />

{<br />

case INIT :<br />

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

case (STDBY) :

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

Saved successfully!

Ooh no, something went wrong!