Wirepas SDK
system.h
Go to the documentation of this file.
1 /* Copyright 2017 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
25 #ifndef APP_LIB_SYSTEM_H_
26 #define APP_LIB_SYSTEM_H_
27 
28 #include <stdlib.h>
29 #include <stdint.h>
30 #include <stdbool.h>
31 
32 #include "app/app.h"
33 
35 #define APP_LIB_SYSTEM_NAME 0x77db1bd5
36 
37 
38 #define APP_LIB_SYSTEM_VERSION 0x201
39 
46 #define APP_LIB_SYSTEM_STOP_PERIODIC UINT32_MAX
47 
54 #define APP_LIB_SYSTEM_IRQ_PRIO_HI 0
55 #define APP_LIB_SYSTEM_IRQ_PRIO_LO 1
56 
64 typedef enum
65 {
87 
96 typedef enum
97 {
123 
130 typedef struct
131 {
133  uint32_t hardware_magic;
137 
152 typedef void (*app_lib_system_startup_cb_f)(void);
153 
167 typedef void (*app_lib_system_shutdown_cb_f)(void);
168 
192 typedef uint32_t (*app_lib_system_periodic_cb_f)(void);
193 
202 typedef void (*app_lib_system_irq_handler_f)(void);
203 
213 typedef app_res_e
215 
222 typedef app_res_e
225 
265 typedef app_res_e
267  uint32_t initial_delay_us,
268  uint32_t execution_time_us);
269 
284 
295 
319 
326 typedef app_res_e
329 
340 typedef app_res_e
342 
356 typedef app_res_e
358 
376 typedef app_res_e
377  (*app_lib_system_enable_fast_app_irq_f)(uint8_t irq_n, uint8_t priority);
378 
452 typedef app_res_e
454  (bool fast,
455  uint8_t irq_n,
456  uint8_t priority,
458 
473 typedef app_res_e
475 
484 typedef uint32_t
486 
500 typedef app_res_e
502  size_t info_num_bytes);
503 
507 typedef struct
508 {
521 
522 #endif /* APP_LIB_SYSTEM_H_ */
app_lib_system_startup_cb_f
void(* app_lib_system_startup_cb_f)(void)
Startup callback.
Definition: system.h:152
APP_LIB_SYSTEM_PROTOCOL_PROFILE_SUB_BRAZIL_915_MHZ
@ APP_LIB_SYSTEM_PROTOCOL_PROFILE_SUB_BRAZIL_915_MHZ
Definition: system.h:119
APP_LIB_SYSTEM_PROTOCOL_PROFILE_SUB_868_MHZ
@ APP_LIB_SYSTEM_PROTOCOL_PROFILE_SUB_868_MHZ
Definition: system.h:103
APP_LIB_SYSTEM_PROTOCOL_PROFILE_SUB_INDIA_865_MHZ
@ APP_LIB_SYSTEM_PROTOCOL_PROFILE_SUB_INDIA_865_MHZ
Definition: system.h:115
app_lib_system_radio_info_t::protocol_profile
uint32_t protocol_profile
Definition: system.h:135
APP_LIB_SYSTEM_PROTOCOL_PROFILE_SUB_915_MHZ
@ APP_LIB_SYSTEM_PROTOCOL_PROFILE_SUB_915_MHZ
Definition: system.h:105
app_lib_system_radio_info_t
Radio information structure.
Definition: system.h:130
app_lib_system_enable_app_irq_f
app_res_e(* app_lib_system_enable_app_irq_f)(uint8_t irq_n)
Enable an app interrupt.
Definition: system.h:341
app_lib_system_exit_critical_section_f
void(* app_lib_system_exit_critical_section_f)(void)
Exit a critical section.
Definition: system.h:294
app_lib_system_disable_app_irq_f
app_res_e(* app_lib_system_disable_app_irq_f)(uint8_t irq_n)
Disable an app interrupt.
Definition: system.h:357
app_lib_system_t::clearPendingFastAppIrq
app_lib_system_clear_pending_fast_app_irq_f clearPendingFastAppIrq
Definition: system.h:517
app_lib_system_t::exitCriticalSection
app_lib_system_exit_critical_section_f exitCriticalSection
Definition: system.h:513
app_lib_system_t::enterCriticalSection
app_lib_system_enter_critical_section_f enterCriticalSection
Definition: system.h:512
app_lib_system_get_radio_info_f
app_res_e(* app_lib_system_get_radio_info_f)(app_lib_system_radio_info_t *info_p, size_t info_num_bytes)
Return radio hardware and platform information.
Definition: system.h:501
APP_LIB_SYSTEM_PROTOCOL_PROFILE_UNKNOWN
@ APP_LIB_SYSTEM_PROTOCOL_PROFILE_UNKNOWN
Definition: system.h:99
app_lib_system_radio_info_t::hardware_magic
uint32_t hardware_magic
Definition: system.h:133
APP_LIB_SYSTEM_HARDWARE_MAGIC_EFR32XG12
@ APP_LIB_SYSTEM_HARDWARE_MAGIC_EFR32XG12
Definition: system.h:77
app_lib_system_t::enableAppIrq
app_lib_system_enable_app_irq_with_handler_f enableAppIrq
Definition: system.h:515
app_lib_system_periodic_cb_f
uint32_t(* app_lib_system_periodic_cb_f)(void)
Periodic callback.
Definition: system.h:192
app_lib_system_t::setPeriodicCb
app_lib_system_set_periodic_cb_f setPeriodicCb
Definition: system.h:511
APP_LIB_SYSTEM_PROTOCOL_PROFILE_RESERVED_6
@ APP_LIB_SYSTEM_PROTOCOL_PROFILE_RESERVED_6
Definition: system.h:111
app_lib_system_t::disableAppIrq
app_lib_system_disable_app_irq_f disableAppIrq
Definition: system.h:516
APP_LIB_SYSTEM_HARDWARE_MAGIC_EFR32XG12_512
@ APP_LIB_SYSTEM_HARDWARE_MAGIC_EFR32XG12_512
Definition: system.h:81
APP_LIB_SYSTEM_HARDWARE_RESERVED_1
@ APP_LIB_SYSTEM_HARDWARE_RESERVED_1
Definition: system.h:69
app_lib_system_t::setShutdownCb
app_lib_system_set_shutdown_cb_f setShutdownCb
Definition: system.h:510
app_lib_system_enable_app_irq_with_handler_f
app_res_e(* app_lib_system_enable_app_irq_with_handler_f)(bool fast, uint8_t irq_n, uint8_t priority, app_lib_system_irq_handler_f handler)
Enable a platform-specific interrupt with given handler and priority.
Definition: system.h:454
app_lib_system_enter_critical_section_f
void(* app_lib_system_enter_critical_section_f)(void)
Enter a critical section.
Definition: system.h:283
app.h
APP_LIB_SYSTEM_PROTOCOL_PROFILE_RESERVED_9
@ APP_LIB_SYSTEM_PROTOCOL_PROFILE_RESERVED_9
Definition: system.h:117
APP_LIB_SYSTEM_HARDWARE_MAGIC_NRF52840
@ APP_LIB_SYSTEM_HARDWARE_MAGIC_NRF52840
Definition: system.h:79
app_lib_system_t::getRadioInfo
app_lib_system_get_radio_info_f getRadioInfo
Definition: system.h:519
app_lib_system_t::setStartupCb
app_lib_system_set_startup_cb_f setStartupCb
Definition: system.h:509
APP_LIB_SYSTEM_HARDWARE_RESERVED_4
@ APP_LIB_SYSTEM_HARDWARE_RESERVED_4
Definition: system.h:75
app_lib_system_set_startup_cb_f
app_res_e(* app_lib_system_set_startup_cb_f)(app_lib_system_startup_cb_f startup_cb)
Set a callback to be called when the system starts up.
Definition: system.h:214
app_lib_system_get_bootloader_version_f
uint32_t(* app_lib_system_get_bootloader_version_f)(void)
Get bootloader version.
Definition: system.h:485
APP_LIB_SYSTEM_HARDWARE_RESERVED_2
@ APP_LIB_SYSTEM_HARDWARE_RESERVED_2
Definition: system.h:71
app_lib_system_register_app_irq_table_f
app_res_e(* app_lib_system_register_app_irq_table_f)(app_lib_system_irq_handler_f *table_p)
Register an interrupt handler table for the app.
Definition: system.h:328
app_lib_system_irq_handler_f
void(* app_lib_system_irq_handler_f)(void)
Interrupt handler callback.
Definition: system.h:202
app_lib_system_t::getBootloaderVersion
app_lib_system_get_bootloader_version_f getBootloaderVersion
Definition: system.h:518
app_lib_system_t
List of library functions.
Definition: system.h:507
APP_LIB_SYSTEM_HARDWARE_MAGIC_NRF52832
@ APP_LIB_SYSTEM_HARDWARE_MAGIC_NRF52832
Definition: system.h:73
APP_LIB_SYSTEM_PROTOCOL_PROFILE_RESERVED_4
@ APP_LIB_SYSTEM_PROTOCOL_PROFILE_RESERVED_4
Definition: system.h:107
APP_LIB_SYSTEM_HARDWARE_MAGIC_UNKNOWN
@ APP_LIB_SYSTEM_HARDWARE_MAGIC_UNKNOWN
Definition: system.h:67
app_lib_system_set_periodic_cb_f
app_res_e(* app_lib_system_set_periodic_cb_f)(app_lib_system_periodic_cb_f work_cb, uint32_t initial_delay_us, uint32_t execution_time_us)
Set the periodic callback.
Definition: system.h:266
APP_LIB_SYSTEM_PROTOCOL_PROFILE_RESERVED_7
@ APP_LIB_SYSTEM_PROTOCOL_PROFILE_RESERVED_7
Definition: system.h:113
APP_LIB_SYSTEM_PROTOCOL_PROFILE_SUB_AUS_915_MHZ
@ APP_LIB_SYSTEM_PROTOCOL_PROFILE_SUB_AUS_915_MHZ
Definition: system.h:121
app_lib_system_disable_deep_sleep
app_res_e(* app_lib_system_disable_deep_sleep)(bool disable)
Disable/Enable deep sleep on stack.
Definition: system.h:318
APP_LIB_SYSTEM_PROTOCOL_PROFILE_ISM_24GHZ
@ APP_LIB_SYSTEM_PROTOCOL_PROFILE_ISM_24GHZ
Definition: system.h:101
app_lib_system_shutdown_cb_f
void(* app_lib_system_shutdown_cb_f)(void)
Shutdown callback.
Definition: system.h:167
app_lib_system_protocol_profile_e
app_lib_system_protocol_profile_e
Protocol profiles.
Definition: system.h:96
app_lib_system_t::disableDeepSleep
app_lib_system_disable_deep_sleep disableDeepSleep
Definition: system.h:514
app_lib_system_hardware_magic_e
app_lib_system_hardware_magic_e
Radio hardware magic number.
Definition: system.h:64
app_lib_system_enable_fast_app_irq_f
app_res_e(* app_lib_system_enable_fast_app_irq_f)(uint8_t irq_n, uint8_t priority)
Enable a fast app interrupt.
Definition: system.h:377
APP_LIB_SYSTEM_HARDWARE_MAGIC_EFR32XG13
@ APP_LIB_SYSTEM_HARDWARE_MAGIC_EFR32XG13
Definition: system.h:83
app_lib_system_set_shutdown_cb_f
app_res_e(* app_lib_system_set_shutdown_cb_f)(app_lib_system_shutdown_cb_f shutdown_cb)
Set a callback to be called just before the system shuts down.
Definition: system.h:224
APP_LIB_SYSTEM_PROTOCOL_PROFILE_SUB_KOREA_917_MHZ
@ APP_LIB_SYSTEM_PROTOCOL_PROFILE_SUB_KOREA_917_MHZ
Definition: system.h:109
app_res_e
app_res_e
Definition: app.h:201
app_lib_system_clear_pending_fast_app_irq_f
app_res_e(* app_lib_system_clear_pending_fast_app_irq_f)(uint8_t irq_n)
Clear fast interrupt flag from NVIC.
Definition: system.h:474
APP_LIB_SYSTEM_HARDWARE_MAGIC_NRF52833
@ APP_LIB_SYSTEM_HARDWARE_MAGIC_NRF52833
Definition: system.h:85