/*
 * @file hv_vos_Task.h
 * @brief Header file of task.
 *
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 * (+) Use ()
 *
 * @endverbatim
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2023-03-01
 */


#ifndef _HV_VOS_TASK_H
#define _HV_VOS_TASK_H

VOS_EXTERN_C_BEGIN

/** @defgroup VOS_TASK VOS_TASK
 *  VOS task functions
 *  @{
 */


/** @brief task forward declaration */
typedef struct _HV_VOS_TASK_S HV_VOS_TASK_S;

/** task entry function type */
typedef void (*HV_VOS_TASK_ENTRY_FN)(void *arg);


typedef struct _HV_VOS_TASK_INIT_PARAMS{
    HV_VOS_TASK_ENTRY_FN entry;
    const CHAR8* name; 
    void *arg;
    UINT32 stackSize;
    UINT32 priority;  
} Hv_Vos_TASK_INIT_PARAMS;


/** @brief Create task
 *  @param param pointer to task init parameters structure
 *  @return task pointer, return NULL if create fail
*/
HV_VOS_TASK_S *Hv_Vos_TaskInit(Hv_Vos_TASK_INIT_PARAMS *param);


/** @brief Destroy task
 *
 * @param self task pointer, NULL for current task
 * @return result
*/
void Hv_Vos_TaskCleanup(HV_VOS_TASK_S *self);


/** @brief Start OS scheduler
*/
void Hv_Vos_TaskStart();


/** @brief yield current task
*/
void Hv_Vos_TaskYield();

/** get current task id */
UINT32 Hv_Vos_TASK_CurrentTaskId();


UINT32 Hv_Vos_TASK_NotifyWait(UINT32* puiValue);

/** @} */ //end of group VOS_TASK

BOOL Hv_Vos_TaskNotifyFromISR(HV_VOS_TASK_S *self);


VOID Hv_Vos_TaskEnterCritical();

VOID Hv_Vos_TaskExitCritical();

VOS_EXTERN_C_END


#endif



