Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge dev #505

Merged
merged 3 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions picosim/srcsim/simcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,10 @@ void config(void)
ds3231_init(DS3231_I2C_PORT, DS3231_I2C_SDA_PIN,
DS3231_I2C_SCL_PIN, &rtc);

/* Try to read the DS3231 RTC status register */
buf = DS3231_STATUS_REG;
i2c_write_blocking(rtc.i2c_port, rtc.i2c_addr, &buf, 1, true);
if (i2c_read_blocking(rtc.i2c_port, rtc.i2c_addr,
&buf, 1, false) == 1) {
/* Use a dummy read to see if a DS3231 RTC is present */
if (i2c_read_blocking(rtc.i2c_port, rtc.i2c_addr, &buf, 1,
false) >= 0) {
puts("DS3231 RTC present, using it for setting the clock\n");
/* Read the date and time from the DS3231 RTC */
ds3231_get_datetime(&dt, &rtc);
t.tm_year = dt.year - 1900;
Expand All @@ -149,6 +148,9 @@ void config(void)
ts.tv_sec = mktime(&t);
ts.tv_nsec = 0;
aon_timer_start(&ts);
#if PICO_RP2040
sleep_us(64);
#endif

menu = 1;

Expand Down Expand Up @@ -228,6 +230,9 @@ void config(void)
ds3231_set_datetime(&dt, &rtc);
ts.tv_sec = mktime(&t);
aon_timer_set_time(&ts);
#if PICO_RP2040
sleep_us(64);
#endif
}
putchar('\n');
break;
Expand Down Expand Up @@ -256,6 +261,9 @@ void config(void)
ds3231_set_datetime(&dt, &rtc);
ts.tv_sec = mktime(&t);
aon_timer_set_time(&ts);
#if PICO_RP2040
sleep_us(64);
#endif
}
putchar('\n');
break;
Expand Down
17 changes: 17 additions & 0 deletions z80core/simfun.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@
#include "sim.h"
#include "simdefs.h"

/*
* The following code can be used as a simport.h file for a machine
* running on an OS using the POSIX API. The implementations are
* included in simfun.c:
*
* #include <stdint.h>
*
* #include "sim.h"
*
* extern void sleep_for_us(long time);
* extern void sleep_for_ms(int time);
* extern uint64_t get_clock_us(void);
* #ifdef WANT_ICE
* extern int get_cmdline(char *buf, int len);
* #endif
*/

extern int load_file(char *fn, WORD start, int size);

#endif /* !SIMFUN_INC */
Loading