NVM: consideration of SoftDevice memory layout (#977)
This commit is contained in:
+4
-6
@@ -30,12 +30,6 @@
|
||||
#include <Arduino.h>
|
||||
#include <stdio.h> // for size_t
|
||||
|
||||
#ifdef __RFduino__
|
||||
#include <chip.h>
|
||||
#else
|
||||
#include <nrf.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define characteristics of Flash
|
||||
*
|
||||
@@ -133,6 +127,10 @@ public:
|
||||
* @return address of given page
|
||||
*/
|
||||
uint32_t *page_address(size_t page);
|
||||
/** Get top of available flash for application data
|
||||
* @return Last available address + 1
|
||||
*/
|
||||
uint32_t *top_app_page_address();
|
||||
//----------------------------------------------------------------------------
|
||||
/*
|
||||
* Accessing flash memory
|
||||
|
||||
@@ -300,7 +300,7 @@ void VirtualPageClass::format()
|
||||
|
||||
uint32_t *VirtualPageClass::get_page_address(uint16_t page)
|
||||
{
|
||||
return (uint32_t *)((Flash.page_count() << Flash.page_size_bits()) -
|
||||
return (uint32_t *)(Flash.top_app_page_address() -
|
||||
((page + VNM_VIRTUAL_PAGE_SKIP_FROM_TOP)
|
||||
<< VNM_VIRTUAL_PAGE_SIZE_BITS));
|
||||
}
|
||||
@@ -336,7 +336,6 @@ void VirtualPageClass::build_page(uint32_t *address, uint32_t magic)
|
||||
uint32_t VirtualPageClass::get_page_erase_cycles(uint32_t *address)
|
||||
{
|
||||
// Return number of cycles
|
||||
return ((uint32_t)address[OFFSET_ERASE_COUNTER] &
|
||||
(uint32_t)MASK_ERASE_COUNTER) +
|
||||
1;
|
||||
return ((((uint32_t)address[OFFSET_ERASE_COUNTER])+1) &
|
||||
(uint32_t)MASK_ERASE_COUNTER);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user