Skip to content

Implement clock controller#93

Open
moojek wants to merge 24 commits intoOperacja-System:mainfrom
moojek:zegar
Open

Implement clock controller#93
moojek wants to merge 24 commits intoOperacja-System:mainfrom
moojek:zegar

Conversation

@moojek
Copy link
Copy Markdown

@moojek moojek commented Mar 23, 2026

Initial version - since I was lazy and it took very long to actually write this, I forgot exact requirements we made for this.
I'd like some input particularly on:

  • in what units we want to operate the clock;
  • do we want to support some kind of queuing or only one timer at a time;
  • should it support custom callbacks or only one predefined;
  • when requested should it run once or periodically.

@Kamilosok Kamilosok added enhancement question Further information is requested labels Mar 24, 2026
@qbojj
Copy link
Copy Markdown
Collaborator

qbojj commented Mar 26, 2026

  • Clock units should probably be what you are doing: same as time CSR (frequency from fdt /cpus/timer-frequency).
  • We can prepare for queuing, If not within of the kernel itself, it will be used in userspace.
  • I don't see any good reason for multiple callbacks - we are writing a microkernel. The only things that a timer interrupt would do is stop current task and switch to the process manager (the one that selects what is the next task to run and its time slice).
  • As in the last point there is no real reason for cycling clock

@frogrammer9 frogrammer9 added new feature Added new functionality and removed enhancement question Further information is requested labels Mar 27, 2026
@moojek moojek marked this pull request as ready for review April 19, 2026 23:06
Comment thread src/lib/hal/arch/riscv/timer.c Outdated
Comment thread src/lib/hal/arch/riscv/timer.c Outdated
Comment thread src/lib/hal/arch/riscv/timer.c
Comment thread src/lib/hal/arch/riscv/timer.c Outdated
@moojek moojek requested a review from qbojj April 20, 2026 12:17
Copy link
Copy Markdown
Collaborator

@Kamilosok Kamilosok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More docs

Comment thread include/hal/timer.h
Comment thread include/hal/timer.h Outdated
Comment thread include/stdbigos/clock.h
Comment thread src/example_sbi/entry.c Outdated
Comment thread src/lib/hal/arch/riscv/timer.c Outdated
@Kamilosok
Copy link
Copy Markdown
Collaborator

Forgot one thing: add the docs pages at least for the api, or confirm that the full clock docs will be added in a separate pr. Thoug I'd prefer code to be shipped already documented.

moojek and others added 3 commits April 24, 2026 22:43
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
@moojek moojek requested a review from Kamilosok April 24, 2026 21:39
@moojek
Copy link
Copy Markdown
Author

moojek commented Apr 26, 2026

Forgot one thing: add the docs pages at least for the api, or confirm that the full clock docs will be added in a separate pr. Thoug I'd prefer code to be shipped already documented.

I will add all the relevant docs within this pull request

Copy link
Copy Markdown
Collaborator

@Kamilosok Kamilosok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs done, LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature Added new functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants