go to single .html
[fw/sdcc] / src / port.h
index 57aebe82f72072eeff1e8f9465f7d8a586c29f77..0e6459b77aa44c12008ee7b363e6532ebced1c4f 100644 (file)
@@ -5,9 +5,33 @@
 #ifndef PORT_INCLUDE
 #define PORT_INCLUDE
 
+#define TARGET_ID_MCS51    1
+#define TARGET_ID_GBZ80    2
+#define TARGET_ID_Z80      3
+#define TARGET_ID_AVR      4
+#define TARGET_ID_DS390    5
+#define TARGET_ID_PIC      6
+#define TARGET_ID_I186     7
+#define TARGET_ID_TLCS900H 8
+#define TARGET_ID_XA51     9
+
+/* Macro to test the target we are compiling for.
+   Can only be used after SDCCmain has defined the port
+*/
+#define TARGET_IS_MCS51 (port->id==TARGET_ID_MCS51)
+#define TARGET_IS_GBZ80 (port->id==TARGET_ID_GBZ80)
+#define TARGET_IS_Z80 (port->id==TARGET_ID_Z80)
+#define TARGET_IS_AVR (port->id==TARGET_ID_AVR)
+#define TARGET_IS_DS390 (port->id==TARGET_ID_DS390)
+#define TARGET_IS_PIC   (port->id==TARGET_ID_PIC)
+#define TARGET_IS_I186 (port->id==TARGET_ID_I186)
+#define TARGET_IS_TCLS900H (port->id==TARGET_ID_TCLS900H)
+
 /* Processor specific names */
 typedef struct
   {
+/** Unique id for this target */
+    const int id;
 /** Target name used for -m */
     const char *target;
 
@@ -16,7 +40,7 @@ typedef struct
 
     struct
       {
-       /** TRUE if all types of glue functions should be inseted into
+       /** TRUE if all types of glue functions should be inserted into
            the file that also defines main.
            We dont want this in cases like the z80 where the startup
            code is provided by a seperate module.
@@ -39,6 +63,8 @@ typedef struct
        const char *plain_opts;
        /* print externs as global */
        int externGlobal;
+       /* assembler file extension */
+       const char *file_ext;
       }
     assembler;
 
@@ -122,7 +148,7 @@ typedef struct
        /** One more than the smallest 
            mul/div operation the processor can do nativley 
            Eg if the processor has an 8 bit mul, nativebelow is 2 */
-       int native_below;
+       unsigned native_below;
        /** The mul/div/mod functions will be made to use regparams
            for sizeof(param) < log2(force_reg)
            i.e. Use 2 for WORD and BYTE, 0 for none. */
@@ -134,7 +160,7 @@ typedef struct
     const char *fun_prefix;
 
     /** Called once the processor target has been selected.
-       First chance to initalise and set any port specific varibles.
+       First chance to initalise and set any port specific variables.
        'port' is set before calling this.  May be NULL.
     */
     void (*init) (void);
@@ -209,11 +235,9 @@ extern PORT avr_port;
 #endif
 #if !OPT_DISABLE_DS390
 extern PORT ds390_port;
-#else
-PORT ds390_port;
 #endif
 #if !OPT_DISABLE_PIC
-extern PORT pic14_port;
+extern PORT pic_port;
 #endif
 #if !OPT_DISABLE_I186
 extern PORT i186_port;
@@ -222,12 +246,4 @@ extern PORT i186_port;
 extern PORT tlcs900h_port;
 #endif
 
-/* Test to see if we are current compiling in DS390 mode. */
-#define IS_MCS51_PORT (port == &mcs51_port)
-#define IS_GBZ80_PORT (port == &gbz80_port)
-#define IS_Z80_PORT (port == &z80_port)
-#define IS_AVR_PORT (port == &avr_port)
-#define IS_DS390_PORT (port == &ds390_port)
-#define IS_PIC_PORT (port == &pic14_port)
-
-#endif
+#endif /* PORT_INCLUDE*/