Renesas PTX1xxR IoT-Reader API (non-OS) Version 7.3.1
Renesas Software Stack for IoT-Reader Applications (non-OS)
ptxPLAT.h
Go to the documentation of this file.
1
49#ifndef COMPS_PLAT_PTXPLAT_H_
50#define COMPS_PLAT_PTXPLAT_H_
51
52
53/*
54 * ####################################################################################################################
55 * INCLUDES
56 * ####################################################################################################################
57 */
58#include "ptxStatus.h"
59#include <stddef.h>
60
61#ifdef __cplusplus
62extern "C" {
63#endif
64
65/*
66 * ####################################################################################################################
67 * DEFINES / TYPES
68 * ####################################################################################################################
69 */
70
79#define PTX_PLAT_TRX_FLAGS_I2C_RESTART_CONDITION 0x01
84struct ptxPlat;
85
89struct ptxPlatTimer;
90
95typedef void (*pptxPlat_RxCallBack_t) (void *ctx);
96
101typedef void (*pptxPlat_TimerCallBack_t) (void *ctx);
102
111
115#define PTX_PLAT_HOST_SPEED_I2C_100000 (100000UL)
116#define PTX_PLAT_HOST_SPEED_I2C_400000 (400000UL)
117#define PTX_PLAT_HOST_SPEED_I2C_1000000 (1000000UL)
118#define PTX_PLAT_HOST_SPEED_I2C_3400000 (3400000UL)
119#define PTX_PLAT_HOST_SPEED_I2C_MAX PTX_PLAT_HOST_SPEED_I2C_3400000
124#define PTX_PLAT_HOST_SPEED_UART_9600 (9600UL)
125#define PTX_PLAT_HOST_SPEED_UART_14400 (14400UL)
126#define PTX_PLAT_HOST_SPEED_UART_19200 (19200UL)
127#define PTX_PLAT_HOST_SPEED_UART_28800 (28800UL)
128#define PTX_PLAT_HOST_SPEED_UART_38400 (38400UL)
129#define PTX_PLAT_HOST_SPEED_UART_57600 (57600UL)
130#define PTX_PLAT_HOST_SPEED_UART_115200 (115200UL)
131#define PTX_PLAT_HOST_SPEED_UART_230400 (230400UL)
132#define PTX_PLAT_HOST_SPEED_UART_460800 (460800UL)
133#define PTX_PLAT_HOST_SPEED_UART_921600 (921600UL)
134#define PTX_PLAT_HOST_SPEED_UART_1843200 (1843200UL)
135#define PTX_PLAT_HOST_SPEED_UART_3000000 (3000000UL)
136#define PTX_PLAT_HOST_SPEED_UART_MAX PTX_PLAT_HOST_SPEED_UART_3000000
137#define PTX_PLAT_HOST_DEFAULT_UART_SPEED PTX_PLAT_HOST_SPEED_UART_115200
142#define PTX_PLAT_HOST_SPEED_SPI_1M (1000000UL)
143#define PTX_PLAT_HOST_SPEED_SPI_5M (5000000UL)
144#define PTX_PLAT_HOST_SPEED_SPI_10M (10000000UL)
145#define PTX_PLAT_HOST_SPEED_SPI_MAX PTX_PLAT_HOST_SPEED_SPI_10M
147#if defined (PTX_INTF_UART)
151#define PTX_PLAT_RXBUF_SIZE (256U)
153#endif
154
155/*
156 * ####################################################################################################################
157 * API FUNCTIONS (Mandatory Implementation)
158 * ####################################################################################################################
159 */
160
175ptxStatus_t ptxPLAT_AllocAndInit(struct ptxPlat **plat, struct ptxPLAT_ConfigPars *initParams);
176
177
188ptxStatus_t ptxPLAT_Deinit(struct ptxPlat *plat);
189
190
222ptxStatus_t ptxPLAT_TRx(struct ptxPlat *plat, uint8_t *txBuf[], size_t txLen[], size_t numTxBuffers, uint8_t *rxBuf[], size_t *rxLen[], size_t numRxBuffers, uint8_t flags);
223
224
233
234
247ptxStatus_t ptxPLAT_StartWaitForRx(struct ptxPlat *plat, pptxPlat_RxCallBack_t irqCb, void *ctxIrqCb);
248
249
259ptxStatus_t ptxPLAT_StopWaitForRx(struct ptxPlat *plat);
260
261
274ptxStatus_t ptxPLAT_Sleep(struct ptxPlat *plat, uint32_t sleep_ms);
275
276
284void ptxPLAT_DisableInterrupts (struct ptxPlat *plat);
285
286
294void ptxPLAT_EnableInterrupts (struct ptxPlat *plat);
295
305ptxStatus_t ptxPLAT_ResetChip (struct ptxPlat *plat);
306
307/*
308 * ####################################################################################################################
309 * API FUNCTIONS (Timer)
310 * ####################################################################################################################
311 */
312
313
326ptxStatus_t ptxPLAT_GetInitializedTimer(struct ptxPlat *plat, struct ptxPlatTimer **timer);
327
328
346ptxStatus_t ptxPLAT_TimerStart(struct ptxPlat *plat, struct ptxPlatTimer *timer, uint32_t ms, uint8_t isBlock, pptxPlat_TimerCallBack_t fnISRCb, void *ISRCxt);
347
348
360ptxStatus_t ptxPLAT_TimerIsElapsed(struct ptxPlat *plat, struct ptxPlatTimer *timer, uint8_t *isElapsed);
361
362
376ptxStatus_t ptxPLAT_TimerDeinit(struct ptxPlat *plat, struct ptxPlatTimer *timer);
377
378
387ptxStatus_t ptxPLAT_IsRxPending (struct ptxPlat *plat , uint8_t *isRxPending);
388
389
397ptxStatus_t ptxPLAT_TriggerRx(struct ptxPlat *plat);
398
399/*
400 * ####################################################################################################################
401 * API FUNCTIONS (Communication interface)
402 * ####################################################################################################################
403 */
404
418uint8_t ptxPLAT_CheckRxActive(struct ptxPlat *plat);
419
420#if defined (PTX_INTF_UART)
431ptxStatus_t ptxPLAT_SetIntfSpeed(struct ptxPlat *plat, uint32_t speed);
432
443uint32_t ptxPLAT_GetIntfSpeed(struct ptxPlat *plat);
444
454ptxStatus_t ptxPLAT_SetCleanStateRx (struct ptxPlat *plat);
455
467ptxStatus_t ptxPLAT_GetReceivedMessage (struct ptxPlat *plat, uint8_t *rxMessageBuffer, size_t *rxMessageBufferLen);
468#endif
469
470#ifdef __cplusplus
471}
472#endif
473
474#endif /* Guard */
475
ptxStatus_t ptxPLAT_TriggerRx(struct ptxPlat *plat)
It triggers Rx Operation from PTX100X (If rx operation pending)
ptxStatus_t ptxPLAT_ResetChip(struct ptxPlat *plat)
Resets PTX1K.
ptxStatus_t ptxPLAT_GetInitializedTimer(struct ptxPlat *plat, struct ptxPlatTimer **timer)
Get an initialized timer.
ptxStatus_t ptxPLAT_AllocAndInit(struct ptxPlat **plat, struct ptxPLAT_ConfigPars *initParams)
Allocate and initialize the PLAT context.
void(* pptxPlat_TimerCallBack_t)(void *ctx)
Callback function for Timer Interrupt.
Definition ptxPLAT.h:101
ptxStatus_t ptxPLAT_WaitForInterrupt(struct ptxPlat *plat)
Wait for any kind of interrupt to be triggered on the CPU. (Blocking)
ptxStatus_t ptxPLAT_Sleep(struct ptxPlat *plat, uint32_t sleep_ms)
Sleep software execution.
ptxStatus_t ptxPLAT_TRx(struct ptxPlat *plat, uint8_t *txBuf[], size_t txLen[], size_t numTxBuffers, uint8_t *rxBuf[], size_t *rxLen[], size_t numRxBuffers, uint8_t flags)
Send and receive content of multiple buffers through the physical interface to the PTX1K.
void ptxPLAT_DisableInterrupts(struct ptxPlat *plat)
Disable Interrupts.
ptxStatus_t ptxPLAT_TimerStart(struct ptxPlat *plat, struct ptxPlatTimer *timer, uint32_t ms, uint8_t isBlock, pptxPlat_TimerCallBack_t fnISRCb, void *ISRCxt)
Start timer for some milliseconds.
void ptxPLAT_EnableInterrupts(struct ptxPlat *plat)
Enable Interrupts.
uint8_t ptxPLAT_CheckRxActive(struct ptxPlat *plat)
Check if PLAT interface reception is taking place at the moment.
struct ptxPLAT_ConfigPars ptxPLAT_ConfigPars_t
Platform-specific parameter initializers.
void(* pptxPlat_RxCallBack_t)(void *ctx)
Callback function for IRQ triggered (asynchronously).
Definition ptxPLAT.h:95
ptxStatus_t ptxPLAT_TimerDeinit(struct ptxPlat *plat, struct ptxPlatTimer *timer)
De initialize the timer.
ptxStatus_t ptxPLAT_TimerIsElapsed(struct ptxPlat *plat, struct ptxPlatTimer *timer, uint8_t *isElapsed)
Get Elapse state of the timer.
ptxStatus_t ptxPLAT_Deinit(struct ptxPlat *plat)
De-initialize the PLAT context.
ptxStatus_t ptxPLAT_StopWaitForRx(struct ptxPlat *plat)
Stop the waiting for IRQ.
ptxStatus_t ptxPLAT_IsRxPending(struct ptxPlat *plat, uint8_t *isRxPending)
It checks if Rx Operation is pending from PTX100X.
ptxStatus_t ptxPLAT_StartWaitForRx(struct ptxPlat *plat, pptxPlat_RxCallBack_t irqCb, void *ctxIrqCb)
Start waiting for IRQ to be triggered.(Not-blocking)
uint16_t ptxStatus_t
Status Type.
Definition ptxStatus.h:70
Platform-specific parameter initializers.
Definition ptxPLAT.h:107
uint8_t DeviceAddress
Definition ptxPLAT.h:109
uint32_t Speed
Definition ptxPLAT.h:108