1 /***************************************************************************//**
2 * \file cy_ipc_drv.h
3 * \version 1.60
4 *
5 * Provides an API declaration of the IPC driver.
6 *
7 ********************************************************************************
8 * \copyright
9 * Copyright 2016-2020 Cypress Semiconductor Corporation
10 * SPDX-License-Identifier: Apache-2.0
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 *     http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *******************************************************************************/
24 
25 #ifndef CY_IPC_DRV_H
26 #define CY_IPC_DRV_H
27 
28 
29 /**
30 * \addtogroup group_ipc
31 * \{
32 * The inter-processor communication (IPC) driver provides a safe and reliable
33 * method to transfer data between CPUs. Hardware locking ensures that only one
34 * device can acquire and transfer data at a time so no data is lost or
35 * overwritten by asynchronous processes or CPUs.
36 *
37 * Include either cy_ipc_pipe.h, cy_ipc_sema.h or cy_ipc_bt.h. Alternatively include cy_pdl.h
38 * to get access to all functions and declarations in the PDL.
39 *
40 * There are three parts to the API:
41 *     - Driver-level (DRV) API - used internally by Semaphore, Pipe and Bluetooth levels
42 *     - Pipe-level (PIPE) API - establishes a communication channel between
43 *       processors
44 *     - Semaphore-level (SEMA) API - enables users to set and clear flags to
45 *       synchronize operations.
46 *     - Bluetooth Subsystem (BTSS) API - establishes communication channel
47 *       between MCU and the BTSS
48 *
49 * Firmware does not need to use the DRV API. It can implement IPC functionality
50 * entirely with the PIPE, SEMA and BTSS APIs.
51 *
52 * \section group_ipc_background Background
53 *
54 * IPC is implemented in hardware as a collection of individual communication
55 * channels, each with a set of 32-bit registers. The IPC design implements a set
56 * of interrupts that enable each processor to notify the other that data is
57 * available, or has been processed. There is also a locking mechanism that
58 * allows only one CPU to gain access at a time.
59 *
60 * The Driver-level API manages each channel's registers to implement IPC
61 * functionality. For information on the IPC registers, see the IPC chapter of
62 * the Technical Reference Manual (TRM).
63 *
64 * At the hardware level, communication is a five-step process.
65 *     -#  The sending processor acquires a channel
66 *     -#  It puts data into the channel
67 *     -#  The sender generates a notify event (interrupt)
68 *     -#  The receiving processor identifies the sender and retrieves the data
69 *     -#  The receiving processor generates a release event (interrupt)
70 *
71 * \image html ipc_driver.png
72 *
73 * These transactions are handled transparently by the DRV-level API. Use the
74 * PIPE, SEMA and BTSS layers of the API to implement communication in your application.
75 * The data transferred is limited to a single 32-bit value incase of PIPE and SEMA and two
76 * 32 bit value incse of BTIPC. As implemented by
77 * the PIPE API, that value is a pointer to a data structure of arbitrary size
78 * and complexity.
79 * BTSS uses both 32 bit registers for communication of short messages. If the payload
80 * is greater than 7 bytes, then it copies the data to  the shared memory between MCU
81 * and the BT SS.
82 *
83 * \section group_ipc_overview Overview
84 *
85 * The Pipe is the key element in the PDL design. A pipe is typically a
86 * full-duplex communication channel between CPU cores. A pipe allows a single
87 * conduit to transfer messages or data to and from multiple processes or CPUs.
88 *
89 * A pipe has two endpoints, one on each core. Each endpoint contains a dedicated
90 * IPC channel and an interrupt. IPC channels 0-7(8 for the CYB064XX devices)
91 * and IPC interrupts 0-7 are reserved for system use.
92 *
93 * The pipe also contains the number of clients it supports, and for each client
94 * a callback function. So the pipe can service a number of clients, each with a
95 * separate callback function, on either endpoint. The number of clients a pipe
96 * supports is the sum of each endpoint's clients.
97 *
98 * This design enables any number of processes on the sending core to put
99 * arbitrary data into a single pipe. The first element of that data is the
100 * client ID of the client that should handle the data.
101 *
102 * An interrupt notifies the receiving core that data is available. The receiving
103 * core parses the data to identify the client, and then dispatches the event to
104 * the appropriate client via the client callback function. An interrupt notifies
105 * the sending core that the receiver is finished. In this way a single pipe can
106 * manage arbitrary data transfers between cores with data flowing in either
107 * direction.
108 *
109 * \image html ipc_ints.png
110 *
111 * The application can use semaphores to control access to shared resources, as
112 * required by the application's logic.
113 *
114 * The PDL provides specific files that set up default IPC functionality.
115 * They are system_psoc6.h, system_psoc6_cm0plus.c and system_psoc6_cm4.c. You
116 * can modify these files based on the requirements of your design.
117 * If you use PSoC Creator as a development environment, it will not overwrite
118 * your changes when you generate the application or build your code.
119 *
120 * BTSS provides dedicated communication channels for communication between
121 * MCU and the BT SS. APIs provided handle exchange of HCI and HPC packets
122 * using 4 dedicated IPC channels. Two dedicated Up Link (UL) channels, one for HCI
123 * and another for HPC from MCU to BT SS and two dedicated Down Link (DL) channels,
124 * one for HCI and another for HPC from BT SS to MCU are used.
125 *
126 * \section group_ipc_pipe_layer PIPE layer
127 *
128 * A pipe is a communication channel between two endpoints. PSoC 6 devices support
129 * 16 IPC channels, and 16 IPC interrupts, each numbered 0-15. IPC Channels 0-7
130 * and IPC interrupts 0-7 are reserved for system use. Channels 8-15 and
131 * interrupts 8-15 are available for application use.
132 *
133 * A full duplex pipe uses two IPC channels, one per endpoint. Each endpoint
134 * specifies all the information required to process a message (either sent or
135 * received). Each endpoint is configured to use an IPC channel, and an IPC
136 * interrupt. Common practice is to use the interrupt with the same number as
137 * the IPC channel. However, IPC Interrupts are not directly associated with the
138 * IPC channels, so any channel can use any interrupt.  Any IPC channel can
139 * trigger 0, 1 or all the IPC interrupts at once, depending on the Notify or
140 * Release masks used.
141 *
142 * It is also possible to set up a one-directional pipe, using a single IPC
143 * channel. In this design one processor is always the sender, and the other is
144 * always the receiver. However, there are still two endpoints.
145 *
146 * A pipe supports an arbitrary number of clients with an array of callback
147 * functions, one per client. The client ID is the index number into the array
148 * for the client. After a pipe is configured and initialized, the application
149 * calls Cy_IPC_Pipe_RegisterCallback() once per client to register each client's
150 * callback function. Multiple clients can use the same callback function. The
151 * endpoints in a pipe share the callback array.
152 *
153 * Use Cy_IPC_Pipe_SendMessage() to send data. You specify both the "to" and
154 * "from" endpoints, and a callback function to be used when the data transfer is
155 * complete. The data is a 32-bit void pointer. The data pointed to is arbitrary,
156 * and can be an array, a structure, or a location in memory. The only limitation
157 * is that the first element of the data must be a 32-bit unsigned word containing
158 * a client ID number. The ID number is the index into the callback array.
159 *
160 * When a message is sent, the receiving endpoint's interrupt handler is called.
161 * The ISR can perform any task required by the design. However, as part of its
162 * function it calls \ref Cy_IPC_Pipe_ExecCallback. This function retrieves the
163 * client ID from the data and calls the associated callback function.
164 * The user-supplied callback function handles the data in whatever way is
165 * appropriate based on the application logic.
166 *
167 * After the callback function is returned by the receiver, it invokes the release
168 * callback function defined by the sender of the message.
169 *
170 * \section group_ipc_sema_layer SEMA Layer
171 *
172 * A semaphore is a flag the application uses to control access to a shared
173 * resource. The SEMA-level API uses an IPC channel to implement
174 * semaphores. Startup code sets up a default semaphore system. The
175 * default system creates an array of 128 semaphores (four 32-bit values).
176 * Semaphores 0-15 are reserved for system use. See
177 * Configuration Considerations - SEMA.
178 *
179 * Functions are available to initialize the semaphore system, to set or
180 * clear a semaphore, or to get the semaphore's current status. Application
181 * logic uses SEMA functions to relate a particular semaphore to a particular
182 * shared resource, and set, clear, or check the flag when accessing the
183 * shared resource.
184 *
185 * \section group_ipc_bt_layer BTSS layer
186 *
187 * A Bluetooth Sub-system (BTSS) layer is a communication channel between the MCU and the BT
188 * Sub-system. It uses 4 IPC channels and 2 interrupts. 2 UL channels ( one for HCI and HPC each)
189 * and 2 DL channels (one for HCI and HPC each). IPC interrupt 0 is used to interrupt the
190 * BT SS and IPC interrupt 1 is used to interrupt the MCU.
191 * IPC channels 0 is used for HCI UL, channel 1 is used from HCI DL,
192 * IPC channels 2 is used for HPC UL,and channel 3 is used from HPC DL.
193 * The IPC interrupt gets triggered for both Notify and Release channel.
194 * Bluetooth stack interface layer registers a callback function for notification
195 * when BT SS sends an HCI packet. It also provides APIs to read the
196 * HCI packets from the BT SS. On the UL path, it supports APIs to send HCI packet
197 * from MCU to BT SS.
198 *
199 * The communication is made more efficient by elimilnating the need for buffers
200 * by packing them into the DATA0 and DATA1 IPC channel registers when payload
201 * length is less than or equal to 7 bytes . In case the where the payload length
202 * is greater than 7bytes, it would use the shared memory to send/recevive the packet.
203 *
204 * This layer support control message communication between the MCU and the BT SS
205 * using the HPC channels. The HPC channel is used for power manamgement,
206 * IO configuration, access for TRNG, etc. APIs are provided to send HPC packets to the
207 * BT SS. It also supports APIs to register the callback function to get notification on receiving
208 * the HPC packets from the BT SS. Multiple modules running on the MCU can register
209 * callback functions. Maximum number of HPC callbacks supported is decided by
210 * the MAX_BT_IPC_HPC_CB macro. All the shared buffer management mechanism
211 * is built into this layer.
212 *
213 * \section group_ipc_configuration_cypipe Configuration Considerations - CYPIPE
214 *
215 * There are none. The startup files set up the required CYPIPE for system
216 * use. Do not modify the CYPIPE. It uses IPC channels 5 and 6 to implement full
217 * duplex communication between cores. See System Interrupt (SysInt) for background.
218 *
219 * To create your own pipe (<b>USRPIPE</b>) you should edit startup files
220 * and take 4 steps:
221 *   -# Define a pipe callbacks processing interrupt handler
222 *      (similar to <b>Cy_SysIpcPipeIsrCm0</b> or <b>Cy_SysIpcPipeIsrCm4</b>)
223 *   -# Define a callbacks array (similar to <b>systemIpcPipeSysCbArray</b>)
224 *   -# Define your pipe configuration with a cy_stc_ipc_pipe_config_t type structure
225 *      (similar to <b>systemIpcPipeConfigCm0</b> and <b>systemIpcPipeConfigCm4</b>)
226 *   -# Call Cy_IPC_Pipe_Init() from each core to initialize your pipe (similar
227 *      to call in the <b>SystemInit</b>)
228 *
229 * \section group_ipc_configuration_sema Configuration Considerations - SEMA
230 *
231 * Startup code calls Cy_IPC_Sema_Init() with default values to set up semaphore
232 * functionality. By default the semaphore system uses IPC channel 4, and
233 * creates 128 semaphores. Do <b>not</b> change the IPC channel.
234 * You can change the number of semaphores.
235 *
236 * To change the number of semaphores, modify this line of code in system_psoc6.h.
237 *
238 * \code
239 * #define CY_IPC_SEMA_COUNT               (uint32_t)(128u)
240 * \endcode
241 *
242 * Startup also declares array ipcSemaArray to hold the semaphore
243 * flags based on the size defined for this symbol. Use increments of 32. You
244 * must have at least 32 semaphores. Semaphores 0-15 are reserved for
245 * system use. Your application can use semaphores greater than 15.
246 *
247 * \section group_ipc_configuration_btss Configuration Considerations - BTSS
248 *
249 * Application code calls Cy_BTIPC_Init() with configuration parameters to set up BTSS IPC
250 * functionality. By default the BT IPC uses IPC channel 0,1,2 and 3.
251 * Do <b>not</b> change the IPC channel.
252 *
253 * To change the number of callbacks supported, modify this line of code in cy_ipc_bt.h.
254 *
255 * \code
256 * #define MAX_BT_IPC_HPC_CB           5
257 * \endcode
258 *
259 * To change the count of maximum number of buffers shared by BT SS,
260 * modify this line of code in cy_ipc_bt.h.
261 *
262 * \code
263 * #define MAX_BUF_COUNT               10
264 * \endcode
265 *
266 * \section group_ipc_more_information More Information
267 *
268 * If the default startup file is not used, or SystemInit() is not called in your
269 * project, call the following three functions prior to executing any flash or
270 * EmEEPROM write or erase operation:
271 *  -# Cy_IPC_Sema_Init()
272 *  -# Cy_IPC_Pipe_Config()
273 *  -# Cy_IPC_Pipe_Init()
274 *  -# Cy_Flash_Init()
275 *
276 * See the technical reference manual(TRM) for more information on the IPC.
277 *
278 * \section group_ipc_changelog Changelog
279 *
280 * <table class="doxtable">
281 *   <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr>
282 *   <tr>
283 *     <td >1.60</td>
284 *     <td>Added new APIs to use DATA0 and DATA1 for short messages.</td>
285 *     <td>Enhancement based on usability/efficiency.</td>
286 *   </tr>
287 *   <tr>
288 *     <td rowspan="2">1.50</td>
289 *     <td>Updated attribute usage for the linker section placement.</td>
290 *     <td>Enhancement based on usability feedback.</td>
291 *   </tr>
292 *   <tr>
293 *     <td>Fixed MISRA 2012 violations.</td>
294 *     <td>MISRA 2012 compliance.</td>
295 *   </tr>
296 *   <tr>
297 *     <td>1.40.2</td>
298 *     <td>Updated information about IPC resources reserved for the system usage
299 *         in \ref group_ipc_pipe_layer section.
300 *     </td>
301 *     <td>Documentation enhancement.</td>
302 *   </tr>
303 *   <tr>
304 *     <td>1.40.1</td>
305 *     <td>Minor documentation updates.</td>
306 *     <td>Documentation enhancement.</td>
307 *   </tr>
308 *   <tr>
309 *     <td rowspan="1">1.40</td>
310 *     <td>Moved cy_semaData structure to the RAM section called ".cy_sharedmem".</td>
311 *     <td>Support Secure Boot devices.</td>
312 *   </tr>
313 *   <tr>
314 *     <td rowspan="3">1.30</td>
315 *     <td>Flattened the organization of the driver source code into the single source directory and the single include directory.</td>
316 *     <td>Driver library directory-structure simplification.</td>
317 *   </tr>
318 *   <tr>
319 *     <td>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.</td>
320 *     <td>Changed IPC driver configuration method from compile time to run time.</td>
321 *   </tr>
322 *   <tr>
323 *     <td>Added register access layer. Use register access macros instead
324 *         of direct register access using dereferenced pointers.</td>
325 *     <td>Makes register access device-independent, so that the PDL does
326 *         not need to be recompiled for each supported part number.</td>
327 *   </tr>
328 *   <tr>
329 *     <td>1.20</td>
330 *     <td>Added \ref Cy_IPC_Pipe_ExecuteCallback function.
331 *         Updated documentation about user pipe initialization.
332 *     </td>
333 *     <td>Interface improvement, documentation update</td>
334 *   </tr>
335 *   <tr>
336 *     <td>1.10.1</td>
337 *     <td>Updated description of the \ref Cy_IPC_Pipe_Init,
338 *         \ref Cy_IPC_Pipe_EndpointInit, \ref Cy_IPC_Sema_Set functions.
339 *         Added / updated code snippets.
340 *     </td>
341 *     <td>Documentation update and clarification</td>
342 *   </tr>
343 *   <tr>
344 *     <td>1.10</td>
345 *     <td>Added support for more IPC structures</td>
346 *     <td>New device support</td>
347 *   </tr>
348 *   <tr>
349 *     <td>1.0</td>
350 *     <td>Initial version</td>
351 *     <td></td>
352 *   </tr>
353 * </table>
354 *
355 * \defgroup group_ipc_drv IPC driver layer (IPC_DRV)
356 * \{
357 *   The functions of this layer are used in the higher IPC levels
358 *   (Semaphores and Pipes).
359 *   Users are not expected to call any of these IPC functions directly (cy_ipc_drv.h).
360 *   Instead include either of cy_ipc_sema.h or cy_ipc_pipe.h.
361 *   Alternatively include cy_pdl.h to get access to all functions and declarations in the PDL.
362 *
363 *   \defgroup group_ipc_macros Macros
364 *       Macro definitions are used in the driver
365 *
366 *   \defgroup group_ipc_functions Functions
367 *       Functions are used in the driver
368 *
369 *   \defgroup group_ipc_data_structures Data Structures
370 *       Data structures are used in the driver
371 *
372 *   \defgroup group_ipc_enums Enumerated Types
373 *       Enumerations are used in the driver
374 * \}
375 *
376 * \defgroup group_ipc_sema IPC semaphores layer (IPC_SEMA)
377 * \defgroup group_ipc_pipe IPC pipes layer (IPC_PIPE)
378 * \defgroup group_ipc_bt IPC bluetooth sub-system layer (IPC_BTSS)
379 *
380 */
381 
382 
383 /******************************************************************************/
384 /* Include files                                                              */
385 /******************************************************************************/
386 
387 #include "cy_device.h"
388 
389 #if defined (CY_IP_M4CPUSS) || defined (CY_IP_MXIPC)
390 
391 
392 #include "cy_syslib.h"
393 #include <stddef.h>
394 
395 
396 /**
397 * \addtogroup group_ipc_macros
398 * \{
399 */
400 
401 /** Driver major version */
402 #define CY_IPC_DRV_VERSION_MAJOR       1
403 
404 /** Driver minor version */
405 #define CY_IPC_DRV_VERSION_MINOR       60
406 
407 /** Defines a value to indicate that no notification events are needed */
408 #define CY_IPC_NO_NOTIFICATION         (uint32_t)(0x00000000UL)
409 
410 /* Error Code constants */
411 #define CY_IPC_ID CY_PDL_DRV_ID(0x22u)  /**< Software PDL driver ID for IPC */
412 
413 /** Return prefix for IPC driver function status codes */
414 #define CY_IPC_ID_INFO    (uint32_t)( CY_IPC_ID | CY_PDL_STATUS_INFO )
415 /** Return prefix for IPC driver function warning return values */
416 #define CY_IPC_ID_WARNING (uint32_t)( CY_IPC_ID | CY_PDL_STATUS_WARNING)
417 /** Return prefix for IPC driver function error return values */
418 #define CY_IPC_ID_ERROR   (uint32_t)( CY_IPC_ID | CY_PDL_STATUS_ERROR)
419 
420 /** Converts the IPC interrupt channel number to interrupt vector */
421 #define CY_IPC_INTR_NUM_TO_VECT(x)         ((int32_t) cy_device->cpussIpc0Irq + (x))
422 
423 /** \} group_ipc_macros */
424 
425 /* end of definition in device.h */
426 
427 /** \cond INTERNAL */
428 #if (CY_CPU_CORTEX_M0P)
429     #define CY_IPC_CHAN_SYSCALL         CY_IPC_CHAN_SYSCALL_CM0
430 #else
431     #define CY_IPC_CHAN_SYSCALL         CY_IPC_CHAN_SYSCALL_CM4
432 #endif  /* (CY_CPU_CORTEX_M0P) */
433 /** \endcond */
434 
435 /**
436 * \addtogroup group_ipc_enums
437 * \{
438 */
439 
440 /**
441 * This is a list of ENUMs used for function return status.
442 */
443 typedef enum
444 {
445     /** Function was successfully executed */
446     CY_IPC_DRV_SUCCESS      = (0x00u),
447     /** Function was not executed due to an error.
448         Typical conditions for the error explained
449         in the function description */
450     CY_IPC_DRV_ERROR        = ( CY_IPC_ID_ERROR + 1UL),
451 } cy_en_ipcdrv_status_t;
452 
453 /** \} group_ipc_enums */
454 
455 
456 #ifdef __cplusplus
457 extern "C" {
458 #endif
459 
460 /** \cond INTERNAL */
461 
462 __STATIC_INLINE void     Cy_IPC_Drv_WriteDataValue (IPC_STRUCT_Type* base, uint32_t dataValue);
463 __STATIC_INLINE uint32_t Cy_IPC_Drv_ReadDataValue (IPC_STRUCT_Type const * base);
464 
465 __STATIC_INLINE uint32_t Cy_IPC_Drv_ExtractAcquireMask (uint32_t intMask);
466 __STATIC_INLINE uint32_t Cy_IPC_Drv_ExtractReleaseMask (uint32_t intMask);
467 
468 /** \endcond */
469 
470 /**
471 * \addtogroup group_ipc_functions
472 * \{
473 */
474 
475 __STATIC_INLINE IPC_STRUCT_Type*       Cy_IPC_Drv_GetIpcBaseAddress (uint32_t ipcIndex);
476 __STATIC_INLINE IPC_INTR_STRUCT_Type*  Cy_IPC_Drv_GetIntrBaseAddr (uint32_t ipcIntrIndex);
477 
478 __STATIC_INLINE void     Cy_IPC_Drv_AcquireNotify (IPC_STRUCT_Type * base, uint32_t notifyEventIntr);
479 __STATIC_INLINE void     Cy_IPC_Drv_ReleaseNotify (IPC_STRUCT_Type * base, uint32_t notifyEventIntr);
480 
481 __STATIC_INLINE  cy_en_ipcdrv_status_t Cy_IPC_Drv_LockAcquire (IPC_STRUCT_Type const * base);
482 cy_en_ipcdrv_status_t    Cy_IPC_Drv_LockRelease (IPC_STRUCT_Type * base, uint32_t releaseEventIntr);
483 __STATIC_INLINE bool     Cy_IPC_Drv_IsLockAcquired (IPC_STRUCT_Type const * base);
484 __STATIC_INLINE uint32_t Cy_IPC_Drv_GetLockStatus (IPC_STRUCT_Type const * base);
485 
486 cy_en_ipcdrv_status_t    Cy_IPC_Drv_SendMsgWord (IPC_STRUCT_Type * base, uint32_t notifyEventIntr, uint32_t message);
487 cy_en_ipcdrv_status_t    Cy_IPC_Drv_ReadMsgWord (IPC_STRUCT_Type const * base, uint32_t * message);
488 
489 #if (CY_IP_M4CPUSS_VERSION > 1) || defined (CY_IP_M33SYSCPUSS_VERSION) || defined (CY_DOXYGEN)
490 cy_en_ipcdrv_status_t    Cy_IPC_Drv_SendMsgDWord (IPC_STRUCT_Type * base, uint32_t notifyEventIntr, uint32_t* message);
491 cy_en_ipcdrv_status_t    Cy_IPC_Drv_ReadMsgDWord (IPC_STRUCT_Type const * base, uint32_t* message);
492 #endif
493 
494 __STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_SendMsgPtr (IPC_STRUCT_Type* base, uint32_t notifyEventIntr, void const * msgPtr);
495 __STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_ReadMsgPtr (IPC_STRUCT_Type const * base, void ** msgPtr);
496 
497 __STATIC_INLINE void     Cy_IPC_Drv_SetInterruptMask (IPC_INTR_STRUCT_Type * base,
498                                                       uint32_t ipcReleaseMask, uint32_t ipcAcquireMask);
499 __STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptMask (IPC_INTR_STRUCT_Type const * base);
500 __STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptStatusMasked (IPC_INTR_STRUCT_Type const * base);
501 __STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptStatus (IPC_INTR_STRUCT_Type const * base);
502 __STATIC_INLINE void     Cy_IPC_Drv_SetInterrupt (IPC_INTR_STRUCT_Type * base,
503                                                       uint32_t ipcReleaseMask, uint32_t ipcAcquireMask);
504 __STATIC_INLINE void     Cy_IPC_Drv_ClearInterrupt (IPC_INTR_STRUCT_Type * base,
505                                                       uint32_t ipcReleaseMask, uint32_t ipcAcquireMask);
506 
507 
508 /*******************************************************************************
509 * Function Name: Cy_IPC_Drv_GetIpcBaseAddress
510 ****************************************************************************//**
511 *
512 * This function takes an IPC channel index as a parameter and returns the base
513 * address the IPC registers corresponding to the IPC channel.
514 *
515 * \note The user is responsible for ensuring that ipcIndex does not exceed the
516 * limits.
517 *
518 * \param ipcIndex
519 * Represents the number of IPC structure. This is converted to the base address of
520 * the IPC channel registers.
521 *
522 * \return
523 * Returns a pointer to the base of the IPC registers.
524 *
525 * \funcusage
526 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_SendMsgWord
527 *
528 *******************************************************************************/
Cy_IPC_Drv_GetIpcBaseAddress(uint32_t ipcIndex)529 __STATIC_INLINE IPC_STRUCT_Type* Cy_IPC_Drv_GetIpcBaseAddress (uint32_t ipcIndex)
530 {
531     CY_ASSERT_L1(CY_IPC_CHANNELS > ipcIndex);
532     return ( (IPC_STRUCT_Type*) CY_IPC_STRUCT_PTR(ipcIndex));
533 }
534 
535 
536 /*******************************************************************************
537 * Function Name: Cy_IPC_Drv_GetIntrBaseAddr
538 ****************************************************************************//**
539 *
540 * This function takes an IPC interrupt structure index and returns the base
541 * address of the IPC interrupt registers corresponding to the IPC Interrupt.
542 *
543 * \note The user is responsible for ensuring that ipcIntrIndex does not exceed the
544 * limits.
545 *
546 * \param ipcIntrIndex
547 * Represents the number of IPC interrupt structure. This is converted to the
548 * base address of the IPC interrupt registers.
549 *
550 * \return
551 * Returns a pointer to the base of the IPC interrupt registers.
552 *
553 * \funcusage
554 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetInterruptStatus
555 *
556 *******************************************************************************/
Cy_IPC_Drv_GetIntrBaseAddr(uint32_t ipcIntrIndex)557 __STATIC_INLINE IPC_INTR_STRUCT_Type* Cy_IPC_Drv_GetIntrBaseAddr (uint32_t ipcIntrIndex)
558 {
559     CY_ASSERT_L1(CY_IPC_INTERRUPTS > ipcIntrIndex);
560     return ( (IPC_INTR_STRUCT_Type*) CY_IPC_INTR_STRUCT_PTR(ipcIntrIndex));
561 }
562 
563 
564 /*******************************************************************************
565 * Function Name: Cy_IPC_Drv_SetInterruptMask
566 ****************************************************************************//**
567 *
568 * This function is used to set the interrupt mask for an IPC Interrupt.
569 * The mask sets release or acquire notification events for all IPC channels.
570 *
571 * \param base
572 * This is a handle to the IPC interrupt. This handle can be calculated from the
573 * IPC interrupt number using \ref Cy_IPC_Drv_GetIntrBaseAddr.
574 *
575 * \param ipcReleaseMask
576 * An encoded list of all IPC channels that can trigger the interrupt on a
577 * release event.
578 *
579 * \param ipcAcquireMask
580 * An encoded list of all IPC channels that can trigger the interrupt on a
581 * notify event.
582 *
583 * \funcusage
584 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetInterruptStatusMasked
585 *
586 *******************************************************************************/
Cy_IPC_Drv_SetInterruptMask(IPC_INTR_STRUCT_Type * base,uint32_t ipcReleaseMask,uint32_t ipcAcquireMask)587 __STATIC_INLINE void  Cy_IPC_Drv_SetInterruptMask (IPC_INTR_STRUCT_Type* base,
588                                               uint32_t ipcReleaseMask, uint32_t ipcAcquireMask)
589 {
590     CY_ASSERT_L1(0UL == (ipcAcquireMask & ~(uint32_t)(IPC_STRUCT_NOTIFY_INTR_NOTIFY_Msk)));
591     CY_ASSERT_L1(0UL == (ipcReleaseMask & ~(uint32_t)(IPC_STRUCT_RELEASE_INTR_RELEASE_Msk)));
592     REG_IPC_INTR_STRUCT_INTR_MASK(base) = _VAL2FLD( IPC_INTR_STRUCT_INTR_MASK_NOTIFY,  ipcAcquireMask) |
593                       _VAL2FLD( IPC_INTR_STRUCT_INTR_MASK_RELEASE, ipcReleaseMask);
594 }
595 
596 
597 /*******************************************************************************
598 * Function Name: Cy_IPC_Drv_GetInterruptMask
599 ****************************************************************************//**
600 *
601 * This function is used to read the interrupt mask.
602 *
603 * \param base
604 * This is a handle to the IPC interrupt. This handle can be calculated from
605 * the IPC interrupt number using \ref Cy_IPC_Drv_GetIntrBaseAddr.
606 *
607 * \return
608 *   The return value is encoded as follows
609 *   <table>
610 *   <tr><th>Interrupt sources   <th>Value
611 *   <tr><td>Ipc_PORTX_RELEASE   <td>Xth bit set
612 *   <tr><td>Ipc_PORTX_NOTIFY    <td>X+16th bit set
613 *   </table>
614 *
615 * \funcusage
616 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetInterruptStatusMasked
617 *
618 *******************************************************************************/
Cy_IPC_Drv_GetInterruptMask(IPC_INTR_STRUCT_Type const * base)619 __STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptMask(IPC_INTR_STRUCT_Type const * base)
620 {
621     return REG_IPC_INTR_STRUCT_INTR_MASK(base);
622 }
623 
624 
625 /*******************************************************************************
626 * Function Name: Cy_IPC_Drv_GetInterruptStatusMasked
627 ****************************************************************************//**
628 *
629 * This function is used to read the active unmasked interrupt. This function
630 * can be used in the interrupt service routine to find which source triggered
631 * the interrupt.
632 *
633 * \param base
634 * This is a handle to the IPC interrupt. This handle can be calculated from the
635 * IPC interrupt number using \ref Cy_IPC_Drv_GetIntrBaseAddr.
636 *
637 * \return
638 *   The return value is encoded as follows
639 *   <table>
640 *   <tr><th>Interrupt sources   <th>Value
641 *   <tr><td>Ipc_PORTX_RELEASE   <td>Xth bit set
642 *   <tr><td>Ipc_PORTX_NOTIFY    <td>X+16th bit set
643 *   </table>
644 *
645 * \funcusage
646 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetInterruptStatusMasked
647 *
648 *******************************************************************************/
Cy_IPC_Drv_GetInterruptStatusMasked(IPC_INTR_STRUCT_Type const * base)649 __STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptStatusMasked (IPC_INTR_STRUCT_Type const * base)
650 {
651     return REG_IPC_INTR_STRUCT_INTR_MASKED(base);
652 }
653 
654 
655 /*******************************************************************************
656 * Function Name: Cy_IPC_Drv_GetInterruptStatus
657 ****************************************************************************//**
658 *
659 * This function is used to read the pending interrupts. Note that this read is
660 * an unmasked read of the interrupt status. Interrupt sources read as active by
661 * this function would generate interrupts only if they were not masked.
662 *
663 * \param base
664 * This is a handle to the IPC interrupt. This handle can be calculated from the
665 * IPC interrupt number using \ref Cy_IPC_Drv_GetIntrBaseAddr.
666 *
667 * \return
668 *   The return value is encoded as follows
669 *   <table>
670 *   <tr><th>Interrupt sources   <th>Value
671 *   <tr><td>Ipc_PORTX_RELEASE   <td>Xth bit set
672 *   <tr><td>Ipc_PORTX_NOTIFY    <td>X+16th bit set
673 *   </table>
674 *
675 * \funcusage
676 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetInterruptStatus
677 *
678 *******************************************************************************/
Cy_IPC_Drv_GetInterruptStatus(IPC_INTR_STRUCT_Type const * base)679 __STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptStatus(IPC_INTR_STRUCT_Type const * base)
680 {
681     return REG_IPC_INTR_STRUCT_INTR(base);
682 }
683 
684 
685 /*******************************************************************************
686 * Function Name: Cy_IPC_Drv_SetInterrupt
687 ****************************************************************************//**
688 *
689 * This function is used to set the interrupt source. This function can be used
690 * to activate interrupts through software.
691 * \note That interrupt sources set using this interrupt would generate interrupts
692 * only if they are not masked.
693 *
694 * \param base
695 * This is a handle to the IPC interrupt. This handle can be calculated from the
696 * IPC interrupt number using \ref Cy_IPC_Drv_GetIntrBaseAddr.
697 *
698 * \param ipcReleaseMask
699 * An encoded list of all IPC channels that can trigger the interrupt on a
700 * release event.
701 *
702 * \param ipcAcquireMask
703 * An encoded list of all IPC channels that can trigger the interrupt on a
704 * notify event.
705 *
706 * \funcusage
707 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_SetInterrupt
708 *
709 *******************************************************************************/
Cy_IPC_Drv_SetInterrupt(IPC_INTR_STRUCT_Type * base,uint32_t ipcReleaseMask,uint32_t ipcAcquireMask)710 __STATIC_INLINE void  Cy_IPC_Drv_SetInterrupt(IPC_INTR_STRUCT_Type* base, uint32_t ipcReleaseMask, uint32_t ipcAcquireMask)
711 {
712     CY_ASSERT_L1(0UL == (ipcAcquireMask  & ~(uint32_t)(IPC_STRUCT_NOTIFY_INTR_NOTIFY_Msk)));
713     CY_ASSERT_L1(0UL == (ipcReleaseMask & ~(uint32_t)(IPC_STRUCT_RELEASE_INTR_RELEASE_Msk)));
714     REG_IPC_INTR_STRUCT_INTR_SET(base) =  _VAL2FLD( IPC_INTR_STRUCT_INTR_NOTIFY,  ipcAcquireMask )  |
715                       _VAL2FLD( IPC_INTR_STRUCT_INTR_RELEASE, ipcReleaseMask );
716 }
717 
718 
719 /*******************************************************************************
720 * Function Name: Cy_IPC_Drv_ClearInterrupt
721 ****************************************************************************//**
722 *
723 * This function is used to clear the interrupt source. Use this function to clear
724 * a pending interrupt source in the interrupt status.
725 *
726 * \param base
727 * This is a handle to the IPC interrupt. This handle can be calculated from the
728 * IPC interrupt number using \ref Cy_IPC_Drv_GetIntrBaseAddr.
729 *
730 * \param ipcReleaseMask
731 * An encoded list of all IPC channels that can trigger the interrupt on a
732 * release event.
733 *
734 * \param ipcAcquireMask
735 * An encoded list of all IPC channels that can trigger the interrupt on a
736 * notify event.
737 *
738 * \funcusage
739 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetInterruptStatusMasked
740 *
741 *******************************************************************************/
Cy_IPC_Drv_ClearInterrupt(IPC_INTR_STRUCT_Type * base,uint32_t ipcReleaseMask,uint32_t ipcAcquireMask)742 __STATIC_INLINE void  Cy_IPC_Drv_ClearInterrupt(IPC_INTR_STRUCT_Type* base, uint32_t ipcReleaseMask, uint32_t ipcAcquireMask)
743 {
744     CY_ASSERT_L1(0UL == (ipcAcquireMask  & ~(uint32_t)(IPC_STRUCT_NOTIFY_INTR_NOTIFY_Msk)));
745     CY_ASSERT_L1(0UL == (ipcReleaseMask & ~(uint32_t)(IPC_STRUCT_RELEASE_INTR_RELEASE_Msk)));
746     REG_IPC_INTR_STRUCT_INTR(base) =  _VAL2FLD(IPC_INTR_STRUCT_INTR_NOTIFY,  ipcAcquireMask) |
747                   _VAL2FLD(IPC_INTR_STRUCT_INTR_RELEASE, ipcReleaseMask);
748     (void)REG_IPC_INTR_STRUCT_INTR(base);  /* Read the register to flush the cache */
749 }
750 
751 /** \} group_ipc_functions */
752 
753 /** \} group_ipc */
754 
755 
756 /*******************************************************************************
757 * Function Name: Cy_IPC_Drv_AcquireNotify
758 ****************************************************************************//**
759 *
760 * The function generates a acquire notification event by IPC interrupt structure.
761 *
762 * \param base
763 * This parameter is a handle that represents the base address of the registers
764 * of the IPC channel.
765 * The parameter is generally returned from a call to the \ref
766 * Cy_IPC_Drv_GetIpcBaseAddress.
767 *
768 * \param notifyEventIntr
769 * Bit encoded list of IPC interrupt structures that are triggered
770 * by a notification. Bit number correspond to number of the IPC interrupt
771 * structure.
772 *
773 * \funcusage
774 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_LockAcquire
775 *
776 *******************************************************************************/
Cy_IPC_Drv_AcquireNotify(IPC_STRUCT_Type * base,uint32_t notifyEventIntr)777 __STATIC_INLINE void  Cy_IPC_Drv_AcquireNotify (IPC_STRUCT_Type* base, uint32_t notifyEventIntr)
778 {
779     CY_ASSERT_L1(0UL == (notifyEventIntr  & ~(uint32_t)(IPC_STRUCT_NOTIFY_INTR_NOTIFY_Msk)));
780     REG_IPC_STRUCT_NOTIFY(base) = _VAL2FLD(IPC_STRUCT_NOTIFY_INTR_NOTIFY, notifyEventIntr);
781 }
782 
783 
784 /*******************************************************************************
785 * Function Name: Cy_IPC_Drv_ReleaseNotify
786 ****************************************************************************//**
787 *
788 * The function generates a release notification event by IPC interrupt structure.
789 *
790 * \param base
791 * This parameter is a handle that represents the base address of the registers
792 * of the IPC channel.
793 * The parameter is generally returned from a call to the \ref
794 * Cy_IPC_Drv_GetIpcBaseAddress.
795 *
796 * \param notifyEventIntr
797 * Bit encoded list of IPC interrupt lines that are triggered by a notification.
798 *
799 * \funcusage
800 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_ReadMsgWord
801 *
802 *******************************************************************************/
Cy_IPC_Drv_ReleaseNotify(IPC_STRUCT_Type * base,uint32_t notifyEventIntr)803 __STATIC_INLINE void  Cy_IPC_Drv_ReleaseNotify (IPC_STRUCT_Type* base, uint32_t notifyEventIntr)
804 {
805     CY_ASSERT_L1(0UL == (notifyEventIntr  & ~(uint32_t)(IPC_INTR_STRUCT_INTR_RELEASE_Msk)));
806     REG_IPC_STRUCT_RELEASE(base) = _VAL2FLD(IPC_INTR_STRUCT_INTR_RELEASE, notifyEventIntr);
807 }
808 
809 
810 /*******************************************************************************
811 * Function Name: Cy_IPC_Drv_WriteDataValue
812 ****************************************************************************//**
813 *
814 * The function writes a value to the DATA register of the IPC channel.
815 *
816 * This function is internal and should not be called directly by user
817 * software.
818 *
819 * \param base
820 * This parameter is a handle that represents the base address of the registers
821 * of the IPC channel.
822 * The parameter is generally returned from a call to the \ref
823 * Cy_IPC_Drv_GetIpcBaseAddress.
824 *
825 * \param dataValue
826 * Value to be written.
827 *
828 *******************************************************************************/
Cy_IPC_Drv_WriteDataValue(IPC_STRUCT_Type * base,uint32_t dataValue)829 __STATIC_INLINE void     Cy_IPC_Drv_WriteDataValue (IPC_STRUCT_Type* base, uint32_t dataValue)
830 {
831     REG_IPC_STRUCT_DATA(base) = dataValue;
832 }
833 
834 #if (CY_IP_M4CPUSS_VERSION > 1) || defined (CY_IP_M33SYSCPUSS_VERSION) || defined (CY_DOXYGEN)
835 /*******************************************************************************
836 * Function Name: Cy_IPC_Drv_WriteDDataValue
837 ****************************************************************************//**
838 *
839 * The function writes two 32 bit values to the DATA registers of the IPC channel.
840 *
841 * This function is internal and should not be called directly by user
842 * software.
843 *
844 * \param base
845 * This parameter is a handle that represents the base address of the registers
846 * of the IPC channel.
847 * The parameter is generally returned from a call to the \ref
848 * Cy_IPC_Drv_GetIpcBaseAddress.
849 *
850 * \param dataValue
851 * Value to be written.
852 *
853 *******************************************************************************/
Cy_IPC_Drv_WriteDDataValue(IPC_STRUCT_Type * base,uint32_t * pDataValue)854 __STATIC_INLINE void Cy_IPC_Drv_WriteDDataValue (IPC_STRUCT_Type* base, uint32_t *pDataValue)
855 {
856     REG_IPC_STRUCT_DATA(base) = *pDataValue++;
857     REG_IPC_STRUCT_DATA1(base) = *pDataValue;
858 
859 }
860 #endif
861 
862 /*******************************************************************************
863 * Function Name: Cy_IPC_Drv_ReadDataValue
864 ****************************************************************************//**
865 *
866 * The function reads a value from the DATA register of the IPC channel.
867 *
868 * This function is internal and should not be called directly by user
869 * software.
870 *
871 * \param base
872 * This parameter is a handle that represents the base address of the registers
873 * of the IPC channel.
874 * The parameter is generally returned from a call to the \ref
875 * Cy_IPC_Drv_GetIpcBaseAddress.
876 *
877 * \return
878 * Value from DATA register.
879 *
880 *******************************************************************************/
Cy_IPC_Drv_ReadDataValue(IPC_STRUCT_Type const * base)881 __STATIC_INLINE uint32_t Cy_IPC_Drv_ReadDataValue (IPC_STRUCT_Type const * base)
882 {
883     return REG_IPC_STRUCT_DATA(base);
884 }
885 
886 #if (CY_IP_M4CPUSS_VERSION > 1) || defined (CY_IP_M33SYSCPUSS_VERSION) || defined (CY_DOXYGEN)
887 /*******************************************************************************
888 * Function Name: Cy_IPC_Drv_ReadDDataValue
889 ****************************************************************************//**
890 *
891 * The function reads two 32bit  values from the DATA registers of the IPC channel.
892 *
893 * This function is internal and should not be called directly by user
894 * software.
895 *
896 * \param base
897 * This parameter is a handle that represents the base address of the registers
898 * of the IPC channel.
899 * The parameter is generally returned from a call to the \ref
900 * Cy_IPC_Drv_GetIpcBaseAddress.
901 *
902 * \return
903 * Value from DATA register.
904 *
905 *******************************************************************************/
Cy_IPC_Drv_ReadDDataValue(IPC_STRUCT_Type const * base,uint32_t * pDataValue)906 __STATIC_INLINE void Cy_IPC_Drv_ReadDDataValue (IPC_STRUCT_Type const * base, uint32_t *pDataValue)
907 {
908     *pDataValue++ = REG_IPC_STRUCT_DATA(base);
909     *pDataValue = REG_IPC_STRUCT_DATA1(base);
910 }
911 #endif
912 
913 /*******************************************************************************
914 * Function Name: Cy_IPC_Drv_IsLockAcquired
915 ****************************************************************************//**
916 *
917 * The function is used to test the status of an IPC channel. The function
918 * tells the reader if the IPC channel was in the locked or released state.
919 *
920 * \param base
921 * This parameter is a handle that represents the base address of the registers
922 * of the IPC channel.
923 * The parameter is generally returned from a call to the \ref
924 * Cy_IPC_Drv_GetIpcBaseAddress.
925 *
926 * \return
927 *   Status for the function:
928 *   true:  The IPC channel is in the Locked state.
929 *   false: The IPC channel is in the Released state.
930 *
931 * \funcusage
932 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_LockAcquire
933 *
934 *******************************************************************************/
Cy_IPC_Drv_IsLockAcquired(IPC_STRUCT_Type const * base)935 __STATIC_INLINE bool Cy_IPC_Drv_IsLockAcquired (IPC_STRUCT_Type const * base)
936 {
937     return ( 0u != _FLD2VAL(IPC_STRUCT_ACQUIRE_SUCCESS, REG_IPC_STRUCT_LOCK_STATUS(base)) );
938 }
939 
940 
941 /*******************************************************************************
942 * Function Name: Cy_IPC_Drv_GetLockStatus
943 ****************************************************************************//**
944 *
945 * The function is used to get the status of an IPC channel.
946 *
947 * \param base
948 * This parameter is a handle that represents the base address of the registers
949 * of the IPC channel.
950 * The parameter is generally returned from a call to the \ref
951 * Cy_IPC_Drv_GetIpcBaseAddress.
952 *
953 * \return
954 * Value from LOCK_STATUS register.
955 *
956 * \funcusage
957 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetLockStatus
958 *
959 *******************************************************************************/
Cy_IPC_Drv_GetLockStatus(IPC_STRUCT_Type const * base)960 __STATIC_INLINE uint32_t Cy_IPC_Drv_GetLockStatus (IPC_STRUCT_Type const * base)
961 {
962     return REG_IPC_STRUCT_LOCK_STATUS(base);
963 }
964 
965 
966 /*******************************************************************************
967 * Function Name: Cy_IPC_Drv_ExtractAcquireMask
968 ****************************************************************************//**
969 *
970 * The function extracts an Acquire mask part from full interrupt mask value.
971 *
972 * This function is internal and should not be called directly by user
973 * software.
974 *
975 * \param intMask
976 * Interrupt mask value to be processed.
977 *
978 * \return
979 * Acquire mask value.
980 *
981 *******************************************************************************/
Cy_IPC_Drv_ExtractAcquireMask(uint32_t intMask)982 __STATIC_INLINE uint32_t Cy_IPC_Drv_ExtractAcquireMask (uint32_t intMask)
983 {
984     return _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_NOTIFY, intMask);
985 }
986 
987 
988 /*******************************************************************************
989 * Function Name: Cy_IPC_Drv_ExtractReleaseMask
990 ****************************************************************************//**
991 *
992 * The function extracts a Release mask part from full interrupt mask value.
993 *
994 * This function is internal and should not be called directly by user
995 * software.
996 *
997 * \param intMask
998 * Interrupt mask value to be processed.
999 *
1000 * \return
1001 * Release mask value.
1002 *
1003 *******************************************************************************/
Cy_IPC_Drv_ExtractReleaseMask(uint32_t intMask)1004 __STATIC_INLINE uint32_t Cy_IPC_Drv_ExtractReleaseMask (uint32_t intMask)
1005 {
1006     return _FLD2VAL(IPC_INTR_STRUCT_INTR_MASK_RELEASE, intMask);
1007 }
1008 
1009 
1010 /*******************************************************************************
1011 * Function Name: Cy_IPC_Drv_SendMsgPtr
1012 ****************************************************************************//**
1013 *
1014 * This function is used to send a message pointer through an IPC channel.
1015 * The message structure may hold a generic pointer that may contain the address
1016 * of any user data type or structure. This parameter could be a pointer to a 32-bit
1017 * integer, an array, or even a data structure defined in the user code. This
1018 * function acts as a transfer engine for sending the pointer. Any memory
1019 * management of the pointer allocation and deallocation is up to the application
1020 * code.
1021 * The function also has an associated notification field that will let the
1022 * message notify one or multiple interrupts.
1023 *
1024 * \param base
1025 * This parameter is a handle that represents the base address of the registers
1026 * of the IPC channel.
1027 * The parameter is generally returned from a call to the \ref
1028 * Cy_IPC_Drv_GetIpcBaseAddress.
1029 *
1030 * \param notifyEventIntr
1031 * Bit encoded list of IPC interrupt lines that are triggered during the release
1032 * action.
1033 *
1034 * \param msgPtr
1035 * The message pointer that is being sent over the IPC channel.
1036 *
1037 * \return   Status of the operation:
1038 *   \retval CY_IPC_DRV_SUCCESS: The send operation was successful.
1039 *   \retval CY_IPC_DRV_ERROR:   The IPC channel is unavailable because
1040 *                               it is already locked.
1041 *
1042 * \funcusage
1043 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_SendMsgPtr
1044 *
1045 *******************************************************************************/
Cy_IPC_Drv_SendMsgPtr(IPC_STRUCT_Type * base,uint32_t notifyEventIntr,void const * msgPtr)1046 __STATIC_INLINE cy_en_ipcdrv_status_t  Cy_IPC_Drv_SendMsgPtr(IPC_STRUCT_Type* base, uint32_t notifyEventIntr, void const * msgPtr)
1047 {
1048     CY_ASSERT_L1(NULL != msgPtr);
1049     return Cy_IPC_Drv_SendMsgWord(base, notifyEventIntr, (uint32_t)msgPtr);
1050 }
1051 
1052 
1053 /*******************************************************************************
1054 * Function Name: Cy_IPC_Drv_ReadMsgPtr
1055 ****************************************************************************//**
1056 *
1057 * This function is used to read a 32-bit pointer message through an IPC channel.
1058 *
1059 * \param base
1060 * This parameter is a handle that represents the base address of the registers
1061 * of the IPC channel.
1062 * The parameter is generally returned from a call to the \ref
1063 * Cy_IPC_Drv_GetIpcBaseAddress.
1064 *
1065 * \param msgPtr
1066 * Pointer variable to hold the data pointer that is being read from the IPC
1067 * channel.
1068 *
1069 *
1070 * \return Status of the operation
1071 *   \retval CY_IPC_DRV_SUCCESS: The function executed successfully and the IPC
1072 *                       was acquired.
1073 *   \retval CY_IPC_DRV_ERROR:   The function encountered an error because the IPC
1074 *                       channel was already in a released state meaning the data
1075 *                       in it is invalid.
1076 *
1077 * \funcusage
1078 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_ReadMsgPtr
1079 *
1080 *******************************************************************************/
Cy_IPC_Drv_ReadMsgPtr(IPC_STRUCT_Type const * base,void ** msgPtr)1081 __STATIC_INLINE  cy_en_ipcdrv_status_t  Cy_IPC_Drv_ReadMsgPtr (IPC_STRUCT_Type const * base, void ** msgPtr)
1082 {
1083     CY_ASSERT_L1(NULL != msgPtr);
1084     return Cy_IPC_Drv_ReadMsgWord(base, (uint32_t *)msgPtr);
1085 }
1086 
1087 
1088 /*******************************************************************************
1089 * Function Name: Cy_IPC_Drv_LockAcquire
1090 ****************************************************************************//**
1091 *
1092 * This function is used to acquire the IPC channel.
1093 *
1094 * \param base
1095 * This parameter is a handle that represents the base address of the registers
1096 * of the IPC channel.
1097 * The parameter is generally returned from a call to the \ref
1098 * Cy_IPC_Drv_GetIpcBaseAddress
1099 *
1100 * \return   Status of the operation
1101 *   \retval CY_IPC_DRV_SUCCESS: The IPC was successfully acquired
1102 *   \retval CY_IPC_DRV_ERROR:   The IPC was not acquired because it was already acquired
1103 *                       by another master
1104 *
1105 * \funcusage
1106 * \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_LockAcquire
1107 *
1108 *******************************************************************************/
Cy_IPC_Drv_LockAcquire(IPC_STRUCT_Type const * base)1109 __STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_LockAcquire (IPC_STRUCT_Type const * base)
1110 {
1111     return ( 0UL != _FLD2VAL(IPC_STRUCT_ACQUIRE_SUCCESS, REG_IPC_STRUCT_ACQUIRE(base))) ? CY_IPC_DRV_SUCCESS : CY_IPC_DRV_ERROR;
1112 }
1113 
1114 #ifdef __cplusplus
1115 }
1116 #endif
1117 
1118 #endif /* CY_IP_M4CPUSS */
1119 
1120 #endif /* !defined (CY_IPC_DRV_H) */
1121 
1122 /* [] END OF FILE */
1123