Add support for mailbox, GPIO, MiniUART, framebuffer and GRAPHICS #32

Merged
hgruniaux merged 47 commits from mailbox into main 2024-03-28 14:55:17 +01:00
hgruniaux commented 2024-03-15 17:53:58 +01:00 (Migrated from github.com)

This PR is much bigger than it should be, but it is the way it is.

Summary of changes:

  • Add support for mailboxes, a way to communicate with periphericals
  • Add support for GPIO
  • Add support for MiniUART (fix #31)
  • The Device interface allows you to query information about the board and other things. Mainly, it is intended to implement most of the queries that can be done using the property channel of mailboxes.
  • The FrameBuffer interface allows the creation of a global framebuffer.
  • The graphics library that allows drawing to a user-provided framebuffer or the global one (including drawing text).
  • The Pi-kachULM_OS Kernel Font format to encode bitmaps font to be used inside the kernel. This also includes the ttf2pkf utility to convert from many font files to our own format. Two precompiled files are included in this PR: FiraCode in 12 pixels and 16 pixels.
This PR is much bigger than it should be, but it is the way it is. Summary of changes: - Add support for mailboxes, a way to communicate with periphericals - Add support for GPIO - Add support for MiniUART (fix #31) - The `Device` interface allows you to query information about the board and other things. Mainly, it is intended to implement most of the queries that can be done using the property channel of mailboxes. - The `FrameBuffer` interface allows the creation of a global framebuffer. - The graphics library that allows drawing to a user-provided framebuffer or the global one (including drawing text). - The Pi-kachULM_OS Kernel Font format to encode bitmaps font to be used inside the kernel. This also includes the `ttf2pkf` utility to convert from many font files to our own format. Two precompiled files are included in this PR: FiraCode in 12 pixels and 16 pixels.
desfreng (Migrated from github.com) reviewed 2024-03-15 17:53:58 +01:00
hgruniaux (Migrated from github.com) reviewed 2024-03-19 10:30:54 +01:00
@ -0,0 +1,111 @@
#include "miniuart.hpp"
hgruniaux (Migrated from github.com) commented 2024-03-19 10:23:37 +01:00

What do you think about using the name MiniUART?

I find it prettier and more consistent with the rest.

What do you think about using the name MiniUART? I find it prettier and more consistent with the rest.
hgruniaux (Migrated from github.com) commented 2024-03-19 10:28:21 +01:00

I found the instruction yield in the ARM ISA. I think it is appropriate here. See https://developer.arm.com/documentation/dui0473/m/arm-and-thumb-instructions/yield.

However, the instruction is optional (it can be implemented as a NOP). I don't know if Raspberry PI treats it as NOP or not.

An incoming PR (with the libk) will include a function to call this instruction.

I found the instruction `yield` in the ARM ISA. I think it is appropriate here. See https://developer.arm.com/documentation/dui0473/m/arm-and-thumb-instructions/yield. However, the instruction is optional (it can be implemented as a NOP). I don't know if Raspberry PI treats it as NOP or not. An incoming PR (with the libk) will include a function to call this instruction.
@ -0,0 +38,4 @@
static constexpr uint64_t RPI4_CORE_CLOCK = 200'000'000;
void init(uint32_t baud_rate) {
// We deactivate Pull Up/Down fot the pins 14 and 15
hgruniaux (Migrated from github.com) commented 2024-03-19 10:25:10 +01:00

Can we choose any baud_rate? If no, I think it will be better to either add a KASSERT or check at runtime if the rate is supported (and emit an error log after a fallback to a default value).

Do you agree?

Can we choose any `baud_rate`? If no, I think it will be better to either add a `KASSERT` or check at runtime if the rate is supported (and emit an error log after a fallback to a default value). Do you agree?
@ -0,0 +1,33 @@
#pragma once
hgruniaux (Migrated from github.com) commented 2024-03-19 10:28:48 +01:00

UART1 or MiniUART ?

UART1 or MiniUART ?
@ -1,22 +1,63 @@
#include "mmio.hpp"
#include "uart.hpp"
#include "debug.hpp"
hgruniaux (Migrated from github.com) commented 2024-03-19 10:30:41 +01:00

It doesn't work on real hardware?

It doesn't work on real hardware?
desfreng (Migrated from github.com) reviewed 2024-03-19 18:15:16 +01:00
@ -0,0 +38,4 @@
static constexpr uint64_t RPI4_CORE_CLOCK = 200'000'000;
void init(uint32_t baud_rate) {
// We deactivate Pull Up/Down fot the pins 14 and 15
desfreng (Migrated from github.com) commented 2024-03-19 18:15:16 +01:00

I have tested with multiplies Band Rate, but I haven't checked with non standard ones !

I have tested with multiplies Band Rate, but I haven't checked with non standard ones !
desfreng commented 2024-03-28 01:43:15 +01:00 (Migrated from github.com)

Why GCC 12 ?! Why this ?

Why GCC 12 ?! Why this ?
Sign in to join this conversation.
No description provided.