uint32_t pstorage_init(void) { cmd_queue_init(); m_next_app_instance = 0; m_round_val = 0; for(unsigned int index = 0; index < PSTORAGE_NUM_OF_PAGES; index++) { m_app_table[index].cb = NULL; } return NRF_SUCCESS; }
uint32_t pstorage_init(void) { uint32_t retval; cmd_queue_init(); m_next_app_instance = 0; m_next_page_addr = PSTORAGE_DATA_START_ADDR; m_round_val = 0; for (uint32_t index = 0; index < PSTORAGE_MAX_APPLICATIONS; index++) { m_app_table[index].cb = NULL; m_app_table[index].block_size = 0; m_app_table[index].num_of_pages = 0; m_app_table[index].block_count = 0; } #ifdef PSTORAGE_RAW_MODE_ENABLE m_raw_app_table.cb = NULL; m_raw_app_table.num_of_pages = 0; m_module_initialized = true; m_swap_state = STATE_INIT; retval = NRF_SUCCESS; #else m_swap_state = STATE_SWAP_DIRTY; // Erase swap region in case it is dirty. retval = sd_flash_page_erase(PSTORAGE_SWAP_ADDR / PSTORAGE_FLASH_PAGE_SIZE); if (retval == NRF_SUCCESS) { m_cmd_queue.flash_access = true; m_module_initialized = true; } #endif //PSTORAGE_RAW_MODE_ENABLE return retval; }
/** * @brief Module initialization routine to be called once by the application. */ uint32_t pstorage_init(void) { cmd_queue_init(); m_next_app_instance = 0; m_next_page_addr = PSTORAGE_DATA_START_ADDR; m_round_val = 0; for(unsigned int index = 0; index < PSTORAGE_MAX_APPLICATIONS; index++) { m_app_table[index].cb = NULL; m_app_table[index].block_size = 0; m_app_table[index].no_of_pages = 0; m_app_table[index].block_count = 0; } #ifdef PSTORAGE_RAW_MODE_ENABLE m_raw_app_table.cb = NULL; m_raw_app_table.no_of_pages = 0; #endif //PSTORAGE_RAW_MODE_ENABLE m_module_initialized = true; return NRF_SUCCESS; }