maixbit: init fpioa clock at reset

This commit is contained in:
Yannis Huber
2020-06-18 15:26:38 +02:00
committed by Ron Evans
parent e1ceca1931
commit 804dc8b1f9
3 changed files with 9 additions and 6 deletions
+2 -2
View File
@@ -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 {
+6 -3
View File
@@ -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
+1 -1
View File
@@ -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{})
}