Fixed CMSIS RTOS wrapper.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14000 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2020-12-28 18:53:33 +00:00
parent ad39bd7adb
commit 9bb2f4eadf
2 changed files with 7 additions and 6 deletions

View File

@ -181,8 +181,9 @@ osStatus osThreadSetPriority(osThreadId thread_id, osPriority newprio) {
/* Changing priority.*/
#if CH_CFG_USE_MUTEXES
if ((tp->prio == tp->realprio) || ((tprio_t)newprio > tp->prio))
tp->prio = (tprio_t)newprio;
if ((tp->hdr.pqueue.prio == tp->realprio) ||
((tprio_t)newprio > tp->hdr.pqueue.prio))
tp->hdr.pqueue.prio = (tprio_t)newprio;
tp->realprio = (tprio_t)newprio;
#else
tp->prio = (tprio_t)newprio;
@ -207,8 +208,8 @@ osStatus osThreadSetPriority(osThreadId thread_id, osPriority newprio) {
case CH_STATE_SNDMSGQ:
#endif
/* Re-enqueues tp with its new priority on the queue.*/
queue_prio_insert(queue_dequeue(tp),
(threads_queue_t *)tp->u.wtobjp);
ch_sch_prio_insert(ch_queue_dequeue(&tp->hdr.queue),
(ch_queue_t *)tp->u.wtobjp);
break;
#endif
case CH_STATE_READY:
@ -217,7 +218,7 @@ osStatus osThreadSetPriority(osThreadId thread_id, osPriority newprio) {
tp->state = CH_STATE_CURRENT;
#endif
/* Re-enqueues tp with its new priority on the ready list.*/
chSchReadyI(queue_dequeue(tp));
chSchReadyI((thread_t *)ch_queue_dequeue(&tp->hdr.queue));
break;
}

View File

@ -556,7 +556,7 @@ static inline osStatus osThreadYield(void) {
*/
static inline osPriority osThreadGetPriority(osThreadId thread_id) {
return (osPriority)(NORMALPRIO - thread_id->prio);
return (osPriority)(NORMALPRIO - thread_id->hdr.pqueue.prio);
}
/**