diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2018-06-03 23:35:52 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2018-06-03 23:35:52 +0200 |
commit | fadeb06d74c3d739dc1202031e1eea1374e8917e (patch) | |
tree | 2db95dbaea94299c74ab90b2fc4ce3fc44e70acf /ota-test/main/misc.c | |
parent | 934bbf7d019e561209802f6a679b3672ce58ef1a (diff) | |
download | modern-esp-sandbox-fadeb06d74c3d739dc1202031e1eea1374e8917e.tar.gz modern-esp-sandbox-fadeb06d74c3d739dc1202031e1eea1374e8917e.tar.bz2 modern-esp-sandbox-fadeb06d74c3d739dc1202031e1eea1374e8917e.tar.xz modern-esp-sandbox-fadeb06d74c3d739dc1202031e1eea1374e8917e.zip |
wip
Diffstat (limited to 'ota-test/main/misc.c')
-rw-r--r-- | ota-test/main/misc.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/ota-test/main/misc.c b/ota-test/main/misc.c new file mode 100644 index 0000000..1b5119b --- /dev/null +++ b/ota-test/main/misc.c @@ -0,0 +1,52 @@ +#include <esp_system.h> + +/****************************************************************************** + * FunctionName : user_rf_cal_sector_set + * Description : SDK just reversed 4 sectors, used for rf init data and paramters. + * We add this function to force users to set rf cal sector, since + * we don't know which sector is free in user's application. + * sector map for last several sectors : ABCCC + * A : rf cal + * B : rf init data + * C : sdk parameters + * Parameters : none + * Returns : rf cal sector +*******************************************************************************/ +uint32_t user_rf_cal_sector_set() +{ + flash_size_map size_map = system_get_flash_size_map(); + uint32_t rf_cal_sec = 0; + + switch (size_map) { + case FLASH_SIZE_4M_MAP_256_256: + rf_cal_sec = 128 - 5; + break; + + case FLASH_SIZE_8M_MAP_512_512: + rf_cal_sec = 256 - 5; + break; + + case FLASH_SIZE_16M_MAP_512_512: + case FLASH_SIZE_16M_MAP_1024_1024: + rf_cal_sec = 512 - 5; + break; + + case FLASH_SIZE_32M_MAP_512_512: + case FLASH_SIZE_32M_MAP_1024_1024: + rf_cal_sec = 1024 - 5; + break; + case FLASH_SIZE_64M_MAP_1024_1024: + rf_cal_sec = 2048 - 5; + break; + case FLASH_SIZE_128M_MAP_1024_1024: + rf_cal_sec = 4096 - 5; + break; + default: + rf_cal_sec = 0; + break; + } + + return rf_cal_sec; +} + + |