1
0
mirror of https://gitee.com/openLuat/LuatOS synced 2025-08-17 22:18:03 +08:00

update:sfdp参数长度做下兼容处理,不必占用那么大空间

This commit is contained in:
Dozingfiretruck 2025-08-17 05:17:23 +08:00
parent 0489f4cc55
commit 13de1d0319
2 changed files with 7 additions and 5 deletions

View File

@ -25,6 +25,10 @@ typedef struct little_flash little_flash_t;
#define LF_INFO(...) LF_PRINTF(__VA_ARGS__)
#endif
#ifndef LF_WARNING
#define LF_WARNING(...) LF_PRINTF(__VA_ARGS__)
#endif
#ifndef LF_ERROR
#define LF_ERROR(...) LF_PRINTF(__VA_ARGS__)
#endif
@ -216,8 +220,6 @@ typedef struct {
uint32_t pt22;
uint32_t pt23;
// ...
uint32_t reserved[8];
// ...
}little_flash_sfdp_pt_t;
typedef struct {

View File

@ -196,9 +196,9 @@ lf_err_t little_flash_sfdp_probe(little_flash_t *lf){
}
LF_DEBUG("Parameter Header is OK. The Parameter ID is 0x%04X, Revision is V%d.%d, Length is %d,Parameter Table Pointer is 0x%06lX.",
sfdp.parameter_id, recv_data[1],recv_data[2],sfdp.parameter_length, sfdp.parameter_pointer);
if (sfdp.parameter_length * 4>sizeof(little_flash_sfdp_pt_t)){
LF_ERROR("Table Revision %d.%d is not supported", sfdp.parameter_major_rev, sfdp.parameter_minor_rev);
return LF_ERR_SFDP_PARAMETER;
if (sfdp.parameter_length * 4 > sizeof(little_flash_sfdp_pt_t)){
LF_WARNING("Table Revision %d.%d parameter_length is too long", sfdp.parameter_major_rev, sfdp.parameter_minor_rev);
sfdp.parameter_length = sizeof(little_flash_sfdp_pt_t) / 4;
}
uint8_t parameter_table[sfdp.parameter_length * 4];
little_flash_sfdp_read(lf, sfdp.parameter_pointer, parameter_table, sfdp.parameter_length);