mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
maixbit: init fpioa clock at reset
This commit is contained in:
@@ -44,10 +44,10 @@ var (
|
||||
|
||||
func (fpioa FPIOA) Init() {
|
||||
// Enable APB0 clock.
|
||||
kendryte.SYSCTL.CLK_EN_CENT.Set(kendryte.SYSCTL_CLK_EN_CENT_APB0_CLK_EN)
|
||||
kendryte.SYSCTL.CLK_EN_CENT.SetBits(kendryte.SYSCTL_CLK_EN_CENT_APB0_CLK_EN)
|
||||
|
||||
// Enable FPIOA peripheral.
|
||||
kendryte.SYSCTL.CLK_EN_PERI.Set(kendryte.SYSCTL_CLK_EN_PERI_FPIOA_CLK_EN)
|
||||
kendryte.SYSCTL.CLK_EN_PERI.SetBits(kendryte.SYSCTL_CLK_EN_PERI_FPIOA_CLK_EN)
|
||||
}
|
||||
|
||||
type UART struct {
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
|
||||
package interrupt
|
||||
|
||||
import "device/kendryte"
|
||||
import (
|
||||
"device/kendryte"
|
||||
"device/riscv"
|
||||
)
|
||||
|
||||
// Enable enables this interrupt. Right after calling this function, the
|
||||
// interrupt may be invoked if it was already pending.
|
||||
func (irq Interrupt) Enable() {
|
||||
// TODO: Use current hartid
|
||||
kendryte.PLIC.TARGET_ENABLES[0].ENABLE[irq.num/32].SetBits(1 << (uint(irq.num) % 32))
|
||||
hartId := riscv.MHARTID.Get()
|
||||
kendryte.PLIC.TARGET_ENABLES[hartId].ENABLE[irq.num/32].SetBits(1 << (uint(irq.num) % 32))
|
||||
}
|
||||
|
||||
// SetPriority sets the interrupt priority for this interrupt. A higher priority
|
||||
|
||||
@@ -100,7 +100,7 @@ func handleInterrupt() {
|
||||
// initPeripherals configures periperhals the way the runtime expects them.
|
||||
func initPeripherals() {
|
||||
|
||||
//machine.FPIOA0.Init()
|
||||
machine.FPIOA0.Init()
|
||||
|
||||
machine.UART0.Configure(machine.UARTConfig{})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user