Restored SB functionality with RT7.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14327 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-04-25 15:16:41 +00:00
parent 30a51cfb3b
commit 9d617edee6
6 changed files with 20 additions and 14 deletions

View File

@ -805,6 +805,10 @@
/* Port-specific settings (override port settings defaulted in chcore.h). */ /* Port-specific settings (override port settings defaulted in chcore.h). */
/*===========================================================================*/ /*===========================================================================*/
#define PORT_USE_SYSCALL TRUE
#define PORT_SWITCHED_REGIONS_NUMBER 2
#endif /* CHCONF_H */ #endif /* CHCONF_H */
/** @} */ /** @} */

View File

@ -805,6 +805,8 @@
/* Port-specific settings (override port settings defaulted in chcore.h). */ /* Port-specific settings (override port settings defaulted in chcore.h). */
/*===========================================================================*/ /*===========================================================================*/
#define PORT_USE_SYSCALL TRUE
#endif /* CHCONF_H */ #endif /* CHCONF_H */
/** @} */ /** @} */

View File

@ -58,13 +58,13 @@ __attribute__((noinline))
void port_syslock_noinline(void) { void port_syslock_noinline(void) {
port_lock(); port_lock();
_stats_start_measure_crit_thd(); __stats_start_measure_crit_thd();
_dbg_check_lock(); __dbg_check_lock();
} }
uint32_t port_get_s_psp(void) { uint32_t port_get_s_psp(void) {
return (uint32_t)currp->ctx.syscall.psp; return (uint32_t)__sch_get_currthread()->ctx.syscall.psp;
} }
__attribute__((weak)) __attribute__((weak))
@ -144,7 +144,7 @@ void SVC_Handler(void) {
struct port_extctx *newctxp; struct port_extctx *newctxp;
/* Supervisor PSP from the thread context structure.*/ /* Supervisor PSP from the thread context structure.*/
s_psp = (uint32_t)currp->ctx.syscall.psp; s_psp = (uint32_t)__sch_get_currthread()->ctx.syscall.psp;
/* Pushing the port_linkctx into the supervisor stack.*/ /* Pushing the port_linkctx into the supervisor stack.*/
s_psp -= sizeof (struct port_linkctx); s_psp -= sizeof (struct port_linkctx);
@ -334,7 +334,7 @@ void __port_irq_epilogue(void) {
__set_CONTROL(control & ~1U); __set_CONTROL(control & ~1U);
/* Switching to S-PSP taking it from the thread context.*/ /* Switching to S-PSP taking it from the thread context.*/
s_psp = (uint32_t)currp->ctx.syscall.psp; s_psp = (uint32_t)__sch_get_currthread()->ctx.syscall.psp;
/* Pushing the middle context for returning to the original frame /* Pushing the middle context for returning to the original frame
and mode.*/ and mode.*/

View File

@ -92,6 +92,12 @@ struct ch_mutex {
*/ */
#define MUTEX_DECL(name) mutex_t name = __MUTEX_DATA(name) #define MUTEX_DECL(name) mutex_t name = __MUTEX_DATA(name)
#if CH_CFG_USE_MESSAGES_PRIORITY == TRUE
#define __ch_msg_insert(tp, qp) ch_sch_prio_insert(&tp->hdr.queue, qp)
#else
#define __ch_msg_insert(tp, qp) ch_queue_insert(&tp->hdr.queue, qp)
#endif
/*===========================================================================*/ /*===========================================================================*/
/* External declarations. */ /* External declarations. */
/*===========================================================================*/ /*===========================================================================*/

View File

@ -63,12 +63,6 @@
/* Module local functions. */ /* Module local functions. */
/*===========================================================================*/ /*===========================================================================*/
#if CH_CFG_USE_MESSAGES_PRIORITY == TRUE
#define msg_insert(tp, qp) ch_sch_prio_insert(&tp->hdr.queue, qp)
#else
#define msg_insert(tp, qp) ch_queue_insert(&tp->hdr.queue, qp)
#endif
/*===========================================================================*/ /*===========================================================================*/
/* Module exported functions. */ /* Module exported functions. */
/*===========================================================================*/ /*===========================================================================*/
@ -91,7 +85,7 @@ msg_t chMsgSend(thread_t *tp, msg_t msg) {
chSysLock(); chSysLock();
currtp->u.sentmsg = msg; currtp->u.sentmsg = msg;
msg_insert(currtp, &tp->msgqueue); __ch_msg_insert(currtp, &tp->msgqueue);
if (tp->state == CH_STATE_WTMSG) { if (tp->state == CH_STATE_WTMSG) {
(void) chSchReadyI(tp); (void) chSchReadyI(tp);
} }

View File

@ -163,7 +163,7 @@ void sbStart(sb_class_t *sbcp, const sb_config_t *config) {
msg_t sbSendMessageTimeout(sb_class_t *sbcp, msg_t sbSendMessageTimeout(sb_class_t *sbcp,
msg_t msg, msg_t msg,
sysinterval_t timeout) { sysinterval_t timeout) {
thread_t *ctp = currp; thread_t *ctp = __sch_get_currthread();
chDbgCheck(sbcp != NULL); chDbgCheck(sbcp != NULL);
@ -171,7 +171,7 @@ msg_t sbSendMessageTimeout(sb_class_t *sbcp,
/* Sending the message.*/ /* Sending the message.*/
ctp->u.sentmsg = msg; ctp->u.sentmsg = msg;
__msg_insert(ctp, &sbcp->tp->msgqueue); __ch_msg_insert(ctp, &sbcp->tp->msgqueue);
if (sbcp->tp->state == CH_STATE_WTMSG) { if (sbcp->tp->state == CH_STATE_WTMSG) {
(void) chSchReadyI(sbcp->tp); (void) chSchReadyI(sbcp->tp);
} }