MTB CAT1 Peripheral driver library

General Description

Functions are used in the driver.

Functions

__STATIC_INLINE IPC_STRUCT_TypeCy_IPC_Drv_GetIpcBaseAddress (uint32_t ipcIndex)
 This function takes an IPC channel index as a parameter and returns the base address the IPC registers corresponding to the IPC channel. More...
 
__STATIC_INLINE IPC_INTR_STRUCT_Type * Cy_IPC_Drv_GetIntrBaseAddr (uint32_t ipcIntrIndex)
 This function takes an IPC interrupt structure index and returns the base address of the IPC interrupt registers corresponding to the IPC Interrupt. More...
 
__STATIC_INLINE void Cy_IPC_Drv_AcquireNotify (IPC_STRUCT_Type *base, uint32_t notifyEventIntr)
 The function generates a acquire notification event by IPC interrupt structure. More...
 
__STATIC_INLINE void Cy_IPC_Drv_ReleaseNotify (IPC_STRUCT_Type *base, uint32_t notifyEventIntr)
 The function generates a release notification event by IPC interrupt structure. More...
 
__STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_LockAcquire (IPC_STRUCT_Type const *base)
 This function is used to acquire the IPC channel. More...
 
cy_en_ipcdrv_status_t Cy_IPC_Drv_LockRelease (IPC_STRUCT_Type *base, uint32_t releaseEventIntr)
 The function is used to release an IPC channel from the locked state. More...
 
__STATIC_INLINE bool Cy_IPC_Drv_IsLockAcquired (IPC_STRUCT_Type const *base)
 The function is used to test the status of an IPC channel. More...
 
__STATIC_INLINE uint32_t Cy_IPC_Drv_GetLockStatus (IPC_STRUCT_Type const *base)
 The function is used to get the status of an IPC channel. More...
 
cy_en_ipcdrv_status_t Cy_IPC_Drv_SendMsgWord (IPC_STRUCT_Type *base, uint32_t notifyEventIntr, uint32_t message)
 This function is used to send a 32-bit word message through an IPC channel. More...
 
cy_en_ipcdrv_status_t Cy_IPC_Drv_ReadMsgWord (IPC_STRUCT_Type const *base, uint32_t *message)
 This function is used to read a 32-bit word message through an IPC channel. More...
 
cy_en_ipcdrv_status_t Cy_IPC_Drv_SendMsgDWord (IPC_STRUCT_Type *base, uint32_t notifyEventIntr, uint32_t *message)
 This function is used to send two 32-bit word message through an IPC channel. More...
 
cy_en_ipcdrv_status_t Cy_IPC_Drv_ReadMsgDWord (IPC_STRUCT_Type const *base, uint32_t *message)
 This function is used to read two 32-bit word message through an IPC channel. More...
 
__STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_SendMsgPtr (IPC_STRUCT_Type *base, uint32_t notifyEventIntr, void const *msgPtr)
 This function is used to send a message pointer through an IPC channel. More...
 
__STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_ReadMsgPtr (IPC_STRUCT_Type const *base, void **msgPtr)
 This function is used to read a 32-bit pointer message through an IPC channel. More...
 
__STATIC_INLINE void Cy_IPC_Drv_SetInterruptMask (IPC_INTR_STRUCT_Type *base, uint32_t ipcReleaseMask, uint32_t ipcNotifyMask)
 This function is used to set the interrupt mask for an IPC Interrupt. More...
 
__STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptMask (IPC_INTR_STRUCT_Type const *base)
 This function is used to read the interrupt mask. More...
 
__STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptStatusMasked (IPC_INTR_STRUCT_Type const *base)
 This function is used to read the active unmasked interrupt. More...
 
__STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptStatus (IPC_INTR_STRUCT_Type const *base)
 This function is used to read the pending interrupts. More...
 
__STATIC_INLINE void Cy_IPC_Drv_SetInterrupt (IPC_INTR_STRUCT_Type *base, uint32_t ipcReleaseMask, uint32_t ipcNotifyMask)
 This function is used to set the interrupt source. More...
 
__STATIC_INLINE void Cy_IPC_Drv_ClearInterrupt (IPC_INTR_STRUCT_Type *base, uint32_t ipcReleaseMask, uint32_t ipcNotifyMask)
 This function is used to clear the interrupt source. More...
 

Function Documentation

◆ Cy_IPC_Drv_GetIpcBaseAddress()

__STATIC_INLINE IPC_STRUCT_Type * Cy_IPC_Drv_GetIpcBaseAddress ( uint32_t  ipcIndex)

This function takes an IPC channel index as a parameter and returns the base address the IPC registers corresponding to the IPC channel.

Note
The user is responsible for ensuring that ipcIndex does not exceed the limits.
Parameters
ipcIndexRepresents the number of IPC structure. This is converted to the base address of the IPC channel registers. This comprises of total number of channels present in all IPC IP instances.
Returns
Returns a pointer to the base of the IPC registers.
Function Usage
/* Scenario: there is a need to send a "one word" (32-bit) message,
* which can be also used as any command/flag/etc.
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#define MY_IPC_INTR_INDEX_WITHIN_IP (MY_IPC_INTR_INDEX % CY_IPC_INTERRUPTS_PER_INSTANCE) /* Example of IPC interrupt channel index within IP */
#define MY_IPC_INTR_MASK (1UL << MY_IPC_INTR_INDEX_WITHIN_IP) /* IPC release interrupt mask */
IPC_STRUCT_Type * myIpc = Cy_IPC_Drv_GetIpcBaseAddress(MY_IPC_CHAN_INDEX); /* Get IPC base register address */
uint32_t myMsg = 0x12345678UL; /* Example message */
if (CY_IPC_DRV_SUCCESS != Cy_IPC_Drv_SendMsgWord(myIpc, MY_IPC_INTR_MASK, myMsg))
{
/* Insert error handling */
}

◆ Cy_IPC_Drv_GetIntrBaseAddr()

__STATIC_INLINE IPC_INTR_STRUCT_Type * Cy_IPC_Drv_GetIntrBaseAddr ( uint32_t  ipcIntrIndex)

This function takes an IPC interrupt structure index and returns the base address of the IPC interrupt registers corresponding to the IPC Interrupt.

Note
The user is responsible for ensuring that ipcIntrIndex does not exceed the limits.
Parameters
ipcIntrIndexRepresents the number of IPC interrupt structure. This is converted to the base address of the IPC interrupt registers. This comprises of total number of channels present in all IPC IP instances.
Returns
Returns a pointer to the base of the IPC interrupt registers.
Function Usage
/* Scenario: there is a need to check the IPC pending interrupts */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (17UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
IPC_INTR_STRUCT_Type * myIpcIntr = Cy_IPC_Drv_GetIntrBaseAddr(MY_IPC_INTR_INDEX);
uint32_t intrStatus = Cy_IPC_Drv_GetInterruptStatus(myIpcIntr);

◆ Cy_IPC_Drv_AcquireNotify()

__STATIC_INLINE void Cy_IPC_Drv_AcquireNotify ( IPC_STRUCT_Type base,
uint32_t  notifyEventIntr 
)

The function generates a acquire notification event by IPC interrupt structure.

Parameters
baseThis parameter is a handle that represents the base address of the registers of the IPC channel. The parameter is generally returned from a call to the Cy_IPC_Drv_GetIpcBaseAddress.
notifyEventIntrBit encoded list of IPC interrupt structures that are triggered by a notification. Bit number correspond to number of the IPC interrupt structure. In case of devices having multiple IPC IP instances, this comprises of all IPC interrupts associated with only particular IPC IP.
Function Usage
/* Scenario: there is a need to acquire the IPC channel so that other CPU
* cores are blocked to use it. Prior to acquiring, check if it is not already
* acquired by another CPU core.
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#ifndef MY_IPC_CHAN_INDEX_WITHIN_IP
#define MY_IPC_CHAN_INDEX_WITHIN_IP (MY_IPC_INTR_INDEX % CY_IPC_INTERRUPTS_PER_INSTANCE) /* Example of IPC interrupt index within IP instance */
#endif /* MY_IPC_CHAN_INDEX_WITHIN_IP */
#ifndef MY_IPC_INTR_MASK
#define MY_IPC_INTR_MASK (1UL << MY_IPC_CHAN_INDEX_WITHIN_IP) /* IPC release interrupt mask */
#endif /* MY_IPC_INTR_MASK */
IPC_STRUCT_Type * myIpc = Cy_IPC_Drv_GetIpcBaseAddress(MY_IPC_CHAN_INDEX); /* Get IPC base register address */
{
{
/* Scenario: there is a need to manually trigger the IPC notification
* interrupt without specifying the data to be passed.
* It can essentially be used as a 1-bit semaphore.
*/
Cy_IPC_Drv_AcquireNotify(myIpc, MY_IPC_INTR_MASK);
/* Another core is expected to own the interrupt generated in the
* IPC interrupt channel #MY_IPC_INTR_INDEX
*/
}
else
{
/* Insert error handling */
}
}

◆ Cy_IPC_Drv_ReleaseNotify()

__STATIC_INLINE void Cy_IPC_Drv_ReleaseNotify ( IPC_STRUCT_Type base,
uint32_t  notifyEventIntr 
)

The function generates a release notification event by IPC interrupt structure.

Parameters
baseThis parameter is a handle that represents the base address of the registers of the IPC channel. The parameter is generally returned from a call to the Cy_IPC_Drv_GetIpcBaseAddress.
notifyEventIntrBit encoded list of IPC interrupt lines that are triggered by a notification. In case of devices having multiple IPC IP instances, this comprises of all IPC interrupts associated with only particular IPC IP.
Function Usage
/* Scenario: a notification interrupt has just occurred so
* there is a need to receive a "one word" (32-bit) message
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#ifndef MY_IPC_INTR_INDEX_WITHIN_IP
#define MY_IPC_INTR_INDEX_WITHIN_IP (MY_IPC_INTR_INDEX % CY_IPC_INTERRUPTS_PER_INSTANCE) /* Example of IPC interrupt channel index within IP */
#endif /* MY_IPC_INTR_INDEX_WITHIN_IP */
#ifndef MY_IPC_INTR_MASK
#define MY_IPC_INTR_MASK (1UL << MY_IPC_INTR_INDEX_WITHIN_IP) /* IPC release interrupt mask */
#endif /* MY_IPC_INTR_MASK */
IPC_STRUCT_Type * myIpc = Cy_IPC_Drv_GetIpcBaseAddress(MY_IPC_CHAN_INDEX); /* Get IPC base register address */
uint32_t myMsg; /* Example message */
{
/* Now myMsg contains the received message word */
/* The IPC data is received and processed.
* Free up the channel for the next transaction.
*/
Cy_IPC_Drv_ReleaseNotify(myIpc, MY_IPC_INTR_MASK);
}
else
{
/* Insert error handling */
}

◆ Cy_IPC_Drv_LockAcquire()

__STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_LockAcquire ( IPC_STRUCT_Type const *  base)

This function is used to acquire the IPC channel.

Parameters
baseThis parameter is a handle that represents the base address of the registers of the IPC channel. The parameter is generally returned from a call to the Cy_IPC_Drv_GetIpcBaseAddress
Returns
Status of the operation
Return values
CY_IPC_DRV_SUCCESSThe IPC was successfully acquired
CY_IPC_DRV_ERRORThe IPC was not acquired because it was already acquired by another master
Function Usage
/* Scenario: there is a need to acquire the IPC channel so that other CPU
* cores are blocked to use it. Prior to acquiring, check if it is not already
* acquired by another CPU core.
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#ifndef MY_IPC_CHAN_INDEX_WITHIN_IP
#define MY_IPC_CHAN_INDEX_WITHIN_IP (MY_IPC_INTR_INDEX % CY_IPC_INTERRUPTS_PER_INSTANCE) /* Example of IPC interrupt index within IP instance */
#endif /* MY_IPC_CHAN_INDEX_WITHIN_IP */
#ifndef MY_IPC_INTR_MASK
#define MY_IPC_INTR_MASK (1UL << MY_IPC_CHAN_INDEX_WITHIN_IP) /* IPC release interrupt mask */
#endif /* MY_IPC_INTR_MASK */
IPC_STRUCT_Type * myIpc = Cy_IPC_Drv_GetIpcBaseAddress(MY_IPC_CHAN_INDEX); /* Get IPC base register address */
{
{
/* Scenario: there is a need to manually trigger the IPC notification
* interrupt without specifying the data to be passed.
* It can essentially be used as a 1-bit semaphore.
*/
Cy_IPC_Drv_AcquireNotify(myIpc, MY_IPC_INTR_MASK);
/* Another core is expected to own the interrupt generated in the
* IPC interrupt channel #MY_IPC_INTR_INDEX
*/
}
else
{
/* Insert error handling */
}
}

◆ Cy_IPC_Drv_LockRelease()

cy_en_ipcdrv_status_t Cy_IPC_Drv_LockRelease ( IPC_STRUCT_Type base,
uint32_t  releaseEventIntr 
)

The function is used to release an IPC channel from the locked state.

The function also has a way to specify through a parameter which IPC interrupts must be notified during the release event.

Parameters
baseThis parameter is a handle that represents the base address of the registers of the IPC channel. The parameter is generally returned from a call to the Cy_IPC_Drv_GetIpcBaseAddress.
releaseEventIntrBit encoded list of IPC interrupt lines that are triggered by a release event. In case of devices having multiple IPC IP instances, this comprises of all IPC interrupts associated with only particular IPC IP.
Returns
Status of the operation
Return values
CY_IPC_DRV_SUCCESSThe function executed successfully and the IPC channel was released.
CY_IPC_DRV_ERRORThe IPC channel was not acquired before the function call.
Function Usage
/* Scenario: an acquire notification interrupt has just occurred
* so now is a time to read a message pointer and then whole the
* message content
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (8UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (8UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#define MY_IPC_INTR_INDEX_WITHIN_IP (MY_IPC_INTR_INDEX % CY_IPC_INTERRUPTS_PER_INSTANCE) /* Example of IPC interrupt channel index within IP */
#define MY_IPC_INTR_MASK (1UL << MY_IPC_INTR_INDEX_WITHIN_IP) /* IPC interrupt mask */
#define MY_IPC_MSG_SIZE (7UL) /* Example message size */
IPC_STRUCT_Type * myIpc = Cy_IPC_Drv_GetIpcBaseAddress(MY_IPC_CHAN_INDEX); /* Get IPC base register address */
uint32_t myMsg[MY_IPC_MSG_SIZE]; /* Example message container */
void * myMsgPtr; /* Example message pointer */
if (CY_IPC_DRV_SUCCESS == Cy_IPC_Drv_ReadMsgPtr(myIpc, &myMsgPtr))
{
uint32_t i;
for(i = 0; i < MY_IPC_MSG_SIZE; i++)
{
myMsg[i] = *((uint32_t*)((uint32_t)myMsgPtr + i)); /* Copying the message content */
}
}
else
{
/* Insert error handling */
}
/* The IPC data was received and processed.
* Free up the channel for the next transaction.
*/
if (CY_IPC_DRV_SUCCESS == Cy_IPC_Drv_LockRelease(myIpc, MY_IPC_INTR_MASK))
{
/* Now the IPC channel is successfully released */
}
else
{
/* Insert error handling */
}

◆ Cy_IPC_Drv_IsLockAcquired()

__STATIC_INLINE bool Cy_IPC_Drv_IsLockAcquired ( IPC_STRUCT_Type const *  base)

The function is used to test the status of an IPC channel.

The function tells the reader if the IPC channel was in the locked or released state.

Parameters
baseThis parameter is a handle that represents the base address of the registers of the IPC channel. The parameter is generally returned from a call to the Cy_IPC_Drv_GetIpcBaseAddress.
Returns
Status for the function: true: The IPC channel is in the Locked state. false: The IPC channel is in the Released state.
Function Usage
/* Scenario: there is a need to acquire the IPC channel so that other CPU
* cores are blocked to use it. Prior to acquiring, check if it is not already
* acquired by another CPU core.
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#ifndef MY_IPC_CHAN_INDEX_WITHIN_IP
#define MY_IPC_CHAN_INDEX_WITHIN_IP (MY_IPC_INTR_INDEX % CY_IPC_INTERRUPTS_PER_INSTANCE) /* Example of IPC interrupt index within IP instance */
#endif /* MY_IPC_CHAN_INDEX_WITHIN_IP */
#ifndef MY_IPC_INTR_MASK
#define MY_IPC_INTR_MASK (1UL << MY_IPC_CHAN_INDEX_WITHIN_IP) /* IPC release interrupt mask */
#endif /* MY_IPC_INTR_MASK */
IPC_STRUCT_Type * myIpc = Cy_IPC_Drv_GetIpcBaseAddress(MY_IPC_CHAN_INDEX); /* Get IPC base register address */
{
{
/* Scenario: there is a need to manually trigger the IPC notification
* interrupt without specifying the data to be passed.
* It can essentially be used as a 1-bit semaphore.
*/
Cy_IPC_Drv_AcquireNotify(myIpc, MY_IPC_INTR_MASK);
/* Another core is expected to own the interrupt generated in the
* IPC interrupt channel #MY_IPC_INTR_INDEX
*/
}
else
{
/* Insert error handling */
}
}

◆ Cy_IPC_Drv_GetLockStatus()

__STATIC_INLINE uint32_t Cy_IPC_Drv_GetLockStatus ( IPC_STRUCT_Type const *  base)

The function is used to get the status of an IPC channel.

Parameters
baseThis parameter is a handle that represents the base address of the registers of the IPC channel. The parameter is generally returned from a call to the Cy_IPC_Drv_GetIpcBaseAddress.
Returns
Value from LOCK_STATUS register.
Function Usage
/* Scenario: there is a need to check the IPC channel status */
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (8UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
IPC_STRUCT_Type * myIpc = Cy_IPC_Drv_GetIpcBaseAddress(MY_IPC_CHAN_INDEX); /* Get IPC base register address */
uint32_t ipcStatus = Cy_IPC_Drv_GetLockStatus(myIpc);
/* Now the ipcStatus contains all the LOCK_STATUS register content,
* such a user/privileged, secure/non-secure access modes,
* protection context, bus master, etc.
*/

◆ Cy_IPC_Drv_SendMsgWord()

cy_en_ipcdrv_status_t Cy_IPC_Drv_SendMsgWord ( IPC_STRUCT_Type base,
uint32_t  notifyEventIntr,
uint32_t  message 
)

This function is used to send a 32-bit word message through an IPC channel.

The function also has an associated notification field that will let the message notify one or multiple IPC interrupts. The IPC channel is locked and remains locked after the function returns. The receiver of the message should release the channel.

Parameters
baseThis parameter is a handle that represents the base address of the registers of the IPC channel. The parameter is generally returned from a call to the Cy_IPC_Drv_GetIpcBaseAddress.
notifyEventIntrBit encoded list of IPC interrupt lines that are triggered by a notification. In case of devices having multiple IPC IP instances, this comprises of all IPC interrupts associated with only particular IPC IP.
messageThe message word that is the data placed in the IPC data register.
Returns
Status of the operation:
Return values
CY_IPC_DRV_SUCCESSThe send operation was successful.
CY_IPC_DRV_ERRORThe IPC channel is unavailable because it is already locked.
Function Usage
/* Scenario: there is a need to send a "one word" (32-bit) message,
* which can be also used as any command/flag/etc.
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#define MY_IPC_INTR_INDEX_WITHIN_IP (MY_IPC_INTR_INDEX % CY_IPC_INTERRUPTS_PER_INSTANCE) /* Example of IPC interrupt channel index within IP */
#define MY_IPC_INTR_MASK (1UL << MY_IPC_INTR_INDEX_WITHIN_IP) /* IPC release interrupt mask */
IPC_STRUCT_Type * myIpc = Cy_IPC_Drv_GetIpcBaseAddress(MY_IPC_CHAN_INDEX); /* Get IPC base register address */
uint32_t myMsg = 0x12345678UL; /* Example message */
if (CY_IPC_DRV_SUCCESS != Cy_IPC_Drv_SendMsgWord(myIpc, MY_IPC_INTR_MASK, myMsg))
{
/* Insert error handling */
}

◆ Cy_IPC_Drv_ReadMsgWord()

cy_en_ipcdrv_status_t Cy_IPC_Drv_ReadMsgWord ( IPC_STRUCT_Type const *  base,
uint32_t *  message 
)

This function is used to read a 32-bit word message through an IPC channel.

This function assumes that the channel is locked (for a valid message). If the channel is not locked, the message is invalid. The user must call Cy_IPC_Drv_Release() function after reading the message to release the IPC channel.

Parameters
baseThis parameter is a handle that represents the base address of the registers of the IPC channel. The parameter is generally returned from a call to the Cy_IPC_Drv_GetIpcBaseAddress.
messageA variable where the read data is copied.
Returns
Status of the operation
Return values
CY_IPC_DRV_SUCCESSThe function executed successfully and the IPC was acquired.
CY_IPC_DRV_ERRORThe function encountered an error because the IPC channel was already in a released state, meaning the data may be invalid.
Function Usage
/* Scenario: a notification interrupt has just occurred so
* there is a need to receive a "one word" (32-bit) message
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#ifndef MY_IPC_INTR_INDEX_WITHIN_IP
#define MY_IPC_INTR_INDEX_WITHIN_IP (MY_IPC_INTR_INDEX % CY_IPC_INTERRUPTS_PER_INSTANCE) /* Example of IPC interrupt channel index within IP */
#endif /* MY_IPC_INTR_INDEX_WITHIN_IP */
#ifndef MY_IPC_INTR_MASK
#define MY_IPC_INTR_MASK (1UL << MY_IPC_INTR_INDEX_WITHIN_IP) /* IPC release interrupt mask */
#endif /* MY_IPC_INTR_MASK */
IPC_STRUCT_Type * myIpc = Cy_IPC_Drv_GetIpcBaseAddress(MY_IPC_CHAN_INDEX); /* Get IPC base register address */
uint32_t myMsg; /* Example message */
{
/* Now myMsg contains the received message word */
/* The IPC data is received and processed.
* Free up the channel for the next transaction.
*/
Cy_IPC_Drv_ReleaseNotify(myIpc, MY_IPC_INTR_MASK);
}
else
{
/* Insert error handling */
}

◆ Cy_IPC_Drv_SendMsgDWord()

cy_en_ipcdrv_status_t Cy_IPC_Drv_SendMsgDWord ( IPC_STRUCT_Type base,
uint32_t  notifyEventIntr,
uint32_t *  message 
)

This function is used to send two 32-bit word message through an IPC channel.

The function also has an associated notification field that will let the message notify one or multiple IPC interrupts. The IPC channel is locked and remains locked after the function returns. The receiver of the message should release the channel.

Parameters
baseThis parameter is a handle that represents the base address of the registers of the IPC channel. The parameter is generally returned from a call to the Cy_IPC_Drv_GetIpcBaseAddress.
notifyEventIntrBit encoded list of IPC interrupt lines that are triggered by a notification. In case of devices having multiple IPC IP instances, this comprises of all IPC interrupts associated with only particular IPC IP.
messageThe message word that is the data placed in the IPC data register.
Returns
Status of the operation:
Return values
CY_IPC_DRV_SUCCESSThe send operation was successful.
CY_IPC_DRV_ERRORThe IPC channel is unavailable because it is already locked.
Function Usage
/* Scenario: there is a need to send a "one word" (32-bit) message,
* which can be also used as any command/flag/etc.
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#define MY_IPC_INTR_INDEX_WITHIN_IP (MY_IPC_INTR_INDEX % CY_IPC_INTERRUPTS_PER_INSTANCE) /* Example of IPC interrupt channel index within IP */
#define MY_IPC_INTR_MASK (1UL << MY_IPC_INTR_INDEX_WITHIN_IP) /* IPC release interrupt mask */
IPC_STRUCT_Type * myIpc = Cy_IPC_Drv_GetIpcBaseAddress(MY_IPC_CHAN_INDEX); /* Get IPC base register address */
uint32_t myMsg = 0x12345678UL; /* Example message */
if (CY_IPC_DRV_SUCCESS != Cy_IPC_Drv_SendMsgWord(myIpc, MY_IPC_INTR_MASK, myMsg))
{
/* Insert error handling */
}

◆ Cy_IPC_Drv_ReadMsgDWord()

cy_en_ipcdrv_status_t Cy_IPC_Drv_ReadMsgDWord ( IPC_STRUCT_Type const *  base,
uint32_t *  message 
)

This function is used to read two 32-bit word message through an IPC channel.

This function assumes that the channel is locked (for a valid message). If the channel is not locked, the message is invalid. The user must call Cy_IPC_Drv_Release() function after reading the message to release the IPC channel.

Parameters
baseThis parameter is a handle that represents the base address of the registers of the IPC channel. The parameter is generally returned from a call to the Cy_IPC_Drv_GetIpcBaseAddress.
messageA variable where the read data is copied.
Returns
Status of the operation
Return values
CY_IPC_DRV_SUCCESSThe function executed successfully and the IPC was acquired.
CY_IPC_DRV_ERRORThe function encountered an error because the IPC channel was already in a released state, meaning the data may be invalid.
Function Usage
/* Scenario: a notification interrupt has just occurred so
* there is a need to receive a "one word" (32-bit) message
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#ifndef MY_IPC_INTR_INDEX_WITHIN_IP
#define MY_IPC_INTR_INDEX_WITHIN_IP (MY_IPC_INTR_INDEX % CY_IPC_INTERRUPTS_PER_INSTANCE) /* Example of IPC interrupt channel index within IP */
#endif /* MY_IPC_INTR_INDEX_WITHIN_IP */
#ifndef MY_IPC_INTR_MASK
#define MY_IPC_INTR_MASK (1UL << MY_IPC_INTR_INDEX_WITHIN_IP) /* IPC release interrupt mask */
#endif /* MY_IPC_INTR_MASK */
IPC_STRUCT_Type * myIpc = Cy_IPC_Drv_GetIpcBaseAddress(MY_IPC_CHAN_INDEX); /* Get IPC base register address */
uint32_t myMsg; /* Example message */
{
/* Now myMsg contains the received message word */
/* The IPC data is received and processed.
* Free up the channel for the next transaction.
*/
Cy_IPC_Drv_ReleaseNotify(myIpc, MY_IPC_INTR_MASK);
}
else
{
/* Insert error handling */
}

◆ Cy_IPC_Drv_SendMsgPtr()

__STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_SendMsgPtr ( IPC_STRUCT_Type base,
uint32_t  notifyEventIntr,
void const *  msgPtr 
)

This function is used to send a message pointer through an IPC channel.

The message structure may hold a generic pointer that may contain the address of any user data type or structure. This parameter could be a pointer to a 32-bit integer, an array, or even a data structure defined in the user code. This function acts as a transfer engine for sending the pointer. Any memory management of the pointer allocation and deallocation is up to the application code. The function also has an associated notification field that will let the message notify one or multiple interrupts.

Parameters
baseThis parameter is a handle that represents the base address of the registers of the IPC channel. The parameter is generally returned from a call to the Cy_IPC_Drv_GetIpcBaseAddress.
notifyEventIntrBit encoded list of IPC interrupt lines that are triggered during the release action. In case of devices having multiple IPC IP instances, this comprises of all IPC interrupts associated with only particular IPC IP.
msgPtrThe message pointer that is being sent over the IPC channel.
Returns
Status of the operation:
Return values
CY_IPC_DRV_SUCCESSThe send operation was successful.
CY_IPC_DRV_ERRORThe IPC channel is unavailable because it is already locked.
Function Usage
/* Scenario: there is a need to send a pointer of the message mailbox */
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#define MY_IPC_INTR_INDEX_WITHIN_IP (MY_IPC_INTR_INDEX % CY_IPC_INTERRUPTS_PER_INSTANCE) /* Example of IPC interrupt channel index within IP */
#define MY_IPC_INTR_MASK (1UL << MY_IPC_INTR_INDEX_WITHIN_IP) /* IPC interrupt mask */
#define MY_IPC_MSG_SIZE (7UL) /* Example message size */
IPC_STRUCT_Type * myIpc = Cy_IPC_Drv_GetIpcBaseAddress(MY_IPC_CHAN_INDEX); /* Get IPC base register address */
uint32_t myMsg[MY_IPC_MSG_SIZE] = {1,2,3,4,5,6,7}; /* Example message, the content is fully user-defined */
if (CY_IPC_DRV_SUCCESS != Cy_IPC_Drv_SendMsgPtr(myIpc, MY_IPC_INTR_MASK, (void *) myMsg))
{
/* Insert error handling */
}

◆ Cy_IPC_Drv_ReadMsgPtr()

__STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_ReadMsgPtr ( IPC_STRUCT_Type const *  base,
void **  msgPtr 
)

This function is used to read a 32-bit pointer message through an IPC channel.

Parameters
baseThis parameter is a handle that represents the base address of the registers of the IPC channel. The parameter is generally returned from a call to the Cy_IPC_Drv_GetIpcBaseAddress.
msgPtrPointer variable to hold the data pointer that is being read from the IPC channel.
Returns
Status of the operation
Return values
CY_IPC_DRV_SUCCESSThe function executed successfully and the IPC was acquired.
CY_IPC_DRV_ERRORThe function encountered an error because the IPC channel was already in a released state meaning the data in it is invalid.
Function Usage
/* Scenario: an acquire notification interrupt has just occurred
* so now is a time to read a message pointer and then whole the
* message content
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (8UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (8UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#define MY_IPC_INTR_INDEX_WITHIN_IP (MY_IPC_INTR_INDEX % CY_IPC_INTERRUPTS_PER_INSTANCE) /* Example of IPC interrupt channel index within IP */
#define MY_IPC_INTR_MASK (1UL << MY_IPC_INTR_INDEX_WITHIN_IP) /* IPC interrupt mask */
#define MY_IPC_MSG_SIZE (7UL) /* Example message size */
IPC_STRUCT_Type * myIpc = Cy_IPC_Drv_GetIpcBaseAddress(MY_IPC_CHAN_INDEX); /* Get IPC base register address */
uint32_t myMsg[MY_IPC_MSG_SIZE]; /* Example message container */
void * myMsgPtr; /* Example message pointer */
if (CY_IPC_DRV_SUCCESS == Cy_IPC_Drv_ReadMsgPtr(myIpc, &myMsgPtr))
{
uint32_t i;
for(i = 0; i < MY_IPC_MSG_SIZE; i++)
{
myMsg[i] = *((uint32_t*)((uint32_t)myMsgPtr + i)); /* Copying the message content */
}
}
else
{
/* Insert error handling */
}
/* The IPC data was received and processed.
* Free up the channel for the next transaction.
*/
if (CY_IPC_DRV_SUCCESS == Cy_IPC_Drv_LockRelease(myIpc, MY_IPC_INTR_MASK))
{
/* Now the IPC channel is successfully released */
}
else
{
/* Insert error handling */
}

◆ Cy_IPC_Drv_SetInterruptMask()

__STATIC_INLINE void Cy_IPC_Drv_SetInterruptMask ( IPC_INTR_STRUCT_Type *  base,
uint32_t  ipcReleaseMask,
uint32_t  ipcNotifyMask 
)

This function is used to set the interrupt mask for an IPC Interrupt.

The mask sets release or acquire notification events for all IPC channels.

Parameters
baseThis is a handle to the IPC interrupt. This handle can be calculated from the IPC interrupt number using Cy_IPC_Drv_GetIntrBaseAddr.
ipcReleaseMaskAn encoded list of all IPC channels that can trigger the interrupt on a release event. In case of devices having multiple IPC IP instances, this comprises of total number of channels present in only particular IPC IP.
ipcNotifyMaskAn encoded list of all IPC channels that can trigger the interrupt on a notify event. In case of devices having multiple IPC IP instances, this comprises of total number of channels present in only particular IPC IP.
Function Usage
/* Scenario: enable IPC interrupts in IPC interrupt channel #MY_IPC_INTR_INDEX
* for both acquire and release events from the IPC channel #MY_IPC_CHAN_INDEX
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#ifndef MY_IPC_CHAN_INDEX_WITHIN_IP
#define MY_IPC_CHAN_INDEX_WITHIN_IP (MY_IPC_CHAN_INDEX % CY_IPC_CHANNELS_PER_INSTANCE) /* Example of IPC channel index within IP instance */
#endif /* MY_IPC_CHAN_INDEX_WITHIN_IP */
#define MY_IPC_RELEASE_INTR_MASK (1UL << MY_IPC_CHAN_INDEX_WITHIN_IP) /* IPC release interrupt mask within IP instance */
#define MY_IPC_ACQUIRE_INTR_MASK (1UL << MY_IPC_CHAN_INDEX_WITHIN_IP) /* IPC acquire interrupt mask within IP instance */
IPC_INTR_STRUCT_Type * myIpcIntr = Cy_IPC_Drv_GetIntrBaseAddr(MY_IPC_INTR_INDEX);
uint32_t intr = Cy_IPC_Drv_GetInterruptMask(myIpcIntr);
uint32_t releaseIntr = _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_RELEASE, intr) | MY_IPC_RELEASE_INTR_MASK;
uint32_t acqiureIntr = _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_NOTIFY, intr) | MY_IPC_ACQUIRE_INTR_MASK;
Cy_IPC_Drv_SetInterruptMask(myIpcIntr, releaseIntr, acqiureIntr);
/* Scenario: the next block is inside the IPC interrupt handler */
{
/* Get all the enabled pending interrupts */
uint32_t intr = Cy_IPC_Drv_GetInterruptStatusMasked(myIpcIntr);
if (0UL != (MY_IPC_RELEASE_INTR_MASK & intr))
{
/* Handle the RELEASE event of the IPC channel MY_IPC_CHAN_INDEX */
}
if (0UL != (MY_IPC_ACQUIRE_INTR_MASK & intr))
{
/* Handle the ACQUIRE interrupt */
}
/* Clear the interrupt */
Cy_IPC_Drv_ClearInterrupt(myIpcIntr, _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_RELEASE, intr),
_FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_NOTIFY, intr));
}
/* Scenario: disable ALL the IPC interrupts (not from the IPC channel
* #MY_IPC_CHAN_INDEX only) in the IPC interrupt channel
* #MY_IPC_INTR_INDEX when they are not needed anymore
*/

◆ Cy_IPC_Drv_GetInterruptMask()

__STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptMask ( IPC_INTR_STRUCT_Type const *  base)

This function is used to read the interrupt mask.

Parameters
baseThis is a handle to the IPC interrupt. This handle can be calculated from the IPC interrupt number using Cy_IPC_Drv_GetIntrBaseAddr.
Returns
In case of devices having multiple IPC IP instances, this comprises of total number of channels present in only particular IPC IP. The return value is encoded as follows
Interrupt sources Value
Ipc_PORTX_RELEASE Xth bit set
Ipc_PORTX_NOTIFY X+16th bit set
Function Usage
/* Scenario: enable IPC interrupts in IPC interrupt channel #MY_IPC_INTR_INDEX
* for both acquire and release events from the IPC channel #MY_IPC_CHAN_INDEX
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#ifndef MY_IPC_CHAN_INDEX_WITHIN_IP
#define MY_IPC_CHAN_INDEX_WITHIN_IP (MY_IPC_CHAN_INDEX % CY_IPC_CHANNELS_PER_INSTANCE) /* Example of IPC channel index within IP instance */
#endif /* MY_IPC_CHAN_INDEX_WITHIN_IP */
#define MY_IPC_RELEASE_INTR_MASK (1UL << MY_IPC_CHAN_INDEX_WITHIN_IP) /* IPC release interrupt mask within IP instance */
#define MY_IPC_ACQUIRE_INTR_MASK (1UL << MY_IPC_CHAN_INDEX_WITHIN_IP) /* IPC acquire interrupt mask within IP instance */
IPC_INTR_STRUCT_Type * myIpcIntr = Cy_IPC_Drv_GetIntrBaseAddr(MY_IPC_INTR_INDEX);
uint32_t intr = Cy_IPC_Drv_GetInterruptMask(myIpcIntr);
uint32_t releaseIntr = _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_RELEASE, intr) | MY_IPC_RELEASE_INTR_MASK;
uint32_t acqiureIntr = _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_NOTIFY, intr) | MY_IPC_ACQUIRE_INTR_MASK;
Cy_IPC_Drv_SetInterruptMask(myIpcIntr, releaseIntr, acqiureIntr);
/* Scenario: the next block is inside the IPC interrupt handler */
{
/* Get all the enabled pending interrupts */
uint32_t intr = Cy_IPC_Drv_GetInterruptStatusMasked(myIpcIntr);
if (0UL != (MY_IPC_RELEASE_INTR_MASK & intr))
{
/* Handle the RELEASE event of the IPC channel MY_IPC_CHAN_INDEX */
}
if (0UL != (MY_IPC_ACQUIRE_INTR_MASK & intr))
{
/* Handle the ACQUIRE interrupt */
}
/* Clear the interrupt */
Cy_IPC_Drv_ClearInterrupt(myIpcIntr, _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_RELEASE, intr),
_FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_NOTIFY, intr));
}
/* Scenario: disable ALL the IPC interrupts (not from the IPC channel
* #MY_IPC_CHAN_INDEX only) in the IPC interrupt channel
* #MY_IPC_INTR_INDEX when they are not needed anymore
*/

◆ Cy_IPC_Drv_GetInterruptStatusMasked()

__STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptStatusMasked ( IPC_INTR_STRUCT_Type const *  base)

This function is used to read the active unmasked interrupt.

This function can be used in the interrupt service routine to find which source triggered the interrupt.

Parameters
baseThis is a handle to the IPC interrupt. This handle can be calculated from the IPC interrupt number using Cy_IPC_Drv_GetIntrBaseAddr.
Returns
In case of devices having multiple IPC IP instances, this comprises of total number of channels present in only particular IPC IP. The return value is encoded as follows
Interrupt sources Value
Ipc_PORTX_RELEASE Xth bit set
Ipc_PORTX_NOTIFY X+16th bit set
Function Usage
/* Scenario: enable IPC interrupts in IPC interrupt channel #MY_IPC_INTR_INDEX
* for both acquire and release events from the IPC channel #MY_IPC_CHAN_INDEX
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#ifndef MY_IPC_CHAN_INDEX_WITHIN_IP
#define MY_IPC_CHAN_INDEX_WITHIN_IP (MY_IPC_CHAN_INDEX % CY_IPC_CHANNELS_PER_INSTANCE) /* Example of IPC channel index within IP instance */
#endif /* MY_IPC_CHAN_INDEX_WITHIN_IP */
#define MY_IPC_RELEASE_INTR_MASK (1UL << MY_IPC_CHAN_INDEX_WITHIN_IP) /* IPC release interrupt mask within IP instance */
#define MY_IPC_ACQUIRE_INTR_MASK (1UL << MY_IPC_CHAN_INDEX_WITHIN_IP) /* IPC acquire interrupt mask within IP instance */
IPC_INTR_STRUCT_Type * myIpcIntr = Cy_IPC_Drv_GetIntrBaseAddr(MY_IPC_INTR_INDEX);
uint32_t intr = Cy_IPC_Drv_GetInterruptMask(myIpcIntr);
uint32_t releaseIntr = _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_RELEASE, intr) | MY_IPC_RELEASE_INTR_MASK;
uint32_t acqiureIntr = _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_NOTIFY, intr) | MY_IPC_ACQUIRE_INTR_MASK;
Cy_IPC_Drv_SetInterruptMask(myIpcIntr, releaseIntr, acqiureIntr);
/* Scenario: the next block is inside the IPC interrupt handler */
{
/* Get all the enabled pending interrupts */
uint32_t intr = Cy_IPC_Drv_GetInterruptStatusMasked(myIpcIntr);
if (0UL != (MY_IPC_RELEASE_INTR_MASK & intr))
{
/* Handle the RELEASE event of the IPC channel MY_IPC_CHAN_INDEX */
}
if (0UL != (MY_IPC_ACQUIRE_INTR_MASK & intr))
{
/* Handle the ACQUIRE interrupt */
}
/* Clear the interrupt */
Cy_IPC_Drv_ClearInterrupt(myIpcIntr, _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_RELEASE, intr),
_FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_NOTIFY, intr));
}
/* Scenario: disable ALL the IPC interrupts (not from the IPC channel
* #MY_IPC_CHAN_INDEX only) in the IPC interrupt channel
* #MY_IPC_INTR_INDEX when they are not needed anymore
*/

◆ Cy_IPC_Drv_GetInterruptStatus()

__STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptStatus ( IPC_INTR_STRUCT_Type const *  base)

This function is used to read the pending interrupts.

Note that this read is an unmasked read of the interrupt status. Interrupt sources read as active by this function would generate interrupts only if they were not masked.

Parameters
baseThis is a handle to the IPC interrupt. This handle can be calculated from the IPC interrupt number using Cy_IPC_Drv_GetIntrBaseAddr.
Returns
In case of devices having multiple IPC IP instances, this comprises of total number of channels present in only particular IPC IP. The return value is encoded as follows
Interrupt sources Value
Ipc_PORTX_RELEASE Xth bit set
Ipc_PORTX_NOTIFY X+16th bit set
Function Usage
/* Scenario: there is a need to check the IPC pending interrupts */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (17UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
IPC_INTR_STRUCT_Type * myIpcIntr = Cy_IPC_Drv_GetIntrBaseAddr(MY_IPC_INTR_INDEX);
uint32_t intrStatus = Cy_IPC_Drv_GetInterruptStatus(myIpcIntr);

◆ Cy_IPC_Drv_SetInterrupt()

__STATIC_INLINE void Cy_IPC_Drv_SetInterrupt ( IPC_INTR_STRUCT_Type *  base,
uint32_t  ipcReleaseMask,
uint32_t  ipcNotifyMask 
)

This function is used to set the interrupt source.

This function can be used to activate interrupts through software.

Note
That interrupt sources set using this interrupt would generate interrupts only if they are not masked.
Parameters
baseThis is a handle to the IPC interrupt. This handle can be calculated from the IPC interrupt number using Cy_IPC_Drv_GetIntrBaseAddr.
ipcReleaseMaskAn encoded list of all IPC channels that can trigger the interrupt on a release event. In case of devices having multiple IPC IP instances, this comprises of total number of channels present in only particular IPC IP.
ipcNotifyMaskAn encoded list of all IPC channels that can trigger the interrupt on a notify event. In case of devices having multiple IPC IP instances, this comprises of total number of channels present in only particular IPC IP.
Function Usage
/* Scenario: there is a need to set the acquire of the IPC channel
* #MY_IPC_CHAN_INDEX interrupt for the IPC interrupt channel
* #MY_IPC_INTR_INDEX by software.
* Prior to triggering the interrupt, ensure that the correspondent interrupt
* mask is set in the IPC interrupt channel #MY_IPC_INTR_INDEX
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#ifndef MY_IPC_CHAN_INDEX_WITHIN_IP
#define MY_IPC_CHAN_INDEX_WITHIN_IP (MY_IPC_CHAN_INDEX % CY_IPC_CHANNELS_PER_INSTANCE) /* Example of IPC channel index within IP instance */
#endif /* MY_IPC_CHAN_INDEX_WITHIN_IP */
#ifndef MY_IPC_ACQUIRE_INTR_MASK
#define MY_IPC_ACQUIRE_INTR_MASK (1UL << MY_IPC_CHAN_INDEX_WITHIN_IP) /* IPC acquire interrupt mask example */
#endif /* MY_IPC_ACQUIRE_INTR_MASK */
IPC_INTR_STRUCT_Type * myIpcIntr = Cy_IPC_Drv_GetIntrBaseAddr(MY_IPC_INTR_INDEX);
if (0UL != (MY_IPC_ACQUIRE_INTR_MASK & _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_NOTIFY, Cy_IPC_Drv_GetInterruptMask(myIpcIntr))))
{
Cy_IPC_Drv_SetInterrupt(myIpcIntr, CY_IPC_NO_NOTIFICATION, MY_IPC_ACQUIRE_INTR_MASK);
}
else
{
/* See the \ref Cy_IPC_Drv_SetInterruptMask function usage */
}

◆ Cy_IPC_Drv_ClearInterrupt()

__STATIC_INLINE void Cy_IPC_Drv_ClearInterrupt ( IPC_INTR_STRUCT_Type *  base,
uint32_t  ipcReleaseMask,
uint32_t  ipcNotifyMask 
)

This function is used to clear the interrupt source.

Use this function to clear a pending interrupt source in the interrupt status.

Parameters
baseThis is a handle to the IPC interrupt. This handle can be calculated from the IPC interrupt number using Cy_IPC_Drv_GetIntrBaseAddr.
ipcReleaseMaskAn encoded list of all IPC channels that can trigger the interrupt on a release event. In case of devices having multiple IPC IP instances, this comprises of total number of channels present in only particular IPC IP.
ipcNotifyMaskAn encoded list of all IPC channels that can trigger the interrupt on a notify event. In case of devices having multiple IPC IP instances, this comprises of total number of channels present in only particular IPC IP.
Function Usage
/* Scenario: enable IPC interrupts in IPC interrupt channel #MY_IPC_INTR_INDEX
* for both acquire and release events from the IPC channel #MY_IPC_CHAN_INDEX
*/
#ifndef MY_IPC_CHAN_INDEX
#define MY_IPC_CHAN_INDEX (17UL) /* Example of IPC channel index */
#endif /* MY_IPC_CHAN_INDEX */
#ifndef MY_IPC_INTR_INDEX
#define MY_IPC_INTR_INDEX (9UL) /* Example of IPC interrupt channel index */
#endif /* MY_IPC_INTR_INDEX */
#ifndef MY_IPC_CHAN_INDEX_WITHIN_IP
#define MY_IPC_CHAN_INDEX_WITHIN_IP (MY_IPC_CHAN_INDEX % CY_IPC_CHANNELS_PER_INSTANCE) /* Example of IPC channel index within IP instance */
#endif /* MY_IPC_CHAN_INDEX_WITHIN_IP */
#define MY_IPC_RELEASE_INTR_MASK (1UL << MY_IPC_CHAN_INDEX_WITHIN_IP) /* IPC release interrupt mask within IP instance */
#define MY_IPC_ACQUIRE_INTR_MASK (1UL << MY_IPC_CHAN_INDEX_WITHIN_IP) /* IPC acquire interrupt mask within IP instance */
IPC_INTR_STRUCT_Type * myIpcIntr = Cy_IPC_Drv_GetIntrBaseAddr(MY_IPC_INTR_INDEX);
uint32_t intr = Cy_IPC_Drv_GetInterruptMask(myIpcIntr);
uint32_t releaseIntr = _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_RELEASE, intr) | MY_IPC_RELEASE_INTR_MASK;
uint32_t acqiureIntr = _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_NOTIFY, intr) | MY_IPC_ACQUIRE_INTR_MASK;
Cy_IPC_Drv_SetInterruptMask(myIpcIntr, releaseIntr, acqiureIntr);
/* Scenario: the next block is inside the IPC interrupt handler */
{
/* Get all the enabled pending interrupts */
uint32_t intr = Cy_IPC_Drv_GetInterruptStatusMasked(myIpcIntr);
if (0UL != (MY_IPC_RELEASE_INTR_MASK & intr))
{
/* Handle the RELEASE event of the IPC channel MY_IPC_CHAN_INDEX */
}
if (0UL != (MY_IPC_ACQUIRE_INTR_MASK & intr))
{
/* Handle the ACQUIRE interrupt */
}
/* Clear the interrupt */
Cy_IPC_Drv_ClearInterrupt(myIpcIntr, _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_RELEASE, intr),
_FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_NOTIFY, intr));
}
/* Scenario: disable ALL the IPC interrupts (not from the IPC channel
* #MY_IPC_CHAN_INDEX only) in the IPC interrupt channel
* #MY_IPC_INTR_INDEX when they are not needed anymore
*/