Microchip® Advanced Software Framework

pds_interface.c File Reference

This is the PDS interface source file which has had implimentations for all public API's.

Copyright (c) 2019 Microchip Technology Inc. and its subsidiaries.

#include "pds_interface.h"
#include "pds_common.h"
#include "pds_task_handler.h"
#include "pds_wl.h"

Functions

PdsStatus_t PDS_Delete (PdsFileItemIdx_t pdsFileItemIdx, uint8_t item)
 This function will set the delete operation for the item in the file mask. More...
 
PdsStatus_t PDS_DeleteAll (void)
 This function will erase all the items stored in the PDS. More...
 
PdsStatus_t PDS_Init (void)
 Initializes the PDS. More...
 
bool PDS_IsRestorable (void)
 This function checks if all the registered files are restorable. More...
 
PdsStatus_t PDS_RegFile (PdsFileItemIdx_t argFileId, PdsFileMarks_t argFileMarks)
 This function registers a file to the PDS. More...
 
PdsStatus_t PDS_Restore (PdsFileItemIdx_t pdsFileItemIdx, uint8_t item)
 This function will restore an item from PDS to RAM. More...
 
PdsStatus_t PDS_RestoreAll (void)
 This function will restore all the items from the PDS to RAM from all registered files. More...
 
PdsStatus_t PDS_Store (PdsFileItemIdx_t pdsFileItemIdx, uint8_t item)
 This function will set the store operation bit in the file marks for the item in PDS. More...
 
PdsStatus_t PDS_StoreAll (void)
 This function will set the store operation to all the items stored in all the registered files in PDS. More...
 
PdsStatus_t PDS_UnInit (void)
 Disables storing to PDS. More...
 
PdsStatus_t PDS_UnRegFile (PdsFileItemIdx_t argFileId)
 This function registers a file to the PDS. More...
 

Variables

PdsFileMarks_t fileMarks [PDS_MAX_FILE_IDX]
 
bool isFileSet [PDS_MAX_FILE_IDX]
 
static bool pdsUnInitFlag = false
 

PdsStatus_t PDS_Delete ( PdsFileItemIdx_t  pdsFileItemIdx,
uint8_t  item 
)

This function will set the delete operation for the item in the file mask.

This function will set the delete operation for the item in the filemask.

Parameters
[in]pdsFileItemIdx- The file id to register file to PDS.
[in]item- The item id of the item in PDS.
[out]status- The return status of the function's operation of type PdsStatus_t.

References _PdsFileMarks::fileMarkListAddr, isFileSet, PDS_INVLIAD_FILE_IDX, PDS_MAX_FILE_IDX, PDS_OK, PDS_OP_DELETE, PDS_STORE_DELETE_TASK_ID, pdsPostTask(), and pdsUnInitFlag.

PdsStatus_t PDS_DeleteAll ( void  )

This function will erase all the items stored in the PDS.

Parameters
[out]status- The return status of the function's operation.

References PDS_OK, pdsUnInitFlag, and pdsWlDeleteAll().

Referenced by enddevice_cpc_execute_command(), and processRunDemoApp().

PdsStatus_t PDS_Init ( void  )

Initializes the PDS.

Parameters
[in]none
[out]status- The return status of the function's operation of type PdsStatus_t.

References PDS_OK, pdsUnInitFlag, and pdsWlInit().

bool PDS_IsRestorable ( void  )

This function checks if all the registered files are restorable.

Parameters
[out]status- The return status of the function's operation.

References isFileFound(), PDS_MAX_FILE_IDX, and pdsUnInitFlag.

Referenced by mote_demo_init().

PdsStatus_t PDS_RegFile ( PdsFileItemIdx_t  argFileId,
PdsFileMarks_t  argFileMarks 
)

This function registers a file to the PDS.

Parameters
[in]argFileId- The file id to register file to PDS.
[out]status- The return status of the function's operation of type PdsStatus_t.

References PDS_INVLIAD_FILE_IDX, PDS_MAX_FILE_IDX, PDS_OK, and pdsUnInitFlag.

Referenced by LORAReg_InitAS(), LORAReg_InitAU(), LORAReg_InitEU(), LORAReg_InitIN(), LORAReg_InitJP(), LORAReg_InitKR(), and LORAReg_InitNA().

PdsStatus_t PDS_Restore ( PdsFileItemIdx_t  pdsFileItemIdx,
uint8_t  item 
)

This function will restore an item from PDS to RAM.

Parameters
[in]pdsFileItemIdx- The file id to register file to PDS.
[in]item- The item id of the item in PDS.
[out]status- The return status of the function's operation of type PdsStatus_t.

References buffer, _ItemHeader::delete, _ItemMap::itemId, _ItemMap::itemOffset, _PdsNvm_t::NVM_Struct, PDS_INVLIAD_FILE_IDX, PDS_ITEM_DELETED, PDS_NOT_FOUND, PDS_OK, _PdsNvm_t::_NVM_Struct::pdsNvmData, pdsUnInitFlag, _PdsWl_t::_WL_Struct::pdsWlData, pdsWlRead(), ptr, _ItemMap::ramAddress, _ItemMap::size, and _PdsWl_t::WL_Struct.

PdsStatus_t PDS_RestoreAll ( void  )
PdsStatus_t PDS_Store ( PdsFileItemIdx_t  pdsFileItemIdx,
uint8_t  item 
)

This function will set the store operation bit in the file marks for the item in PDS.

This function will set the store operation bit in the filemarks for the item in PDS.

Parameters
[in]pdsFileItemIdx- The file id to register file to PDS.
[in]item- The item id of the item in PDS.
[out]status- The return status of the function's operation of type PdsStatus_t.

References _PdsFileMarks::fileMarkListAddr, isFileSet, PDS_INVLIAD_FILE_IDX, PDS_MAX_FILE_IDX, PDS_OK, PDS_OP_STORE, PDS_STORE_DELETE_TASK_ID, pdsPostTask(), and pdsUnInitFlag.

PdsStatus_t PDS_StoreAll ( void  )

This function will set the store operation to all the items stored in all the registered files in PDS.

Parameters
[in]none
[out]status- The return status of the function's operation of type PdsStatus_t.

References _PdsFileMarks::fileMarkListAddr, isFileSet, _PdsFileMarks::numItems, PDS_MAX_FILE_IDX, PDS_OK, PDS_OP_STORE, PDS_STORE_DELETE_TASK_ID, pdsPostTask(), and pdsUnInitFlag.

Referenced by demo_joindata_callback().

PdsStatus_t PDS_UnInit ( void  )

Disables storing to PDS.

Parameters
[in]none
[out]status- The return status of the function's operation of type PdsStatus_t.

References PDS_OK, and pdsUnInitFlag.

PdsStatus_t PDS_UnRegFile ( PdsFileItemIdx_t  argFileId)

This function registers a file to the PDS.

This function un-registers a file to the PDS.

Parameters
[in]argFileId- The file id to register file to PDS.
[out]status- The return status of the function's operation of type PdsStatus_t.

References PDS_INVLIAD_FILE_IDX, PDS_MAX_FILE_IDX, PDS_OK, and pdsUnInitFlag.

Referenced by LORAREG_UnInit().