1 /* 2 * Arm SCP/MCP Software 3 * Copyright (c) 2015-2022, Arm Limited and Contributors. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 #ifndef FWK_INTERNAL_CORE_H 9 #define FWK_INTERNAL_CORE_H 10 11 #include <fwk_core.h> 12 #include <fwk_event.h> 13 #include <fwk_noreturn.h> 14 15 #include <stddef.h> 16 17 /* 18 * \brief Initialize the core framework component. 19 * 20 * \param event_count The maximum number of events in all queues at all time. 21 * 22 * \retval ::FWK_SUCCESS The core framework component was initialized. 23 * \retval ::FWK_E_NOMEM Insufficient memory available for event queues. 24 */ 25 int __fwk_init(size_t event_count); 26 27 /* 28 * \brief Loop forever, processing events raised by modules and interrupt 29 * handlers. This function will suspend execution if the queue is empty and 30 * resume on an interrupt. 31 * 32 * \return The function does not return. 33 */ 34 noreturn void __fwk_run_main_loop(void); 35 36 /* 37 * \brief Get the event being currently processed. 38 * 39 * \return The event being currently processed, or \c NULL if event processing 40 * has not yet begun. 41 */ 42 const struct fwk_event *__fwk_get_current_event(void); 43 44 /* 45 * \brief Put a notification event in one of the event queues. 46 * 47 * \details The core component copies the notification event description into 48 * its internal data and so does not keep track of the pointer passed as a 49 * parameter. 50 * 51 * If the function is called from an ISR, the validity of the event source 52 * identifier is checked and the event is put in the ISR event queue. 53 * 54 * \param event Pointer to the notification event to queue. 55 * 56 * \retval ::FWK_SUCCESS The event was queued. 57 * \retval ::FWK_E_PARAM The source identifier is not valid. 58 * \retval ::FWK_E_NOMEM No memory space to copy the event data. 59 */ 60 int __fwk_put_notification(struct fwk_event *event); 61 62 /*! 63 * \brief Put an event in one of the event queues. 64 * 65 * \details The framework copies the event description into its internal data 66 * and so does not keep track of the pointer passed as a parameter. 67 * 68 * In the runtime phase, the source identifier of the event is populated 69 * with the identifier of the caller, and it is therefore unnecessary for 70 * the caller to do so manually. Note that this does not occur in the 71 * pre-runtime phase. 72 * 73 * If the function is called from an ISR, the event is put in the ISR 74 * event queue. 75 * 76 * In both cases, the event identifier and target identifier are checked 77 * to be valid and to refer to the same module. 78 * 79 * In the case of a delayed response event, the event's 'is_response' flag 80 * must be set. 81 * 82 * 83 * \param[in] event Pointer to the event to queue. Must not be \c NULL. 84 * 85 * \retval ::FWK_SUCCESS The event was queued. 86 * \retval ::FWK_E_INIT The core framework component is not initialized. 87 * \retval ::FWK_E_PARAM An invalid parameter was encountered: 88 * - The `event` parameter was a null pointer value. 89 * - One or more fields of the event were invalid. 90 * \retval ::FWK_E_OS Operating system error. 91 * 92 * \return Status code representing the result of the operation. 93 */ 94 int __fwk_put_event(struct fwk_event *event); 95 96 /*! 97 * \brief Put a light event by converting to a normal event in one of the event 98 * queues. 99 * 100 * \details The framework copies the light event description into its internal 101 * data(<tt> struct fwk_event </tt>) and so does not keep track of the 102 * pointer passed as a parameter. 103 * 104 * In the runtime phase, the source identifier of the event is populated 105 * with the identifier of the caller, and it is therefore unnecessary for 106 * the caller to do so manually. Note that this does not occur in the 107 * pre-runtime phase. 108 * 109 * If the function is called from an ISR, the event is put in the ISR 110 * event queue. 111 * 112 * In both cases, the event identifier and target identifier are checked 113 * to be valid and to refer to the same module. 114 * 115 * 116 * \param[in] event Pointer to the event to queue. Must not be \c NULL. 117 * 118 * \retval ::FWK_SUCCESS The event was queued. 119 * \retval ::FWK_E_INIT The core framework component is not initialized. 120 * \retval ::FWK_E_PARAM An invalid parameter was encountered: 121 * - The `event` parameter was a null pointer value. 122 * - One or more fields of the event were invalid. 123 * \retval ::FWK_E_OS Operating system error. 124 * 125 * \return Status code representing the result of the operation. 126 */ 127 int __fwk_put_event_light(struct fwk_event_light *event); 128 129 #endif /* FWK_INTERNAL_CORE_H */ 130