Anson Huang | b629413 | 2018-06-05 16:05:59 +0800 | [diff] [blame] | 1 | /* |
Samuel Holland | 19893cc | 2019-12-04 02:45:58 -0600 | [diff] [blame] | 2 | * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. |
Anson Huang | b629413 | 2018-06-05 16:05:59 +0800 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | /*! |
| 8 | * Header file for the IPC implementation. |
| 9 | */ |
| 10 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 11 | #ifndef SCI_IPC_H |
| 12 | #define SCI_IPC_H |
Anson Huang | b629413 | 2018-06-05 16:05:59 +0800 | [diff] [blame] | 13 | |
| 14 | /* Includes */ |
| 15 | |
| 16 | #include <sci/sci_types.h> |
| 17 | |
| 18 | /* Defines */ |
| 19 | |
| 20 | /* Types */ |
| 21 | |
| 22 | /* Functions */ |
| 23 | |
| 24 | /*! |
| 25 | * This function opens an IPC channel. |
| 26 | * |
| 27 | * @param[out] ipc return pointer for ipc handle |
| 28 | * @param[in] id id of channel to open |
| 29 | * |
| 30 | * @return Returns an error code (SC_ERR_NONE = success, SC_ERR_IPC |
| 31 | * otherwise). |
| 32 | * |
| 33 | * The \a id parameter is implementation specific. Could be an MU |
| 34 | * address, pointer to a driver path, channel index, etc. |
| 35 | */ |
| 36 | sc_err_t sc_ipc_open(sc_ipc_t *ipc, sc_ipc_id_t id); |
| 37 | |
| 38 | /*! |
| 39 | * This function closes an IPC channel. |
| 40 | * |
| 41 | * @param[in] ipc id of channel to close |
| 42 | */ |
| 43 | void sc_ipc_close(sc_ipc_t ipc); |
| 44 | |
| 45 | /*! |
| 46 | * This function reads a message from an IPC channel. |
| 47 | * |
| 48 | * @param[in] ipc id of channel read from |
| 49 | * @param[out] data pointer to message buffer to read |
| 50 | * |
| 51 | * This function will block if no message is available to be read. |
| 52 | */ |
| 53 | void sc_ipc_read(sc_ipc_t ipc, void *data); |
| 54 | |
| 55 | /*! |
| 56 | * This function writes a message to an IPC channel. |
| 57 | * |
| 58 | * @param[in] ipc id of channel to write to |
| 59 | * @param[in] data pointer to message buffer to write |
| 60 | * |
| 61 | * This function will block if the outgoing buffer is full. |
| 62 | */ |
| 63 | void sc_ipc_write(sc_ipc_t ipc, void *data); |
| 64 | |
Samuel Holland | 19893cc | 2019-12-04 02:45:58 -0600 | [diff] [blame] | 65 | extern sc_ipc_t ipc_handle; |
Anson Huang | b629413 | 2018-06-05 16:05:59 +0800 | [diff] [blame] | 66 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 67 | #endif /* SCI_IPC_H */ |