Skip to content

feat(rtc): rtc driver implementation initial setup #626

Merged
veqcc merged 11 commits intomainfrom
feat/rtc_driver_first
Aug 8, 2025
Merged

feat(rtc): rtc driver implementation initial setup #626
veqcc merged 11 commits intomainfrom
feat/rtc_driver_first

Conversation

@Koichi98
Copy link
Contributor

@Koichi98 Koichi98 commented Aug 7, 2025

Description

Implemented rtc driver. This is a initial PR to prepare some register constants and the fundamental functions used.
mc146818 is the real time clock broadly used in x86 architecture, and I've checked that I could successfully get the time.

Related links

mc146818_read
https://github.com/openbsd/src/blob/ca647cfa4ec3ccb8360714bc0ebc32a394f7fb6a/sys/arch/amd64/isa/clock.c#L142

mc146818_write
https://github.com/openbsd/src/blob/ca647cfa4ec3ccb8360714bc0ebc32a394f7fb6a/sys/arch/amd64/isa/clock.c#L150

Registers constant
https://github.com/openbsd/src/blob/ca647cfa4ec3ccb8360714bc0ebc32a394f7fb6a/sys/dev/ic/mc146818reg.h#L65-L112

outb
https://github.com/openbsd/src/blob/ca647cfa4ec3ccb8360714bc0ebc32a394f7fb6a/sys/arch/amd64/include/pio.h#L147

inb
https://github.com/openbsd/src/blob/ca647cfa4ec3ccb8360714bc0ebc32a394f7fb6a/sys/arch/amd64/include/pio.h#L57

How was this PR tested?

Notes for reviewers

Koichi98 added 8 commits July 25, 2025 11:34
Signed-off-by: Koichi <koichi.imai.2@tier4.jp>
Signed-off-by: Koichi <koichi.imai.2@tier4.jp>
Signed-off-by: Koichi <koichi.imai.2@tier4.jp>
Signed-off-by: Koichi <koichi.imai.2@tier4.jp>
Signed-off-by: Koichi <koichi.imai.2@tier4.jp>
Signed-off-by: Koichi <koichi.imai.2@tier4.jp>
Signed-off-by: Koichi <koichi.imai.2@tier4.jp>
Signed-off-by: Koichi <koichi.imai.2@tier4.jp>
@Koichi98 Koichi98 self-assigned this Aug 7, 2025
@Koichi98 Koichi98 marked this pull request as ready for review August 8, 2025 00:14
@Koichi98 Koichi98 requested review from veqcc and ytakano August 8, 2025 00:19
@ytakano
Copy link
Collaborator

ytakano commented Aug 8, 2025

Just curiosity, why did you implement this driver?

@Koichi98
Copy link
Contributor Author

Koichi98 commented Aug 8, 2025

Just curiosity, why did you implement this driver?

Since we need time management system for handling things like access times in the file system. While this may seem redundant once NTP is implemented, it's still good to have a reliable time source to fall back on if NTP synchronization fails. Also, another reason is to build a time management framework into Awkernel now, which will make future integration with NTP much smoother.

@veqcc veqcc merged commit 33cceff into main Aug 8, 2025
1 check passed
@veqcc veqcc deleted the feat/rtc_driver_first branch August 8, 2025 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants