X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/bad2d92d98f9990ee5ccf509c0eafe5b3af9f4dc..cdc4625b124f725fbc9462d5592d1d3be2aa613a:/avr/main.c diff --git a/avr/main.c b/avr/main.c index 2955630..8bffef9 100644 --- a/avr/main.c +++ b/avr/main.c @@ -1,10 +1,11 @@ /* + * (C) Copyright 2014 Leo C. + * + * SPDX-License-Identifier: GPL-2.0+ */ #include "common.h" - -#include #include #include #include @@ -18,8 +19,10 @@ #include "timer.h" #include "cli.h" #include "env.h" - -#define udelay(n) _delay_us(n) +#include "z180-serv.h" +#include "gpio.h" +#include "time.h" +#include "rtc.h" static uint8_t mcusr; @@ -66,6 +69,11 @@ ISR(INT5_vect) Stat |= S_MSG_PENDING; } +ISR(INT6_vect) +{ + Stat |= S_CON_PENDING; +} + static void setup_avr(void) { @@ -105,10 +113,13 @@ void setup_avr(void) TCCR3B = (0b01<= 0) { if (tstc()) { /* we got a key press */ - (void) my_getchar(); /* consume input */ + (void) my_getchar(1); /* consume input */ my_puts_P(PSTR("\b\b\b 0")); abort = 1; /* don't auto boot */ } @@ -213,10 +234,13 @@ void main_loop(void) int main(void) { + extern void setup_mmc(void); + for (int i = 0; i < GPIO_MAX; i++) + gpio_config(i, INPUT_PULLUP); setup_avr(); + setup_mmc(); z80_setup_bus(); - env_init(); if (reset_reason_is_power_on()) @@ -237,9 +261,11 @@ int main(void) #else i2c_init(CONFIG_SYS_I2C_CLOCK); #endif + setup_system_time(); printf_P(PSTR("\nATMEGA1281+Z8S180 Stamp Monitor\n\n")); + setup_z180_serv(); main_loop(); }