Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #11 from Lora-net/develop
Merge original official develop branch
  • Loading branch information
Apaisal committed Jun 12, 2019
2 parents 63bb5b4 + bf9ab7e commit 9e1d7f7
Show file tree
Hide file tree
Showing 20 changed files with 369 additions and 739 deletions.
26 changes: 0 additions & 26 deletions src/apps/LoRaMac/common/NvmCtxMgmt.c
Expand Up @@ -112,7 +112,6 @@ LoRaMacCtxUpdateStatus_t CtxUpdateStatus = { .Value = 0 };
/*
* Nvmm handles
*/
static NvmmDataBlock_t FCntHandlerNvmCtxDataBlock;
static NvmmDataBlock_t SecureElementNvmCtxDataBlock;
static NvmmDataBlock_t CryptoNvmCtxDataBlock;
#if ( MAX_PERSISTENT_CTX_MGMT_ENABLED == 1 )
Expand Down Expand Up @@ -164,11 +163,6 @@ void NvmCtxMgmtEvent( LoRaMacNvmCtxModule_t module )
CtxUpdateStatus.Elements.ConfirmQueue = 1;
break;
}
case LORAMAC_NVMCTXMODULE_FCNT_HANDLER:
{
CtxUpdateStatus.Elements.FCntHandlerNvmCtx = 1;
break;
}
default:
{
break;
Expand Down Expand Up @@ -213,14 +207,6 @@ NvmCtxMgmtStatus_t NvmCtxMgmtStore( void )
}
}

if( CtxUpdateStatus.Elements.FCntHandlerNvmCtx == 1 )
{
if( NvmmWrite( &FCntHandlerNvmCtxDataBlock, MacContexts->FCntHandlerNvmCtx, MacContexts->FCntHandlerNvmCtxSize ) != NVMM_SUCCESS )
{
return NVMCTXMGMT_STATUS_FAIL;
}
}

#if ( MAX_PERSISTENT_CTX_MGMT_ENABLED == 1 )
if( CtxUpdateStatus.Elements.Mac == 1 )
{
Expand Down Expand Up @@ -288,7 +274,6 @@ NvmCtxMgmtStatus_t NvmCtxMgmtRestore( void )

uint8_t NvmCryptoCtxRestore[mibReq.Param.Contexts->CryptoNvmCtxSize];
uint8_t NvmSecureElementCtxRestore[mibReq.Param.Contexts->SecureElementNvmCtxSize];
uint8_t NvmFCntHandlerCtxRestore[mibReq.Param.Contexts->FCntHandlerNvmCtxSize];
#if ( MAX_PERSISTENT_CTX_MGMT_ENABLED == 1 )
uint8_t NvmMacCtxRestore[mibReq.Param.Contexts->MacNvmCtxSize];
uint8_t NvmRegionCtxRestore[mibReq.Param.Contexts->RegionNvmCtxSize];
Expand Down Expand Up @@ -319,17 +304,6 @@ NvmCtxMgmtStatus_t NvmCtxMgmtRestore( void )
status = NVMCTXMGMT_STATUS_FAIL;
}

if ( NvmmDeclare( &FCntHandlerNvmCtxDataBlock, mibReq.Param.Contexts->FCntHandlerNvmCtxSize ) == NVMM_SUCCESS )
{
NvmmRead( &FCntHandlerNvmCtxDataBlock, NvmFCntHandlerCtxRestore, mibReq.Param.Contexts->FCntHandlerNvmCtxSize );
contexts.FCntHandlerNvmCtx = &NvmFCntHandlerCtxRestore;
contexts.FCntHandlerNvmCtxSize = mibReq.Param.Contexts->FCntHandlerNvmCtxSize;
}
else
{
status = NVMCTXMGMT_STATUS_FAIL;
}

#if ( MAX_PERSISTENT_CTX_MGMT_ENABLED == 1 )
if( NvmmDeclare( &MacNvmCtxDataBlock, mibReq.Param.Contexts->MacNvmCtxSize ) == NVMM_SUCCESS )
{
Expand Down
7 changes: 2 additions & 5 deletions src/boards/B-L072Z-LRWAN1/rtc-board.c
Expand Up @@ -485,16 +485,13 @@ static uint64_t RtcGetCalendarValue( RTC_DateTypeDef* date, RTC_TimeTypeDef* tim
uint32_t correction;
uint32_t seconds;

// Get Time and Date
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );

// Make sure it is correct due to asynchronus nature of RTC
do
{
firstRead = time->SubSeconds;
firstRead = RTC->SSR;
HAL_RTC_GetDate( &RtcHandle, date, RTC_FORMAT_BIN );
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );
}while( firstRead != time->SubSeconds );
}while( firstRead != RTC->SSR );

// Calculte amount of elapsed days since 01/01/2000
seconds = DIVC( ( DAYS_IN_YEAR * 3 + DAYS_IN_LEAP_YEAR ) * date->Year , 4 );
Expand Down
7 changes: 2 additions & 5 deletions src/boards/NAMote72/rtc-board.c
Expand Up @@ -484,16 +484,13 @@ static uint64_t RtcGetCalendarValue( RTC_DateTypeDef* date, RTC_TimeTypeDef* tim
uint32_t correction;
uint32_t seconds;

// Get Time and Date
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );

// Make sure it is correct due to asynchronus nature of RTC
do
{
firstRead = time->SubSeconds;
firstRead = RTC->SSR;
HAL_RTC_GetDate( &RtcHandle, date, RTC_FORMAT_BIN );
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );
}while( firstRead != time->SubSeconds );
}while( firstRead != RTC->SSR );

// Calculte amount of elapsed days since 01/01/2000
seconds = DIVC( ( DAYS_IN_YEAR * 3 + DAYS_IN_LEAP_YEAR ) * date->Year , 4 );
Expand Down
7 changes: 2 additions & 5 deletions src/boards/NucleoL073/rtc-board.c
Expand Up @@ -485,16 +485,13 @@ static uint64_t RtcGetCalendarValue( RTC_DateTypeDef* date, RTC_TimeTypeDef* tim
uint32_t correction;
uint32_t seconds;

// Get Time and Date
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );

// Make sure it is correct due to asynchronus nature of RTC
do
{
firstRead = time->SubSeconds;
firstRead = RTC->SSR;
HAL_RTC_GetDate( &RtcHandle, date, RTC_FORMAT_BIN );
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );
}while( firstRead != time->SubSeconds );
}while( firstRead != RTC->SSR );

// Calculte amount of elapsed days since 01/01/2000
seconds = DIVC( ( DAYS_IN_YEAR * 3 + DAYS_IN_LEAP_YEAR ) * date->Year , 4 );
Expand Down
7 changes: 2 additions & 5 deletions src/boards/NucleoL152/rtc-board.c
Expand Up @@ -484,16 +484,13 @@ static uint64_t RtcGetCalendarValue( RTC_DateTypeDef* date, RTC_TimeTypeDef* tim
uint32_t correction;
uint32_t seconds;

// Get Time and Date
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );

// Make sure it is correct due to asynchronus nature of RTC
do
{
firstRead = time->SubSeconds;
firstRead = RTC->SSR;
HAL_RTC_GetDate( &RtcHandle, date, RTC_FORMAT_BIN );
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );
}while( firstRead != time->SubSeconds );
}while( firstRead != RTC->SSR );

// Calculte amount of elapsed days since 01/01/2000
seconds = DIVC( ( DAYS_IN_YEAR * 3 + DAYS_IN_LEAP_YEAR ) * date->Year , 4 );
Expand Down
7 changes: 2 additions & 5 deletions src/boards/NucleoL476/rtc-board.c
Expand Up @@ -484,16 +484,13 @@ static uint64_t RtcGetCalendarValue( RTC_DateTypeDef* date, RTC_TimeTypeDef* tim
uint32_t correction;
uint32_t seconds;

// Get Time and Date
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );

// Make sure it is correct due to asynchronus nature of RTC
do
{
firstRead = time->SubSeconds;
firstRead = RTC->SSR;
HAL_RTC_GetDate( &RtcHandle, date, RTC_FORMAT_BIN );
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );
}while( firstRead != time->SubSeconds );
}while( firstRead != RTC->SSR );

// Calculte amount of elapsed days since 01/01/2000
seconds = DIVC( ( DAYS_IN_YEAR * 3 + DAYS_IN_LEAP_YEAR ) * date->Year , 4 );
Expand Down
7 changes: 2 additions & 5 deletions src/boards/SKiM880B/rtc-board.c
Expand Up @@ -484,16 +484,13 @@ static uint64_t RtcGetCalendarValue( RTC_DateTypeDef* date, RTC_TimeTypeDef* tim
uint32_t correction;
uint32_t seconds;

// Get Time and Date
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );

// Make sure it is correct due to asynchronus nature of RTC
do
{
firstRead = time->SubSeconds;
firstRead = RTC->SSR;
HAL_RTC_GetDate( &RtcHandle, date, RTC_FORMAT_BIN );
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );
}while( firstRead != time->SubSeconds );
}while( firstRead != RTC->SSR );

// Calculte amount of elapsed days since 01/01/2000
seconds = DIVC( ( DAYS_IN_YEAR * 3 + DAYS_IN_LEAP_YEAR ) * date->Year , 4 );
Expand Down
7 changes: 2 additions & 5 deletions src/boards/SKiM881AXL/rtc-board.c
Expand Up @@ -485,16 +485,13 @@ static uint64_t RtcGetCalendarValue( RTC_DateTypeDef* date, RTC_TimeTypeDef* tim
uint32_t correction;
uint32_t seconds;

// Get Time and Date
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );

// Make sure it is correct due to asynchronus nature of RTC
do
{
firstRead = time->SubSeconds;
firstRead = RTC->SSR;
HAL_RTC_GetDate( &RtcHandle, date, RTC_FORMAT_BIN );
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );
}while( firstRead != time->SubSeconds );
}while( firstRead != RTC->SSR );

// Calculte amount of elapsed days since 01/01/2000
seconds = DIVC( ( DAYS_IN_YEAR * 3 + DAYS_IN_LEAP_YEAR ) * date->Year , 4 );
Expand Down
7 changes: 2 additions & 5 deletions src/boards/SKiM980A/rtc-board.c
Expand Up @@ -484,16 +484,13 @@ static uint64_t RtcGetCalendarValue( RTC_DateTypeDef* date, RTC_TimeTypeDef* tim
uint32_t correction;
uint32_t seconds;

// Get Time and Date
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );

// Make sure it is correct due to asynchronus nature of RTC
do
{
firstRead = time->SubSeconds;
firstRead = RTC->SSR;
HAL_RTC_GetDate( &RtcHandle, date, RTC_FORMAT_BIN );
HAL_RTC_GetTime( &RtcHandle, time, RTC_FORMAT_BIN );
}while( firstRead != time->SubSeconds );
}while( firstRead != RTC->SSR );

// Calculte amount of elapsed days since 01/01/2000
seconds = DIVC( ( DAYS_IN_YEAR * 3 + DAYS_IN_LEAP_YEAR ) * date->Year , 4 );
Expand Down

0 comments on commit 9e1d7f7

Please sign in to comment.