Gnu

Compiler and Platform specific definitions and typedefs for the GNU C ARM compiler. More...

Defines

#define _HAL_USE_COMMON_PGM_
 Use the Master Program Memory Declarations from platform-common.h.
#define _HAL_USE_COMMON_MEMUTILS_
 Use the C Standard Library Memory Utilities from platform-common.h.
#define PLATCOMMONOKTOINCLUDE
 Include platform-common.h last to pick up defaults and common definitions.

Master Variable Types

These are a set of typedefs to make the size of all variable declarations explicitly known.



typedef unsigned char boolean
 A typedef to make the size of the variable explicitly known.
typedef unsigned char int8u
typedef signed char int8s
typedef unsigned short int16u
typedef signed short int16s
typedef unsigned int int32u
typedef signed int int32s
typedef unsigned int PointerType

Miscellaneous Macros



char __ApplicationFlashStart
char __ApplicationFlashEnd
void halInternalResetWatchDog (void)
 Macro to reset the watchdog timer.
#define BIGENDIAN_CPU   FALSE
 A convenient method for code to know what endiannes processor it is running on.
#define NO_STRIPPING
 A friendlier name for the compiler's intrinsic for not stripping.
#define __no_init
#define EEPROM   errorerror
 A friendlier name for the compiler's intrinsic for eeprom reference.
#define __SOURCEFILE__   __FILE__
 The __SOURCEFILE__ macro is used by asserts to list the filename if it isn't otherwise defined, set it to the compiler intrinsic which specifies the whole filename and path of the sourcefile.
#define assert(condition)   do { if (! (condition)) {while (1); }} while(0)
#define __delay_cycles(x)   please_use_halCommonDelayMicroseconds_instead_of_delay_cycles
 __delay_cycles() is an intrinsic IAR call; however, we have explicity disallowed it since it is too specific to the system clock.
#define DEBUG_LEVEL   FULL_DEBUG
 Set debug level based on whether or DEBUG is defined.
#define APPLICATION_IMAGE_START   ((u32) &__ApplicationFlashStart)
 Set the application start and end address.
#define APPLICATION_IMAGE_END   ((u32) &__ApplicationFlashEnd)
#define halResetWatchdog()   halInternalResetWatchDog()
#define UNUSED
 Define __attribute__ to nothing since it isn't handled by IAR.
#define SIGNED_ENUM
 Some platforms need to cast enum values that have the high bit set.
#define STACK_FILL_VALUE   0xCDCDCDCD
 Define the magic value that is interpreted by IAR C-SPY's Stack View.
#define RAMFUNC   __ramfunc
 Define a generic RAM function identifier to a compiler specific one.
#define NO_OPERATION()   __no_operation()
 Define a generic no operation identifier to a compiler specific one.
#define SET_REG_FIELD(reg, field, value)
 A convenience macro that makes it easy to change the field of a register to any value.
#define simulatedTimePasses()
 Stub for code not running in simulation.
#define simulatedTimePassesMs(x)
 Stub for code not running in simulation.
#define simulatedSerialTimePasses()
 Stub for code not running in simulation.
#define _HAL_USE_COMMON_DIVMOD_
 Use the Divide and Modulus Operations from platform-common.h.
#define VAR_AT_SEGMENT(__variableDeclaration, __segmentName)   __variableDeclaration __attribute__ ((section (__segmentName)))
 Provide a portable way to specify the segment where a variable lives.
#define ALIGN_VAR(__variableDeclaration, alignment)   __variableDeclaration __attribute__ ((aligned(alignment)))

Global Interrupt Manipulation Macros

Note: The special purpose BASEPRI register is used to enable and disable interrupts while permitting faults.

When BASEPRI is set to 1 no interrupts can trigger. The configurable faults (usage, memory management, and bus faults) can trigger if enabled as well as the always-enabled exceptions (reset, NMI and hard fault). When BASEPRI is set to 0, it is disabled, so any interrupt can triggger if its priority is higher than the current priority.



int8u _readBasePri (void)
void _writeBasePri (int8u priority)
void _enableBasePri (void)
int8u _disableBasePri (void)
boolean _basePriIsDisabled (void)
void _setPriMask (void)
void _clearPriMask (void)
#define ATOMIC_LITE(blah)   ATOMIC(blah)
#define DECLARE_INTERRUPT_STATE_LITE   DECLARE_INTERRUPT_STATE
#define DISABLE_INTERRUPTS_LITE()   DISABLE_INTERRUPTS()
#define RESTORE_INTERRUPTS_LITE()   RESTORE_INTERRUPTS()
#define DECLARE_INTERRUPT_STATE   int8u _emIsrState
 This macro should be called in the local variable declarations section of any function which calls DISABLE_INTERRUPTS() or RESTORE_INTERRUPTS().
#define DISABLE_INTERRUPTS()
 Disable interrupts, saving the previous state so it can be later restored with RESTORE_INTERRUPTS().
#define RESTORE_INTERRUPTS()
 Restore the global interrupt state previously saved by DISABLE_INTERRUPTS().
#define INTERRUPTS_ON()
 Enable global interrupts without regard to the current or previous state.
#define INTERRUPTS_OFF()
 Disable global interrupts without regard to the current or previous state.
#define INTERRUPTS_ARE_OFF()   ( _basePriIsDisabled() )
#define INTERRUPTS_WERE_ON()   (_emIsrState == 0)
#define ATOMIC(blah)
 A block of code may be made atomic by wrapping it with this macro.
#define HANDLE_PENDING_INTERRUPTS()
 Allows any pending interrupts to be executed.
#define SET_BASE_PRIORITY_LEVEL(basepri)
 Sets the base priority mask (BASEPRI) to the value passed, bit shifted up by PRIGROUP_POSITION+1.

External Declarations

These are routines that are defined in certain header files that we don't want to include, e.g.

stdlib.h



int abs (int I)
 Returns the absolute value of I (also called the magnitude of I).

Portable segment names



#define __NO_INIT__   ".noinit"
 Portable segment names.
#define __INTVEC__   ".intvec"
#define __CSTACK__   "CSTACK"
#define __DATA_INIT__   ".data_init"
#define __DATA__   ".data"
#define __BSS__   ".bss"
#define __CONST__   ".rodata"
#define __TEXT__   ".text"
#define __TEXTRW_INIT__   ".textrw_init"
#define __TEXTRW__   ".textrw"
#define __FAT__   "FAT"
#define __NVM__   "NVM"

Detailed Description

Compiler and Platform specific definitions and typedefs for the GNU C ARM compiler.

Note:
gnu.h should be included first in all source files by setting the preprocessor macro PLATFORM_HEADER to point to it. gnu.h automatically includes platform-common.h.

See gnu.h and platform-common.h for source code.


Define Documentation

#define __delay_cycles (  )     please_use_halCommonDelayMicroseconds_instead_of_delay_cycles

__delay_cycles() is an intrinsic IAR call; however, we have explicity disallowed it since it is too specific to the system clock.

Note:
Please use halCommonDelayMicroseconds() instead, because it correctly accounts for various system clock speeds.

Definition at line 162 of file gnu.h.

#define APPLICATION_IMAGE_START   ((u32) &__ApplicationFlashStart)

Set the application start and end address.

This are useful to detect whether an image is for bootloader mode or not. This can be used also to clone image to another node via bootloader.

Definition at line 182 of file gnu.h.

#define ATOMIC ( blah   ) 
Value:

A block of code may be made atomic by wrapping it with this macro.

Something which is atomic cannot be interrupted by interrupts.

Definition at line 452 of file gnu.h.

Referenced by halInternalFlashErase(), halInternalFlashWrite(), halRequestAdcData(), halStartAdcConversion(), and halToggleLed().

#define BIGENDIAN_CPU   FALSE

A convenient method for code to know what endiannes processor it is running on.

For the Cortex-M3, we are little endian.

Definition at line 119 of file gnu.h.

#define DEBUG_LEVEL   FULL_DEBUG

Set debug level based on whether or DEBUG is defined.

basic debugging support is included if DEBUG is not defined.

Definition at line 171 of file gnu.h.

 
#define DISABLE_INTERRUPTS (  ) 
Value:
do {                                          \
      _emIsrState = _disableBasePri();            \
    } while(0)

Disable interrupts, saving the previous state so it can be later restored with RESTORE_INTERRUPTS().

Note:
Do not fail to call RESTORE_INTERRUPTS().
It is safe to nest this call.

Definition at line 398 of file gnu.h.

Referenced by flash_read().

 
#define HANDLE_PENDING_INTERRUPTS (  ) 
Value:
do {                              \
      if (INTERRUPTS_ARE_OFF()) {     \
        INTERRUPTS_ON();              \
        INTERRUPTS_OFF();             \
      }                               \
   } while (0)

Allows any pending interrupts to be executed.

Usually this would be called at a safe point while interrupts are disabled (such as within an ISR).

Takes no action if interrupts are already enabled.

Definition at line 468 of file gnu.h.

 
#define INTERRUPTS_ARE_OFF (  )     ( _basePriIsDisabled() )
Returns:
TRUE if global interrupts are disabled.

Definition at line 440 of file gnu.h.

Referenced by halRequestAdcData().

 
#define INTERRUPTS_WERE_ON (  )     (_emIsrState == 0)
Returns:
TRUE if global interrupt flag was enabled when DISABLE_INTERRUPTS() was called.

Definition at line 446 of file gnu.h.

 
#define RESTORE_INTERRUPTS (  ) 
Value:
do {                            \
      _writeBasePri(_emIsrState); \
    } while(0)

Restore the global interrupt state previously saved by DISABLE_INTERRUPTS().

Note:
Do not call without having first called DISABLE_INTERRUPTS() to have saved the state.
It is safe to nest this call.

Definition at line 411 of file gnu.h.

#define SET_BASE_PRIORITY_LEVEL ( basepri   ) 
Value:
do {                                   \
      _writeBasePri(basepri);              \
    } while(0)

Sets the base priority mask (BASEPRI) to the value passed, bit shifted up by PRIGROUP_POSITION+1.

This will inhibit the core from taking all interrupts with a preemptive priority equal to or less than the BASEPRI mask. This macro is dependent on the value of PRIGROUP_POSITION in nvic-config.h. Note that the value 0 disables the the base priority mask.

Refer to the "PRIGROUP" table in nvic-config.h to know the valid values for this macro depending on the value of PRIGROUP_POSITION. With respect to the table, this macro can only take the preemptive priority group numbers denoted by the parenthesis.

Definition at line 490 of file gnu.h.

#define UNUSED

Define __attribute__ to nothing since it isn't handled by IAR.

Declare a variable as unused to avoid a warning. Has no effect in IAR builds

Definition at line 205 of file gnu.h.


Function Documentation

int abs ( int  I  ) 

Returns the absolute value of I (also called the magnitude of I).

That is, if I is negative, the result is the opposite of I, but if I is nonnegative the result is I.

Parameters:
I An integer.
Returns:
A nonnegative integer.

Referenced by lcd_num_putdec().

void halInternalResetWatchDog ( void   ) 

Macro to reset the watchdog timer.

Note: be very very careful when using this as you can easily get into an infinite loop if you are not careful.

Macro to reset the watchdog timer.

This function is pointed to by the macro halResetWatchdog().

Warning:
Be very careful when using this as you can easily get into an infinite loop.

Definition at line 25 of file micro-common.c.


Generated on Mon Apr 11 14:23:57 2011 for Contiki 2.5 by  doxygen 1.6.1