Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

BUG correction in uCOS-III

Status
Not open for further replies.

Michaelvys

Newbie level 3
Joined
Aug 21, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,317
I fixed bug uCOS-III in os_flag.c. This eliminates the exception when used OSFlagPend and OSFlagPost with the same OS_FLAG_GRP in one thread.
I added in the structure OS_FLAG_GRP of the variable Prio and apply it in OSFlagPost, that prevent appear the exception.

oc.h
======================
#if OS_CFG_FLAG_EN > 0u
struct os_flag_grp { /* Event Flag Group */
OS_OBJ_TYPE Type; /* Should be set to OS_EVENT_TYPE_FLAG */
CPU_CHAR *NamePtr;
OS_PEND_LIST PendList; /* List of tasks waiting on event flag group */
OS_FLAGS Flags; /* 8, 16 or 32 bit flags */
CPU_TS TS; /* Timestamp of when last post occurred */
#if OS_CFG_DBG_EN > 0u
OS_OBJ_QTY DbgIx;
#endif
int Prio; /* Revision by Michael Vysotsky correct bug */
};
#endif
======================
os_flag.c
======================
OS_FLAGS OSFlagPend(....)
{
........

break;
#endif

default:
CPU_CRITICAL_EXIT();
*p_err = OS_ERR_OPT_INVALID;
return ((OS_FLAGS)0);
}
p_grp->Prio = pend_data.TCBPtr->Prio; /* Revision by Michael Vysotsky */
OSSched(); /* Find next HPT ready to run */

CPU_CRITICAL_ENTER();
switch (OSTCBCurPtr->PendStatus) {
case OS_STATUS_PEND_OK: /* We got the vent flags */
if (p_ts != (CPU_TS *)0) {
*p_ts = OSTCBCurPtr->TS;
}
*p_err = OS_ERR_NONE;
break;
.....
}
OS_FLAGS OS_FlagPost(......)
{
.......
p_grp->TS = ts;
p_pend_list = &p_grp->PendList;
if((p_pend_data = p_pend_list->HeadPtr)&&(p_grp->Prio != OSTCBCurPtr->Prio)) /* Revision Michael Vysotsky */
p_tcb = p_pend_data->TCBPtr;
while (p_tcb != (OS_TCB *)0) { /* Go through all tasks waiting on event flag(s) */
p_pend_data_next = p_pend_data->NextPtr;
.......
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top