94 lines
2.4 KiB
C
Executable File
94 lines
2.4 KiB
C
Executable File
/**
|
|
* @file include/di_fw/config.h
|
|
* @brief Configuration header file
|
|
* @date September 2, 2016
|
|
* @author A.A.W.M. Ruijs
|
|
* @copyright 2016 Dual Inventive Technology Centre B.V.
|
|
*/
|
|
#ifndef INCLUDE_DI_FW_DEVICE_H_
|
|
#define INCLUDE_DI_FW_DEVICE_H_
|
|
|
|
#include <di/config.h>
|
|
|
|
/**
|
|
* the item uids are split over libdi_fw and the application
|
|
* the first 3 config items are managed by libdi_fw, the application
|
|
* takes care of the config items from entry DI_FW_CONFIG_ITEM_APPLICATION_START
|
|
*
|
|
* in case the application wants to add his own config item(s), it should provide
|
|
* the config item uid, starting with DI_FW_CONFIG_ITEM_APPLICATION_START:
|
|
*/
|
|
enum di_fw_config_item_uids {
|
|
DI_FW_CONFIG_ITEM_DEVICE_TOKEN_UID = 1,
|
|
DI_FW_CONFIG_ITEM_DEVICE_ACTIVATION_UID = 2,
|
|
DI_FW_CONFIG_ITEM_DEVICE_SERVICE_UID = 3,
|
|
DI_FW_CONFIG_ITEM_DEVICE_UID_UID = 4,
|
|
|
|
DI_FW_CONFIG_ITEM_APPLICATION_START = 5
|
|
};
|
|
|
|
/**
|
|
* point to a specific EEPROM device for read or write operations
|
|
* used as index in an array, don't change!
|
|
*/
|
|
enum di_fw_config_devices {
|
|
DI_FW_CONFIG_PRIMARY_DEVICE = 0,
|
|
DI_FW_CONFIG_SECUNDARY_DEVICE = 1
|
|
};
|
|
|
|
#define DI_FW_CONFIG_ITEM_DEVICE_TOKEN { \
|
|
DI_FW_CONFIG_ITEM_DEVICE_TOKEN_UID, \
|
|
sizeof(uint32_t), \
|
|
DI_DEVICE_CONFIG_DEFAULT_TOKEN }
|
|
|
|
#define DI_FW_CONFIG_ITEM_DEVICE_ACTIVATION { \
|
|
DI_FW_CONFIG_ITEM_DEVICE_ACTIVATION_UID, \
|
|
sizeof(bool), \
|
|
DI_DEVICE_CONFIG_DEFAULT_ACTIVATION }
|
|
|
|
#define DI_FW_CONFIG_ITEM_DEVICE_SERVICE { \
|
|
DI_FW_CONFIG_ITEM_DEVICE_SERVICE_UID, \
|
|
sizeof(bool), \
|
|
DI_DEVICE_CONFIG_DEFAULT_SERVICE }
|
|
|
|
#define DI_FW_CONFIG_ITEM_DEVICE_UID { \
|
|
DI_FW_CONFIG_ITEM_DEVICE_UID_UID, \
|
|
DI_DEVICE_UID_LEN, \
|
|
DI_DEVICE_CONFIG_DEFAULT_UID }
|
|
|
|
/**
|
|
* struct to store EEPROM device info (addresses and availability)
|
|
* needed in a redundant setup
|
|
*/
|
|
struct di_fw_config_device_info {
|
|
uint16_t address;
|
|
bool available;
|
|
};
|
|
|
|
/**
|
|
* Initially set/get the token in/from the EEPROM
|
|
*/
|
|
di_errno_t di_fw_config_init_device_token(void);
|
|
|
|
/**
|
|
* Initially set/get the activation in/from the EEPROM
|
|
*/
|
|
di_errno_t di_fw_config_init_device_activation(void);
|
|
|
|
/**
|
|
* Initially set/get the service in/from the EEPROM
|
|
*/
|
|
di_errno_t di_fw_config_init_device_service(void);
|
|
|
|
/**
|
|
* setting all config parameters to the right value.
|
|
*/
|
|
di_errno_t di_fw_config_init(const struct di_config_item *item_list, const size_t size);
|
|
|
|
/**
|
|
* Function to get config of device
|
|
*/
|
|
struct di_config_ctx *di_fw_config_get_ctx(void);
|
|
|
|
#endif
|