Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cibomahto committed Dec 13, 2024
1 parent 480819d commit adecf53
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 29 deletions.
3 changes: 2 additions & 1 deletion src/machine/machine_rp2.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const deviceName = rp.Device

const (
// Number of spin locks available
_NUMSPINLOCKS = 32
// Note: On RP2350, most spinlocks are unusable due to Errata 2
_NUMSPINLOCKS = 32
_PICO_SPINLOCK_ID_IRQ = 9
)

Expand Down
14 changes: 7 additions & 7 deletions src/machine/machine_rp2_2040.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import (
)

const (
_NUMBANK0_GPIOS = 30
_NUMBANK0_IRQS = 4
_NUMIRQ = 32
rp2350ExtraReg = 0
_NUMBANK0_GPIOS = 30
_NUMBANK0_IRQS = 4
_NUMIRQ = 32
rp2350ExtraReg = 0
RESETS_RESET_Msk = 0x01ffffff
initUnreset = rp.RESETS_RESET_ADC |
initUnreset = rp.RESETS_RESET_ADC |
rp.RESETS_RESET_RTC |
rp.RESETS_RESET_SPI0 |
rp.RESETS_RESET_SPI1 |
rp.RESETS_RESET_UART0 |
rp.RESETS_RESET_UART1 |
rp.RESETS_RESET_USBCTRL
initDontReset = rp.RESETS_RESET_IO_QSPI |
initDontReset = rp.RESETS_RESET_IO_QSPI |
rp.RESETS_RESET_PADS_QSPI |
rp.RESETS_RESET_PLL_USB |
rp.RESETS_RESET_USBCTRL |
Expand Down Expand Up @@ -61,7 +61,7 @@ const (

func CalcClockDiv(srcFreq, freq uint32) uint32 {
// Div register is 24.8 int.frac divider so multiply by 2^8 (left shift by 8)
return uint32((uint64(srcFreq) << 8) / uint64(freq))
return uint32((uint64(srcFreq) << 8) / uint64(freq))
}

type clocksType struct {
Expand Down
39 changes: 18 additions & 21 deletions src/machine/machine_rp2_2350.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@ import (
)

const (
_NUMBANK0_GPIOS = 48
_NUMBANK0_IRQS = 6
rp2350ExtraReg = 1
_NUMIRQ = 51
notimpl = "rp2350: not implemented"
_NUMBANK0_GPIOS = 48
_NUMBANK0_IRQS = 6
rp2350ExtraReg = 1
_NUMIRQ = 51
notimpl = "rp2350: not implemented"
RESETS_RESET_Msk = 0x1fffffff
initUnreset = rp.RESETS_RESET_ADC |
initUnreset = rp.RESETS_RESET_ADC |
rp.RESETS_RESET_SPI0 |
rp.RESETS_RESET_SPI1 |
rp.RESETS_RESET_UART0 |
rp.RESETS_RESET_UART1 |
rp.RESETS_RESET_USBCTRL
initDontReset =
rp.RESETS_RESET_USBCTRL |
initDontReset = rp.RESETS_RESET_USBCTRL |
rp.RESETS_RESET_SYSCFG |
rp.RESETS_RESET_PLL_USB |
rp.RESETS_RESET_PLL_SYS |
Expand Down Expand Up @@ -69,11 +68,11 @@ func CalcClockDiv(srcFreq, freq uint32) uint32 {
}

type clocksType struct {
clk [NumClocks]clockType
dftclk_xosc_ctrl volatile.Register32
dftclk_rosc_ctrl volatile.Register32
dftclk_lposc_ctrl volatile.Register32
resus struct {
clk [NumClocks]clockType
dftclk_xosc_ctrl volatile.Register32
dftclk_rosc_ctrl volatile.Register32
dftclk_lposc_ctrl volatile.Register32
resus struct {
ctrl volatile.Register32
status volatile.Register32
}
Expand All @@ -90,14 +89,13 @@ type clocksType struct {
intS volatile.Register32
}


// GPIO function selectors
const (
// Connect the high-speed transmit peripheral (HSTX) to GPIO.
fnHSTX pinFunc = 0
fnSPI pinFunc = 1 // Connect one of the internal PL022 SPI peripherals to GPIO
fnSPI pinFunc = 1 // Connect one of the internal PL022 SPI peripherals to GPIO
fnUART pinFunc = 2
fnI2C pinFunc = 3
fnI2C pinFunc = 3
// Connect a PWM slice to GPIO. There are eight PWM slices,
// each with two outputchannels (A/B). The B pin can also be used as an input,
// for frequency and duty cyclemeasurement
Expand All @@ -117,9 +115,9 @@ const (
// QSPI memory interface peripheral, used for execute-in-place from external QSPI flash or PSRAM memory devices.
fnQMI pinFunc = 9
// USB power control signals to/from the internal USB controller.
fnUSB pinFunc = 10
fnUSB pinFunc = 10
fnUARTAlt pinFunc = 11
fnNULL pinFunc = 0x1f
fnNULL pinFunc = 0x1f
)

// Configure configures the gpio pin as per mode.
Expand Down Expand Up @@ -177,8 +175,8 @@ func irqSet(num uint32, enabled bool) {
return
}

register_index := num/32
var mask uint32 = 1<<(num%32)
register_index := num / 32
var mask uint32 = 1 << (num % 32)

if enabled {
// Clear pending before enable
Expand All @@ -199,7 +197,6 @@ func irqSet(num uint32, enabled bool) {
}
}


func (clks *clocksType) initRTC() {} // No RTC on RP2350.

func (clks *clocksType) initTicks() {
Expand Down

0 comments on commit adecf53

Please sign in to comment.