mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-20 18:40:31 +00:00
hal_flash_sector.h: add get_alignment() to get Flash read/write alignment requirements
This commit is contained in:
parent
a5481ee357
commit
cc480b8fa8
@ -55,6 +55,11 @@ typedef struct {
|
||||
*/
|
||||
uint32_t (*get_size)(void * context);
|
||||
|
||||
/**
|
||||
* Get flash read/write alignmenent requirements
|
||||
*/
|
||||
uint32_t (*get_alignment)(void * context);
|
||||
|
||||
/**
|
||||
* Erase a bank
|
||||
* @param context
|
||||
|
@ -53,6 +53,11 @@ static uint32_t hal_flash_sector_memory_get_size(void * context){
|
||||
return self->bank_size;
|
||||
}
|
||||
|
||||
static uint32_t hal_flash_sector_memory_get_alignment(void * context){
|
||||
UNUSED(context);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void hal_flash_sector_memory_erase(void * context, int bank){
|
||||
hal_flash_sector_memory_t * self = (hal_flash_sector_memory_t *) context;
|
||||
if (bank > 1) return;
|
||||
@ -96,10 +101,11 @@ static void hal_flash_sector_memory_write(void * context, int bank, uint32_t off
|
||||
}
|
||||
|
||||
static const hal_flash_sector_t hal_flash_sector_memory_instance = {
|
||||
/* uint32_t (*get_size)() */ &hal_flash_sector_memory_get_size,
|
||||
/* void (*erase)(int); */ &hal_flash_sector_memory_erase,
|
||||
/* void (*read)(..); */ &hal_flash_sector_memory_read,
|
||||
/* void (*write)(..); */ &hal_flash_sector_memory_write,
|
||||
/* uint32_t (*get_size)(..) */ &hal_flash_sector_memory_get_size,
|
||||
/* uint32_t (*get_alignment)(..); */ &hal_flash_sector_memory_get_alignment,
|
||||
/* void (*erase)(..); */ &hal_flash_sector_memory_erase,
|
||||
/* void (*read)(..); */ &hal_flash_sector_memory_read,
|
||||
/* void (*write)(..); */ &hal_flash_sector_memory_write,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -296,6 +296,11 @@ static uint32_t hal_flash_sector_stm32_get_size(void * context){
|
||||
return self->sector_size;
|
||||
}
|
||||
|
||||
static uint32_t hal_flash_sector_memory_get_alignment(void * context){
|
||||
UNUSED(context);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void hal_flash_sector_stm32_erase(void * context, int bank){
|
||||
hal_flash_sector_stm32_t * self = (hal_flash_sector_stm32_t *) context;
|
||||
if (bank > 1) return;
|
||||
@ -336,10 +341,11 @@ static void hal_flash_sector_stm32_write(void * context, int bank, uint32_t offs
|
||||
}
|
||||
|
||||
static const hal_flash_sector_t hal_flash_sector_stm32_impl = {
|
||||
/* uint32_t (*get_size)() */ &hal_flash_sector_stm32_get_size,
|
||||
/* void (*erase)(int); */ &hal_flash_sector_stm32_erase,
|
||||
/* void (*read)(..); */ &hal_flash_sector_stm32_read,
|
||||
/* void (*write)(..); */ &hal_flash_sector_stm32_write,
|
||||
/* uint32_t (*get_size)() */ &hal_flash_sector_stm32_get_size,
|
||||
/* uint32_t (*get_alignment)(..); */ &hal_flash_sector_memory_get_alignment,
|
||||
/* void (*erase)(..); */ &hal_flash_sector_stm32_erase,
|
||||
/* void (*read)(..); */ &hal_flash_sector_stm32_read,
|
||||
/* void (*write)(..); */ &hal_flash_sector_stm32_write,
|
||||
};
|
||||
|
||||
static const hal_flash_sector_t * hal_flash_sector_stm32_init_instance(hal_flash_sector_stm32_t * context, uint32_t sector_size,
|
||||
|
Loading…
x
Reference in New Issue
Block a user