rename flash_nrf52 to flash_nrf5x
This commit is contained in:
1 parent
8dc3bbed50
commit
3361e5acf2
5 files changed
+33
-33
No files matched your search
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file flash_nrf52.c
|
||||
@file flash_nrf5x.c
|
||||
@author hathach (tinyusb.org)
|
||||
|
||||
@section LICENSE
|
||||
@@ -34,7 +34,7 @@
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
#include "flash_nrf52.h"
|
||||
#include "flash_nrf5x.h"
|
||||
#include "flash_cache.h"
|
||||
#include "nrf_sdm.h"
|
||||
#include "nrf_soc.h"
|
||||
@@ -46,7 +46,7 @@
|
||||
static SemaphoreHandle_t _sem = NULL;
|
||||
static volatile uint32_t _op_result;
|
||||
|
||||
void flash_nrf52_event_cb (uint32_t event)
|
||||
void flash_nrf5x_event_cb (uint32_t event)
|
||||
{
|
||||
_op_result = event;
|
||||
xSemaphoreGive(_sem);
|
||||
@@ -69,25 +69,25 @@ flash_cache_t _cache = {
|
||||
//--------------------------------------------------------------------+
|
||||
// Application API
|
||||
//--------------------------------------------------------------------+
|
||||
void flash_nrf52_flush (void)
|
||||
void flash_nrf5x_flush (void)
|
||||
{
|
||||
flash_cache_flush(&_cache);
|
||||
}
|
||||
|
||||
uint32_t flash_nrf52_write (uint32_t dst, void const * src, uint32_t len)
|
||||
uint32_t flash_nrf5x_write (uint32_t dst, void const * src, uint32_t len)
|
||||
{
|
||||
// TODO prevent write SD + bootloader region
|
||||
return flash_cache_write(&_cache, dst, src, len);
|
||||
}
|
||||
|
||||
uint32_t flash_nrf52_read (void* dst, uint32_t src, uint32_t len)
|
||||
uint32_t flash_nrf5x_read (void* dst, uint32_t src, uint32_t len)
|
||||
{
|
||||
// return cache value if available
|
||||
flash_cache_read(&_cache, dst, src, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
bool flash_nrf52_erase(uint32_t addr)
|
||||
bool flash_nrf5x_erase(uint32_t addr)
|
||||
{
|
||||
return fal_erase(addr);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file flash_nrf52.h
|
||||
@file flash_nrf5x.h
|
||||
@author hathach (tinyusb.org)
|
||||
|
||||
@section LICENSE
|
||||
@@ -45,47 +45,47 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void flash_nrf52_flush (void);
|
||||
bool flash_nrf52_erase(uint32_t addr);
|
||||
void flash_nrf5x_flush (void);
|
||||
bool flash_nrf5x_erase(uint32_t addr);
|
||||
|
||||
uint32_t flash_nrf52_write (uint32_t dst, void const * src, uint32_t len);
|
||||
uint32_t flash_nrf52_read (void* dst, uint32_t src, uint32_t len);
|
||||
uint32_t flash_nrf5x_write (uint32_t dst, void const * src, uint32_t len);
|
||||
uint32_t flash_nrf5x_read (void* dst, uint32_t src, uint32_t len);
|
||||
|
||||
static inline uint32_t flash_nrf52_write8 (uint32_t dst, uint8_t num)
|
||||
static inline uint32_t flash_nrf5x_write8 (uint32_t dst, uint8_t num)
|
||||
{
|
||||
flash_nrf52_write(dst, &num, sizeof(num));
|
||||
flash_nrf5x_write(dst, &num, sizeof(num));
|
||||
return sizeof(num);
|
||||
}
|
||||
|
||||
static inline uint32_t flash_nrf52_write16 (uint32_t dst, uint8_t num)
|
||||
static inline uint32_t flash_nrf5x_write16 (uint32_t dst, uint8_t num)
|
||||
{
|
||||
flash_nrf52_write(dst, &num, sizeof(num));
|
||||
flash_nrf5x_write(dst, &num, sizeof(num));
|
||||
return sizeof(num);
|
||||
}
|
||||
static inline uint32_t flash_nrf52_write32 (uint32_t dst, uint8_t num)
|
||||
static inline uint32_t flash_nrf5x_write32 (uint32_t dst, uint8_t num)
|
||||
{
|
||||
flash_nrf52_write(dst, &num, sizeof(num));
|
||||
flash_nrf5x_write(dst, &num, sizeof(num));
|
||||
return sizeof(num);
|
||||
}
|
||||
|
||||
static inline uint8_t flash_nrf52_read8 (uint32_t src)
|
||||
static inline uint8_t flash_nrf5x_read8 (uint32_t src)
|
||||
{
|
||||
uint8_t num;
|
||||
flash_nrf52_read(&num, src, sizeof(num));
|
||||
flash_nrf5x_read(&num, src, sizeof(num));
|
||||
return num;
|
||||
}
|
||||
|
||||
static inline uint16_t flash_nrf52_read16 (uint32_t src)
|
||||
static inline uint16_t flash_nrf5x_read16 (uint32_t src)
|
||||
{
|
||||
uint16_t num;
|
||||
flash_nrf52_read(&num, src, sizeof(num));
|
||||
flash_nrf5x_read(&num, src, sizeof(num));
|
||||
return num;
|
||||
}
|
||||
|
||||
static inline uint16_t flash_nrf52_read32 (uint32_t src)
|
||||
static inline uint16_t flash_nrf5x_read32 (uint32_t src)
|
||||
{
|
||||
uint32_t num;
|
||||
flash_nrf52_read(&num, src, sizeof(num));
|
||||
flash_nrf5x_read(&num, src, sizeof(num));
|
||||
return num;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ AdafruitBluefruit Bluefruit;
|
||||
*------------------------------------------------------------------*/
|
||||
extern "C"
|
||||
{
|
||||
void flash_nrf52_event_cb (uint32_t event) ATTR_WEAK;
|
||||
void flash_nrf5x_event_cb (uint32_t event) ATTR_WEAK;
|
||||
}
|
||||
|
||||
void adafruit_ble_task(void* arg);
|
||||
@@ -801,7 +801,7 @@ void adafruit_soc_task(void* arg)
|
||||
// Flash
|
||||
case NRF_EVT_FLASH_OPERATION_SUCCESS:
|
||||
case NRF_EVT_FLASH_OPERATION_ERROR:
|
||||
if ( flash_nrf52_event_cb ) flash_nrf52_event_cb(soc_evt);
|
||||
if ( flash_nrf5x_event_cb ) flash_nrf5x_event_cb(soc_evt);
|
||||
break;
|
||||
|
||||
/*------------- usb power event handler -------------*/
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "bonding.h"
|
||||
|
||||
#include "bluefruit.h"
|
||||
#include "flash/flash_nrf52.h"
|
||||
#include "flash/flash_nrf5x.h"
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Bond Key is saved in following layout
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <Arduino.h>
|
||||
#include <string.h>
|
||||
#include "InternalFS.h"
|
||||
#include "flash/flash_nrf52.h"
|
||||
#include "flash/flash_nrf5x.h"
|
||||
|
||||
#ifdef NRF52840_XXAA
|
||||
#define LFS_FLASH_ADDR 0xED000
|
||||
@@ -118,7 +118,7 @@ static int _iflash_read (const struct lfs_config *c, lfs_block_t block, lfs_off_
|
||||
(void) c;
|
||||
|
||||
uint32_t addr = lba2addr(block) + off;
|
||||
flash_nrf52_read(buffer, addr, size);
|
||||
flash_nrf5x_read(buffer, addr, size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -132,7 +132,7 @@ static int _iflash_prog (const struct lfs_config *c, lfs_block_t block, lfs_off_
|
||||
(void) c;
|
||||
|
||||
uint32_t addr = lba2addr(block) + off;
|
||||
flash_nrf52_write(addr, buffer, size);
|
||||
flash_nrf5x_write(addr, buffer, size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -150,10 +150,10 @@ static int _iflash_erase (const struct lfs_config *c, lfs_block_t block)
|
||||
// implement as write 0xff to whole block address
|
||||
for(int i=0; i <LFS_BLOCK_SIZE; i++)
|
||||
{
|
||||
flash_nrf52_write8(addr + i, 0xFF);
|
||||
flash_nrf5x_write8(addr + i, 0xFF);
|
||||
}
|
||||
|
||||
// flash_nrf52_flush();
|
||||
// flash_nrf5x_flush();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -163,7 +163,7 @@ static int _iflash_erase (const struct lfs_config *c, lfs_block_t block)
|
||||
static int _iflash_sync (const struct lfs_config *c)
|
||||
{
|
||||
(void) c;
|
||||
flash_nrf52_flush();
|
||||
flash_nrf5x_flush();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user