ODeV framework  v2
Macros | Typedefs | Functions
AManagedTask.h File Reference

This file declare the Managed task Interface. More...

#include "syslowpower.h"
#include "FreeRTOS.h"
+ Include dependency graph for AManagedTask.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MT_MAX_ERROR_COUNT   0x7
 
#define MT_ALLOWED_ERROR_COUNT   0x2
 

Typedefs

typedef struct _AManagedTask AManagedTask
 

Functions

sys_error_code_t AMTHardwareInit (AManagedTask *this, void *pParams)
 
sys_error_code_t AMTOnCreateTask (AManagedTask *this, TaskFunction_t *pvTaskCode, const char **pcName, unsigned short *pnStackDepth, void **pParams, UBaseType_t *pxPriority)
 
sys_error_code_t AMTDoEnterPowerMode (AManagedTask *this, const EPowerMode eActivePowerMode, const EPowerMode eNewPowerMode)
 
sys_error_code_t AMTHandleError (AManagedTask *this, SysEvent xError)
 
sys_error_code_t AMTInit (AManagedTask *this)
 
EPowerMode AMTGetSystemPowerMode ()
 
sys_error_code_t AMTNotifyIsStillRunning (AManagedTask *this, sys_error_code_t nStepError)
 
void AMTReportErrOnStepExecution (AManagedTask *this, sys_error_code_t nStepError)
 
void AMTResetAEDCounter (AManagedTask *this)
 
boolean_t AMTIsPowerModeSwitchPending (AManagedTask *this)
 

Detailed Description

This file declare the Managed task Interface.

Author
STMicroelectronics - ST-Korea - MCD Team
Version
1.2.0
Date
Jan 13, 2017 TODO - STF - what is a managed task?
Attention

© COPYRIGHT 2016 STMicroelectronics

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:

   http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Macro Definition Documentation

◆ MT_ALLOWED_ERROR_COUNT

#define MT_ALLOWED_ERROR_COUNT   0x2

Specifies the maximum number of error a task can report before resetting the nIsTaskStillRunning flag. If the AEM (::AppErrorManager) is used it will in turn trigger a system reset due to the WWDG.

◆ MT_MAX_ERROR_COUNT

#define MT_MAX_ERROR_COUNT   0x7

Specifies the maximum number of errors that can be tracked by a managed task.

Typedef Documentation

◆ AManagedTask

typedef struct _AManagedTask AManagedTask

Create type name for _AManagedTask.

Function Documentation

◆ AMTDoEnterPowerMode()

sys_error_code_t AMTDoEnterPowerMode ( AManagedTask this,
const EPowerMode  eActivePowerMode,
const EPowerMode  eNewPowerMode 
)
inline

Task specific function called by the framework when the system is entering a specific power mode. This function is executed in the INIT task execution flow. A managed task should ... TBC

Parameters
this[IN] specifies a task object pointer.
eActivePowerMode[IN] specifies the current power mode of the system.
eNewPowerMode[IN] specifies the new power mode that is to be activated by the system.
Returns
SYS_NO_ERROR_CODE if success, a task specific error code otherwise.

◆ AMTGetSystemPowerMode()

EPowerMode AMTGetSystemPowerMode ( )
inline

Utility function to retrieve the current power mode of the system.

Returns
the current power mode of the system

◆ AMTHandleError()

sys_error_code_t AMTHandleError ( AManagedTask this,
SysEvent  xError 
)
inline

Called by the framework to handle a system wide error. This function is executed in the INIT task execution flow.

Parameters
this[IN] specifies a task object pointer.
xError[IN] specifies a system error
Returns
SYS_NO_ERROR_CODE if success, a task specific error code otherwise.

◆ AMTHardwareInit()

sys_error_code_t AMTHardwareInit ( AManagedTask this,
void *  pParams 
)
inline

Task specific function called by the framework to initialize task related hardware resources. This function is called by the INIT task.

Parameters
this[IN] specifies a task object pointer.
pParams[IN] specifies a pointer to task specific hardware initialization parameters.
Returns
SYS_NO_ERROR_CODE if success, one of the following error codes otherwise:
  • SYS_OUT_OF_MEMORY_ERROR_CODE if is not possible to instantiate the driver object.
  • Other task specific error code

◆ AMTInit()

sys_error_code_t AMTInit ( AManagedTask this)
inline

Initialize a managed task structure. The application is responsible to allocate a managed task in memory. This method must be called after the allocation.

Parameters
this[IN] specifies a task object pointer.
Returns
SYS_NO_ERROR_CODE

◆ AMTIsPowerModeSwitchPending()

boolean_t AMTIsPowerModeSwitchPending ( AManagedTask this)
inline

Check if the INIT task has requested a power mode switch.

Parameters
this[IN] specifies a task object pointer.
Returns
TRUE if there is power mode switch pending request, FALSE otherwise.

◆ AMTNotifyIsStillRunning()

sys_error_code_t AMTNotifyIsStillRunning ( AManagedTask this,
sys_error_code_t  nStepError 
)
inline

Notify the system that the task is still running. If an application error manage delegate is installed (_IApplicationErrorDelegate), then a managed task must notify the system that it is working fine in order to prevent a system reset.

Parameters
this[IN] specifies a task object pointer.
nStepError[IN] specifies an error code. Usually it is the error code reported during the task step execution.
Returns
SYS_NO_ERROR_CODE if success, a task specific error code otherwise.

◆ AMTOnCreateTask()

sys_error_code_t AMTOnCreateTask ( AManagedTask this,
TaskFunction_t *  pvTaskCode,
const char **  pcName,
unsigned short *  pnStackDepth,
void **  pParams,
UBaseType_t *  pxPriority 
)
inline

Task specific function called by the framework before the task is created. An application should use this function in order to perform task specific software initialization and pass task specific parameters to the INIT task.

Parameters
this[IN] specifies a task object pointer.
pvTaskCode[OUT] used by the application to specify the task main function.
pcName[OUT] used by the application to specify a descriptive name for the task.
pnStackDepth[OUT] used by the application to specify the task stack size.
pxPriority[OUT] used by the application to specify the task priority.
pParams[OUT] specifies a pointer to the parameters passed from the application to the task.
Returns
SYS_NO_ERROR_CODE if success, a task specific error code otherwise. If the function fails the task creation process is stopped.

◆ AMTReportErrOnStepExecution()

void AMTReportErrOnStepExecution ( AManagedTask this,
sys_error_code_t  nStepError 
)
inline

A managed task can handle an error during the step execution by itself. Another option is to let the error navigate up to the main control loop of the task where it will be reported to the system using the AMTNotifyIsStillRunning() function. But if an error occurs and the managed task want to ignore the error and proceed with the step execution, it should notify the system using this function before the error is overwritten. For example:

xRes = HCPExeuteCommand(&this->m_xProtocol, xReport.outputReport11.nCommandID, NULL, this->m_pxDriver);
if (SYS_IS_ERROR_CODE(xRes)) {
  AMTReportErrOnStepExecution(this, xRes);
}
// continue with the step execution.

In this why the error is logged and the AED count the error when it check if the task is still running properly.

Parameters
this[IN] specifies a task object pointer.
nStepError[IN] specifies an error code.

◆ AMTResetAEDCounter()

void AMTResetAEDCounter ( AManagedTask this)
inline

This function is a convenient method to call the call the system function SysResetAEDCounter() from a task code.

Parameters
this[IN] specifies a task object pointer.
+ Here is the call graph for this function: