Pumpkin, Inc.

Pumpkin User Forums

UNPROTECT SALVO kernel

If you have a general question or comment regarding Salvo, post it here.

UNPROTECT SALVO kernel

Postby luben » Sun Jan 19, 2003 7:30 am

Hello,

As I know when entering into the kernel of SALVO, there are some critical places, where is not good to disturb SALVO. They use OSProtect and OSUnprotect to disable/ reenable interrupts. If interrupts occur in such places, in some cases this could be extremely dangerous and could yield wrong operation of the kernel. From other side in other cases, interrupting the kernel in these places could be normal, without any risk of anything.

I have a project, where the interrupts are enabled, but I don't need to protect the kernel - I'm sure that I will not "hurt" it and I don't signal events in ISR and I don't call OSTimer in ISR. The problem is that I have to guarantee fast response of the ISR. With protect/unprotect services there are some moments, when ISR becomes slowlier. I calculated that even if protect/unprotect "eats" 2 cycles - it's too much and in some rare cases the ISR will skip the right data. So I just need to "switch of" the protection of the kernel, "promissing" to the kernel that I'll take care for it.

My quesation is - is there some smart approach in current SALVO for "switch of" the protection of the kernel - like if all OSCALLFROMxxx are made only from main level - protect/unprotect is defined like void functions.

Or this will require new totally new service in SALVO - OSUNPROTECT with settings TRUE/FALSE?

Regards
Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: UNPROTECT SALVO kernel

Postby aek » Mon Jan 20, 2003 11:58 am

Hi Luben.

Protection is required whenever a Salvo resource is accessed from an interrupt/foreground code and from mainline/background code.

quote:
I calculated that even if protect/unprotect "eats" 2 cycles - it's too much and in some rare cases the ISR will skip the right data.
That's not the major problem. The major problem is that interrupts will be disabled for more than 2 cycles when the Salvo code is in a critical section. I.e. a critical section can and will delay the processing of an interrupt for more than 2 cycles.

So, what can you do? Well, in a source-code build, you can redefine OSEi() and OSDi() to only disabel those interrupt(s) that are "related" to the Salvo code. E.g if OSTimer() is called via a TimerN interrupt, then you can simple enable or disable the TimerN Interrupt Enable bit(s) instead of disabling all interrupts. In other words, you change Salvo's interrupt control to be selective instead of general.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: UNPROTECT SALVO kernel

Postby luben » Mon Jan 20, 2003 12:03 pm

Hello,

Some small idea to improve SALVO.

So, if it's important not to disturb the kernel when in ISR accessing SALVO resources, then PROTECT and UNPROTECT should work only in these cases.

In all other cases PROTECT has no sense - it just makes slowlier the ISR, without any sense.
I mean, in some cases the PROTECT has no sense at all (no use of OSTimer in ISR, no Signalling of events in ISR) - in thses cases PROTECT should be void

Regards
Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: UNPROTECT SALVO kernel

Postby aek » Mon Jan 20, 2003 12:34 pm

Hi Luben.

quote:
I mean, in some cases the PROTECT has no sense at all (no use of OSTimer in ISR, no Signalling of events in ISR) - in thses cases PROTECT should be void.
In those cases (i.e. where you aren't calling any Salvo services from ISRs) then you can use OSCALL_FROM_FOREGROUND etc. instead). Those libraries and configurations do no interrupt control at all ... just be sure to document why you did it that way ... :-)

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron