X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fpic%2Fdevice.h;h=bea75a49625c661a3770aa2f4395dec283ce0de5;hb=4fa52c899d3553b51d56db35d035f17b7e22e66b;hp=c4ff2f333beb77ecd4b71cf9945e21f5d0424265;hpb=bfbab54dcff5c3613d548e106c8f726f94f32638;p=fw%2Fsdcc diff --git a/src/pic/device.h b/src/pic/device.h index c4ff2f33..bea75a49 100644 --- a/src/pic/device.h +++ b/src/pic/device.h @@ -38,12 +38,12 @@ */ typedef struct memRange { - int start_address; /* first address in range */ - int end_address; /* last */ - int alias; /* bit mask defining how/if memory range is aliased - * 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 */ + int start_address; /* first address in range */ + int end_address; /* last */ + int alias; /* bit mask defining how/if memory range is aliased + * 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 */ } memRange; @@ -55,13 +55,13 @@ typedef struct memRange { */ 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 */ + 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; @@ -71,22 +71,48 @@ typedef struct AssignedMemory { */ extern AssignedMemory *finalMapping; -#define PROCESSOR_NAMES 4 /* Processor unique attributes */ typedef struct PIC_device { - char *name[PROCESSOR_NAMES];/* aliases for the processor name */ - - memRange *ram; /* RAM memory map */ - memRange *sfr; /* SFR memory map */ - - int maxRAMaddress; /* maximum value for a data address */ - // int hasAliasedRAM:1; /* True if there are bank independent registers */ + char *name; /* the processor name */ + + memRange *ram; /* RAM memory map */ + memRange *sfr; /* SFR memory map */ + + int maxRAMaddress; /* maximum value for a data address */ + int defMaxRAMaddrs; /* default maximum value for a data address */ + int bankMask; /* Bitmask that is ANDed with address to extract banking bits */ + // int hasAliasedRAM:1; /* True if there are bank independent registers */ + int hasSecondConfigReg; /* True if there is a second configuration register */ + + int programMemSize; /* program memory size in words - for device listing only */ + int dataMemSize; /* data (RAM) memory size in bytes - for device listing only */ + int eepromMemSize; /* EEPROM memory size in bytes - for device listing only */ + int ioPins; /* number of I/O pins - for device listing only */ } PIC_device; /* Given a pointer to a register, this macro returns the bank that it is in */ -#define REG_BANK(r) (finalMapping[(r)->address].bank) -#define REG_isALIASED(r) (finalMapping[(r)->address].alias != 0) -#define REG_isVALID(r) (finalMapping[(r)->address].isValid) +#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); + +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); #endif /* __DEVICE_H__ */