Fixes and new sbWait() API.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12984 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2019-09-13 13:54:25 +00:00
parent ad2a66cd42
commit bba90d0866
3 changed files with 23 additions and 5 deletions

View File

@ -159,9 +159,9 @@ uint32_t sb_api_wait_all_timeout(struct port_extctx *ctxp) {
uint32_t sb_api_broadcast_flags(struct port_extctx *ctxp) {
#if CH_CFG_USE_EVENTS == TRUE
sb_class_t *sbcp = (sb_class_t *)chThdGetSelfX()->ctx.syscall.p;
chEvtBroadcastFlags((event_source_t *)ctxp->r0,
(eventflags_t)ctxp->r1);
chEvtBroadcastFlags(&sbcp->es, (eventflags_t)ctxp->r0);
return SB_ERR_NOERROR;
#else
return SB_ERR_NOT_IMPLEMENTED;

View File

@ -144,7 +144,7 @@ void sbObjectInit(sb_class_t *sbcp) {
sbcp->msg_tp = NULL;
#endif
#if CH_CFG_USE_EVENTS == TRUE
chEvtObjectInit(sbcp->esp);
chEvtObjectInit(&sbcp->es);
#endif
}

View File

@ -110,7 +110,7 @@ typedef struct {
thread_t *msg_tp;
#endif
#if (CH_CFG_USE_EVENTS == TRUE) || defined(__DOXYGEN__)
event_source_t *esp;
event_source_t es;
#endif
} sb_class_t;
@ -950,6 +950,24 @@ extern "C" {
/* Module inline functions. */
/*===========================================================================*/
#if (CH_CFG_USE_WAITEXIT == TRUE) || defined(__DOXYGEN__)
/**
* @brief Blocks the execution of the invoking thread until the sandbox
* thread terminates then the exit code is returned.
* @pre The configuration option @p CH_CFG_USE_WAITEXIT must be enabled in
* order to use this function.
*
* @param[in] sbcp pointer to the sandbox object
* @return The exit code from the terminated thread.
*
* @api
*/
static inline msg_t sbWait(sb_class_t *sbcp) {
return chThdWait(sbcp->tp);
}
#endif /* CH_CFG_USE_WAITEXIT == TRUE */
#if (CH_CFG_USE_MESSAGES == TRUE) || defined(__DOXYGEN__)
/**
* @brief Sends a message to a sandboxed thread.
@ -1004,7 +1022,7 @@ static inline void sbEvtSignal(sb_class_t *sbcp, eventmask_t events) {
*/
static inline event_source_t *sbGetEventSourceX(sb_class_t *sbcp) {
return sbcp->esp;
return &sbcp->es;
}
#endif /* CH_CFG_USE_EVENTS == TRUE */