* as/z80/z80mch.c: fixed bug #1704376: missing as-z80 errors
[fw/sdcc] / src / pic / device.h
index bea75a49625c661a3770aa2f4395dec283ce0de5..ccf3616e09f7689f668b991c14f129b3991f8c2e 100644 (file)
 #ifndef  __DEVICE_H__
 #define  __DEVICE_H__
 
+#include "common.h"
+
+/*
+ * Imports
+ */
+extern char *iComments2;
+
 /* memRange - a structure to define a range of valid memory addresses 
  * 
  * The Memory of most PICs (and other micros) is a collection of
@@ -44,33 +51,10 @@ typedef struct memRange {
                                 * e.g. alias = 0x80 means start_address is identical
                                 * to the memory location at (0x80 | start_address) */
        int bank;               /* PIC memory bank this range occupies */
+       struct memRange *next;  /* linked list */
 
 } memRange;
 
-/* AssignedMemory - A structure to keep track of the memory that has been used.
- *
- * When a register gets assigned an address this struct is used to
- * keep track of a few details about the register. There is one of
- * these structures for each memory location in the device.
- */
-
-typedef struct AssignedMemory {
-       regs *reg;        /* Pointer to the register (NULL if this is an invalid address) */
-       int  instance;    /* the i'th byte of a multibyte register */
-       int  alias;       /* Bit mapping of aliased addresses (see memRange) */
-       int  bank;        /* Memory bank of this register */
-       int  isValid:1;   /* True if the address is legal */
-       int  isSFR:1;     /* True if the address is that of a Special Function reg */
-       int  isEmitted:1; /* True if the register has been written to a cBlock */
-
-} AssignedMemory;
-
-
-/*
- * finalMapping - Dynamically allocated array that records the register assignments
- */
-
-extern AssignedMemory *finalMapping;
 /* Processor unique attributes */
 typedef struct PIC_device {
        char *name;                 /* the processor name */
@@ -91,28 +75,16 @@ typedef struct PIC_device {
 
 } PIC_device;
 
-/* Given a pointer to a register, this macro returns the bank that it is in */
-#define REG_ADDR(r)        ((r)->isBitField ? (((r)->address)>>3) : (r)->address)
-#define REG_BANK(r)        (finalMapping[REG_ADDR(r)].bank)
-#define REG_isALIASED(r)   (finalMapping[REG_ADDR(r)].alias != 0)
-#define REG_isVALID(r)     (finalMapping[REG_ADDR(r)].isValid)
-
-
-/****************************************/
-void assignConfigWordValue(int address, int value);
-int getConfigWord(int address);
-int isREGinBank(regs *reg, int bank);
-int REGallBanks(regs *reg);
-void addMemRange(memRange *r, int type);
-void setMaxRAM(int size);
-void setDefMaxRam(void);
 
+PIC_device *init_pic(char *pic_type);
+int picIsInitialized(void);
+char *processor_base_name(void);
+int IS_CONFIG_ADDRESS(int addr);
 void pic14_assignConfigWordValue(int address, int value);
-int pic14_emitConfigWord (FILE * vFile);
-int pic14_getConfigWord(int address);
-unsigned pic14_getMaxRam(void);
-int pic14_getHasSecondConfigReg(void);
-int pic14_getSharebankSize(void);
-int pic14_getSharebankAddress(void);
+int pic14_emitConfigWord(FILE *vFile);
+
+int pic14_allRAMShared(void);
+int pic14_getSharedStack(int *low, int *high, int *size);
+PIC_device * pic14_getPIC(void);
 
 #endif  /* __DEVICE_H__ */