-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompiler.h
More file actions
54 lines (46 loc) · 2.1 KB
/
compiler.h
File metadata and controls
54 lines (46 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef COMPILER_H
#define COMPILER_H
#ifdef __cplusplus
extern "C"{
#endif
#include "type.h"
#include "macroUtility.h"
/* ------------------------------------------------------------------------------------------------
* Target Defines
* ------------------------------------------------------------------------------------------------
*/
#define HAL_MCU_MSP430G2553
/* ------------------------------------------------------------------------------------------------
* Compiler Abstraction
* ------------------------------------------------------------------------------------------------
*/
/* ---------------------- IAR Compiler ---------------------- */
#ifdef __IAR_SYSTEMS_ICC__
#include <msp430.h>
#define HAL_COMPILER_IAR
#define HAL_MCU_LITTLE_ENDIAN() 1
#define _PRAGMA(x) _Pragma(#x)
#define HAL_ISR_FUNC_DECLARATION(f,v) _PRAGMA(vector=v) __interrupt void f(void)
#define HAL_ISR_FUNC_PROTOTYPE(f,v) _PRAGMA(vector=v) __interrupt void f(void)
#define HAL_ISR_FUNCTION(f,v) HAL_ISR_FUNC_PROTOTYPE(f,v); HAL_ISR_FUNC_DECLARATION(f,v)
#define STATIC static
/* ------------------ Unrecognized Compiler ------------------ */
#else
#error "ERROR: Unknown compiler."
#endif
/* ------------------------------------------------------------------------------------------------
* Interrupt Macros
* ------------------------------------------------------------------------------------------------
*/
#define HAL_ENABLE_INTERRUPTS() asm("eint")
#define HAL_DISABLE_INTERRUPTS() st( asm("dint"); asm("nop"); )
#define HAL_INTERRUPTS_ARE_ENABLED() (__get_SR_register() & GIE)
typedef istate_t halIntState_t;
#define HAL_ENTER_CRITICAL_SECTION(x) st( x = __get_interrupt_state(); HAL_DISABLE_INTERRUPTS(); )
#define HAL_EXIT_CRITICAL_SECTION(x) st( __set_interrupt_state(x); )
#define HAL_CRITICAL_STATEMENT(x) st( halIntState_t s; HAL_ENTER_CRITICAL_SECTION(s); x; HAL_EXIT_CRITICAL_SECTION(s); )
#ifdef __cplusplus
}
#endif
#endif /* End #ifndef COMPILER_H */
/* End of file */