1 /* 2 * Copyright 2024 NXP 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief SCMI SHMEM API 10 */ 11 12 #ifndef _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_SHMEM_H_ 13 #define _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_SHMEM_H_ 14 15 #include <zephyr/device.h> 16 #include <zephyr/arch/cpu.h> 17 #include <errno.h> 18 19 #define SCMI_SHMEM_CHAN_STATUS_BUSY_BIT BIT(0) 20 #define SCMI_SHMEM_CHAN_FLAG_IRQ_BIT BIT(0) 21 22 struct scmi_message; 23 24 /** 25 * @brief Write a message in the SHMEM area 26 * 27 * @param shmem pointer to shmem device 28 * @param msg message to write 29 * 30 * @retval 0 if successful 31 * @retval negative errno if failure 32 */ 33 int scmi_shmem_write_message(const struct device *shmem, 34 struct scmi_message *msg); 35 36 /** 37 * @brief Read a message from a SHMEM area 38 * 39 * @param shmem pointer to shmem device 40 * @param msg message to write the data into 41 * 42 * @retval 0 if successful 43 * @retval negative errno if failure 44 */ 45 int scmi_shmem_read_message(const struct device *shmem, 46 struct scmi_message *msg); 47 48 /** 49 * @brief Update the channel flags 50 * 51 * @param shmem pointer to shmem device 52 * @param mask value to negate and bitwise-and the old 53 * channel flags value 54 * @param val value to bitwise and with the mask and 55 * bitwise-or with the masked old value 56 */ 57 void scmi_shmem_update_flags(const struct device *shmem, 58 uint32_t mask, uint32_t val); 59 60 /** 61 * @brief Read a channel's status 62 * 63 * @param shmem pointer to shmem device 64 */ 65 uint32_t scmi_shmem_channel_status(const struct device *shmem); 66 67 #endif /* _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_SHMEM_H_ */ 68