mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 13:14:32 +02:00
Remove CR line ends.
This commit is contained in:
@@ -315,7 +315,9 @@ esp_err_t WL_Flash::updateVersion()
|
|||||||
esp_err_t result = ESP_OK;
|
esp_err_t result = ESP_OK;
|
||||||
|
|
||||||
result = this->updateV1_V2();
|
result = this->updateV1_V2();
|
||||||
if (result == ESP_OK) return result;
|
if (result == ESP_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
// check next version
|
// check next version
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -340,7 +342,7 @@ esp_err_t WL_Flash::updateV1_V2()
|
|||||||
|
|
||||||
ESP_LOGD(TAG, "%s - process crc1=0x%08x, crc2=0x%08x, v1_crc1=0x%08x, v1_crc2=0x%08x, version=%i", __func__, crc1, crc2, v1_crc1, v1_crc2, this->state.version);
|
ESP_LOGD(TAG, "%s - process crc1=0x%08x, crc2=0x%08x, v1_crc1=0x%08x, v1_crc2=0x%08x, version=%i", __func__, crc1, crc2, v1_crc1, v1_crc2, this->state.version);
|
||||||
|
|
||||||
if ((crc1 == v1_crc1) && (crc2 == v1_crc2) && (v1_crc1 == v1_crc2) && (this->state.version == 1) && (state_copy->version == 1)){
|
if ((crc1 == v1_crc1) && (crc2 == v1_crc2) && (v1_crc1 == v1_crc2) && (this->state.version == 1) && (state_copy->version == 1)) {
|
||||||
// Here we have to update all internal structures
|
// Here we have to update all internal structures
|
||||||
ESP_LOGI(TAG, "%s Update from V1 to V2, crc=0x%08x, ", __func__, crc1);
|
ESP_LOGI(TAG, "%s Update from V1 to V2, crc=0x%08x, ", __func__, crc1);
|
||||||
uint32_t pos = 0;
|
uint32_t pos = 0;
|
||||||
@@ -373,7 +375,7 @@ esp_err_t WL_Flash::updateV1_V2()
|
|||||||
WL_RESULT_CHECK(result);
|
WL_RESULT_CHECK(result);
|
||||||
|
|
||||||
memset(this->temp_buff, 0, this->cfg.wr_size);
|
memset(this->temp_buff, 0, this->cfg.wr_size);
|
||||||
for (uint32_t i=0 ; i<= pos; i++) {
|
for (uint32_t i = 0 ; i <= pos; i++) {
|
||||||
this->fillOkBuff(i);
|
this->fillOkBuff(i);
|
||||||
result = this->flash_drv->write(this->addr_state1 + sizeof(wl_state_t) + i * this->cfg.wr_size, this->temp_buff, this->cfg.wr_size);
|
result = this->flash_drv->write(this->addr_state1 + sizeof(wl_state_t) + i * this->cfg.wr_size, this->temp_buff, this->cfg.wr_size);
|
||||||
WL_RESULT_CHECK(result);
|
WL_RESULT_CHECK(result);
|
||||||
@@ -386,7 +388,7 @@ esp_err_t WL_Flash::updateV1_V2()
|
|||||||
ESP_LOGD(TAG, "%s - move_count= 0x%08x, pos= 0x%08x", __func__, this->state.move_count, this->state.pos);
|
ESP_LOGD(TAG, "%s - move_count= 0x%08x, pos= 0x%08x", __func__, this->state.move_count, this->state.pos);
|
||||||
|
|
||||||
memset(this->temp_buff, 0, this->cfg.wr_size);
|
memset(this->temp_buff, 0, this->cfg.wr_size);
|
||||||
for (uint32_t i=0 ; i<= pos; i++) {
|
for (uint32_t i = 0 ; i <= pos; i++) {
|
||||||
this->fillOkBuff(i);
|
this->fillOkBuff(i);
|
||||||
result = this->flash_drv->write(this->addr_state2 + sizeof(wl_state_t) + i * this->cfg.wr_size, this->temp_buff, this->cfg.wr_size);
|
result = this->flash_drv->write(this->addr_state2 + sizeof(wl_state_t) + i * this->cfg.wr_size, this->temp_buff, this->cfg.wr_size);
|
||||||
WL_RESULT_CHECK(result);
|
WL_RESULT_CHECK(result);
|
||||||
@@ -400,10 +402,10 @@ esp_err_t WL_Flash::updateV1_V2()
|
|||||||
|
|
||||||
void WL_Flash::fillOkBuff(int n)
|
void WL_Flash::fillOkBuff(int n)
|
||||||
{
|
{
|
||||||
uint32_t* buff = (uint32_t*)this->temp_buff;
|
uint32_t *buff = (uint32_t *)this->temp_buff;
|
||||||
|
|
||||||
for (int i=0 ; i< 4 ; i++) {
|
for (int i = 0 ; i < 4 ; i++) {
|
||||||
buff[i] = this->state.device_id + n*4 + i;
|
buff[i] = this->state.device_id + n * 4 + i;
|
||||||
buff[i] = crc32::crc32_le(WL_CFG_CRC_CONST, (uint8_t *)&buff[i], sizeof(uint32_t));
|
buff[i] = crc32::crc32_le(WL_CFG_CRC_CONST, (uint8_t *)&buff[i], sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -411,11 +413,13 @@ void WL_Flash::fillOkBuff(int n)
|
|||||||
bool WL_Flash::OkBuffSet(int n)
|
bool WL_Flash::OkBuffSet(int n)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
uint32_t* data_buff = (uint32_t*)this->temp_buff;
|
uint32_t *data_buff = (uint32_t *)this->temp_buff;
|
||||||
for (int i=0 ; i< 4 ; i++) {
|
for (int i = 0 ; i < 4 ; i++) {
|
||||||
uint32_t data = this->state.device_id + n*4 + i;
|
uint32_t data = this->state.device_id + n * 4 + i;
|
||||||
uint32_t crc = crc32::crc32_le(WL_CFG_CRC_CONST, (uint8_t *)&data, sizeof(uint32_t));
|
uint32_t crc = crc32::crc32_le(WL_CFG_CRC_CONST, (uint8_t *)&data, sizeof(uint32_t));
|
||||||
if (crc != data_buff[i]) result = false;
|
if (crc != data_buff[i]) {
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user