Added sys_mbox_trypost_fromisr() and tcpip_callbackmsg_trycallback_fromisr()

This can be used to post preallocated messages from an ISR to the tcpip thread
when using FreeRTOS, where where calls differ between task level and ISR level.

Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
goldsimon
2018-01-05 21:08:27 +01:00
parent 1623c3e2cc
commit 8fc20142f7
3 changed files with 31 additions and 1 deletions

View File

@@ -531,6 +531,25 @@ tcpip_callbackmsg_trycallback(struct tcpip_callback_msg *msg)
return sys_mbox_trypost(&mbox, msg);
}
/**
* @ingroup lwip_os
* Try to post a callback-message to the tcpip_thread mbox.
* Same as @ref tcpip_callbackmsg_trycallback but calls sys_mbox_trypost_fromisr(),
* mainly to help FreeRTOS, where calls differ between task level and ISR level.
*
* @param msg pointer to the message to post
* @return sys_mbox_trypost_fromisr() return code (without change, so this
* knowledge can be used to e.g. propagate "bool needs_scheduling")
*
* @see tcpip_callbackmsg_new()
*/
err_t
tcpip_callbackmsg_trycallback_fromisr(struct tcpip_callback_msg *msg)
{
LWIP_ASSERT("Invalid mbox", sys_mbox_valid_val(mbox));
return sys_mbox_trypost_fromisr(&mbox, msg);
}
/**
* @ingroup lwip_os
* Initialize this module: