system

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NextCPU

func NextCPU() rtos.IntCtx

NextCPU returns the interrupt context suitable for the rtos.IRQ.Enable function. Use it to evenly (in terms of quantity, not workload) distribute interrupts between available CPUs / cores.

func Setup

func Setup(xoscHz int64, sys, usb PLL, maxFlashHz int64)

Setup initializes and configures the system. It expects a crystal oscillator as the source of the reference frequency to both PLLs and an QSPI flash supporting maxFlashHz clock from which the code is executed (XIP).

func SetupPico2_125MHz

func SetupPico2_125MHz()

SetupPico2_125MHz setups the system assuming it is an RPI Pico 2 compatible, that is, it's clocked from 12 MHz crystal, the XIP QSPI flash supports 133 MHz clock, the IOVDD >= 2.5 V. Both the CPU and QSPI flash are configured to run at conservative 125 MHz, which seems to be a good compromise between speed and stability. See Setup for more generic fuction that does the same.

func SetupPico2_133MHz

func SetupPico2_133MHz()

SetupPico2_133MHz is like SetupPico2_125MHz but both the CPU and QSPI flash run at 133 MHz. It's gives you slightly faster system but without any margin for flash and its circuity.

func SetupPico2_150MHz

func SetupPico2_150MHz()

SetupPico2_150MHz is like SetupPico2_125MHz but the CPU runs at 150 MHz, the QSPI flash at 75 MHz. It should give you quite good performance while being very forgiving for flash and its circuity.

Types

type PLL

type PLL struct {
	RefDiv   int
	FbDiv    int
	PostDiv1 int
	PostDiv2 int
}

A PLL configuration.

vcoHz = refHz / RefDiv * FbDiv
outHz = vcoHz / (PostDiv1 * PostDiv2)

Constraints:

1 <= RefDiv <= 63
16 <= FbDiv <= 320
1 <= PostDiv <= 7
refHz / RefDiv >= 5 MHz
750 MHz <= vcoHz <= 1600 MHz

func (PLL) Fout

func (pll PLL) Fout(refHz int64) (outHz int64)

Fout calculates the output frequency fo the PLL worknig with the pll configuration and the refHz frequency as an input. It returns outHz < 0 if the refHz is invalid or the pll configuration is invalid for the given refHz.

Directories

Path Synopsis
console
Package init when imported configures the whole system for typical usage assuming it's RPI Pico 2 compatible, that is, it's clocked from 12 MHz crystal, the XIP QSPI Flash supports 133 MHz clock, the IOVDD >= 2.5 V. Both the CPU and Flash are configured to run at conservative 125 MHz.
Package init when imported configures the whole system for typical usage assuming it's RPI Pico 2 compatible, that is, it's clocked from 12 MHz crystal, the XIP QSPI Flash supports 133 MHz clock, the IOVDD >= 2.5 V. Both the CPU and Flash are configured to run at conservative 125 MHz.
timer
riscvst
Package riscvst provides the implementation of a tickless system timer based on the RISCV platform timer.
Package riscvst provides the implementation of a tickless system timer based on the RISCV platform timer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL