|
38 | 38 | #define MTC_W25Q32_BV (0x4016) /* W25Q32BV */
|
39 | 39 | #define MTC_W25Q32_DW (0x6016) /* W25Q32DW */
|
40 | 40 | #define MTC_W25Q64_BV_CV (0x4017) /* W25Q64BV W25Q64CV */
|
41 |
| -#define MTC_W25Q64_DW (0x4017) /* W25Q64DW */ |
| 41 | +#define MTC_W25Q64_DW (0x6017) /* W25Q64DW */ |
42 | 42 | #define MTC_W25Q128_BV (0x4018) /* W25Q128BV */
|
43 | 43 | #define MTC_W25Q256_FV (TBD) /* W25Q256FV */
|
44 | 44 | #define MTC_MX25L25645_GM2I (0x2019) /* MX25L25645GM2I-10G */
|
@@ -149,38 +149,48 @@ ret_code_t hal_spi_flash_info(flash_info_t *info) {
|
149 | 149 | memory_type_capacity = rx[1];
|
150 | 150 | memory_type_capacity = (memory_type_capacity << 8) | rx[2];
|
151 | 151 |
|
152 |
| - if (memory_type_capacity == MTC_MX25L25645_GM2I) { |
153 |
| - NRF_LOG_INFO("MX25L25645GM2I-10G detection"); |
154 |
| - info->block_count = 8192; |
155 |
| - } else if (memory_type_capacity == MTC_W25Q128_BV) { |
156 |
| - NRF_LOG_INFO("W25Q128BV detection"); |
157 |
| - info->block_count = 4096; |
158 |
| - } else if (memory_type_capacity == MTC_W25Q64_BV_CV) { |
159 |
| - NRF_LOG_INFO("W25Q64BV or W25Q64CV detection"); |
160 |
| - info->block_count = 2048; |
161 |
| - } else if (memory_type_capacity == MTC_W25Q64_DW) { |
162 |
| - NRF_LOG_INFO("W25Q64DW detection"); |
163 |
| - info->block_count = 2048; |
164 |
| - } else if (memory_type_capacity == MTC_W25Q32_BV) { |
165 |
| - NRF_LOG_INFO("W25Q32BV detection"); |
166 |
| - info->block_count = 1024; |
167 |
| - } else if (memory_type_capacity == MTC_W25Q32_DW) { |
168 |
| - NRF_LOG_INFO("W25Q32DW detection"); |
169 |
| - info->block_count = 1024; |
170 |
| - } else if (memory_type_capacity == MTC_W25Q16_BV_CL_CV) { |
171 |
| - NRF_LOG_INFO("W25Q16BV or W25Q16CL or W25Q16CV detection"); |
172 |
| - info->block_count = 512; |
173 |
| - } else if (memory_type_capacity == MTC_W25Q16_DW) { |
174 |
| - NRF_LOG_INFO("W25Q16DW detection"); |
175 |
| - info->block_count = 512; |
176 |
| - } else { |
177 |
| - NRF_LOG_INFO("Memory Capacity error! %d", memory_type_capacity); |
178 |
| - info->block_count = 0; |
179 |
| - return NRF_ERROR_INVALID_PARAM; |
| 152 | + switch (memory_type_capacity) { |
| 153 | + case MTC_MX25L25645_GM2I: |
| 154 | + NRF_LOG_INFO("MX25L25645GM2I-10G detection"); |
| 155 | + info->block_count = 8192; |
| 156 | + break; |
| 157 | + case MTC_W25Q128_BV: |
| 158 | + NRF_LOG_INFO("W25Q128BV detection"); |
| 159 | + info->block_count = 4096; |
| 160 | + break; |
| 161 | + case MTC_W25Q64_BV_CV: |
| 162 | + NRF_LOG_INFO("W25Q64BV or W25Q64CV detection"); |
| 163 | + info->block_count = 2048; |
| 164 | + break; |
| 165 | + case MTC_W25Q64_DW: |
| 166 | + NRF_LOG_INFO("W25Q64DW detection"); |
| 167 | + info->block_count = 2048; |
| 168 | + break; |
| 169 | + case MTC_W25Q32_BV: |
| 170 | + NRF_LOG_INFO("W25Q32BV detection"); |
| 171 | + info->block_count = 1024; |
| 172 | + break; |
| 173 | + case MTC_W25Q32_DW: |
| 174 | + NRF_LOG_INFO("W25Q32DW detection"); |
| 175 | + info->block_count = 1024; |
| 176 | + break; |
| 177 | + case MTC_W25Q16_BV_CL_CV: |
| 178 | + NRF_LOG_INFO("W25Q16BV or W25Q16CL or W25Q16CV detection"); |
| 179 | + info->block_count = 512; |
| 180 | + break; |
| 181 | + case MTC_W25Q16_DW: |
| 182 | + NRF_LOG_INFO("W25Q16DW detection"); |
| 183 | + info->block_count = 512; |
| 184 | + break; |
| 185 | + default: |
| 186 | + NRF_LOG_INFO("Memory Capacity error! %d", memory_type_capacity); |
| 187 | + info->block_count = 0; |
| 188 | + return NRF_ERROR_INVALID_PARAM; |
180 | 189 | }
|
181 | 190 | return NRF_SUCCESS;
|
182 | 191 | }
|
183 | 192 |
|
| 193 | + |
184 | 194 | ret_code_t hal_spi_flash_read(uint32_t address, void *buffer, size_t size) {
|
185 | 195 |
|
186 | 196 | uint8_t tx[4];
|
|
0 commit comments