Lines Matching full:flash

2  * This file is part of the Serial Flash Universal Driver Library.
25 …* Function: Analyze the SFDP (Serial Flash Discoverable Parameters) which from JESD216/A/B (V1.X) …
41 …* of a flash memory device. Different areas within the address range of the data array may have a …
49 /* the JEDEC basic flash parameter table length is 9 DWORDs (288-bit) on JESD216 (V1.0) initial rel…
64 static sfud_err read_sfdp_data(const sfud_flash *flash, uint32_t addr, uint8_t *read_buf, size_t si…
65 static bool read_sfdp_header(sfud_flash *flash);
66 static bool read_basic_header(const sfud_flash *flash, sfdp_para_header *basic_header);
67 static bool read_basic_table(sfud_flash *flash, sfdp_para_header *basic_header);
76 * @param flash flash device
80 bool sfud_read_sfdp(sfud_flash *flash) { in sfud_read_sfdp() argument
81 SFUD_ASSERT(flash); in sfud_read_sfdp()
83 /* JEDEC basic flash parameter header */ in sfud_read_sfdp()
85 if (read_sfdp_header(flash) && read_basic_header(flash, &basic_header)) { in sfud_read_sfdp()
86 return read_basic_table(flash, &basic_header); in sfud_read_sfdp()
88 …g: Read SFDP parameter header information failed. The %s is not support JEDEC SFDP.", flash->name); in sfud_read_sfdp()
96 * @param flash flash device
100 static bool read_sfdp_header(sfud_flash *flash) { in read_sfdp_header() argument
101 sfud_sfdp *sfdp = &flash->sfdp; in read_sfdp_header()
109 SFUD_ASSERT(flash); in read_sfdp_header()
113 if (read_sfdp_data(flash, header_addr, header, sizeof(header)) != SFUD_SUCCESS) { in read_sfdp_header()
140 * @param flash flash device
144 static bool read_basic_header(const sfud_flash *flash, sfdp_para_header *basic_header) { in read_basic_header() argument
150 SFUD_ASSERT(flash); in read_basic_header()
153 /* read JEDEC basic flash parameter header */ in read_basic_header()
154 if (read_sfdp_data(flash, header_addr, header, sizeof(header)) != SFUD_SUCCESS) { in read_basic_header()
155 SFUD_INFO("Error: Can't read JEDEC basic flash parameter header."); in read_basic_header()
163 /* check JEDEC basic flash parameter header */ in read_basic_header()
165 … SFUD_INFO("Error: This reversion(V%d.%d) JEDEC basic flash parameter header is not supported.", in read_basic_header()
170 …SFUD_INFO("Error: The JEDEC basic flash parameter table length (now is %d) error.", basic_header->… in read_basic_header()
173 …SFUD_DEBUG("Check JEDEC basic flash parameter header is OK. The table id is %d, reversion is V%d.%… in read_basic_header()
183 * @param flash flash device
187 static bool read_basic_table(sfud_flash *flash, sfdp_para_header *basic_header) { in read_basic_table() argument
188 sfud_sfdp *sfdp = &flash->sfdp; in read_basic_table()
194 SFUD_ASSERT(flash); in read_basic_table()
197 /* read JEDEC basic flash parameter table */ in read_basic_table()
198 if (read_sfdp_data(flash, table_addr, table, sizeof(table)) != SFUD_SUCCESS) { in read_basic_table()
199 SFUD_INFO("Warning: Can't read JEDEC basic flash parameter table."); in read_basic_table()
202 /* print JEDEC basic flash parameter table info */ in read_basic_table()
203 SFUD_DEBUG("JEDEC basic flash parameter table info:"); in read_basic_table()
245 SFUD_DEBUG("Target flash status register is non-volatile."); in read_basic_table()
255 SFUD_DEBUG("Flash device requires instruction 50h as the write enable prior " in read_basic_table()
260 SFUD_DEBUG("Flash device requires instruction 06h as the write enable prior " in read_basic_table()
266 /* get address bytes, number of bytes used in addressing flash array read, write and erase. */ in read_basic_table()
289 /* get flash memory capacity */ in read_basic_table()
299 SFUD_INFO("Error: The flash capacity is grater than 32 Gb/ 4 GB! Not Supported."); in read_basic_table()
311 …SFUD_DEBUG("Flash device supports %ldKB block erase. Command is 0x%02X.", sfdp->eraser[j].size / 1… in read_basic_table()
337 static sfud_err read_sfdp_data(const sfud_flash *flash, uint32_t addr, uint8_t *read_buf, size_t si… in read_sfdp_data() argument
346 SFUD_ASSERT(flash); in read_sfdp_data()
349 SFUD_ASSERT(flash->spi.wr); in read_sfdp_data()
351 return flash->spi.wr(&flash->spi, cmd, sizeof(cmd), read_buf, size); in read_sfdp_data()
357 * @param flash flash device
363 size_t sfud_sfdp_get_suitable_eraser(const sfud_flash *flash, uint32_t addr, size_t erase_size) { in sfud_sfdp_get_suitable_eraser() argument
365 /* only used when flash supported SFDP */ in sfud_sfdp_get_suitable_eraser()
366 SFUD_ASSERT(flash->sfdp.available); in sfud_sfdp_get_suitable_eraser()
368 if (addr % flash->sfdp.eraser[SMALLEST_ERASER_INDEX].size) { in sfud_sfdp_get_suitable_eraser()
375 if ((flash->sfdp.eraser[i].size != 0) && (erase_size >= flash->sfdp.eraser[i].size) in sfud_sfdp_get_suitable_eraser()
376 && (addr % flash->sfdp.eraser[i].size == 0)) { in sfud_sfdp_get_suitable_eraser()