]> oss.titaniummirror.com Git - msp430-libc.git/blobdiff - src/core_common.inc
Imported msp430-libc-20100207
[msp430-libc.git] / src / core_common.inc
diff --git a/src/core_common.inc b/src/core_common.inc
new file mode 100644 (file)
index 0000000..ec364ef
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef  __CORE_COMMON_H__
+#define  __CORE_COMMON_H__
+#if defined (__ASSEMBLER__)
+
+/*
+ * if __MSP430X2__ defined, __MSP430X__ is defined too
+ * so we check for __MSP430X__ only
+ */
+#if defined(__MSP430X__)
+  #if defined(__MSP430X_ADDR_16BIT__)
+    #define XBR     br
+    #define XCALL   call
+    #define XRET    ret
+    #define XMOVA   mov
+    #define XCMP    cmp
+  #else
+    #define XBR     bra
+    #define XCALL   calla
+    #define XRET    reta
+    #define XMOVA   mova
+    #define XCMP    cmpa
+  #endif
+  #if defined(__MSP430X_REGS_16BIT__)
+    #define XPUSH   pushx.w
+    #define XPOP    popx.w
+    #define XPUSHM  pushm.w
+    #define XPOPM   popm.w
+    #define XMOV    movx.w
+    .equ    PUSH_BYTES, 2
+  #else
+    #define XPUSH   pushx.a
+    #define XPOP    popx.a
+    #define XPUSHM  pushm.a
+    #define XPOPM   popm.a
+    #define XMOV    movx.a
+    .equ    PUSH_BYTES, 4
+  #endif
+#else
+  #define XBR     br
+  #define XCALL   call
+  #define XRET    ret
+  #define XMOV    mov
+  #define XCMP    cmp
+  #define XPUSH   push
+  #define XPOP    pop
+  #define XMOVA   mov
+  .equ    PUSH_BYTES, 2
+#endif
+
+#endif  /* __ASSEMBLER__ */
+
+#endif  /* __CORE_COMMON_H__ */