aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Albers Raviola <thomas@thomaslabs.org>2024-12-03 21:45:47 +0100
committerThomas Albers Raviola <thomas@thomaslabs.org>2024-12-03 21:45:47 +0100
commitd46862a5bd2319c595b11427f781201ca063d194 (patch)
treee83d3f40c60233a1da85334745b882f188b0be52 /src
parent9cd14efb76a4ddbcd013f44d50dc1ff93d56c4ca (diff)
Add bootloader
Diffstat (limited to 'src')
-rw-r--r--src/main.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/main.c b/src/main.c
index aff1329..8d9eb19 100644
--- a/src/main.c
+++ b/src/main.c
@@ -25,33 +25,25 @@ init_pio(void)
// A, B and five keys as inputs
port_b_ctrl = 0x7F;
// Load interrupt vector
- // port_b_ctrl = ISR_ADDRESS(port_b_isr_ptr);
+ port_b_ctrl = ISR_ADDRESS(port_b_isr_ptr);
// Interrupt word - interrupt if any pin goes low, mask follows
- // port_b_ctrl = PIO_INT_CTRL(PIO_INT_EN | PIO_OR | PIO_LOW | PIO_MASK);
+ port_b_ctrl = PIO_INT_CTRL(PIO_INT_EN | PIO_OR | PIO_LOW | PIO_MASK);
// Mask - 0 means to check line
- // port_b_ctrl = 0x80;
+ port_b_ctrl = 0x80;
+ // Control mode - i.e. no parallel port communication
/* port_a_ctrl = PIO_MODE_3; */
-
/* port_a_ctrl = 0x7C; */
-
- /* // Load interrupt vector */
- /* port_a_ctrl = ISR_ADDRESS(port_a_isr_ptr); */
-
- /* port_a_ctrl = PIO_INT_CTRL(PIO_INT_EN | PIO_OR | PIO_HIGH | PIO_MASK); */
- /* port_a_ctrl = 0x83; */
-
- /* // SDA and SCL high */
+ /* SDA and SCL high */
/* port_a_data = 0x03; */
}
static inline void
init_ctc(void)
{
- /* 200Hz clock */
- ctc_channel_1 = CTC_CTRL(CTC_INT_BIT | CTC_PRESCALER_BIT
- | CTC_TIME_CONST_BIT | CTC_RST_BIT);
- ctc_channel_1 = 0;
+ // Init CTC with known state (disable posible non-defined interrupts)
+ ctc_channel_0 = CTC_CTRL(0);
+ ctc_channel_1 = CTC_CTRL(0);
/* 200Hz clock */
ctc_channel_2 = CTC_CTRL(CTC_INT_BIT | CTC_PRESCALER_BIT
@@ -136,12 +128,6 @@ main(void)
EI;
addstr("Starting system ...\r\n");
- // Load interrupt vector
- port_b_ctrl = ISR_ADDRESS(port_b_isr_ptr);
- // Interrupt word - interrupt if any pin goes low, mask follows
- port_b_ctrl = PIO_INT_CTRL(PIO_INT_EN | PIO_OR | PIO_LOW | PIO_MASK);
- // Mask - 0 means to check line
- port_b_ctrl = 0x80;
_menu();
while (1)