void ll_storage_service_init(void *queue, flash_partition_t * storage_partitions, uint8_t number_of_partitions) { cfw_register_service(queue, &ll_storage_service, handle_message, NULL); ll_storage_config.partitions = storage_partitions; ll_storage_config.no_part = number_of_partitions; }
static void ble_bt_rdy(int err) { _ble_cb.ble_state = BLE_ST_DISABLED; /* register BLE service */ if (cfw_register_service(_ble_cb.queue, &ble_service, ble_service_message_handler, &_ble_cb) == -1) { panic(0xb1eb1e); } }
/* * Init and Configure partitions seen by the Circular Storage Service. */ static void circular_storage_service_init(int id, void *queue) { uint16_t flash_id = 0; int16_t partition_index = -1; flash_device_t flash; uint32_t i = 0; uint32_t j = 0; uint16_t partition_id; uint32_t first_block = 0; uint32_t block_count = 0; uint32_t elt_size = 0; /* for each storage configuration */ for (i = 0; i < cir_storage_config.cir_storage_count; i++) { partition_id = cir_storage_config.cir_storage_list[i].partition_id; first_block = cir_storage_config.cir_storage_list[i].first_block; block_count = cir_storage_config.cir_storage_list[i].block_count; elt_size = cir_storage_config.cir_storage_list[i].element_size; /* Check storage configuration is valid */ for (j = 0; j < cir_storage_config.no_part; j++) { if (cir_storage_config.partitions[j].partition_id == partition_id) { flash_id = cir_storage_config.partitions[j]. flash_id; partition_index = j; break; } } assert(partition_index != -1); extern const flash_device_t flash_devices[]; flash = flash_devices[flash_id]; assert(flash.flash_location == SERIAL_FLASH); /* Initialise the configuration */ cir_storage_config.cir_storage_list[i].storage = (void *)cir_storage_flash_spi_init(elt_size, first_block, block_count); } cfw_register_service(queue, &circular_storage_service, handle_message, NULL); }
/* * @brief Register battery service * @remark Called by fuel gauge layer to advertise its end of initialization */ static void bs_fuel_gauge_init_done(void) { if (cfw_register_service(queue, &battery_service, bs_handle_message, NULL) == -1) pr_error(LOG_MODULE_BS, "Cannot register Battery service"); }