1 /*
2  * Copyright (c) 2022 Intellinium <giuliano.franchetto@intellinium.com>
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_SUBSYS_LORAWAN_NVM_H_
8 #define ZEPHYR_SUBSYS_LORAWAN_NVM_H_
9 
10 #include <stdint.h>
11 
12 /**
13  * @brief Hook function called when an interrupt related to NVM
14  * is received from the LoRaWAN stack.
15  *
16  * @note This function should not be called directly by the application
17  *
18  * @param flags OR'ed flags received with the interrupt
19  *
20  * @see LORAMAC_NVM_NOTIFY_FLAG_NONE
21  * @see LORAMAC_NVM_NOTIFY_FLAG_CRYPTO
22  * @see LORAMAC_NVM_NOTIFY_FLAG_MAC_GROUP1
23  * @see LORAMAC_NVM_NOTIFY_FLAG_MAC_GROUP2
24  * @see LORAMAC_NVM_NOTIFY_FLAG_SECURE_ELEMENT
25  * @see LORAMAC_NVM_NOTIFY_FLAG_REGION_GROUP1
26  * @see LORAMAC_NVM_NOTIFY_FLAG_REGION_GROUP2
27  * @see LORAMAC_NVM_NOTIFY_FLAG_CLASS_B
28  */
29 void lorawan_nvm_data_mgmt_event(uint16_t flags);
30 
31 /**
32  * @brief Restores all the relevant LoRaWAN data from the Non-Volatile Memory.
33  *
34  * @note This function should only be called if a NVM has been enabled, and
35  * not directly by the application.
36  *
37  * @return 0 on success, or a negative error code otherwise
38  */
39 int lorawan_nvm_data_restore(void);
40 
41 /**
42  * @brief Initializes the NVM backend
43  *
44  * @note This function shall be called before any other
45  * NVM back functions.
46  *
47  * @return 0 on success, or a negative error code otherwise
48  */
49 int lorawan_nvm_init(void);
50 
51 #endif /* ZEPHYR_SUBSYS_LORAWAN_NVM_H_ */
52