Anson Huang | b629413 | 2018-06-05 16:05:59 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | /*! |
| 8 | * Header file for the IPC implementation. |
| 9 | */ |
| 10 | |
| 11 | #ifndef SC_IPC_H |
| 12 | #define SC_IPC_H |
| 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 | |
| 65 | sc_ipc_t ipc_handle; |
| 66 | |
| 67 | #endif /* SC_IPC_H */ |