Remove CR line ends.

This commit is contained in:
Dmitry 2018-07-27 09:54:23 +03:00
parent e98a49a691
commit 2281f6318a

View File

@ -95,13 +95,13 @@ esp_err_t WL_Flash::config(wl_config_t *cfg, Flash_Access *flash_drv)
this->flash_size = ((this->cfg.full_mem_size - this->state_size * 2 - this->cfg_size) / this->cfg.page_size - 1) * this->cfg.page_size; // -1 remove dummy block
ESP_LOGD(TAG, "%s - config result: state_size=0x%08x, cfg_size=0x%08x, addr_cfg=0x%08x, addr_state1=0x%08x, addr_state2=0x%08x, flash_size=0x%08x", __func__,
(uint32_t) this->state_size,
(uint32_t) this->cfg_size,
(uint32_t) this->addr_cfg,
(uint32_t) this->addr_state1,
(uint32_t) this->addr_state2,
(uint32_t) this->flash_size
);
(uint32_t) this->state_size,
(uint32_t) this->cfg_size,
(uint32_t) this->addr_cfg,
(uint32_t) this->addr_state1,
(uint32_t) this->addr_state2,
(uint32_t) this->flash_size
);
if (flash_sz <= 0) {
result = ESP_ERR_INVALID_ARG;
}
@ -315,7 +315,9 @@ esp_err_t WL_Flash::updateVersion()
esp_err_t result = ESP_OK;
result = this->updateV1_V2();
if (result == ESP_OK) return result;
if (result == ESP_OK) {
return result;
}
// check next version
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);
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
ESP_LOGI(TAG, "%s Update from V1 to V2, crc=0x%08x, ", __func__, crc1);
uint32_t pos = 0;
@ -352,7 +354,7 @@ esp_err_t WL_Flash::updateV1_V2()
ESP_LOGV(TAG, "%s- result= 0x%08x, pos= %i, pos_bits= 0x%08x", __func__, (uint32_t)result, (uint32_t)pos, (uint32_t)pos_bits);
pos = i;
if (pos_bits == 0xff) {
break; // we have found position
break; // we have found position
}
}
ESP_LOGI(TAG, "%s max_pos=%i, pos=%i, state.ver=%i, state2.ver=%i", __func__, (uint32_t)this->state.max_pos, (uint32_t)pos, (uint32_t)this->state.version, (uint32_t)state_copy->version);
@ -373,7 +375,7 @@ esp_err_t WL_Flash::updateV1_V2()
WL_RESULT_CHECK(result);
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);
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);
@ -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);
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);
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);
@ -400,10 +402,10 @@ esp_err_t WL_Flash::updateV1_V2()
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++) {
buff[i] = this->state.device_id + n*4 + i;
for (int i = 0 ; i < 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));
}
}
@ -411,11 +413,13 @@ void WL_Flash::fillOkBuff(int n)
bool WL_Flash::OkBuffSet(int n)
{
bool result = true;
uint32_t* data_buff = (uint32_t*)this->temp_buff;
for (int i=0 ; i< 4 ; i++) {
uint32_t data = this->state.device_id + n*4 + i;
uint32_t *data_buff = (uint32_t *)this->temp_buff;
for (int i = 0 ; i < 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));
if (crc != data_buff[i]) result = false;
if (crc != data_buff[i]) {
result = false;
}
}
return result;
}