1 /* 2 * Arm SCP/MCP Software 3 * Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 * 7 * Description: 8 * Notification definitions. 9 */ 10 11 #ifndef FWK_NOTIFICATION_H 12 #define FWK_NOTIFICATION_H 13 14 #include <fwk_event.h> 15 #include <fwk_id.h> 16 #include <fwk_macros.h> 17 18 #if FWK_HAS_INCLUDE(<fmw_notification.h>) 19 # include <fmw_notification.h> /* cppcheck-suppress missingIncludeSystem */ 20 #endif 21 22 /*! 23 * \ingroup GroupLibFramework 24 * \defgroup GroupNotification Notifications 25 * \{ 26 */ 27 28 /*! 29 * \def FMW_NOTIFICATION_MAX 30 * 31 * \brief Maximum number of active notifications. 32 * 33 * \details This value represents the maximum number of notifications that can 34 * be active at any one time. 35 */ 36 #ifndef FMW_NOTIFICATION_MAX 37 # define FMW_NOTIFICATION_MAX 64 38 #endif 39 40 /*! 41 * \brief Subscribe to a notification. 42 * 43 * \param notification_id Identifier of the notification. 44 * \param source_id Notification source identifier. 45 * \param target_id Notification target identifier. 46 * 47 * \retval ::FWK_SUCCESS The subscription was successful. 48 * \retval ::FWK_E_INIT The notification component has not been initialized. 49 * \retval ::FWK_E_HANDLER The function was called from an interrupt handler. 50 * \retval ::FWK_E_PARAM One or more identifiers were invalid. 51 * \retval ::FWK_E_STATE The entity \p target_id has already subscribed to the 52 * notification \p notification_id from the entity \p source_id. 53 * \retval ::FWK_E_NOMEM The maximum number of subscriptions has been reached. 54 */ 55 int fwk_notification_subscribe(fwk_id_t notification_id, fwk_id_t source_id, 56 fwk_id_t target_id); 57 58 /*! 59 * \brief Unsubscribe from a notification. 60 * 61 * \param notification_id Identifier of the notification. 62 * \param source_id Notification source identifier. 63 * \param target_id Notification target identifier. 64 * 65 * \retval ::FWK_SUCCESS The subscription was successfully cancelled. 66 * \retval ::FWK_E_INIT The notification component has not been initialized. 67 * \retval ::FWK_E_HANDLER The function was called from an interrupt handler. 68 * \retval ::FWK_E_PARAM One or more identifiers were invalid. 69 * \retval ::FWK_E_STATE The entity \p target_id has not subscribed to the 70 * notification \p notification_id from the entity \p source_id. 71 */ 72 int fwk_notification_unsubscribe(fwk_id_t notification_id, fwk_id_t source_id, 73 fwk_id_t target_id); 74 75 /*! 76 * \brief Send a notification to all entities that are subscribed to it. 77 * 78 * \note During the runtime phase, if the source identifier of the notification 79 * event is not a valid entity identifier, the event source identifier is 80 * populated automatically by the framework with the identifier of the 81 * entity target of the event being currently processed. 82 * 83 * \param notification_event Pointer to the notification event. Must not be 84 * \c NULL. 85 * \param [out] count Number of notification events that were sent. Must not be 86 * \c NULL. 87 * 88 * \retval ::FWK_SUCCESS All subscribers were notified successfully. 89 * \retval ::FWK_E_INIT The notification component has not been initialized. 90 * \retval ::FWK_E_PARAM One of more parameters were invalid. 91 */ 92 int fwk_notification_notify(struct fwk_event *notification_event, 93 unsigned int *count); 94 95 /*! 96 * \} 97 */ 98 99 #endif /* FWK_NOTIFICATION_H */ 100