IPC双核通信

1.  void IPC_setFlagLtoR(IPC_Type_t ipcType, uint32_t flags);
**function description**The local core sets the local-to-remote IPC flag. This function allows the local core system to set the specified IPC flag and send it to the remote core system. `flags` The parameter can be any IPC flag value: `IPC_FLAG0 - IPC_FLAG31`. **parameter description**

input parameters: - parameter ipcType Is the enumeration type corresponding to the IPC instance used. >- parameter flags is the IPC flag mask to be set.

return parameter>-None

2.  void IPC_clearFlagLtoR(IPC_Type_t ipcType, uint32_t flags);
**function description**: The local core clears the local-to-remote IPC flag. This function allows the local core system to clear the specified IPC flag sent to the remote core system. `flags` The parameter can be any IPC flag value: IPC _ FLAG0-IPC _ FLAG31. **parameter description**

input parameters: - parameter ipcType Is the enumeration type corresponding to the IPC instance used. >- parameter flags is the IPC flag mask to be cleared.

return parameter>-None

3.  void IPC_ackFlagRtoL(IPC_Type_t ipcType, uint32_t flags);
**function description**The local kernel acknowledges the remote-to-local IPC flag. This function allows the local kernel system to acknowledge/clear the IPC flags set by the remote kernel system. `flags` The parameter can be any IPC flag value: `IPC_FLAG0 - IPC_FLAG31`. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter flags is the IPC flag mask for acknowledgement.

return parameter>-None

4.  bool IPC_isFlagBusyLtoR(IPC_Type_t ipcType, uint32_t flags);
**function description**: Determines whether a given IPC flag is busy. This function allows the caller to determine whether the specified local-to-remote IPC flag is pending. `flags ` The parameter can be any IPC flag value: `IPC_FLAG0 - IPC_FLAG31`. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter flags is the IPC flag mask for acknowledgement.

return parameter>- parameter true is any of the specified IPC flags busy >- parameter false is all of the specified IPC flags idle

5.  bool IPC_isFlagBusyRtoL(IPC_Type_t ipcType, uint32_t flags);
**function description**: Determines whether a given remote-to-local IPC flag is busy. This function allows the caller to determine whether the specified remote-to-local IPC flag is pending. `flags ` The parameter can be any IPC flag value: `IPC_FLAG0 - IPC_FLAG31`. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter flags is the IPC flag mask for acknowledgement.

return parameter>- parameter true is any of the specified IPC flags busy >- parameter false is all of the specified IPC flags idle

6.  void IPC_waitForFlag(IPC_Type_t ipcType, uint32_t flag);
**function description**: Wait for remote kernel to send flag. This function allows the caller to wait for the remote kernel to send a remote-to-local flag. `flag ` The parameter can be any IPC flag value: `IPC_FLAG0 - IPC_FLAG31`. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter flags is the IPC flag mask for acknowledgement.

return parameter>-None

7.  void IPC_waitForAck(IPC_Type_t ipcType, uint32_t flag);
**function description**: Wait for the IPC flag to be acknowledged. This function allows the caller to wait for the remote kernel to acknowledge the IPC flag. `flag ` The parameter can be any IPC flag value: `IPC_FLAG0 - IPC_FLAG31`. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter flags is the IPC flag mask for acknowledgement.

return parameter>-None

8.  void IPC_sync(IPC_Type_t ipcType, uint32_t flag);
**function description**: Synchronize both cores. This function allows local and remote kernels to be synchronized. Neither kernel returns from the function call until another kernel enters the function. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter flags is the IPC flag mask for acknowledgement.

notice: This function must be called with the same flag mask on both cores.

return parameter>-None

9.  void IPC_init(IPC_Type_t ipcType)
**function description**: Initialize IPC. This function initializes IPC by clearing all flags. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used.

return parameter>-None

10.  bool IPC_sendCommand(IPC_Type_t ipcType, uint32_t flags, bool addrCorrEnable,
                uint32_t command, uint32_t addr, uint32_t data);
**function description**: Send commands to the remote kernel. This function allows the caller to send commands to the remote kernel. A command consists of unique command values, one ``32位地址``, and one ``32位数据``. The function also sends the specified flags to the remote kernel. Due to possible differences in the address space of the local and remote cores, for example, in the F2838X device, the address space of the C28x core is different from that of the CM core. If you ``addr ``are ``IPC MSG RAM``pointing to an address in, ``addrCorrEnable``the parameter can be used to correct the address mismatch. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter flags is the IPC flag mask for acknowledgement. >- parameter addrCorrEnable is a flag to determine whether to translate the addr argument to a remote kernel address space. >- parameter command is a 32-bit command value. >- parameter addr is the 32-bit address sent as part of the command. >- parameter data is the 32-bit data sent as part of the command. >-The parameter flags parameter can be any IPC flag value: IPC_FLAG0 - IPC_FLAG31. >-The parameter addrCorrEnable parameter can take the following values: - Transl ** IPC_ADDR_CORRECTION_ENABLE ates the address into the address space of the remote kernel - ** IPC_ADDR_CORRECTION_DISABLE : Do not modify addrparameter

Applications should use the IPC _ getResponse function to read the response sent by the remote kernel.

notice: The application should wait and not send another command until it receives a response.

notice: addrCorrEnableparameters must be consistent on both the sending and receiving cores.

return parameter>- parameter true Yes The command was sent successfully >- parameter false Yes The specified flag is busy and the command was not sent

11.  bool IPC_readCommand(IPC_Type_t ipcType, uint32_t flags, bool addrCorrEnable,
                uint32_t *command, uint32_t *addr, uint32_t *data);
**function description**: Read the command sent by the remote kernel. This function allows the caller to read the commands sent by the remote kernel. A command consists of unique command values, one ``32位地址``, and one ``32位数据``. There may be differences in the address space of the local and remote cores, for example, in the F2838X device, the C28x core and the CM core have different address spaces. If you ``addr``are ``IPC MSG RAM``pointing to an address in, ``addrCorrEnable``the parameter can be used to correct the address mismatch. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter flags is the IPC flag mask for acknowledgement. >- parameter addrCorrEnable is a flag to determine whether to translate the addr argument to a remote kernel address space. >- parameter command is a 32-bit command value. >- parameter addr is the 32-bit address sent as part of the command. >- parameter data is the 32-bit data sent as part of the command. >-The parameter flags parameter can be any IPC flag value: IPC_FLAG0 - IPC_FLAG31. >-The parameter addrCorrEnable parameter can take the following values: - Transl ** IPC_ADDR_CORRECTION_ENABLE ates the address into the address space of the remote kernel - ** IPC_ADDR_CORRECTION_DISABLE : Do not modify addrparameter

notice: After reading the command, the application should acknowledge the flag and send a response if needed.

notice: addrCorrEnable parameters must be consistent on both the sending and receiving cores.

return parameter>- parameter true Yes The command was sent successfully >- parameter false Yes The specified flag is busy and the command was not sent

12.  void IPC_sendResponse(IPC_Type_t ipcType, uint32_t data)
**function description**: Send the response of the command to the remote kernel. This function allows the caller to respond to commands previously sent by the remote kernel. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter data is the 32-bit response value to send.

return parameter>-None

13.  uint32_t IPC_getResponse(IPC_Type_t ipcType)
**function description**: Read the response from the remote kernel. This function allows the caller to read the remote kernel's response to a command previously sent by the local kernel. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used.

return parameter>-Response value of 32 bits.

14.  uint64_t IPC_getCounter(IPC_Type_t ipcType)
**function description**: Read the timestamp counter value. This function allows the caller to read the IPC timestamp counter value. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used.

return parameter>-64-bit counter value.

15.  void IPC_registerInterrupt(IPC_Type_t ipcType, uint32_t ipcInt,
                      void (*pfnHandler)(void));
**function description**: Register an interrupt handler for IPC. This function registers the handler to be called when an IPC interrupt occurs. This function enables a global interrupt in the interrupt controller. ``ipcInt``The parameter can be any IPC flag value: ``IPC_INT0 - IPC_INT7``. ``IPC_INT0``Corresponds to a ``IPC``flag 0 interrupt, and so on. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter ipcInt is the flag number of the interrupt being registered. >- parameter pfnHandler is a pointer to the ISR function.

16.  void IPC_unregisterInterrupt(IPC_Type_t ipcType, uint32_t ipcInt);
**function description**: Logs off the interrupt handler for the IPC. This function clears the handler that is called when an IPC interrupt occurs. The function also masks the interrupt in the interrupt controller to ensure that the interrupt handler is not called again. ``ipcInt``The parameter can be any IPC flag value: ``IPC_INT0 - IPC_INT7``. ``IPC_INT0``Corresponds to an IPC flag 0 interrupt, and so on. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter ipcInt is the flag number of the logging-off interrupt.

17.  void IPC_initMessageQueue(IPC_Type_t ipcType, volatile IPC_MessageQueue_t *msgQueue,
                     uint32_t ipcInt_L, uint32_t ipcInt_R);
**function description**: Initializes the IPC message queue. This function uses a ring buffer and an index address to initialize an IPC message queue for a pair of IPC interrupts. ``ipcInt_L``The and ``ipcInt_R``parameters can be one of the following values: ``IPC_INT0``, ``IPC_INT1``, ``IPC_INT2``, ``IPC_INT3``. **parameter description**

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter msgQueue Specify IPC_MessageQueue_t the address of the instance. >- parameter ipcInt_L Specifies the interrupt number that the local kernel uses for the message queue. >- parameter ipcInt_R Specifies the interrupt number that the remote kernel uses for the message queue.

notice: If an interrupt is currently being used by one IPC_MessageQueue_tinstance, the interrupt should not be associated with another IPC_MessageQueue_tinstance.

notice: For a particular ipcInt_L - ipcInt_Rpairing, instances must be defined and initialized IPC_MessageQueue_ton both the local and remote systems.

return parameter>-None

18.  bool IPC_sendMessageToQueue(IPC_Type_t ipcType,
                       volatile IPC_MessageQueue_t *msgQueue,
                       bool addrCorrEnable, IPC_Message_t *msg, bool block);

Sends a message function descriptionto a message queue. This function checks whether there is a free slot in the message queue. If there is an empty slot, it will put msgthe pointed message into the free slot and set the appropriate IPC interrupt flag. parameter description

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter msgQueue Specify IPC_MessageQueue_t the address of the instance. >- parameter addrCorrEnable is a flag to determine whether to translate the addr argument to a remote kernel address space. >- parameter msg Specifies the address of the instance to send to the message queue IPC_Message_t. >- parameter block Specifies whether to allow the function to block until the buffer has a free slot. >-The parameter addrCorrEnable parameter can take the following values: - Transl ** IPC_ADDR_CORRECTION_ENABLE ates the address into the address space of the remote kernel - ** IPC_ADDR_CORRECTION_DISABLE : Do not modify addrparameter - The parameter block parameter can take the following values: - IPC_BLOCKING_CALL - IPC_NONBLOCKING_CALL

return parameter>- parameter true Message successfully sent >- parameter false Queue is full

19.  bool IPC_readMessageFromQueue(IPC_Type_t ipcType,
                         volatile IPC_MessageQueue_t *msgQueue,
                         bool addrCorrEnable, IPC_Message_t *msg, bool block);

Reads a message function descriptionfrom a message queue. This function checks if there is a message in the message queue. If a message exists, it reads the message and writes to msg the address pointed to. parameter description

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter msgQueue Specify IPC_MessageQueue_t the address of the instance. >- parameter addrCorrEnable is a flag to determine whether to translate the addr argument to a remote kernel address space. >- parameter msg Specifies the address of the instance to send to the message queue IPC_Message_t. >-The parameter addrCorrEnable parameter can take the following values: - Transl ** IPC_ADDR_CORRECTION_ENABLE ates the address into the address space of the remote kernel - The parameter block parameter can take the following values: - IPC_BLOCKING_CALL - IPC_NONBLOCKING_CALL**

return parameter>- parameter true Message successfully sent >- parameter false Queue is full

20.  bool IPC_readMessageFromQueue(IPC_Type_t ipcType,
                         volatile IPC_MessageQueue_t *msgQueue,
                         bool addrCorrEnable, IPC_Message_t *msg, bool block);

Reads a message function descriptionfrom a message queue. This function checks if there is a message in the message queue. If a message exists, it reads the message and writes to msg the address pointed to. parameter description

input parameters: - parameter ipcType Is an enumeration corresponding to the IPC instance used. >- parameter msgQueue Specify IPC_MessageQueue_t the address of the instance. >- parameter addrCorrEnable is a flag to determine whether to translate the addr argument to a remote kernel address space. >- parameter msg Specifies the address of the instance to send to the message queue IPC_Message_t. >-The parameter addrCorrEnable parameter can take the following values: - Transl ** IPC_ADDR_CORRECTION_ENABLE ates the address into the address space of the remote kernel - The parameter block parameter can take the following values: - IPC_BLOCKING_CALL - IPC_NONBLOCKING_CALL**

return parameter>- parameter true Message successfully read >- parameter false Queue is empty