Microchip® Advanced Software Framework

pds_interface.h File Reference
#include "compiler.h"

Data Structures

struct  _ItemHeader
 
struct  _ItemMap
 
struct  _PdsFileMarks
 

Macros

#define DECLARE_ITEM(RAMADDR, FILEID, ITEMID, SIZE, MEMOFFSET)   {.ramAddress = RAMADDR, .fileId = FILEID, .itemId = (ITEMID & 0xFF), .size = SIZE, .itemOffset = MEMOFFSET}
 
#define ITEM_HERADER_MAGIC_NUM   0xa5
 
#define PDS_DELETE(item)
 
#define PDS_FILE_START_OFFSET   0x00
 
#define PDS_FILES_VERSION   0x01
 
#define PDS_MAGIC   0xa5
 
#define PDS_NVM_VERSION   0x01
 
#define PDS_RESTORE(item)
 
#define PDS_SIZE_OF_ITEM_HDR   sizeof(ItemHeader_t)
 
#define PDS_STORE(item)
 
#define PDS_WL_VERSION   0x01
 

Typedefs

typedef struct _ItemHeader ItemHeader_t
 
typedef struct _ItemMap ItemMap_t
 
typedef enum _PdsFileItemIdx PdsFileItemIdx_t
 
typedef struct _PdsFileMarks PdsFileMarks_t
 
typedef enum _PdsOperations PdsOperations_t
 
typedef enum _PdsStatus PdsStatus_t
 

Enumerations

enum  _PdsFileItemIdx {
  PDS_FILE_MAC_01_IDX = 0U,
  PDS_FILE_MAC_02_IDX,
  PDS_FILE_REG_NA_03_IDX,
  PDS_FILE_REG_EU868_04_IDX,
  PDS_FILE_REG_AS_05_IDX,
  PDS_FILE_REG_KR_06_IDX,
  PDS_FILE_REG_IND_07_IDX,
  PDS_FILE_REG_JPN_08_IDX,
  PDS_FILE_REG_AU_09_IDX,
  PDS_FILE_REG_KR2_10_IDX,
  PDS_FILE_REG_JPN2_11_IDX,
  PDS_FILE_REG_EU868_12_IDX,
  PDS_FILE_APP_DATA1_13_IDX,
  PDS_MAX_FILE_IDX
}
 
enum  _PdsOperations {
  PDS_OP_NONE = 0x00,
  PDS_OP_STORE = 0x01,
  PDS_OP_DELETE = 0x02
}
 
enum  _PdsStatus {
  PDS_OK = 0,
  PDS_CRC_ERROR,
  PDS_ERROR,
  PDS_NOT_FOUND,
  PDS_NOT_ENOUGH_MEMORY,
  PDS_INVLIAD_FILE_IDX,
  PDS_ITEM_DELETED
}
 

Functions

PdsStatus_t PDS_Delete (PdsFileItemIdx_t pdsFileItemIdx, uint8_t item)
 This function will set the delete operation for the item in the filemask. 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 filemarks 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 un-registers a file to the PDS. More...
 

#define DECLARE_ITEM (   RAMADDR,
  FILEID,
  ITEMID,
  SIZE,
  MEMOFFSET 
)    {.ramAddress = RAMADDR, .fileId = FILEID, .itemId = (ITEMID & 0xFF), .size = SIZE, .itemOffset = MEMOFFSET}
#define ITEM_HERADER_MAGIC_NUM   0xa5
#define PDS_DELETE (   item)
Value:
do { \
PdsFileItemIdx_t file = item >> 8; \
uint8_t itemNum = (uint8_t)item & 0xFF; \
PDS_Delete(file, itemNum); \
} while(0)
enum _PdsFileItemIdx PdsFileItemIdx_t
PdsStatus_t PDS_Delete(PdsFileItemIdx_t pdsFileItemIdx, uint8_t item)
This function will set the delete operation for the item in the filemask.
Definition: pds_interface.c:210
#define PDS_FILE_START_OFFSET   0x00
#define PDS_FILES_VERSION   0x01

Referenced by pdsStoreDelete().

#define PDS_MAGIC   0xa5

Referenced by pdsStoreDelete(), and pdsWlWrite().

#define PDS_NVM_VERSION   0x01

Referenced by pdsNvmWrite().

#define PDS_RESTORE (   item)
Value:
do { \
PdsFileItemIdx_t file = item >> 8; \
uint8_t itemNum = (uint8_t)item & 0xFF; \
PDS_Restore(file, itemNum); \
} while(0)
enum _PdsFileItemIdx PdsFileItemIdx_t
PdsStatus_t PDS_Restore(PdsFileItemIdx_t pdsFileItemIdx, uint8_t item)
This function will restore an item from PDS to RAM.
Definition: pds_interface.c:143
#define PDS_SIZE_OF_ITEM_HDR   sizeof(ItemHeader_t)
#define PDS_STORE (   item)
Value:
do { \
PdsFileItemIdx_t file = item >> 8; \
uint8_t itemNum = (uint8_t)(item & 0x00FF);\
PDS_Store(file, itemNum); \
} while(0)
enum _PdsFileItemIdx PdsFileItemIdx_t
PdsStatus_t PDS_Store(PdsFileItemIdx_t pdsFileItemIdx, uint8_t item)
This function will set the store operation bit in the filemarks for the item in PDS.
Definition: pds_interface.c:105

Referenced by Enableallchannels(), GetTxChannelConfig1(), LORAReg_InitAS(), setDataRange(), setDataRangeT2(), setDefaultTxPower(), setDlFrequency(), setDutyCycle(), setEnableAllChs(), setFrequency(), setJoinSuccess(), UpdateChannelIdStatus(), UpdateChannelIdStatusT2(), UpdateChannelIdStatusT3(), and UpdateChannelIdStatusT4().

#define PDS_WL_VERSION   0x01

Referenced by pdsWlWrite().

typedef struct _ItemHeader ItemHeader_t
typedef struct _ItemMap ItemMap_t
typedef struct _PdsFileMarks PdsFileMarks_t
typedef enum _PdsStatus PdsStatus_t

Enumerator
PDS_FILE_MAC_01_IDX 
PDS_FILE_MAC_02_IDX 
PDS_FILE_REG_NA_03_IDX 
PDS_FILE_REG_EU868_04_IDX 
PDS_FILE_REG_AS_05_IDX 
PDS_FILE_REG_KR_06_IDX 
PDS_FILE_REG_IND_07_IDX 
PDS_FILE_REG_JPN_08_IDX 
PDS_FILE_REG_AU_09_IDX 
PDS_FILE_REG_KR2_10_IDX 
PDS_FILE_REG_JPN2_11_IDX 
PDS_FILE_REG_EU868_12_IDX 
PDS_FILE_APP_DATA1_13_IDX 
PDS_MAX_FILE_IDX 
Enumerator
PDS_OP_NONE 
PDS_OP_STORE 
PDS_OP_DELETE 
enum _PdsStatus
Enumerator
PDS_OK 
PDS_CRC_ERROR 
PDS_ERROR 
PDS_NOT_FOUND 
PDS_NOT_ENOUGH_MEMORY 
PDS_INVLIAD_FILE_IDX 
PDS_ITEM_DELETED 

PdsStatus_t PDS_Delete ( PdsFileItemIdx_t  pdsFileItemIdx,
uint8_t  item 
)

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

Parameters
[in]pdsFileItemIdx- The file id to regsiter 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.

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 regsiter 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.
[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 filemarks for the item in PDS.

Parameters
[in]pdsFileItemIdx- The file id to regsiter 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.

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 un-registers a file to the PDS.

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

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().