Microchip® Advanced Software Framework

pds_task_handler.c File Reference

This is the Pds Driver Task Manager source file which contains Pds task scheduler.

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

#include "system_task_manager.h"
#include "pds_interface.h"
#include "pds_common.h"
#include "pds_task_handler.h"
#include "pds_wl.h"
#include "atomic.h"
#include <stdint.h>

Functions

SYSTEM_TaskStatus_t PDS_TaskHandler (void)
 PDS task handler. More...
 
void pdsClearTask (PdsTaskIds_t id)
 Clear task for PDS task manager. More...
 
void pdsPostTask (PdsTaskIds_t id)
 Set task for PDS task manager. More...
 
static PdsStatus_t pdsStoreDelete (PdsFileItemIdx_t pdsFileItemIdx, uint8_t *buffer)
 This function stores and deletes the items in a file based on file marks set. More...
 
static SYSTEM_TaskStatus_t pdsStoreDeleteHandler (void)
 This function checks if an operation is pending for a file and will initiate store/delete operation. More...
 

Variables

PdsFileMarks_t fileMarks []
 
bool isFileSet []
 
static volatile uint8_t pdsTaskFlags = 0x0000u
 pdsTaskFlags - 8-bit bitmap for the tasks of PDS layer. More...
 
static SYSTEM_TaskStatus_t(* pdsTaskHandlers [PDS_TASKS_COUNT])(void)
 Array of pds task handlers. More...
 

SYSTEM_TaskStatus_t PDS_TaskHandler ( void  )

PDS task handler.

This function is called to process pds task. SHOULD be defined in PDS.

References ATOMIC_SECTION_ENTER, ATOMIC_SECTION_EXIT, PDS_TASK_ID, PDS_TASKS_COUNT, pdsTaskFlags, pdsTaskHandlers, SYSTEM_PostTask(), and SYSTEM_TASK_SUCCESS.

void pdsClearTask ( PdsTaskIds_t  id)

Clear task for PDS task manager.

Parameters
[in]id- a single value from the type PdsTaskIds_t

References ATOMIC_SECTION_ENTER, ATOMIC_SECTION_EXIT, and pdsTaskFlags.

void pdsPostTask ( PdsTaskIds_t  id)

Set task for PDS task manager.

Parameters
[in]id- a single value from the type PdsTaskIds_t

References ATOMIC_SECTION_ENTER, ATOMIC_SECTION_EXIT, PDS_TASK_ID, pdsTaskFlags, and SYSTEM_PostTask().

Referenced by PDS_Delete(), PDS_Store(), PDS_StoreAll(), and pdsStoreDeleteHandler().

static PdsStatus_t pdsStoreDelete ( PdsFileItemIdx_t  pdsFileItemIdx,
uint8_t *  buffer 
)
static

This function stores and deletes the items in a file based on file marks set.

Parameters
[in]pdsFileItemIdx- The file id to look for.
[in]buffer- The buffer to be used for reading and writing a file.
[out]status- The return status of the function's operation of type PdsStatus_t.

References _ItemHeader::delete, _PdsFileMarks::fileMarkListAddr, _ItemHeader::itemId, _ItemMap::itemId, _ItemMap::itemOffset, _ItemHeader::magic, _PdsFileMarks::numItems, PDS_FILES_VERSION, PDS_MAGIC, PDS_NOT_FOUND, PDS_OK, PDS_OP_DELETE, PDS_OP_NONE, PDS_OP_STORE, PDS_WL_DATA_SIZE, pdsWlRead(), pdsWlWrite(), ptr, _ItemMap::ramAddress, _ItemHeader::size, _ItemMap::size, and _ItemHeader::version.

Referenced by pdsStoreDeleteHandler().

static SYSTEM_TaskStatus_t pdsStoreDeleteHandler ( void  )
static

This function checks if an operation is pending for a file and will initiate store/delete operation.

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

References buffer, isFileSet, PDS_FILE_MAC_01_IDX, PDS_MAX_FILE_IDX, PDS_OK, PDS_STORE_DELETE_TASK_ID, pdsPostTask(), pdsStoreDelete(), and SYSTEM_TASK_SUCCESS.

PdsFileMarks_t fileMarks[]
volatile uint8_t pdsTaskFlags = 0x0000u
static

pdsTaskFlags - 8-bit bitmap for the tasks of PDS layer.

Referenced by PDS_TaskHandler(), pdsClearTask(), and pdsPostTask().

SYSTEM_TaskStatus_t(* pdsTaskHandlers[PDS_TASKS_COUNT])(void)
static
Initial value:
= {
}
static SYSTEM_TaskStatus_t pdsStoreDeleteHandler(void)
This function checks if an operation is pending for a file and will initiate store/delete operation...
Definition: pds_task_handler.c:165

Array of pds task handlers.

Referenced by PDS_TaskHandler().