Miscellaneous

Miscellaneous system functions. More...

Modules

Types
Data types.

Functions

gos_result_t gos_system_reboot (void)
Reboot the device. More...
char * gos_system_get_version_str (char *version_str_buffer)
Return the current firmware version as a string. More...
gos_result_t gos_system_get_version_details ( gos_version_details_t *details, char *version_str_buffer)
Return details about the current firmware version. More...
char * gos_system_get_uuid_str (char *uuid_str_buffer)
Return the device's UUID as a string. More...
void gos_system_set_irq_callback (gos_platform_irq_t irq, gos_handler_noarg_t callback)
Register an interrupt callback. More...
void gos_system_set_system_tick_callback ( gos_handler_noarg_t callback)
Register a system tick callback. More...
void gos_system_reset_faults (void)
Clear all system faults. More...
gos_result_t gos_system_retrieve_faults (char *buffer)
Populate the given buffer with the current system faults string. More...
uint32_t gos_system_get_faults_count (void)
Return the number of system faults. More...
void gos_system_reset_safemode_app_counters (uint32_t mask)
Clear a safemode app counter. More...
uint32_t gos_system_get_safemode_app_counters (void)
Get the current safemode app counters. More...
void gos_system_kick_watchdog (void)
Kick the watchdog timer.
gos_result_t gos_system_set_factory_reset_gpio ( gos_gpio_t gpio, bool level)
Configure the factory reset GPIO. More...
gos_result_t gos_system_get_factory_reset_gpio ( gos_gpio_t *gpio_ptr, bool *level_ptr)
Get the current factory reset GPIO configuration. More...
gos_startup_type_t gos_system_get_startup_type (void)
Get the system startup type. More...
gos_reset_cause_t gos_system_get_reset_cause (void)
Get system reset cause. More...

Detailed Description

Miscellaneous system functions.

Function Documentation

gos_system_get_factory_reset_gpio()

gos_result_t gos_system_get_factory_reset_gpio ( gos_gpio_t * gpio_ptr,
bool * level_ptr
)

Get the current factory reset GPIO configuration.

This returns the current factory reset GPIO configuration.

Parameters
[out] gpio_ptr Pointer to hold the GPIO value, if this value is GOS_GPIO_INVALID then the factory reset GPIO is disabled
[out] level_ptr Pointer to hold GPIO active level, true = active HIGH, false = active LOW
Examples:
system/factory_reset_gpio/main.c .

gos_system_get_faults_count()

uint32_t gos_system_get_faults_count ( void )

Return the number of system faults.

See Gecko OS Command API documentation: faults_reset

gos_system_get_reset_cause()

gos_reset_cause_t gos_system_get_reset_cause ( void )

Get system reset cause.

This returns the cause of the last system reset, see gos_reset_cause_t for more details.

Returns
gos_reset_cause_t The cause of the last reset

gos_system_get_safemode_app_counters()

uint32_t gos_system_get_safemode_app_counters ( void )

Get the current safemode app counters.

See the Safemode app documentation for more details: Safemode App

gos_system_get_startup_type()

gos_startup_type_t gos_system_get_startup_type ( void )

Get the system startup type.

This returns how the system is starting up, see gos_startup_type_t for more details.

Returns
gos_startup_type_t The type of system startup

gos_system_get_uuid_str()

char* gos_system_get_uuid_str ( char * uuid_str_buffer )

Return the device's UUID as a string.

This returns the device's UUID as a string.

The supplied uuid_str_buffer should be a buffer of at least 41 bytes.

Parameters
[out] uuid_str_buffer Buffer to hold UUID string
Returns
Device's UUID string (this is the same pointer as the supplied uuid_str_buffer argument)
Examples:
dms/telemetry/main.c , and hurricane/security_camera/camera.c .

gos_system_get_version_details()

gos_result_t gos_system_get_version_details ( gos_version_details_t * details,
char * version_str_buffer
)

Return details about the current firmware version.

This populates gos_version_details_t based on the current version string. See Gecko OS Command API documentation: version .

Note
If version_str_buffer is NULL then only the kernel.version and bundle.version fields are populated.
Parameters
[out] details Populated details about the current firmware version
[in] version_str_buffer String buffer to hold parsed version string, must be at least 96 bytes

gos_system_get_version_str()

char* gos_system_get_version_str ( char * version_str_buffer )

Return the current firmware version as a string.

This returns the current firmware version as a string. See Gecko OS Command API documentation: version .

The supplied version_str_buffer should be a buffer of at least 96 bytes.

Parameters
[out] version_str_buffer Buffer to hold version string
Returns
Current firmware version string (this is the same pointer as the supplied version_str_buffer argument)
Examples:
dms/messages/main.c , network/http_server_stream/main.c , and system/core_dump/main.c .

gos_system_reboot()

gos_system_reset_faults()

void gos_system_reset_faults ( void )

Clear all system faults.

See Gecko OS Command API documentation: faults_reset

gos_system_reset_safemode_app_counters()

void gos_system_reset_safemode_app_counters ( uint32_t mask )

Clear a safemode app counter.

See the Safemode app documentation for more details: Safemode App

Note
Extreme caution should be used with this API!

To clear all counters, use the mask: GOS_SAFEMODE_COUNTER_ALL,e.g.

gos_system_reset_safemode_app_counters (GOS_SAFEMODE_COUNTER_ALL);

gos_system_retrieve_faults()

gos_result_t gos_system_retrieve_faults ( char * buffer )

Populate the given buffer with the current system faults string.

Parameters
buffer Buffer to hold faults string, this buffer but be at least 512 bytes
Returns
The result of the API, see gos_result_t

gos_system_set_factory_reset_gpio()

gos_result_t gos_system_set_factory_reset_gpio ( gos_gpio_t gpio,
bool level
)

Configure the factory reset GPIO.

This configures the factory reset GPIO.

Note
To disable the factory reset GPIO completely, set the gpio argument as GOS_GPIO_INVALID
Parameters
[in] gpio The GPIO to use as the factory reset GPIO, set as GOS_GPIO_INVALID to completely disable the factory reset GPIO feature
[in] level GPIO 'active' level, true = active HIGH, false = active LOW
Returns
The result of the API, see gos_result_t
Examples:
system/factory_reset_gpio/main.c .

gos_system_set_irq_callback()

void gos_system_set_irq_callback ( gos_platform_irq_t irq,
gos_handler_noarg_t callback
)

Register an interrupt callback.

This registers an interrupt handler for the specificied interrupt vector.

The corresponding interrupt must be enabled using the appropriate MCU registers before the callback is triggered.

Note
Extreme care should be taken when registering an irq callback. The stability of the OS cannot be guaranteed with this is used.

gos_system_set_system_tick_callback()

void gos_system_set_system_tick_callback ( gos_handler_noarg_t callback )

Register a system tick callback.

Register a callback to be called every system tick = 1 millisecond.

Note
The callback MUST be extremely simple as the system tick is used by the RTOS scheduler.