paul@0 | 1 | #ifndef __ASSEMBLER__ |
paul@0 | 2 | |
paul@0 | 3 | #ifndef __PIC32_C_H__ |
paul@0 | 4 | #define __PIC32_C_H__ |
paul@0 | 5 | |
paul@0 | 6 | #include <stdint.h> |
paul@2 | 7 | #include "mips.h" |
paul@0 | 8 | #include "pic32.h" |
paul@0 | 9 | |
paul@0 | 10 | /* Access. */ |
paul@0 | 11 | |
paul@0 | 12 | #define REG(mem) *((volatile uint32_t *) (mem)) |
paul@0 | 13 | |
paul@0 | 14 | /* Bit clearing, setting and inverting. */ |
paul@0 | 15 | |
paul@0 | 16 | #define CLR_REG(mem, val) (REG(mem + CLR) = val) |
paul@0 | 17 | #define SET_REG(mem, val) (REG(mem + SET) = val) |
paul@0 | 18 | #define INV_REG(mem, val) (REG(mem + INV) = val) |
paul@0 | 19 | |
paul@2 | 20 | /* Address translation. */ |
paul@2 | 21 | |
paul@2 | 22 | #define PHYSICAL(addr) (((uint32_t) addr) - KSEG0_BASE) |
paul@2 | 23 | #define HW_PHYSICAL(addr) (((uint32_t) addr) - KSEG1_BASE) |
paul@2 | 24 | |
paul@0 | 25 | #endif /* __PIC32_C_H__ */ |
paul@0 | 26 | |
paul@0 | 27 | #endif /* __ASSEMBLER__ */ |