/***************************************************************************//**
* \file cy_ipc_drv.h
* \version 1.130
* Provides an API declaration of the IPC driver.
*
********************************************************************************
* \copyright
* Copyright (c) (2020-2022), Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
#ifndef CY_IPC_DRV_H
#define CY_IPC_DRV_H
/**
* \addtogroup group_ipc
* \{
* The inter-processor communication (IPC) driver provides a safe and reliable
* method to transfer data between CPUs. Hardware locking ensures that only one
* device can acquire and transfer data at a time so no data is lost or
* overwritten by asynchronous processes or CPUs.
*
* Include either cy_ipc_pipe.h, cy_ipc_sema.h or cy_ipc_bt.h. Alternatively include cy_pdl.h
* to get access to all functions and declarations in the PDL.
*
* There are four parts to the API:
* - Driver-level (DRV) API - used internally by Semaphore, Pipe and Bluetooth levels. These APIs are supported in all CAT1 devices.
* - Pipe-level (PIPE) API - establishes a communication channel between
* processors. These APIs are supported in all CAT1 devices.
* - Semaphore-level (SEMA) API - enables users to set and clear flags to
* synchronize operations. These APIs are supported in all CAT1 devices.
* - Bluetooth Subsystem (BTSS) API - establishes communication channel
* between MCU and the BTSS. These APIs are supported in CAT1B devices.
*
* Firmware does not need to use the DRV API. It can implement IPC functionality
* entirely with the PIPE, SEMA and BTSS APIs.
*
* \section group_ipc_background Background
*
* IPC is implemented in hardware as a collection of individual communication
* channels, each with a set of 32-bit registers. The IPC design implements a set
* of interrupts that enable each processor to notify the other that data is
* available, or has been processed. There is also a locking mechanism that
* allows only one CPU to gain access at a time.
*
* In case of devices having multiple IPC IP instances, IPC channels and IPC
* interrupts are associated with each other within particular IP instance. It is not
* possible to create an IPC mechanism where IPC channels of one IPC instance interacts
* with interrupts of another IPC instance. Following table describes channels and
* interrupts present in different devices:
*
* | Version | Changes | Reason for Change |
*
* | 1.130 |
* Updated APIs \ref Cy_IPC_Pipe_Init. |
* Improving interrupt configuration logic. |
*
*
* | 1.120 |
* Updated APIs \ref Cy_IPC_Sema_Set, \ref Cy_IPC_Sema_Clear, \ref Cy_IPC_Sema_Status, \ref Cy_IPC_Sema_GetMaxSems.
* - Added enums \ref cy_stc_ipc_msg_buf_remove_t. |
* Support added for HPC buffer remove command and BT IPC driver enhancements. |
*
*
* | 1.110 |
* Updated internal APIs . |
* Hold PDCM lock at IPC write and to unlock only after CH release by BTSS. |
*
*
* | 1.100 |
* Added support for TRAVEO™ II Body Entry devices.
* Added support for CM0 and CM4 core devices in cy_ipc_pipe API.
* Replaced some hardcoded values (register size) with the relevant device defines. |
* Code enhancement and support for new devices. |
*
*
* | 1.91 |
* Updated \ref Cy_IPC_Sema_Set, \ref Cy_IPC_Sema_Clear, \ref Cy_IPC_Sema_Status, \ref Cy_IPC_Sema_GetMaxSems APIs
* \n Added new macros |
* Support for CAT1D devices added. |
*
*
* | 1.90 |
* Added structure \ref cy_stc_ipc_msg_inrush_mode_t and enum \ref cy_en_btipc_inrush_mode_t, Modified enums \ref cy_en_btipc_lpo_cmd_t
* and \ref cy_en_btipc_hpcpti_t. |
* Support for inrush mode selection for CAT1B. |
*
*
* | Added structure \ref cy_stc_ipc_pipe_ep_config_mask_t and \ref Cy_IPC_Pipe_EndpointInitExt API. |
* Support for multiple instance of IPC IPs for CAT1D. |
*
*
* | 1.80 |
*
*
* - Defined CY_IPC_CHAN_SYSCALL macro and handled caches for CM7 device.
* - Other than CAT1A devices, pipe config structure \ref cy_stc_ipc_pipe_config_t description is changed.
* ep0ConfigData is used for receiver endpoint and ep1ConfigData is used for send endpoint.
* For CAT1A devices, ep0ConfigData is always used for first endpoint(CM0+) and ep1ConfigData is always used for second endpoint(CM4).
* - Updated argument name of Cy_IPC_Drv_SetInterruptMask(),
* Cy_IPC_Drv_SetInterrupt() and Cy_IPC_Drv_ClearInterrupt() for better
* user readability.
* - Added multiple IPs support.
* - Removed standard c library functions from cy_ipc_sema.c.
|
*
*
*
* - Added support for CM7.
* - Enhancement based on usability/efficiency.
* - To support multiple IPC IP instances.
* - Code cleanup.
|
*
*
* | 1.70 |
* Added BT IPC service layer. |
* To support communication between MCU and BTSS through IPC. |
*
*
* | 1.60 |
* Added new APIs to use DATA0 and DATA1 for short messages. |
* Enhancement based on usability/efficiency. |
*
*
* | 1.50 |
* Updated attribute usage for the linker section placement. |
* Enhancement based on usability feedback. |
*
*
* | Fixed MISRA 2012 violations. |
* MISRA 2012 compliance. |
*
*
* | 1.40.2 |
* Updated information about IPC resources reserved for the system usage
* in \ref group_ipc_pipe_layer section.
* |
* Documentation enhancement. |
*
*
* | 1.40.1 |
* Minor documentation updates. |
* Documentation enhancement. |
*
*
* | 1.40 |
* Moved cy_semaData structure to the RAM section called ".cy_sharedmem". |
* Support Secure Boot devices. |
*
*
* | 1.30 |
* Flattened the organization of the driver source code into the single source directory and the single include directory. |
* Driver library directory-structure simplification. |
*
*
* | Moved the Cy_IPC_SystemSemaInit(), Cy_IPC_SystemPipeInit() functions implementation from IPC to Startup, removed cy_ipc_config.c and cy_ipc_config.h files. |
* Changed IPC driver configuration method from compile time to run time. |
*
*
* | Added register access layer. Use register access macros instead
* of direct register access using dereferenced pointers. |
* Makes register access device-independent, so that the PDL does
* not need to be recompiled for each supported part number. |
*
*
* | 1.20 |
* Added \ref Cy_IPC_Pipe_ExecuteCallback function.
* Updated documentation about user pipe initialization.
* |
* Interface improvement, documentation update |
*
*
* | 1.10.1 |
* Updated description of the \ref Cy_IPC_Pipe_Init,
* \ref Cy_IPC_Pipe_EndpointInit, \ref Cy_IPC_Sema_Set functions.
* Added / updated code snippets.
* |
* Documentation update and clarification |
*
*
* | 1.10 |
* Added support for more IPC structures |
* New device support |
*
*
* | 1.0 |
* Initial version |
* |
*
*
*
* \defgroup group_ipc_drv IPC driver layer (IPC_DRV)
* \{
* The functions of this layer are used in the higher IPC levels
* (Semaphores and Pipes).
* Users are not expected to call any of these IPC functions directly (cy_ipc_drv.h).
* Instead include either of cy_ipc_sema.h or cy_ipc_pipe.h.
* Alternatively include cy_pdl.h to get access to all functions and declarations in the PDL.
*
* \defgroup group_ipc_macros Macros
* Macro definitions are used in the driver
*
* \defgroup group_ipc_functions Functions
* Functions are used in the driver
*
* \defgroup group_ipc_data_structures Data Structures
* Data structures are used in the driver
*
* \defgroup group_ipc_enums Enumerated Types
* Enumerations are used in the driver
* \}
*
* \defgroup group_ipc_sema IPC semaphores layer (IPC_SEMA)
* \defgroup group_ipc_pipe IPC pipes layer (IPC_PIPE)
* \defgroup group_ipc_bt IPC Bluetooth sub-system layer (IPC_BTSS)
*
*/
/******************************************************************************/
/* Include files */
/******************************************************************************/
#include "cy_device.h"
#if defined (CY_IP_M4CPUSS) || defined (CY_IP_MXIPC) || defined (CY_IP_M7CPUSS)
#include "cy_syslib.h"
#include