Skip to content

Commit

Permalink
Fix the ISR2 interrupts masking, ok this time
Browse files Browse the repository at this point in the history
  • Loading branch information
jlbirccyn committed Nov 20, 2017
1 parent 72a3d3d commit 3b06b7b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions os/tpl_os_kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,18 +645,6 @@ FUNC(P2CONST(tpl_context, AUTOMATIC, OS_CONST), OS_CODE)
proc_name_table[TPL_KERN_REF(kern).running_id])
);

/*
* If the running process is an ISR2 and ISR2 priority masking is enabled
* tpl_unmask_isr2_priority is called for the preempted ISR2 so that
* lowest priority ISR2 interrupts are unmasked
*/
#if WITH_ISR2_PRIORITY_MASKING == YES && ISR_COUNT > 0
if (TPL_KERN_REF(kern).s_running->type == IS_ROUTINE)
{
tpl_unmask_isr2_priority(TPL_KERN_REF(kern).running_id);
}
#endif /* WITH_ISR2_PRIORITY_MASKING */

/* The current running task becomes READY */
TPL_KERN_REF(kern).running->state = (tpl_proc_state)READY;

Expand All @@ -669,12 +657,24 @@ FUNC(P2CONST(tpl_context, AUTOMATIC, OS_CONST), OS_CODE)
#endif /* WITH_AUTOSAR_TIMING_PROTECTION */
}

#if WITH_ISR2_PRIORITY_MASKING == YES && ISR_COUNT > 0
/*
* If the running process is an ISR2 and ISR2 priority masking is enabled
* tpl_unmask_isr2_priority is called for the preempted or terminated ISR2
* so that lowest priority ISR2 interrupts are unmasked. When OS starts,
* s_running is NULL, so it is check to prevent NULL dereference.
*/
if (TPL_KERN_REF(kern).s_running != NULL &&
TPL_KERN_REF(kern).s_running->type == IS_ROUTINE)
{
tpl_unmask_isr2_priority(TPL_KERN_REF(kern).running_id);
}

/*
* If the elected process is an ISR2 and ISR2 priority masking is enabled
* tpl_mask_isr2_priority is called for the started ISR2 so that lowest
* priority ISR2 interrupts are masked
*/
#if WITH_ISR2_PRIORITY_MASKING == YES && ISR_COUNT > 0
if (TPL_KERN_REF(kern).s_elected->type == IS_ROUTINE)
{
tpl_mask_isr2_priority(TPL_KERN_REF(kern).elected_id);
Expand Down

1 comment on commit 3b06b7b

@carelisan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yu0

Please sign in to comment.