diff options
Diffstat (limited to 'include/hardware.h')
| -rw-r--r-- | include/hardware.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/include/hardware.h b/include/hardware.h new file mode 100644 index 0000000..2e6c9da --- /dev/null +++ b/include/hardware.h @@ -0,0 +1,80 @@ +#ifndef HARDWARE_H +#define HARDWARE_H + +// ******************************************************** +#define CTC_CHANNEL_0 0x00 +#define CTC_CHANNEL_1 0x01 +#define CTC_CHANNEL_2 0x02 +#define CTC_CHANNEL_3 0x03 + +#define CTC_CTRL_OR_VECTOR_BIT 0x01 +#define CTC_RST_BIT 0x02 +#define CTC_TIME_CONST_BIT 0x04 +#define CTC_TIME_TRG_BIT 0x08 +#define CTC_CLK_TRG_BIT 0x10 +#define CTC_PRESCALER_BIT 0x20 +#define CTC_MODE_BIT 0x40 +#define CTC_INT_BIT 0x80 + +#define CTC_CTRL(x) ((x) | CTC_CTRL_OR_VECTOR_BIT) + +// ******************************************************** +#define PORT_A_CTRL 0x42 +#define PORT_A_DATA 0x40 +#define PORT_B_CTRL 0x43 +#define PORT_B_DATA 0x41 + +#define PIO_MODE_3 0xCF + +#define PIO_INT_CTRL(x) ((x) | 0x07) +#define PIO_OR 0x00 +#define PIO_AND 0x40 +#define PIO_LOW 0x00 +#define PIO_HIGH 0x20 +#define PIO_MASK 0x10 +#define PIO_INT_EN 0x80 + +// ******************************************************** +#define SIO_A_CTRL 0x22 +#define SIO_A_DATA 0x20 +#define SIO_B_CTRL 0x23 +#define SIO_B_DATA 0x21 + +#define SIO_EX_INT_EN 0x01 +#define SIO_TX_INT_EN 0x02 +#define SIO_STATUS_AFFECTS_VECTOR 0x04 +#define SIO_RX_INT_MD0 0x08 +#define SIO_RX_INT_MD1 0x10 +#define SIO_WAIT_RDY_ON_RX_TX 0x20 +#define SIO_WAIT_RDY_FTN 0x40 +#define SIO_WAIT_RDY_EN 0x80 + +// ******************************************************** +#define TFT_CTRL 0x60 +#define TFT_DATA 0x61 + +#ifndef ASSEMBLY +__sfr __at(CTC_CHANNEL_0) ctc_channel_0; +__sfr __at(CTC_CHANNEL_1) ctc_channel_1; +__sfr __at(CTC_CHANNEL_2) ctc_channel_2; +__sfr __at(CTC_CHANNEL_3) ctc_channel_3; + +__sfr __at(SIO_A_DATA) sio_a_data; +__sfr __at(SIO_B_DATA) sio_b_data; +__sfr __at(SIO_A_CTRL) sio_a_ctrl; +__sfr __at(SIO_B_CTRL) sio_b_ctrl; + +__sfr __at(PORT_A_DATA) port_a_data; +__sfr __at(PORT_B_DATA) port_b_data; +__sfr __at(PORT_A_CTRL) port_a_ctrl; +__sfr __at(PORT_B_CTRL) port_b_ctrl; + +__sfr __at(TFT_CTRL) tft_ctrl; +__sfr __at(TFT_DATA) tft_data; + +#define IM(__mode) __asm__("im " #__mode) +#define EI __asm__("ei") +#define DI __asm__("di") +#endif // ASSEMBLY + +#endif // HARDWARE_H |
