diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4b80c3b..b7d756c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,10 +35,10 @@ jobs: - name: Turn off git core.autocrlf if: matrix.os == 'windows-latest' run: git config --global core.autocrlf false - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 2 - - uses: actions/setup-go@v5 + - uses: actions/setup-go@v6 with: go-version-file: go.mod - name: 'go install necessary tools' @@ -49,7 +49,7 @@ jobs: if: always() run: go test -timeout=120s -covermode=count -coverprofile coverage.txt -bench=. -benchtime=1x ./... # Don't send code coverage if anything failed to reduce spam. - - uses: codecov/codecov-action@v4 + - uses: codecov/codecov-action@v6 with: token: ${{secrets.CODECOV_TOKEN}} - name: 'Cleanup' @@ -57,6 +57,9 @@ jobs: run: rm coverage.txt - name: 'Check: go test -race' run: go test -timeout=120s -race -bench=. -benchtime=1x ./... + # codecov leaves junk behind, remove that first. + - run: rm -f codecov codecov.SHA256SUM codecov.SHA256SUM.sig codecov.exe.SHA256SUM codecov.exe.SHA256SUM.sig + if: always() - name: 'Check: benchmark 📈' run: ba -against HEAD~1 - name: 'Check: go test -short (CGO_ENABLED=0)' @@ -105,8 +108,8 @@ jobs: - name: Turn off git core.autocrlf if: matrix.os == 'windows-latest' run: git config --global core.autocrlf false - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 with: go-version-file: go.mod - name: 'go install necessary tools' @@ -256,15 +259,15 @@ jobs: permissions: security-events: write steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 with: go-version-file: go.mod - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v4 with: languages: go - name: Autobuild - uses: github/codeql-action/autobuild@v3 + uses: github/codeql-action/autobuild@v4 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4 diff --git a/.gohci.yml b/.gohci.yml deleted file mode 100644 index 4319377..0000000 --- a/.gohci.yml +++ /dev/null @@ -1,518 +0,0 @@ -# Copyright 2021 The Periph Authors. All rights reserved. -# Use of this source code is governed under the Apache License, Version 2.0 -# that can be found in the LICENSE file. - -# See https://github.com/periph/gohci -version: 1 -workers: -# BeagleBone Green Wireles by SeedStudio. -# https://beagleboard.org/green-wireless -- name: beaglebone-1860 - checks: - - cmd: - - go - - test - - -cover - - -bench=. - - -benchtime=1000ms - - -benchmem - - ./... - # Test in advance: devices - - dir: .. - cmd: - - git - - clone - - --depth - - 1 - - https://github.com/periph/devices - - dir: ../devices - cmd: - - go - - mod - - edit - - -replace=periph.io/x/host/v3=../host - - dir: ../devices - cmd: - - go - - get - - -t - - ./... - - dir: ../devices - cmd: - - go - - test - - -short - - ./... - # Test in advance: cmd - - dir: .. - cmd: - - git - - clone - - --depth - - 1 - - https://github.com/periph/cmd - - dir: ../cmd - cmd: - - go - - mod - - edit - - -replace=periph.io/x/host/v3=../host - - dir: ../cmd - cmd: - - go - - get - - -t - - ./... - - dir: ../cmd - cmd: - - go - - test - - -short - - ./... - # Test commands. - - dir: ../cmd - cmd: - - go - - install - - -v - - ./headers-list - - ./i2c-list - - ./periph-info - - ./periph-smoketest - - ./spi-list - - cmd: - - periph-info - - cmd: - - headers-list - - -f - - cmd: - - i2c-list - - cmd: - - spi-list - - cmd: - - periph-smoketest - - gpio - - -pin1 - - P8_45 - - -pin2 - - P8_46 - -# ODROID-C1+ by HardKernel -# https://www.hardkernel.com/shop/odroid-c1/ -- name: odroid-483d - checks: - - cmd: - - go - - test - - -cover - - -bench=. - - -benchtime=1000ms - - -benchmem - - ./... - # Test in advance: devices - - dir: .. - cmd: - - git - - clone - - --depth - - 1 - - https://github.com/periph/devices - - dir: ../devices - cmd: - - go - - mod - - edit - - -replace=periph.io/x/host/v3=../host - - dir: ../devices - cmd: - - go - - get - - -t - - ./... - - dir: ../devices - cmd: - - go - - test - - -short - - ./... - # Test in advance: cmd - - dir: .. - cmd: - - git - - clone - - --depth - - 1 - - https://github.com/periph/cmd - - dir: ../cmd - cmd: - - go - - mod - - edit - - -replace=periph.io/x/host/v3=../host - - dir: ../cmd - cmd: - - go - - get - - -t - - ./... - - dir: ../cmd - cmd: - - go - - test - - -short - - ./... - # Test commands. - - dir: ../cmd - cmd: - - go - - install - - -v - - ./gpio-list - - ./headers-list - - ./i2c-list - - ./periph-info - - ./periph-smoketest - - ./spi-list - - cmd: - - periph-info - - cmd: - - gpio-list - - -f - - cmd: - - headers-list - - -f - - cmd: - - i2c-list - - cmd: - - spi-list - - cmd: - - periph-smoketest - - odroid-c1 - - cmd: - - periph-smoketest - - i2c-testboard - - cmd: - - periph-smoketest - - onewire-testboard - - cmd: - - periph-smoketest - - spi-testboard - - cmd: - - periph-smoketest - - sysfs-benchmark - - -p - - 97 - - -short - -# Raspberry Pi 3 -- name: raspberrypi-2f34 - checks: - - cmd: - - go - - test - - -cover - - -bench=. - - -benchtime=1000ms - - -benchmem - - ./... - # Test in advance: devices - - dir: .. - cmd: - - git - - clone - - --depth - - 1 - - https://github.com/periph/devices - - dir: ../devices - cmd: - - go - - mod - - edit - - -replace=periph.io/x/host/v3=../host - - dir: ../devices - cmd: - - go - - get - - -t - - ./... - - dir: ../devices - cmd: - - go - - test - - -short - - ./... - # Test in advance: cmd - - dir: .. - cmd: - - git - - clone - - --depth - - 1 - - https://github.com/periph/cmd - - dir: ../cmd - cmd: - - go - - mod - - edit - - -replace=periph.io/x/host/v3=../host - - dir: ../cmd - cmd: - - go - - get - - -t - - ./... - - dir: ../cmd - cmd: - - go - - test - - -short - - ./... - # Test commands. - - dir: ../cmd - cmd: - - go - - install - - -v - - ./gpio-list - - ./headers-list - - ./i2c-list - - ./periph-info - - ./periph-smoketest - - ./spi-list - - cmd: - - periph-info - - cmd: - - gpio-list - - -f - - cmd: - - headers-list - - -f - - cmd: - - i2c-list - - cmd: - - spi-list - - cmd: - - periph-smoketest - - i2c-testboard - - cmd: - - periph-smoketest - - onewire-testboard - - -i2cbus - - 1 - - cmd: - - periph-smoketest - - spi-testboard - - cmd: - - periph-smoketest - - sysfs-benchmark - - -p - - 12 - - -short - - cmd: - - periph-smoketest - - bcm283x-benchmark - - -p - - 12 - - -short - - cmd: - - periph-smoketest - - gpio - - -pin1 - - P1_15 - - -pin2 - - P1_16 - - cmd: - - periph-smoketest - - bcm283x - - -quick - - cmd: - - periph-smoketest - - ftdi - - -type - - ft232h - -# Old MacBook Pro on 10.9. -- name: mbp - checks: - - cmd: - - go - - test - - -cover - - -bench=. - - -benchtime=1000ms - - -benchmem - - ./... - # Test in advance: devices - - dir: .. - cmd: - - git - - clone - - --depth - - 1 - - https://github.com/periph/devices - - dir: ../devices - cmd: - - go - - mod - - edit - - -replace=periph.io/x/host/v3=../host - - dir: ../devices - cmd: - - go - - get - - -t - - ./... - - dir: ../devices - cmd: - - go - - test - - -short - - ./... - # Test in advance: cmd - - dir: .. - cmd: - - git - - clone - - --depth - - 1 - - https://github.com/periph/cmd - - dir: ../cmd - cmd: - - go - - mod - - edit - - -replace=periph.io/x/host/v3=../host - - dir: ../cmd - cmd: - - go - - get - - -t - - ./... - - dir: ../cmd - cmd: - - go - - test - - -short - - ./... - # Test commands. - - dir: ../cmd - cmd: - - go - - install - - -v - - ./gpio-list - - ./headers-list - - ./i2c-list - - ./periph-info - - ./periph-smoketest - - ./spi-list - - cmd: - - periph-info - - cmd: - - gpio-list - - -f - - cmd: - - headers-list - - -f - - cmd: - - i2c-list - - cmd: - - spi-list - - cmd: - - periph-smoketest - - ftdi - - -type - - ft232r - -# Laptop on Windows 10. -- name: win10 - checks: - - cmd: - - go - - test - - -cover - - -bench=. - - -benchtime=1000ms - - -benchmem - - ./... - # Test in advance: devices - - dir: .. - cmd: - - git - - clone - - --depth - - 1 - - https://github.com/periph/devices - - dir: ../devices - cmd: - - go - - mod - - edit - - -replace=periph.io/x/host/v3=../host - - dir: ../devices - cmd: - - go - - get - - -t - - ./... - - dir: ../devices - cmd: - - go - - test - - -short - - ./... - # Test in advance: cmd - - dir: .. - cmd: - - git - - clone - - --depth - - 1 - - https://github.com/periph/cmd - - dir: ../cmd - cmd: - - go - - mod - - edit - - -replace=periph.io/x/host/v3=../host - - dir: ../cmd - cmd: - - go - - get - - -t - - ./... - - dir: ../cmd - cmd: - - go - - test - - -short - - ./... - # Test commands. - - dir: ../cmd - cmd: - - go - - install - - -v - - ./gpio-list - - ./headers-list - - ./i2c-list - - ./periph-info - - ./periph-smoketest - - ./spi-list - - cmd: - - periph-info - - cmd: - - gpio-list - - -f - - cmd: - - headers-list - - -f - - cmd: - - i2c-list - - cmd: - - spi-list - - cmd: - - periph-smoketest - - ftdi - - -type - - ft232h diff --git a/allwinner/gpio.go b/allwinner/gpio.go index b8c4946..5d6cfe1 100644 --- a/allwinner/gpio.go +++ b/allwinner/gpio.go @@ -10,6 +10,7 @@ package allwinner import ( "errors" "fmt" + "math" "os" "path" "strconv" @@ -1033,8 +1034,11 @@ func (d *driverGPIO) Init() (bool, error) { } // gpioBaseAddr is the physical base address of the GPIO registers. - gpioBaseAddr := uint32(getBaseAddress()) - if err := pmem.MapAsPOD(uint64(gpioBaseAddr), &d.gpioMemory); err != nil { + gpioBaseAddr := getBaseAddress() + if gpioBaseAddr > math.MaxUint32 { + return true, fmt.Errorf("gpio base address 0x%X overflows uint32", gpioBaseAddr) + } + if err := pmem.MapAsPOD(gpioBaseAddr, &d.gpioMemory); err != nil { if os.IsPermission(err) { return true, fmt.Errorf("need more access, try as root: %v", err) } diff --git a/codecov.yml b/codecov.yml index e1bd436..739c4da 100644 --- a/codecov.yml +++ b/codecov.yml @@ -12,7 +12,7 @@ coverage: status: patch: default: - target: 60% + target: 20% threshold: 10% project: default: diff --git a/go.mod b/go.mod index dfea089..8c57489 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,9 @@ module periph.io/x/host/v3 -go 1.22.6 +go 1.25.0 require ( - periph.io/x/conn/v3 v3.7.2 + periph.io/x/conn/v3 v3.7.3 periph.io/x/d2xx v0.1.1 ) diff --git a/go.sum b/go.sum index e78040c..3f311dd 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ -github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= -github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc= -periph.io/x/conn/v3 v3.7.2 h1:qt9dE6XGP5ljbFnCKRJ9OOCoiOyBGlw7JZgoi72zZ1s= -periph.io/x/conn/v3 v3.7.2/go.mod h1:Ao0b4sFRo4QOx6c1tROJU1fLJN1hUIYggjOrkIVnpGg= +github.com/jonboulle/clockwork v0.5.0 h1:Hyh9A8u51kptdkR+cqRpT1EebBwTn1oK9YfGYbdFz6I= +github.com/jonboulle/clockwork v0.5.0/go.mod h1:3mZlmanh0g2NDKO5TWZVJAfofYk64M7XN3SzBPjZF60= +periph.io/x/conn/v3 v3.7.3 h1:+8UblkC4omTB1M+jZTvTj3qoxQOTJy0ZRQm8DLUuVzc= +periph.io/x/conn/v3 v3.7.3/go.mod h1:tyV9YaYquOJ2Q2yAL0B5zk9ZvHGsbW56M6y92wjyPDQ= periph.io/x/d2xx v0.1.1 h1:LHp+u+qAWLB5THrTT/AzyjdvfUhllvDF5wBJP7uvn+U= periph.io/x/d2xx v0.1.1/go.mod h1:rLM321G11Fc14Pp088khBkmXb70Pxx/kCPaIK7uRUBc=