15#define OS_TIMER_INIT_MAGIC 0x3892
25#define OS_TIMER_CONTROL_TASK_EVT_MASK (CONTROL_TASK_MSG_EVT_SYSTEM_TIMER_DISARM | \
26 CONTROL_TASK_MSG_EVT_SYSTEM_TIMER_ARM | \
27 CONTROL_TASK_MSG_EVT_SYSTEM_TIMER_REARM | \
28 CONTROL_TASK_MSG_EVT_SYSTEM_TIMER_PERIOD | \
29 CONTROL_TASK_MSG_EVT_SYSTEM_TIMER_FIRE)
45#if CONFIG_ENABLE_UNIT_TEST
90 uint32_t ut_period = 0;
91 bool ut_reload =
false;
106 ut_reload =
UT_GET_ARG(1, uint32_t, argv) == 0 ? false :
true;
206 msg_params->
cb(msg_params);
229#if CONFIG_ENABLE_UNIT_TEST
270 if (timer_handle == NULL)
281 if (*timer_handle == NULL)
284 (*timer_handle)->cb = cb;
285 (*timer_handle)->period = period;
316 if (timer_handle == NULL)
341 if (timer_handle == NULL)
367 if (timer_handle == NULL)
374 timer_handle->
period = period_ms;
394 if (timer_handle == NULL)
422 if (timer_handle == NULL)
436 (*timer_handle)->init = 0;
struct dev_struct dev_struct_t
Structure representing the device composition and elements.
CONTROL_TASK_MSG_EVT_SYSTEM_TIMER_FIRE
CONTROL_TASK_MSG_EVT_SYSTEM_TIMER_PERIOD
uint32_t control_task_msg_evt_t
Type definition for control task message event.
meshx_err_t(* control_task_msg_handle_t)(dev_struct_t *pdev, control_task_msg_evt_t evt, void *params)
Function pointer type for control task message handler.
@ CONTROL_TASK_MSG_CODE_SYSTEM
CONTROL_TASK_MSG_EVT_SYSTEM_TIMER_DISARM
CONTROL_TASK_MSG_EVT_SYSTEM_TIMER_ARM
meshx_err_t control_task_msg_publish(control_task_msg_code_t msg_code, control_task_msg_evt_t msg_evt, const void *msg_evt_params, size_t sizeof_msg_evt_params)
Publish a control task message.
CONTROL_TASK_MSG_EVT_SYSTEM_TIMER_REARM
meshx_err_t control_task_msg_subscribe(control_task_msg_code_t msg_code, control_task_msg_evt_t evt_bmap, control_task_msg_handle_t callback)
Subscribe to a control task message.
meshx_err_t
MeshX Error Codes.
#define MESHX_LOGI(module_id, format,...)
#define MESHX_LOGE(module_id, format,...)
#define MESHX_LOGD(module_id, format,...)
meshx_err_t meshx_os_timer_start(const meshx_os_timer_t *timer_handle)
Start a timer.
static meshx_err_t meshx_os_timer_control_task_cb(const dev_struct_t *pdev, control_task_msg_evt_t evt, void *params)
static meshx_err_t meshx_os_timer_unit_test_cb_handler(int cmd_id, int argc, char **argv)
Callback handler for OS Timer unit test command.
#define OS_TIMER_INIT_MAGIC
meshx_err_t meshx_os_timer_init(void)
Initialize the OS timer module.
meshx_err_t meshx_os_timer_create(const char *name, uint32_t period, bool reload, meshx_os_timer_cb_t cb, meshx_os_timer_t **timer_handle)
Create a timer.
meshx_err_t meshx_os_timer_restart(const meshx_os_timer_t *timer_handle)
Restart a timer.
meshx_err_t meshx_os_timer_set_period(meshx_os_timer_t *timer_handle, const uint32_t period_ms)
Set period on an initialised timer.
#define OS_TIMER_CONTROL_TASK_EVT_MASK
Mask for OS timer control task events.
void meshx_os_timer_fire_cb(const void *timer_handle)
static void meshx_os_timer_ut_cb_handler(const meshx_os_timer_t *p_timer)
OS Timer Unit Test Callback handler.
meshx_err_t meshx_os_timer_stop(const meshx_os_timer_t *timer_handle)
Stop a timer.
static struct meshx_os_timer_reg_head meshx_os_timer_reg_table_head
Head of the OS timer registration table.
meshx_err_t meshx_os_timer_delete(meshx_os_timer_t **timer_handle)
Delete a timer.
meshx_os_timer_cli_cmd_t
OS Timer CLI command enumeration.
@ OS_TIMER_CLI_CMD_CREATE
@ OS_TIMER_CLI_CMD_PERIOD_SET
@ OS_TIMER_CLI_CMD_DISARM
@ OS_TIMER_CLI_CMD_DELETE
SLIST_HEAD(meshx_os_timer_reg_head, meshx_os_timer)
Header file for OS timer utilities.
struct meshx_os_timer meshx_os_timer_t
Alias for the meshx_os_timer structure.
void(* meshx_os_timer_cb_t)(const meshx_os_timer_t *p_timer)
Timer callback function prototype.
#define OS_TIMER_SIZE
return meshx_os_timer_t size
#define OS_TMER_GET_TIMER_NAME(timer)
return timer registered name pointer
meshx_err_t meshx_rtos_timer_stop(meshx_rtos_timer_t *timer)
Stops the RTOS timer.
meshx_err_t meshx_rtos_timer_start(meshx_rtos_timer_t *timer)
Starts the RTOS timer.
meshx_err_t meshx_rtos_timer_delete(meshx_rtos_timer_t *timer)
Deletes the RTOS timer.
void(* meshx_rtos_timer_callback_t)(void *)
void meshx_os_timer_fire_cb(const void *timer_handle)
meshx_err_t meshx_rtos_timer_change_period(meshx_rtos_timer_t *timer, uint32_t new_period_ms)
Changes the period of the RTOS timer.
meshx_err_t meshx_rtos_timer_reset(meshx_rtos_timer_t *timer)
Resets the RTOS timer.
meshx_err_t meshx_rtos_timer_create(meshx_rtos_timer_t *timer, const char *name, meshx_rtos_timer_callback_t cb, void *arg, uint32_t period_ms, bool reload)
Creates a new RTOS timer.
@ MODULE_ID_COMPONENT_OS_TIMER
Head of the singly linked list for OS timer control task message parameters.
Structure to hold parameters for the OS timer control task message.
meshx_os_timer_handle_t timer_handle
meshx_err_t register_unit_test(module_id_t module_id, module_callback_t callback)
Register a unit test for a specific module.
#define UT_GET_ARG(_x, _type, _argv)
Macro to extract an argument from the argument list.