MTB CAT1 Peripheral driver library

General Description

Functions are used in the driver.

Functions

cy_en_btipcdrv_status_t Cy_BTIPC_Init (cy_stc_ipc_bt_context_t *btIpcContext, cy_stc_ipc_bt_config_t *btIpcConfig)
 This function initializes the Bluetooth IPC. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_WarmInit (cy_stc_ipc_bt_context_t *btIpcContext, cy_stc_ipc_bt_config_t *btIpcConfig)
 This function performs the warm initialization of the Bluetooth IPC. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_Deinit (cy_stc_ipc_bt_context_t *btIpcContext)
 This function de-initializes the Bluetooth IPC. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HCI_getPTI (cy_en_btipc_hcipti_t *pti, uint32_t *p_length, uint32_t *msgPtr)
 This function gets the payload type indicator and the length of the HCI packet received from BTSS. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HCI_Write (cy_stc_ipc_bt_context_t *btIpcContext, cy_en_btipc_hcipti_t pti, void *data, size_t length)
 This function sends the HCI packet form the BT stack to the BTSS. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HPC_Write (cy_stc_ipc_bt_context_t *btIpcContext, void *data, size_t length)
 This function sends the HPC packet form the MCU to the BTSS. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HCI_GetReadBufPtr (cy_stc_ipc_bt_context_t *btIpcContext, void **ppData, size_t *pLength)
 This function gets the pointer to the received HCI packet by MCU from BTSS. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HCI_GetWriteBufPtr (cy_stc_ipc_bt_context_t *btIpcContext, cy_en_btipc_hcipti_t pti, void **ppData, size_t length)
 This function gets the pointer to the buffer to write HCI packet to send to BTSS. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HPC_GetWriteBufPtr (cy_stc_ipc_bt_context_t *btIpcContext, void **ppData, size_t length)
 This function gets the pointer to the buffer to write HPC long message packet to send to BTSS. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HCI_RelChannel (cy_stc_ipc_bt_context_t *btIpcContext)
 This function releases the HCI channel after handling the notification from the BT SS. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HCI_RelBuffer (cy_stc_ipc_bt_context_t *btIpcContext, uint32_t *msgPtr)
 This function releases the HCI buffer after copying the data received from BTSS. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HPC_RelChannel (cy_stc_ipc_bt_context_t *btIpcContext, void *buf)
 This function releases the HPC channel after handling the notification from the BT SS. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HCI_RegisterCb (cy_stc_ipc_bt_context_t *btIpcContext, cy_ipc_bt_callback_ptr_t hciNotifyCallbackPtr)
 This function registers the callback for HCI message notifications from BT SS. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HCI_UnregisterCb (cy_stc_ipc_bt_context_t *btIpcContext)
 This function un-registers the callback function registered for HCI message notifications from BT SS. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HPC_RegisterCb (cy_stc_ipc_bt_context_t *btIpcContext, cy_stc_ipc_hcp_cb_t *pHpcNotifyCallbackParam)
 This function registers the callback for HPC message notifications from BT SS. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HPC_UnregisterCb (cy_stc_ipc_bt_context_t *btIpcContext, cy_stc_ipc_hcp_cb_t *pHpcNotifyCallbackParam)
 This function un-registers the callback function registered for HPC message notifications from BT SS. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_Buffer_RegisterCb (cy_stc_ipc_bt_context_t *btIpcContext, cy_ipc_bt_bufcallback_ptr_t bufCallbackPtr)
 This function registers the callback for buffer available notification. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_HCI_FIFOGet (cy_stc_ipc_bt_context_t *btIpcContext, uint32_t **ppMsg, uint8_t delete)
 This function is called to pull the IPC message from FIFO. More...
 
uint16_t Cy_BTIPC_HCI_FIFOCount (cy_stc_ipc_bt_context_t *btIpcContext)
 This function is called to get the number of messages in the IPC FIFO. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_RetrieveContext (cy_stc_ipc_bt_context_t *btIpcContext, cy_stc_ipc_bt_save_ctxt_t *pContextRet)
 This function is called to retrieve the context to be saved during RAM off state. More...
 
cy_en_btipcdrv_status_t Cy_BTIPC_RestoreContext (cy_stc_ipc_bt_context_t *btIpcContext, cy_stc_ipc_bt_save_ctxt_t *pContextRet)
 This function is called to restore the saved context during RAM off state. More...
 

Function Documentation

◆ Cy_BTIPC_Init()

cy_en_btipcdrv_status_t Cy_BTIPC_Init ( cy_stc_ipc_bt_context_t btIpcContext,
cy_stc_ipc_bt_config_t btIpcConfig 
)

This function initializes the Bluetooth IPC.

The IPC channels used for HCI and HPC packet exchange between MCU and BT SS are initialized.

Note
In general, this function is called during application initialization.
Parameters
btIpcConfigThis is the pointer to the bt ipc configuration structure.
btIpcContextThis is the pointer to the bt ipc context structure.
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR: BT IPC API return for general error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle

◆ Cy_BTIPC_WarmInit()

cy_en_btipcdrv_status_t Cy_BTIPC_WarmInit ( cy_stc_ipc_bt_context_t btIpcContext,
cy_stc_ipc_bt_config_t btIpcConfig 
)

This function performs the warm initialization of the Bluetooth IPC.

Note
In general, this function is called during application warm boot initialization.
Parameters
btIpcConfigThis is the pointer to the bt ipc configuration structure.
btIpcContextThis is the pointer to the bt ipc context structure.
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR: BT IPC API return for general error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle

◆ Cy_BTIPC_Deinit()

cy_en_btipcdrv_status_t Cy_BTIPC_Deinit ( cy_stc_ipc_bt_context_t btIpcContext)

This function de-initializes the Bluetooth IPC.

All the registered callbacks are deleted.

Note
In general, this function is called when the application does not need BT IPC service anymore.
Parameters
btIpcContextThis is the pointer to the bt ipc context structure.
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle

◆ Cy_BTIPC_HCI_getPTI()

cy_en_btipcdrv_status_t Cy_BTIPC_HCI_getPTI ( cy_en_btipc_hcipti_t pti,
uint32_t *  p_length,
uint32_t *  msgPtr 
)

This function gets the payload type indicator and the length of the HCI packet received from BTSS.

This function can be called to find out the type of HCI packet and allocate buffer of appropriate size to copy the packet data.

Note
In general, this function is called before reading the packet to allocate memory of required size.
Parameters
ptiThis is the pointer to payload type indicator which is returned by the function.
p_lengthThis is the pointer to the length of the payload filled by the function.
msgPtrThis is the pointer to buffer which contains the IPC data received in DATA0 and DATA1 registers.
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle

◆ Cy_BTIPC_HCI_Write()

cy_en_btipcdrv_status_t Cy_BTIPC_HCI_Write ( cy_stc_ipc_bt_context_t btIpcContext,
cy_en_btipc_hcipti_t  pti,
void *  data,
size_t  length 
)

This function sends the HCI packet form the BT stack to the BTSS.

Parameters
ptiThis is the HCI payload type indicator.
dataThis is the pointer to the buffer holding the HCI payload.
lengthThis is the length of the HCI payload in number of bytes.
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle CY_BT_IPC_DRV_ERROR_LOCK_ACQUIRE: BT IPC API return for buffer pool full error

◆ Cy_BTIPC_HPC_Write()

cy_en_btipcdrv_status_t Cy_BTIPC_HPC_Write ( cy_stc_ipc_bt_context_t btIpcContext,
void *  data,
size_t  length 
)

This function sends the HPC packet form the MCU to the BTSS.

Parameters
dataThis is the pointer to the buffer holding the HPC payload.
lengthThis is the length of the HPC payload in number of bytes.
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle CY_BT_IPC_DRV_ERROR_LOCK_ACQUIRE: BT IPC API return for buffer pool full error

◆ Cy_BTIPC_HCI_GetReadBufPtr()

cy_en_btipcdrv_status_t Cy_BTIPC_HCI_GetReadBufPtr ( cy_stc_ipc_bt_context_t btIpcContext,
void **  ppData,
size_t *  pLength 
)

This function gets the pointer to the received HCI packet by MCU from BTSS.

Parameters
ppDataThis is the pointer to the pointer of received HCI payload buffer
pLengthThis is the pointer to the size of the payload received in number of bytes
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle CY_BT_IPC_DRV_ERROR_LOCK_ACQUIRE: BT IPC API return for buffer pool full error CY_BT_IPC_DRV_ERROR_LOCK_REL: BT IPCAPI return for channel release error

◆ Cy_BTIPC_HCI_GetWriteBufPtr()

cy_en_btipcdrv_status_t Cy_BTIPC_HCI_GetWriteBufPtr ( cy_stc_ipc_bt_context_t btIpcContext,
cy_en_btipc_hcipti_t  pti,
void **  ppData,
size_t  length 
)

This function gets the pointer to the buffer to write HCI packet to send to BTSS.

Parameters
ptiThis is the HCI payload type indicator.
ppDataThis is the pointer to the pointer of buffer to write HCI payload buffer
lengthThis is the length of the HCI payload in number of bytes.
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle CY_BT_IPC_DRV_ERROR_LOCK_ACQUIRE: BT IPC API return for buffer pool full error CY_BT_IPC_DRV_ERROR_LOCK_REL: BT IPCAPI return for channel release error

◆ Cy_BTIPC_HPC_GetWriteBufPtr()

cy_en_btipcdrv_status_t Cy_BTIPC_HPC_GetWriteBufPtr ( cy_stc_ipc_bt_context_t btIpcContext,
void **  ppData,
size_t  length 
)

This function gets the pointer to the buffer to write HPC long message packet to send to BTSS.

Parameters
ppDataThis is the pointer to the pointer of buffer to write HPC long message payload buffer
lengthThis is the length of the HPC payload in number of bytes.
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle CY_BT_IPC_DRV_ERROR_LOCK_ACQUIRE: BT IPC API return for buffer pool full error CY_BT_IPC_DRV_ERROR_LOCK_REL: BT IPCAPI return for channel release error

◆ Cy_BTIPC_HCI_RelChannel()

cy_en_btipcdrv_status_t Cy_BTIPC_HCI_RelChannel ( cy_stc_ipc_bt_context_t btIpcContext)

This function releases the HCI channel after handling the notification from the BT SS.

Parameters
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle CY_BT_IPC_DRV_ERROR_LOCK_REL: BT IPCAPI return for channel release error

◆ Cy_BTIPC_HCI_RelBuffer()

cy_en_btipcdrv_status_t Cy_BTIPC_HCI_RelBuffer ( cy_stc_ipc_bt_context_t btIpcContext,
uint32_t *  msgPtr 
)

This function releases the HCI buffer after copying the data received from BTSS.

Parameters
btIpcContextThis is the pointer to the bt ipc context structure
msgPtrThis is the pointer to the IPC message received form BTSS
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle CY_BT_IPC_DRV_ERROR_LOCK_REL: BT IPCAPI return for channel release error

◆ Cy_BTIPC_HPC_RelChannel()

cy_en_btipcdrv_status_t Cy_BTIPC_HPC_RelChannel ( cy_stc_ipc_bt_context_t btIpcContext,
void *  buf 
)

This function releases the HPC channel after handling the notification from the BT SS.

Parameters
bufThis is the pointer to the buffer received from BT SS in DATA0 and DATA1 channel registers.
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle CY_BT_IPC_DRV_ERROR_LOCK_REL: BT IPCAPI return for channel release error

◆ Cy_BTIPC_HCI_RegisterCb()

cy_en_btipcdrv_status_t Cy_BTIPC_HCI_RegisterCb ( cy_stc_ipc_bt_context_t btIpcContext,
cy_ipc_bt_callback_ptr_t  hciNotifyCallbackPtr 
)

This function registers the callback for HCI message notifications from BT SS.

Parameters
hciNotifyCallbackPtrThis is the pointer to the function to be called for HCI notifications.
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle

◆ Cy_BTIPC_HCI_UnregisterCb()

cy_en_btipcdrv_status_t Cy_BTIPC_HCI_UnregisterCb ( cy_stc_ipc_bt_context_t btIpcContext)

This function un-registers the callback function registered for HCI message notifications from BT SS.

Parameters
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle

◆ Cy_BTIPC_HPC_RegisterCb()

cy_en_btipcdrv_status_t Cy_BTIPC_HPC_RegisterCb ( cy_stc_ipc_bt_context_t btIpcContext,
cy_stc_ipc_hcp_cb_t pHpcNotifyCallbackParam 
)

This function registers the callback for HPC message notifications from BT SS.

Parameters
pHpcNotifyCallbackParamThis is the pointer to the function to be called for HPC notifications.
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle CY_BT_IPC_DRV_ERROR: BT IPC API return for general error

◆ Cy_BTIPC_HPC_UnregisterCb()

cy_en_btipcdrv_status_t Cy_BTIPC_HPC_UnregisterCb ( cy_stc_ipc_bt_context_t btIpcContext,
cy_stc_ipc_hcp_cb_t pHpcNotifyCallbackParam 
)

This function un-registers the callback function registered for HPC message notifications from BT SS.

Parameters
pHpcNotifyCallbackParamThis is the pointer to the callback function to be un-registered.
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle CY_BT_IPC_DRV_ERROR: BT IPC API return for general error

◆ Cy_BTIPC_Buffer_RegisterCb()

cy_en_btipcdrv_status_t Cy_BTIPC_Buffer_RegisterCb ( cy_stc_ipc_bt_context_t btIpcContext,
cy_ipc_bt_bufcallback_ptr_t  bufCallbackPtr 
)

This function registers the callback for buffer available notification.

Parameters
bufCallbackPtrThis is the pointer to the function to be called for buffer available notification.
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle CY_BT_IPC_DRV_ERROR: BT IPC API return for general error

◆ Cy_BTIPC_HCI_FIFOGet()

cy_en_btipcdrv_status_t Cy_BTIPC_HCI_FIFOGet ( cy_stc_ipc_bt_context_t btIpcContext,
uint32_t **  ppMsg,
uint8_t  delete 
)

This function is called to pull the IPC message from FIFO.

Parameters
ppMsgThis is the pointer to pointer the location in FIFO where the retrieved message is stored.
deleteWhen set to 1, the entry from the FIFO is deleted after pulling it.
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BUF_FULL : BT IPC API return for FIFO full

◆ Cy_BTIPC_HCI_FIFOCount()

uint16_t Cy_BTIPC_HCI_FIFOCount ( cy_stc_ipc_bt_context_t btIpcContext)

This function is called to get the number of messages in the IPC FIFO.

Parameters
btIpcContextThis is the pointer to the bt ipc context structure
Returns
number of messages in the IPC FIFO

◆ Cy_BTIPC_RetrieveContext()

cy_en_btipcdrv_status_t Cy_BTIPC_RetrieveContext ( cy_stc_ipc_bt_context_t btIpcContext,
cy_stc_ipc_bt_save_ctxt_t pContextRet 
)

This function is called to retrieve the context to be saved during RAM off state.

Parameters
pContextRetPointer to the context to be retrieved. This will be updated by this function.
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle

◆ Cy_BTIPC_RestoreContext()

cy_en_btipcdrv_status_t Cy_BTIPC_RestoreContext ( cy_stc_ipc_bt_context_t btIpcContext,
cy_stc_ipc_bt_save_ctxt_t pContextRet 
)

This function is called to restore the saved context during RAM off state.

Parameters
pContextRetPointer to the saved context structure to be restored
btIpcContextThis is the pointer to the bt ipc context structure
Returns
CY_BT_IPC_DRV_SUCCESS: BT IPC API return for no error CY_BT_IPC_DRV_ERROR_BAD_HANDLE: BT IPC API return for bad handle