CORDET Framework - C2 Implementation
CrFwOutManager.c File Reference

Implementation of OutManager State Machine. More...

Go to the source code of this file.

Functions

static void OutManagerInitAction (FwPrDesc_t initPr)
 Initialization action for OutManagers. More...
 
static void OutManagerConfigAction (FwPrDesc_t initPr)
 Configuration action for OutManagers. More...
 
static void OutManagerShutdownAction (FwSmDesc_t smDesc)
 Shutdown action for OutManager. More...
 
static void OutManagerExecAction (FwPrDesc_t execPr)
 Implement the logic of the Execution Procedure (see figure below). More...
 
FwSmDesc_t CrFwOutManagerMake (CrFwInstanceId_t i)
 Factory function to retrieve the i-th OutManager State Machine instance. More...
 
CrFwBool_t CrFwOutManagerLoad (FwSmDesc_t smDesc, FwSmDesc_t outCmp)
 Load a new OutComponent into the OutManager. More...
 
CrFwCounterU1_t CrFwOutManagerGetNOfPendingOutCmp (FwSmDesc_t smDesc)
 Return the number of OutComponents currently in the POCL of an OutManager. More...
 
CrFwCounterU2_t CrFwOutManagerGetNOfLoadedOutCmp (FwSmDesc_t smDesc)
 Return the number of OutComponents successfully loaded in the POCL of an OutManager since the OutManager was last reset. More...
 
CrFwCounterU1_t CrFwOutManagerGetPOCLSize (FwSmDesc_t smDesc)
 Return the size of the POCL of an OutManager. More...
 

Variables

static CrFwCounterU2_t outManagerPoclSize [CR_FW_NOF_OUTMANAGER] = CR_FW_OUTMANAGER_POCLSIZE
 The sizes of the POCL in the OutManager components. More...
 
static FwSmDesc_t outManagerDesc [CR_FW_NOF_OUTMANAGER]
 The descriptors of the OutManager State Machines. More...
 
static CrFwCmpData_t outManagerData [CR_FW_NOF_OUTMANAGER]
 The data structures for the OutManager State Machines and their Procedures. More...
 
static CrFwOutManagerData_t outManagerCmpSpecificData [CR_FW_NOF_OUTMANAGER]
 The component-specific data for the OutManager instances.
 

Detailed Description

Implementation of OutManager State Machine.

Author
Vaclav Cechticky vacla.nosp@m.v.ce.nosp@m.chtic.nosp@m.ky@p.nosp@m.np-so.nosp@m.ftwa.nosp@m.re.co.nosp@m.m
Alessandro Pasetti paset.nosp@m.ti@p.nosp@m.np-so.nosp@m.ftwa.nosp@m.re.co.nosp@m.m

This file is part of the CORDET Framework.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

For information on alternative licensing, please contact P&P Software GmbH.

Definition in file CrFwOutManager.c.

Function Documentation

CrFwCounterU2_t CrFwOutManagerGetNOfLoadedOutCmp ( FwSmDesc_t  smDesc)

Return the number of OutComponents successfully loaded in the POCL of an OutManager since the OutManager was last reset.

Parameters
smDescthe descriptor of the OutManager State Machine.
Returns
the number of OutComponents successfully loaded in the POCL of an OutManager.

Definition at line 283 of file CrFwOutManager.c.

CrFwCounterU1_t CrFwOutManagerGetNOfPendingOutCmp ( FwSmDesc_t  smDesc)

Return the number of OutComponents currently in the POCL of an OutManager.

Parameters
smDescthe descriptor of the OutManager State Machine.
Returns
the number of OutComponents currently in the POCL of an OutManager.

Definition at line 276 of file CrFwOutManager.c.

CrFwCounterU1_t CrFwOutManagerGetPOCLSize ( FwSmDesc_t  smDesc)

Return the size of the POCL of an OutManager.

Parameters
smDescthe descriptor of the OutManager State Machine.
Returns
the size of the POCL of an OutManager.

Definition at line 290 of file CrFwOutManager.c.

CrFwBool_t CrFwOutManagerLoad ( FwSmDesc_t  smDesc,
FwSmDesc_t  outCmp 
)

Load a new OutComponent into the OutManager.

The behaviour implemented by this function is shown in the activity diagram below. If the POCL is not full, the function identifies a free position in the POCL where to store the OutComponent. If the POCL is full, the function generates the error report crOutManagerPoclFull and then releases the OutCompoment and returns.

This function adds OutComponents to the POCL. The POCL is flushed when the OutManager is executed (i.e. it is flushed by function OutManagerExecAction). The algorithms to identify a free position in the POCL and to process the POCL entries when the OutManager is executed are optimized for a situation where multiple load operations are performed before the OutManager is executed.

Additionally, these algorithms guarantee the following ordering constraint. Let OutComponents C1 to Cn be successfully loaded into an OutManager through a sequence of calls to function CrFwOutManagerLoad and assume that this sequence of load operations is not interrupted by an execution of the OutManager. Under these conditions, when the OutManager is executed next, the OutComponents C1 to Cn will be processed in the order in which they have been loaded.

The implementation of function CrFwOutManagerLoad is based on the internal variable freePos. This variable has the following characteristics:

  • it is initialized to point to the first entry in the POCL;
  • after the execution of the load function, freePos either points to the next free position in the POCL or is equal to the POCL size if the POCL is full;
  • after execution of the OutManager, it is re-initialized to point to the first position in the POCL.
OutManagerLoad.png
Parameters
smDescthe descriptor of the OutManager State Machine.
outCmpthe descriptor of the OutComponent to be loaded in the OutManager
Returns
1 if the load operation was successful (the POCL was not full and the OutComponent was successfully loaded in the OutManager) or 0 if the load operation has failed (the POCL was full and the OutComponent could not be loaded in the OutManager).

Definition at line 179 of file CrFwOutManager.c.

FwSmDesc_t CrFwOutManagerMake ( CrFwInstanceId_t  outManagerId)

Factory function to retrieve the i-th OutManager State Machine instance.

The first time this function is called with a certain value of the argument i, it creates the i-th OutManager State Machine instance. Subsequent calls returns the same instance.

The OutManager identifier i must be in the range: [0, CR_FW_NOF_OUTMANAGER-1]. If the identifier is out of range, the function returns NULL and sets the application error code to: crOutManagerIllId.

The first time this function is called with a certain value of i, it returns an OutManager State Machine which has been started but which still needs to be initialized and configured.

Parameters
outManagerIdthe identifier of the OutManager
Returns
the descriptor of the OutManager State Machine or NULL if the state machine could not be created or if the identifier i is out of range.

Definition at line 95 of file CrFwOutManager.c.

static void OutManagerConfigAction ( FwPrDesc_t  initPr)
static

Configuration action for OutManagers.

This function resets the POCL and releases all OutComponents in the POCL. The outcome of the initialization action is always: "success"

Parameters
initPrthe Initialization Procedure of the OutManager

Definition at line 240 of file CrFwOutManager.c.

static void OutManagerExecAction ( FwPrDesc_t  execPr)
static

Implement the logic of the Execution Procedure (see figure below).

This function is executed every time the Execution Procedure of the OutManager is executed.

OutManagerExecution.png
Parameters
execPrthe Execution Procedure of the OutManager

Definition at line 147 of file CrFwOutManager.c.

static void OutManagerInitAction ( FwPrDesc_t  initPr)
static

Initialization action for OutManagers.

This function allocates the memory for the OutManager data structures and initializes them. The outcome of the initialization action is always "success" (the situation where the memory allocation fails is not handled).

Parameters
initPrthe Initialization Procedure of the OutManager

Definition at line 227 of file CrFwOutManager.c.

static void OutManagerShutdownAction ( FwSmDesc_t  smDesc)
static

Shutdown action for OutManager.

This function resets the POCL and releases all OutComponents in the POCL.

Parameters
smDescthe OutManager state machine

Definition at line 259 of file CrFwOutManager.c.

Variable Documentation

CrFwCmpData_t outManagerData[CR_FW_NOF_OUTMANAGER]
static

The data structures for the OutManager State Machines and their Procedures.

Definition at line 55 of file CrFwOutManager.c.

FwSmDesc_t outManagerDesc[CR_FW_NOF_OUTMANAGER]
static

The descriptors of the OutManager State Machines.

Definition at line 52 of file CrFwOutManager.c.

The sizes of the POCL in the OutManager components.

Definition at line 49 of file CrFwOutManager.c.

P&P Software GmbH, Copyright 2012-2013, All Rights Reserved