CORDET Framework - C2 Implementation
CrFwInManager.c File Reference

Implementation of InManager State Machine. More...

Go to the source code of this file.

Functions

static void InManagerInitAction (FwPrDesc_t initPr)
 Initialization action for InManagers. More...
 
static void InManagerConfigAction (FwPrDesc_t initPr)
 Configuration action for InManagers. More...
 
static void InManagerShutdownAction (FwSmDesc_t smDesc)
 Shutdown action for InManager. More...
 
static void InManagerExecAction (FwPrDesc_t execPr)
 Implement the logic of the Execution Procedure (see figure below). More...
 
FwSmDesc_t CrFwInManagerMake (CrFwInstanceId_t i)
 Factory function to retrieve the i-th InManager State Machine instance. More...
 
CrFwBool_t CrFwInManagerLoad (FwSmDesc_t smDesc, FwSmDesc_t inCmp)
 Load a new InReport or InCommand into the InManager. More...
 
CrFwCounterU1_t CrFwInManagerGetNOfPendingInCmp (FwSmDesc_t smDesc)
 Return the number of InReport or InCommands currently in the PCRL of an InManager. More...
 
CrFwCounterU2_t CrFwInManagerGetNOfLoadedInCmp (FwSmDesc_t smDesc)
 Return the number of InReport or InCommands successfully loaded since the InManager was last reset. More...
 
CrFwCounterU1_t CrFwInManagerGetPCRLSize (FwSmDesc_t smDesc)
 Return the size of the PCRL of an InManager. More...
 

Variables

static CrFwCounterU2_t inManagerPcrlSize [CR_FW_NOF_INMANAGER] = CR_FW_INMANAGER_PCRLSIZE
 The sizes of the PCRL in the InManager components. More...
 
static FwSmDesc_t inManagerDesc [CR_FW_NOF_INMANAGER]
 The descriptors of the InManager State Machines. More...
 
static CrFwCmpData_t inManagerData [CR_FW_NOF_INMANAGER]
 The data structures for the InManager State Machines and their Procedures. More...
 
static CrFwInManagerData_t inManagerCmpSpecificData [CR_FW_NOF_INMANAGER]
 The component-specific data for the InManager instances.
 

Detailed Description

Implementation of InManager 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 CrFwInManager.c.

Function Documentation

CrFwCounterU2_t CrFwInManagerGetNOfLoadedInCmp ( FwSmDesc_t  smDesc)

Return the number of InReport or InCommands successfully loaded since the InManager was last reset.

Parameters
smDescthe descriptor of the InManager State Machine.
Returns
the number of InReport or InCommands currently in the PCRL of an InManager.

Definition at line 301 of file CrFwInManager.c.

CrFwCounterU1_t CrFwInManagerGetNOfPendingInCmp ( FwSmDesc_t  smDesc)

Return the number of InReport or InCommands currently in the PCRL of an InManager.

Parameters
smDescthe descriptor of the InManager State Machine.
Returns
the number of OutComponents currently in the PCRL of an InManager.

Definition at line 294 of file CrFwInManager.c.

CrFwCounterU1_t CrFwInManagerGetPCRLSize ( FwSmDesc_t  smDesc)

Return the size of the PCRL of an InManager.

Parameters
smDescthe descriptor of the InManager State Machine.
Returns
the size of the PCRL of an InManager.

Definition at line 308 of file CrFwInManager.c.

CrFwBool_t CrFwInManagerLoad ( FwSmDesc_t  smDesc,
FwSmDesc_t  inCmp 
)

Load a new InReport or InCommand into the InManager.

The behaviour implemented by this function is shown in the activity diagram below. If the PCRL is not full, the function identifies a free position in the PCRL where to store the InReport/InCommand. This function adds InReport/InCommand to the PCRL. The PCRL is flushed when the InManager is executed (i.e. it is flushed by function InManagerExecAction). The algorithms to identify a free position in the PCRL and to process the PCRL entries when the InManager is executed are optimized for a situation where multiple load operations are performed before the InManager is executed.

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

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

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

Definition at line 189 of file CrFwInManager.c.

FwSmDesc_t CrFwInManagerMake ( CrFwInstanceId_t  inManagerId)

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

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

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

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

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

Definition at line 96 of file CrFwInManager.c.

static void InManagerConfigAction ( FwPrDesc_t  initPr)
static

Configuration action for InManagers.

This function resets the PCRL, releases all InCommands and InReports in the PCRL and resets the counter of successfully loaded InReports or InCommands. The outcome of the initialization action is always: "success"

Parameters
initPrthe Initialization Procedure of the InManager

Definition at line 248 of file CrFwInManager.c.

static void InManagerExecAction ( 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 InManager is executed.

InManagerExecution.png
Parameters
execPrthe Execution Procedure of the InManager

Definition at line 148 of file CrFwInManager.c.

static void InManagerInitAction ( FwPrDesc_t  initPr)
static

Initialization action for InManagers.

This function allocates the memory for the InManager 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 InManager

Definition at line 235 of file CrFwInManager.c.

static void InManagerShutdownAction ( FwSmDesc_t  smDesc)
static

Shutdown action for InManager.

This function resets the PCRL and releases all InCommands and InReports in the PCRL.

Parameters
smDescthe InManager state machine

Definition at line 272 of file CrFwInManager.c.

Variable Documentation

CrFwCmpData_t inManagerData[CR_FW_NOF_INMANAGER]
static

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

Definition at line 55 of file CrFwInManager.c.

FwSmDesc_t inManagerDesc[CR_FW_NOF_INMANAGER]
static

The descriptors of the InManager State Machines.

Definition at line 52 of file CrFwInManager.c.

The sizes of the PCRL in the InManager components.

Definition at line 49 of file CrFwInManager.c.

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