kernel: remove k_alert API
This API was used in only one place in non-test code. See whether we can remove it. Closes #12232 Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
parent
b026a34026
commit
bfad9721d2
20 changed files with 2 additions and 1266 deletions
145
include/kernel.h
145
include/kernel.h
|
@ -115,7 +115,6 @@ typedef struct {
|
|||
struct k_thread;
|
||||
struct k_mutex;
|
||||
struct k_sem;
|
||||
struct k_alert;
|
||||
struct k_msgq;
|
||||
struct k_mbox;
|
||||
struct k_pipe;
|
||||
|
@ -3071,150 +3070,6 @@ static inline unsigned int _impl_k_sem_count_get(struct k_sem *sem)
|
|||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup alert_apis Alert APIs
|
||||
* @ingroup kernel_apis
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef k_alert_handler_t
|
||||
* @brief Alert handler function type.
|
||||
*
|
||||
* An alert's alert handler function is invoked by the system workqueue
|
||||
* when the alert is signaled. The alert handler function is optional,
|
||||
* and is only invoked if the alert has been initialized with one.
|
||||
*
|
||||
* @param alert Address of the alert.
|
||||
*
|
||||
* @return 0 if alert has been consumed; non-zero if alert should pend.
|
||||
*/
|
||||
typedef int (*k_alert_handler_t)(struct k_alert *alert);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @cond INTERNAL_HIDDEN
|
||||
*/
|
||||
|
||||
#define K_ALERT_DEFAULT NULL
|
||||
#define K_ALERT_IGNORE ((k_alert_handler_t)0xFFFFFFFF)
|
||||
|
||||
struct k_alert {
|
||||
k_alert_handler_t handler;
|
||||
atomic_t send_count;
|
||||
struct k_work work_item;
|
||||
struct k_sem sem;
|
||||
|
||||
_OBJECT_TRACING_NEXT_PTR(k_alert)
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
extern void _alert_deliver(struct k_work *work);
|
||||
|
||||
#define _K_ALERT_INITIALIZER(obj, alert_handler, max_num_pending_alerts) \
|
||||
{ \
|
||||
.handler = (k_alert_handler_t)alert_handler, \
|
||||
.send_count = ATOMIC_INIT(0), \
|
||||
.work_item = _K_WORK_INITIALIZER(_alert_deliver), \
|
||||
.sem = _K_SEM_INITIALIZER(obj.sem, 0, max_num_pending_alerts), \
|
||||
_OBJECT_TRACING_INIT \
|
||||
}
|
||||
|
||||
#define K_ALERT_INITIALIZER DEPRECATED_MACRO _K_ALERT_INITIALIZER
|
||||
|
||||
/**
|
||||
* INTERNAL_HIDDEN @endcond
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup alert_apis
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def K_ALERT_DEFINE(name, alert_handler, max_num_pending_alerts)
|
||||
*
|
||||
* @brief Statically define and initialize an alert.
|
||||
*
|
||||
* The alert can be accessed outside the module where it is defined using:
|
||||
*
|
||||
* @code extern struct k_alert <name>; @endcode
|
||||
*
|
||||
* @param name Name of the alert.
|
||||
* @param alert_handler Action to take when alert is sent. Specify either
|
||||
* the address of a function to be invoked by the system workqueue
|
||||
* thread, K_ALERT_IGNORE (which causes the alert to be ignored), or
|
||||
* K_ALERT_DEFAULT (which causes the alert to pend).
|
||||
* @param max_num_pending_alerts Maximum number of pending alerts.
|
||||
*
|
||||
* @req K-ALERT-001
|
||||
*/
|
||||
#define K_ALERT_DEFINE(name, alert_handler, max_num_pending_alerts) \
|
||||
struct k_alert name \
|
||||
__in_section(_k_alert, static, name) = \
|
||||
_K_ALERT_INITIALIZER(name, alert_handler, \
|
||||
max_num_pending_alerts)
|
||||
|
||||
/**
|
||||
* @brief Initialize an alert.
|
||||
*
|
||||
* This routine initializes an alert object, prior to its first use.
|
||||
*
|
||||
* @param alert Address of the alert.
|
||||
* @param handler Action to take when alert is sent. Specify either the address
|
||||
* of a function to be invoked by the system workqueue thread,
|
||||
* K_ALERT_IGNORE (which causes the alert to be ignored), or
|
||||
* K_ALERT_DEFAULT (which causes the alert to pend).
|
||||
* @param max_num_pending_alerts Maximum number of pending alerts.
|
||||
*
|
||||
* @return N/A
|
||||
* @req K-ALERT-002
|
||||
*/
|
||||
extern void k_alert_init(struct k_alert *alert, k_alert_handler_t handler,
|
||||
unsigned int max_num_pending_alerts);
|
||||
|
||||
/**
|
||||
* @brief Receive an alert.
|
||||
*
|
||||
* This routine receives a pending alert for @a alert.
|
||||
*
|
||||
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
|
||||
*
|
||||
* @param alert Address of the alert.
|
||||
* @param timeout Waiting period to receive the alert (in milliseconds),
|
||||
* or one of the special values K_NO_WAIT and K_FOREVER.
|
||||
*
|
||||
* @retval 0 Alert received.
|
||||
* @retval -EBUSY Returned without waiting.
|
||||
* @retval -EAGAIN Waiting period timed out.
|
||||
* @req K-ALERT-002
|
||||
*/
|
||||
__syscall int k_alert_recv(struct k_alert *alert, s32_t timeout);
|
||||
|
||||
/**
|
||||
* @brief Signal an alert.
|
||||
*
|
||||
* This routine signals @a alert. The action specified for @a alert will
|
||||
* be taken, which may trigger the execution of an alert handler function
|
||||
* and/or cause the alert to pend (assuming the alert has not reached its
|
||||
* maximum number of pending alerts).
|
||||
*
|
||||
* @note Can be called by ISRs.
|
||||
*
|
||||
* @param alert Address of the alert.
|
||||
*
|
||||
* @return N/A
|
||||
* @req K-ALERT-002
|
||||
*/
|
||||
__syscall void k_alert_send(struct k_alert *alert);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup msgq_apis Message Queue APIs
|
||||
* @ingroup kernel_apis
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue