brazos-trapezoidal
SRMicro_defs.h
Go to the documentation of this file.
1
6#ifndef SRMICRO_DEFS_H_
7 #define SRMICRO_DEFS_H_
8//#include "intrinsics.h"
9//=====================================================================================================================
10//-------------------------------------- PUBLIC (Extern Variables, Constants & Defines) -------------------------------
11//=====================================================================================================================
12typedef enum
13{
14 MICRO_HI_CLOCK,
15 MICRO_HE_CLOCK,
16 MICRO_LI_CLOCK
17} MICRO_CLOCK_SOURCE_TYPE;
18
19typedef struct
20{
21 unsigned long XTAL_Frequency; // Main Clock Frequency.............12.5MHz (e.g.)
22 unsigned long SYSCLK_Frequency; // Internal Clock Frequency..........100MHz (e.g.)
23 unsigned long PCLK_Frequency; // Peripheral Clock Frequency.........50MHz (e.g.)
25
26#define CRYSTAL_FREQUENCY (HSE_VALUE) // (12.5 MHz)
27#define SYSTEM_CLOCK_FREQUENCY (HSE_VALUE<<3L) // (100 MHz)
28#define PERIPHERAL_CLOCK_FREQUENCY (SYSTEM_CLOCK_FREQUENCY >>PERIPHERAL_CLOCK_MULTIPLIER) // (50 MHz)
29#define LOW_SPEED_PERIPHERAL_CLOCK_FREQUENCY (SYSTEM_CLOCK_FREQUENCY >>LOW_SPEED_PERIPHERAL_CLOCK_MULTIPLIER) // (50 MHz)
30
31
32//extern __istate_t SRMicro_Macro_Interrupt_Status;
33
34// Note that there's no protection for overwrite SRMicro_Macro_Interrupt_Status, so if MICRO_SAVE_INTERRUPT_CONTEXT() is called 2x
35// without MICRO_RESTORE_INTERRUPT_CONTEXT() the second will overwrite the first.
36//#define MICRO_SAVE_INTERRUPT_CONTEXT() { SRMicro_Macro_Interrupt_Status = __get_interrupt_state(); \
37 __disable_interrupt();}
38
39//
40#define MICRO_RESTORE_INTERRUPT_CONTEXT() {if (SRMicro_Macro_Interrupt_Status & 0x00010000) {__enable_interrupt();}}
41
43
67#define MICRO_DECLARE_INTERRUPT_CONTEXT_LOCAL() uint32_t local_interrupt_context;
68
92//#define MICRO_SAVE_INTERRUPT_CONTEXT_LOCAL() { local_interrupt_context = __get_interrupt_state(); \
93 __disable_interrupt();}
94
118#define MICRO_RESTORE_INTERRUPT_CONTEXT_LOCAL() { if (local_interrupt_context & 0x00010000) \
119 { \
120 __enable_interrupt(); \
121 } \
122 }
123
124
125
126
127//=====================================================================================================================
128//-------------------------------------- PUBLIC (Function Prototypes) -------------------------------------------------
129//=====================================================================================================================
130/* This ISR function measure the cycle of the frequency-divided LOCO clock used for the independent watchdog timer (IWDT)
131 * in the RX62T. By this function, the main clock oscillation frequency errors can be detected.
132 * This needs to be configured in the SRInterruptVector_prm.h file as below
133 *
134 * #define SRINTERRUPTVECTOR__GPT0_LOCO1 SRMicro__LOCOISR
135 */
136void SRMicro__LOCOISR(void);
137
138#endif // SRMICRO_DEFS_H_
139
140