NXP NFC Reader Library  v4.040.05.011646
Platform Component

These Components implement the Platform abstraction layer. More...

Collaboration diagram for Platform Component:

Data Structures

struct  phPlatform_DataParams_t
 OSAL parameter structure. More...
 

Macros

#define PH_PLATFORM_SET_HIGH   1
 Logic High. More...
 
#define PH_PLATFORM_SET_LOW   0
 Logic Low. More...
 
#define PH_PLATFORM_MAX_TIMERS   4U
 Maximum number of timers available. More...
 

Typedefs

typedef void(* pphPlatform_TickTimerISRCallBck_t) (void)
 Tick Timer ISR callback which will be called by ISR handler implementation in Platform Layer. More...
 
typedef void(* pphPlatform_CallBck_t) (uint8_t bTimerId)
 Timer callback interface which will be called once registered timer timeout expires. More...
 
typedef enum phPlatform_Timer_Status phPlatform_Timer_Status_t
 Status of the timer.
 

Enumerations

enum  phPlatform_Timer_Status { E_TIMER_FREE = 0, E_TIMER_ACTIVE, E_TIMER_RUNNING, E_TIMER_STOPPED }
 Status of the timer. More...
 

Functions

phStatus_t phPlatform_Init (phPlatform_DataParams_t *pDataParams, uint8_t *pTxBuffer, uint16_t wTxBufSize, uint8_t *pRxBuffer, uint16_t wRxBufSize)
 Initializes the Platform component. More...
 
phStatus_t phPlatform_DeInit (phPlatform_DataParams_t *pDataParams)
 De-initialize the Platform component. More...
 
void phPlatform_FE_Reset (void)
 Performs Front-end reset. More...
 
void phPlatform_FE_Powerdown (void)
 Performs Front-end power-down. More...
 
void phPlatform_EnterCriticalSection (void)
 Enter critical section. More...
 
void phPlatform_ExitCriticalSection (void)
 Exit critical section. More...
 
uint32_t phPlatform_Is_Irq_Context (void)
 Returns whether Controller is in ISR mode or NOT. More...
 
void phPlatform_Sleep (void)
 Enter sleep mode. More...
 
void phPlatform_WakeUp (void)
 Exit sleep mode. More...
 
phStatus_t phPlatform_Timer_Init (phPlatform_DataParams_t *pDataParams)
 Initializes the Timer component. More...
 
void phPlatform_Timer_Create (phPlatform_DataParams_t *pDataParams, uint32_t dwUnits, phPlatform_Timer_Struct_t **ppTimerHandle)
 Allocates a free timer. More...
 
phStatus_t phPlatform_Timer_Configure (phPlatform_Timer_Struct_t *pTimerHandle, uint32_t dwTimePeriod, pphPlatform_CallBck_t pCallBackFunc)
 This API configures the acquired timer with timeout duration and callback to be called upon timer expire. More...
 
phStatus_t phPlatform_Timer_Start (phPlatform_Timer_Struct_t *pTimerHandle, uint16_t wOption)
 Start the timer. More...
 
phStatus_t phPlatform_Timer_GetElapsedDelay (phPlatform_Timer_Struct_t *pTimerHandle, uint32_t *dwGetElapsedDelay)
 Get Elapsed Delay from timer which is created and started before calling this API. More...
 
phStatus_t phPlatform_Timer_Stop (phPlatform_Timer_Struct_t *pTimerHandle)
 Stop the timer. More...
 
phStatus_t phPlatform_Timer_Reset (phPlatform_Timer_Struct_t *pTimerHandle)
 Resets the timer allocated to the application which is created by phPlatform_Timer_Create. More...
 
phStatus_t phPlatform_Timer_Delete (phPlatform_Timer_Struct_t *pTimerHandle)
 Delete or Deallocate the timer. More...
 
void phPlatform_Timer_DeInit (phPlatform_DataParams_t *pDataParams)
 DeInitializes the Timer component. More...
 
void phPlatform_Controller_Init (void)
 Initialize Controller related IPs or clock. More...
 

Platform Ports

#define PH_PLATFORM_PORT0   0
 Platform Host Port Abstraction for Port0. More...
 
#define PH_PLATFORM_PORT1   1
 Platform Host Port Abstraction for Port1. More...
 
#define PH_PLATFORM_PORT2   2
 Platform Host Port Abstraction for Port2. More...
 
#define PH_PLATFORM_PORT3   3
 Platform Host Port Abstraction for Port3. More...
 
#define PH_PLATFORM_PORT4   4
 Platform Host Port Abstraction for Port4. More...
 

Timer Configuration

#define PH_PLATFORM_TIMER_SINGLE_SHOT   0x0000U
 On Timer expire it will be Stopped and Timercallback will be called. More...
 
#define PH_PLATFORM_TIMER_FREE_RUN   0x0001U
 Auto reloads on expire of the Timer and Timercallback will be called. More...
 

Timer Units

#define PH_PLATFORM_TIMER_UNIT_US   1000000U
 Indicates that the specified delay is in microseconds. More...
 
#define PH_PLATFORM_TIMER_UNIT_MS   1000U
 Indicates that the specified delay is in milliseconds. More...
 
#define PH_PLATFORM_TIMER_UNIT_S   1U
 Indicates that the specified delay is in seconds. More...
 

Detailed Description

These Components implement the Platform abstraction layer.

Macro Definition Documentation

§ PH_PLATFORM_PORT0

#define PH_PLATFORM_PORT0   0

Platform Host Port Abstraction for Port0.

§ PH_PLATFORM_PORT1

#define PH_PLATFORM_PORT1   1

Platform Host Port Abstraction for Port1.

§ PH_PLATFORM_PORT2

#define PH_PLATFORM_PORT2   2

Platform Host Port Abstraction for Port2.

§ PH_PLATFORM_PORT3

#define PH_PLATFORM_PORT3   3

Platform Host Port Abstraction for Port3.

§ PH_PLATFORM_PORT4

#define PH_PLATFORM_PORT4   4

Platform Host Port Abstraction for Port4.

§ PH_PLATFORM_SET_HIGH

#define PH_PLATFORM_SET_HIGH   1

Logic High.

§ PH_PLATFORM_SET_LOW

#define PH_PLATFORM_SET_LOW   0

Logic Low.

§ PH_PLATFORM_MAX_TIMERS

#define PH_PLATFORM_MAX_TIMERS   4U

Maximum number of timers available.

§ PH_PLATFORM_TIMER_SINGLE_SHOT

#define PH_PLATFORM_TIMER_SINGLE_SHOT   0x0000U

On Timer expire it will be Stopped and Timercallback will be called.

§ PH_PLATFORM_TIMER_FREE_RUN

#define PH_PLATFORM_TIMER_FREE_RUN   0x0001U

Auto reloads on expire of the Timer and Timercallback will be called.

§ PH_PLATFORM_TIMER_UNIT_US

#define PH_PLATFORM_TIMER_UNIT_US   1000000U

Indicates that the specified delay is in microseconds.

§ PH_PLATFORM_TIMER_UNIT_MS

#define PH_PLATFORM_TIMER_UNIT_MS   1000U

Indicates that the specified delay is in milliseconds.

§ PH_PLATFORM_TIMER_UNIT_S

#define PH_PLATFORM_TIMER_UNIT_S   1U

Indicates that the specified delay is in seconds.

Typedef Documentation

§ pphPlatform_TickTimerISRCallBck_t

typedef void(* pphPlatform_TickTimerISRCallBck_t) (void)

Tick Timer ISR callback which will be called by ISR handler implementation in Platform Layer.

Return values
None

§ pphPlatform_CallBck_t

typedef void(* pphPlatform_CallBck_t) (uint8_t bTimerId)

Timer callback interface which will be called once registered timer timeout expires.

Parameters
[in]TimerIdTimer Id for which callback is called.
Return values
None

Enumeration Type Documentation

§ phPlatform_Timer_Status

Status of the timer.

Enumerator
E_TIMER_FREE 

E_TIMER_FREE.

E_TIMER_ACTIVE 

E_TIMER_ACTIVE.

E_TIMER_RUNNING 

E_TIMER_RUNNING.

E_TIMER_STOPPED 

E_TIMER_STOPPED.

Function Documentation

§ phPlatform_Init()

phStatus_t phPlatform_Init ( phPlatform_DataParams_t pDataParams,
uint8_t pTxBuffer,
uint16_t  wTxBufSize,
uint8_t pRxBuffer,
uint16_t  wRxBufSize 
)

Initializes the Platform component.

a. Performs Front-end initialization required to configure reset pins and interrupt pins of Controller connected to a particular front-end. b. Initialize BAL. c. Initialize OSAL. d. Initialize HAL. e. Initialize Platform Timers.

Parameters
[in]pDataParamsData parameters representing this component. Application allocates this Data structure and passes the pointer of the same.
[in]pISRCallBackApplication callback that needs to be called by RF ISR Handler.
[in]pTxBufferPointer to application allocated transmit buffer used by the phhalHw functions.
[in]wTxBufSizeSize of the application allocated transmit buffer.
[in]pRxBufferPointer to application allocated receive buffer used by the phhalHw functions.
[in]wRxBufSizeSize of the application allocated receive buffer. Specify the buffer+1 byte, because one byte is reserved for SPI communication.
Returns
Status of the API
Return values
PH_ERR_SUCCESSOperation successful.

§ phPlatform_DeInit()

phStatus_t phPlatform_DeInit ( phPlatform_DataParams_t pDataParams)

De-initialize the Platform component.

a. Performs Front-end power down. b. De-initialize HAL.

Parameters
[in]pDataParamsData parameters representing this component.
Returns
Status of the API
Return values
PH_ERR_SUCCESSOperation successful.

§ phPlatform_FE_Reset()

void phPlatform_FE_Reset ( void  )

Performs Front-end reset.

When this API is called a pulse will be triggered on "NRSTPD" PIN (Not Reset and Power Down) to reset front-end device.

Returns
void

§ phPlatform_FE_Powerdown()

void phPlatform_FE_Powerdown ( void  )

Performs Front-end power-down.

When this API is called a "NRSTPD" PIN (Not Reset and Power Down) will be configured to power-down the front-end device.

Returns
void

§ phPlatform_EnterCriticalSection()

void phPlatform_EnterCriticalSection ( void  )

Enter critical section.

Returns
void

§ phPlatform_ExitCriticalSection()

void phPlatform_ExitCriticalSection ( void  )

Exit critical section.

Returns
void

§ phPlatform_Is_Irq_Context()

uint32_t phPlatform_Is_Irq_Context ( void  )

Returns whether Controller is in ISR mode or NOT.

Returns
uint32_t 0-> Controller is NOT in ISR handler mode, Non-zero to indicate ISR mode.

§ phPlatform_Sleep()

void phPlatform_Sleep ( void  )

Enter sleep mode.

Returns
void

§ phPlatform_WakeUp()

void phPlatform_WakeUp ( void  )

Exit sleep mode.

Returns
void

§ phPlatform_Timer_Init()

phStatus_t phPlatform_Timer_Init ( phPlatform_DataParams_t pDataParams)

Initializes the Timer component.

Note
This Api must be called before calling any other Timer Api.
Parameters
[in]pDataParamsPointer to this layers parameter structure.
Returns
Status of the API
Return values
PH_ERR_SUCCESSOperation successful.

§ phPlatform_Timer_Create()

void phPlatform_Timer_Create ( phPlatform_DataParams_t pDataParams,
uint32_t  dwUnits,
phPlatform_Timer_Struct_t **  ppTimerHandle 
)

Allocates a free timer.

Parameters
[in]pDataParamsPointer to this layers parameter structure.
[in]dwUnitsTimer tick units.
[out]ppTimerHandleTimer handle in case of success else NULL.
Returns
void

§ phPlatform_Timer_Configure()

phStatus_t phPlatform_Timer_Configure ( phPlatform_Timer_Struct_t *  pTimerHandle,
uint32_t  dwTimePeriod,
pphPlatform_CallBck_t  pCallBackFunc 
)

This API configures the acquired timer with timeout duration and callback to be called upon timer expire.

Parameters
[in]pTimerHandleTimer handle returned by phPlatform_Timer_Create.
[in]dwTimePeriodTime delay count.
[in]pCallBackFuncCallback to be called on time out.
Returns
Status of the API
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_PARAMETERInvalid input parameter.
PH_ERR_PARAMETER_OVERFLOWIf timer cannot be configured to the provide time by parameter dwTimePeriod.

§ phPlatform_Timer_Start()

phStatus_t phPlatform_Timer_Start ( phPlatform_Timer_Struct_t *  pTimerHandle,
uint16_t  wOption 
)

Start the timer.

Parameters
[in]pTimerHandleTimer handle returned by phPlatform_Timer_Create.
[in]wOptionParameter to mention Single shot PH_PLATFORM_TIMER_SINGLE_SHOT or Free running timer PH_PLATFORM_TIMER_FREE_RUN.
Returns
Status of the API
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_PARAMETERInvalid input parameter.
PH_ERR_RESOURCE_ERRORTimer could not be started.

§ phPlatform_Timer_GetElapsedDelay()

phStatus_t phPlatform_Timer_GetElapsedDelay ( phPlatform_Timer_Struct_t *  pTimerHandle,
uint32_t dwGetElapsedDelay 
)

Get Elapsed Delay from timer which is created and started before calling this API.

Parameters
[in]pTimerHandleTimer handle returned by phPlatform_Timer_Create.
[out]dwGetElapsedDelayMeasured Delay after Timer Start in sec/milli/micro seconds based on input option.
Returns
Status of the API
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_PARAMETERInvalid input parameter.

§ phPlatform_Timer_Stop()

phStatus_t phPlatform_Timer_Stop ( phPlatform_Timer_Struct_t *  pTimerHandle)

Stop the timer.

Parameters
[in]pTimerHandleTimer handle returned by phPlatform_Timer_Create.
Returns
Status of the API
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_PARAMETERInvalid input parameter.
PH_ERR_RESOURCE_ERRORTimer could not be stopped.

§ phPlatform_Timer_Reset()

phStatus_t phPlatform_Timer_Reset ( phPlatform_Timer_Struct_t *  pTimerHandle)

Resets the timer allocated to the application which is created by phPlatform_Timer_Create.

Parameters
[in]pTimerHandleTimer handle returned by phPlatform_Timer_Create.
Returns
Status of the API
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_PARAMETERInvalid input parameter.
PH_ERR_RESOURCE_ERRORTimer could not be stopped.

§ phPlatform_Timer_Delete()

phStatus_t phPlatform_Timer_Delete ( phPlatform_Timer_Struct_t *  pTimerHandle)

Delete or Deallocate the timer.

Parameters
[in]pTimerHandleTimer handle returned by phPlatform_Timer_Create.
Returns
Status of the API
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_PARAMETERInvalid input parameter.
PH_ERR_RESOURCE_ERRORTimer could not be stopped.

§ phPlatform_Timer_DeInit()

void phPlatform_Timer_DeInit ( phPlatform_DataParams_t pDataParams)

DeInitializes the Timer component.

Parameters
[in]pDataParamsPointer to this layers parameter structure.
Returns
void

§ phPlatform_Controller_Init()

void phPlatform_Controller_Init ( void  )

Initialize Controller related IPs or clock.

Returns
void