brazos-trapezoidal
Classes | Macros | Enumerations | Functions
SRMicro_defs.h File Reference

Specific defines for the SRMicro module implemented for STM8. More...

Go to the source code of this file.

Classes

struct  MICRO_CLOCK_DEF
 

Macros

#define CRYSTAL_FREQUENCY   (HSE_VALUE)
 
#define SYSTEM_CLOCK_FREQUENCY   (HSE_VALUE<<3L)
 
#define PERIPHERAL_CLOCK_FREQUENCY   (SYSTEM_CLOCK_FREQUENCY >>PERIPHERAL_CLOCK_MULTIPLIER)
 
#define LOW_SPEED_PERIPHERAL_CLOCK_FREQUENCY   (SYSTEM_CLOCK_FREQUENCY >>LOW_SPEED_PERIPHERAL_CLOCK_MULTIPLIER)
 
#define MICRO_RESTORE_INTERRUPT_CONTEXT()   {if (SRMicro_Macro_Interrupt_Status & 0x00010000) {__enable_interrupt();}}
 
#define MICRO_DECLARE_INTERRUPT_CONTEXT_LOCAL()   uint32_t local_interrupt_context;
 The MICRO_DECLARE_INTERRUPT_CONTEXT_LOCAL() macro defines a local variable of the type istate_t. More...
 
#define MICRO_RESTORE_INTERRUPT_CONTEXT_LOCAL()
 The MICRO_SAVE_INTERRUPT_CONTEXT_LOCAL macro saves the interrupt context into the local variable and disable interrupts. More...
 

Enumerations

enum  MICRO_CLOCK_SOURCE_TYPE { MICRO_HI_CLOCK , MICRO_HE_CLOCK , MICRO_LI_CLOCK }
 

Functions

void SRMicro__LOCOISR (void)
 

Detailed Description

Specific defines for the SRMicro module implemented for STM8.

Definition in file SRMicro_defs.h.

Macro Definition Documentation

◆ CRYSTAL_FREQUENCY

#define CRYSTAL_FREQUENCY   (HSE_VALUE)

Definition at line 26 of file SRMicro_defs.h.

◆ LOW_SPEED_PERIPHERAL_CLOCK_FREQUENCY

#define LOW_SPEED_PERIPHERAL_CLOCK_FREQUENCY   (SYSTEM_CLOCK_FREQUENCY >>LOW_SPEED_PERIPHERAL_CLOCK_MULTIPLIER)

Definition at line 29 of file SRMicro_defs.h.

◆ MICRO_DECLARE_INTERRUPT_CONTEXT_LOCAL

#define MICRO_DECLARE_INTERRUPT_CONTEXT_LOCAL ( )    uint32_t local_interrupt_context;

The MICRO_DECLARE_INTERRUPT_CONTEXT_LOCAL() macro defines a local variable of the type istate_t.

The local variable will be used to keep the interrupt context in a local scope. The call for this macro should be placed only once in the top of the function along with the local variables declaration.

Note
void Function (void)
{
     variables declaration...
     MICRO_DECLARE_INTERRUPT_CONTEXT_LOCAL();

     code...
     MICRO_SAVE_INTERRUPT_CONTEXT_LOCAL();
     protected code 1...
     MICRO_RESTORE_INTERRUPT_CONTEXT_LOCAL();

     code...
     MICRO_SAVE_INTERRUPT_CONTEXT_LOCAL();
     protected code 2...
     MICRO_RESTORE_INTERRUPT_CONTEXT_LOCAL();
}

Definition at line 67 of file SRMicro_defs.h.

◆ MICRO_RESTORE_INTERRUPT_CONTEXT

#define MICRO_RESTORE_INTERRUPT_CONTEXT ( )    {if (SRMicro_Macro_Interrupt_Status & 0x00010000) {__enable_interrupt();}}

Definition at line 40 of file SRMicro_defs.h.

◆ MICRO_RESTORE_INTERRUPT_CONTEXT_LOCAL

#define MICRO_RESTORE_INTERRUPT_CONTEXT_LOCAL ( )
Value:
{ if (local_interrupt_context & 0x00010000) \
{ \
__enable_interrupt(); \
} \
}

The MICRO_SAVE_INTERRUPT_CONTEXT_LOCAL macro saves the interrupt context into the local variable and disable interrupts.

This macro requires the macro MICRO_DECLARE_INTERRUPT_CONTEXT_LOCAL() to be added in the top of the function in order to declare the local variable used to keep the interrupt context.

Note
void Function (void)
{
     variables declaration...
     MICRO_DECLARE_INTERRUPT_CONTEXT_LOCAL();

     code...
     MICRO_SAVE_INTERRUPT_CONTEXT_LOCAL();
     protected code 1...
     MICRO_RESTORE_INTERRUPT_CONTEXT_LOCAL();

     code...
     MICRO_SAVE_INTERRUPT_CONTEXT_LOCAL();
     protected code 2...
     MICRO_RESTORE_INTERRUPT_CONTEXT_LOCAL();
}

The MICRO_RESTORE_INTERRUPT_CONTEXT_LOCAL() macro restores the I bit in the PSW register so restabilishing the interrupt context

This macro requires the macro MICRO_DECLARE_INTERRUPT_CONTEXT_LOCAL() to be added in the top of the function in order to declare the local variable used to keep the interrupt context.

Note
void Function (void)
{
     variables declaration...
     MICRO_DECLARE_INTERRUPT_CONTEXT_LOCAL();

     code...
     MICRO_SAVE_INTERRUPT_CONTEXT_LOCAL();
     protected code 1...
     MICRO_RESTORE_INTERRUPT_CONTEXT_LOCAL();

     code...
     MICRO_SAVE_INTERRUPT_CONTEXT_LOCAL();
     protected code 2...
     MICRO_RESTORE_INTERRUPT_CONTEXT_LOCAL();
}

Definition at line 118 of file SRMicro_defs.h.

◆ PERIPHERAL_CLOCK_FREQUENCY

#define PERIPHERAL_CLOCK_FREQUENCY   (SYSTEM_CLOCK_FREQUENCY >>PERIPHERAL_CLOCK_MULTIPLIER)

Definition at line 28 of file SRMicro_defs.h.

◆ SYSTEM_CLOCK_FREQUENCY

#define SYSTEM_CLOCK_FREQUENCY   (HSE_VALUE<<3L)

Definition at line 27 of file SRMicro_defs.h.

Enumeration Type Documentation

◆ MICRO_CLOCK_SOURCE_TYPE

enum MICRO_CLOCK_SOURCE_TYPE

Definition at line 12 of file SRMicro_defs.h.