This is a well-known feature of mspgcc which has been discussed here and
described in docs.
So, from doc.txt:
---------------------------------------------------------------------------
attribute 'critical' will disable interrupts on function entry and restore
them on function exit.
Also defined in iomacros.h
#define critical __attribute__ ((critical))
For example:
int critical clearIntrptSource(int src)
{
intrsrc &= ~src;
return intrsrc;
}
Attributes added in version 3.2 and higher.
Attribute 'reentrant' will disable interrupts on function entry and enable
interrupt on function exit irrespective to the previous r2 state.
#define reentrant __attribute__ ((reentrant))
For example:
int reentrant clearIntrptSource(int src)
{
intrsrc &= ~src;
return intrsrc;
}
--------------------------------------------------------------------------
So, the first one behaves as you want - saves r2 , dint and then restores r2
on funct exit.
I've done it slightly different, than other compilers do -
r2 being saved just before very first _real_ subprogramm's instruction in
order to minimize "interrupts disabled" time.
If you want more information on it, please do not hesitate to contact me.
~d
On Tuesday 01 April 2003 08:18, Andrew Kalman wrote:
> Hi All.
>
> For those of you not familiar with the Salvo RTOS, it's an RTOS with an
> especially small RAM footprint that is well-suited to the MSP430.
>
> Pumpkin has certified the Archelon / Quadravox, IAR, ImageCraft and Rowley
> Associates compilers for use with Salvo.
>
> We've been asked to do an mspgcc port. One thing we would need (and I
> couldn't find in the documentation) is a __monitor__ keyword (all 4 of the
> abovenamed compilers support this). When applied to a function like this:
>
> void MyFn (args) __monitor__
> {
> ...
> }
>
> the net result is that the very first two instructions in the function are:
>
> push SR
> dint
>
> and the very last instruction is
>
> reti
>
> i.e. the function saves the GIE status upon entry, and restores it upon
> exit.
>
> Since this will affect a function's stack frame, this is something that
> must be supported natively in the compiler, and cannot be done via in-line
> assembly.
>
> Are there any plans to support this keyword? If so, when would it be folded
> into a new mspgcc release?
>
> Thanks,
> ---------------------------------------------------------------
> Andrew E. Kalman, Ph.D. [email protected]
>
> Pumpkin, Inc.
> home of Salvo, The RTOS that runs in tiny places.(TM)
> http://www.pumpkininc.com
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: ValueWeb:
> Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
> No other company gives more support or power for your dedicated server
> http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
--
/********************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
(_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 3468202, 5585314
********************************************************************/