mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Refactor BSP
Magic BSP -> PinecilV2 Pine64 BSP -> Pinecil Update Makefile
This commit is contained in:
23
source/Core/BSP/Pinecilv2/flash.c
Normal file
23
source/Core/BSP/Pinecilv2/flash.c
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* flash.c
|
||||
*
|
||||
* Created on: 29 May 2020
|
||||
* Author: Ralim
|
||||
*/
|
||||
|
||||
#include "BSP.h"
|
||||
#include "BSP_Flash.h"
|
||||
#include "hal_flash.h"
|
||||
#include "string.h"
|
||||
|
||||
#define FLASH_PAGE_SIZE (1024)
|
||||
|
||||
#define SETTINGS_START_PAGE (1023 * FLASH_PAGE_SIZE) // Hal auto offsets base addr
|
||||
|
||||
uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
||||
BL_Err_Type err = flash_erase(SETTINGS_START_PAGE, FLASH_PAGE_SIZE);
|
||||
err = flash_write(SETTINGS_START_PAGE, buffer, length);
|
||||
return err != SUCCESS;
|
||||
}
|
||||
|
||||
void flash_read_buffer(uint8_t *buffer, const uint16_t length) { flash_read(SETTINGS_START_PAGE, buffer, length); }
|
||||
Reference in New Issue
Block a user