ODeV framework  v2
Data Structures | Typedefs | Functions
AManagedTaskVtbl.h File Reference

TODO - insert here the file description. More...

#include "systypes.h"
#include "syserror.h"
#include "systp.h"
#include "FreeRTOS.h"
#include "task.h"
+ Include dependency graph for AManagedTaskVtbl.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _AMTStatus
 
struct  _AManagedTask
 

Typedefs

typedef struct _AManagedTask_vtbl AManagedTask_vtbl
 
typedef struct _AMTStatus AMTStatus
 

Functions

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

Detailed Description

TODO - insert here the file description.

Author
STMicroelectronics - ST-Korea - MCD Team
Version
1.2.0
Date
Jan 13, 2017
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.

Typedef Documentation

◆ AManagedTask_vtbl

typedef struct _AManagedTask_vtbl AManagedTask_vtbl

Create type name for _IManagedTask_vtb.

◆ AMTStatus

typedef struct _AMTStatus AMTStatus

Managed Task status field. This data is used to coordinate the power mode switch between the INIT task and the application managed tasks.

Function Documentation

◆ AMTDoEnterPowerMode()

SYS_DEFINE_INLINE 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()

SYS_DEFINE_INLINE EPowerMode AMTGetSystemPowerMode ( )
inline

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

Returns
the current power mode of the system

◆ AMTHandleError()

SYS_DEFINE_INLINE 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_DEFINE_INLINE 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_DEFINE_INLINE 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()

SYS_DEFINE_INLINE 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_DEFINE_INLINE 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_DEFINE_INLINE 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()

SYS_DEFINE_INLINE 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()

SYS_DEFINE_INLINE 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: