NTURT Zephyr v0.0.1
NTURT common library for Zephyr RTOS
Loading...
Searching...
No Matches
System

Basic system support. More...

+ Collaboration diagram for System:

Topics

 Utility
 Utility macros and functions.
 

Data Structures

struct  sys_shutdown_callback
 Shutdown callback. More...
 

Macros

#define SYS_SHUTDOWN_CALLBACK_DEFINE_NAMED(_name, _handler, _user_data, _priority)
 Same as SYS_SHUTDOWN_CALLBACK_DEFINE, but with a custom name for the callback.
 
#define SYS_SHUTDOWN_CALLBACK_DEFINE(handler, user_data, priority)
 Define a shutdown callback.
 

Typedefs

typedef void(* sys_shutdown_handler_t) (void *user_data)
 Shutdown handler type.
 

Functions

int sys_work_submit (struct k_work *work)
 Submit a work item to the system work queue.
 
int sys_work_schedule (struct k_work_delayable *dwork, k_timeout_t delay)
 Submit an idle work item to the system work queue after a delay.
 
int sys_work_reschedule (struct k_work_delayable *dwork, k_timeout_t delay)
 Reschedule a work item to the system work queue after a delay.
 
void sys_shutdown ()
 Shutdown the system.
 
void sys_reset ()
 Reset the system.
 
int sys_set_time (time_t time)
 Set system time.
 

Detailed Description

Basic system support.

Macro Definition Documentation

◆ SYS_SHUTDOWN_CALLBACK_DEFINE

#define SYS_SHUTDOWN_CALLBACK_DEFINE ( handler,
user_data,
priority )

#include <nturt/sys/sys.h>

Value:
SYS_SHUTDOWN_CALLBACK_DEFINE_NAMED(handler, handler, user_data, priority)
#define SYS_SHUTDOWN_CALLBACK_DEFINE_NAMED(_name, _handler, _user_data, _priority)
Same as SYS_SHUTDOWN_CALLBACK_DEFINE, but with a custom name for the callback.
Definition sys.h:32

Define a shutdown callback.

Parameters
[in]handlerHandler for shutting down.
[in]user_dataPointer to custom data for the callback.
[in]_priorityPriority of the callback.
Note
Since the name of the callback is derived from the name of handler , if the same handler is used for multiple callbacks, SYS_SHUTDOWN_CALLBACK_DEFINE_NAMED can be used instead to prevent linker errors.

◆ SYS_SHUTDOWN_CALLBACK_DEFINE_NAMED

#define SYS_SHUTDOWN_CALLBACK_DEFINE_NAMED ( _name,
_handler,
_user_data,
_priority )

#include <nturt/sys/sys.h>

Value:
static const STRUCT_SECTION_ITERABLE( \
CONCAT(__sys_shutdown_handler_, _priority, _name)) = { \
.handler = _handler, \
.user_data = _user_data, \
}
Shutdown callback.
Definition sys.h:66

Same as SYS_SHUTDOWN_CALLBACK_DEFINE, but with a custom name for the callback.

Typedef Documentation

◆ sys_shutdown_handler_t

typedef void(* sys_shutdown_handler_t) (void *user_data)

#include <nturt/sys/sys.h>

Shutdown handler type.

Parameters
[in,out]user_dataPointer to custom user data for the callback provided by SYS_SHUTDOWN_CALLBACK_DEFINE.

Function Documentation

◆ sys_reset()

void sys_reset ( )

#include <nturt/sys/sys.h>

Reset the system.

◆ sys_set_time()

int sys_set_time ( time_t time)

#include <nturt/sys/sys.h>

Set system time.

Parameters
[in]timeTime to set.
Return values
0For success.
othersNegative error number.

◆ sys_shutdown()

void sys_shutdown ( )

#include <nturt/sys/sys.h>

Shutdown the system.

◆ sys_work_reschedule()

int sys_work_reschedule ( struct k_work_delayable * dwork,
k_timeout_t delay )

#include <nturt/sys/sys.h>

Reschedule a work item to the system work queue after a delay.

Different from the system work queue provided by Zephyr running in high priority designed for bottom halves of interrupts, this work queue runs in lower priority for less critical application level works.

Parameters
dworkPointer to the delayable work item.
delayThe time to wait before submitting the work item.
Returns
int Same as Zephyr k_work_reschedule_for_queue.

◆ sys_work_schedule()

int sys_work_schedule ( struct k_work_delayable * dwork,
k_timeout_t delay )

#include <nturt/sys/sys.h>

Submit an idle work item to the system work queue after a delay.

Different from the system work queue provided by Zephyr running in high priority designed for bottom halves of interrupts, this work queue runs in lower priority for less critical application level works.

Parameters
dworkPointer to the delayable work item.
delayThe time to wait before submitting the work item. If K_NO_WAIT this is equivalent to sys_work_submit.
Returns
int Same as Zephyr k_work_schedule_for_queue.

◆ sys_work_submit()

int sys_work_submit ( struct k_work * work)

#include <nturt/sys/sys.h>

Submit a work item to the system work queue.

Different from the system work queue provided by Zephyr running in high priority designed for bottom halves of interrupts, this work queue runs in lower priority for less critical application level works.

Parameters
workPointer to the queue item.
Returns
int Same as Zephyr k_work_submit_to_queue.