EmbeddedRelated.com
Forums

Re: Disable/Enable interrupts using inline assebmly?

Started by pand...@gmail.com April 1, 2009
Is it possible to enable/disable interrupts in the code in this manner
>inline while using the assembly syntax directly?
>
>#define DISABLE_INTERRUPTS _asm("DINT")
>#define ENABLE_INTERRUPTS _asm("EINT")
>
>Thanks
>
>Hi all,
I'm working using gcc compiler and i'm using msp430f2274 and cc2480 for my application. Previously i worked with CCEv3 compiler and i have tested. Just i did Tx/Rx using two boards. Now i want to do the same using GCC compiler also. I did a modification for all syntax changes for ISRs and for _enable_interrupts(),_disable_interrupts(). But i have the doubt for following lines, pls if anyone knows about it, in GCC pls tell me:

#define HAL_ENTER_CRITICAL_SECTION(x) \
st( x = __get_interrupt_state(); HAL_DISABLE_INTERRUPTS(); )
#define HAL_EXIT_CRITICAL_SECTION(x) __set_interrupt_state((x))
#define HAL_CRITICAL_STATEMENT(x) \
st( halIntState_t s; HAL_ENTER_CRITICAL_SECTION(s); x; HAL_EXIT_CRITICAL_SECTION(s); )

for this i have written the following lines that to only for __get_interrupt_state(); and __set_interrupt_state((x)), i got error here so i changed in this way:
#define HAL_ENTER_CRITICAL_SECTION(x) \
st( x = READ_SR; HAL_DISABLE_INTERRUPTS(); )
#define HAL_EXIT_CRITICAL_SECTION(x) WRITE_SR(x)
#define HAL_CRITICAL_STATEMENT(x) \
st( halIntState_t s; HAL_ENTER_CRITICAL_SECTION(s); x; HAL_EXIT_CRITICAL_SECTION(s); )

Pls tell what i can use instead of READ_SR and WRITE_SR(x)?

Also how to check Data Memory taken for a code in GCC?
It'll show the code size for .text and also for .data(data memory), but this .data is const always if i add the global variables it'll not alter at all why? .text size will vary. I'm working with eclipse.
Thanks&Regards,
Pandit

Beginning Microcontrollers with the MSP430