github.com/f-secure-foundry/tamago@v0.0.0-20220307101044-d73fcdd7f11b/board/raspberrypi/pizero/pizero.go (about)

     1  // Raspberry Pi Zero support for tamago/arm
     2  // https://github.com/f-secure-foundry/tamago
     3  //
     4  // Copyright (c) the pizero package authors
     5  //
     6  // Use of this source code is governed by the license
     7  // that can be found in the LICENSE file.
     8  
     9  // Package pizero provides hardware initialization, automatically on import,
    10  // for the Raspberry Pi Zero single board computer.
    11  //
    12  // This package is only meant to be used with `GOOS=tamago GOARCH=arm` as
    13  // supported by the TamaGo framework for bare metal Go on ARM SoCs, see
    14  // https://github.com/f-secure-foundry/tamago.
    15  package pizero
    16  
    17  import (
    18  	_ "unsafe"
    19  
    20  	"github.com/f-secure-foundry/tamago/board/raspberrypi"
    21  	"github.com/f-secure-foundry/tamago/soc/bcm2835"
    22  )
    23  
    24  const peripheralBase = 0x20000000
    25  
    26  type board struct{}
    27  
    28  // Board provides access to the capabilities of the Pi Zero.
    29  var Board pi.Board = &board{}
    30  
    31  // Init takes care of the lower level SoC initialization triggered early in
    32  // runtime setup.
    33  //
    34  //go:linkname Init runtime.hwinit
    35  func Init() {
    36  	// Defer to generic BCM2835 initialization, with Pi Zero
    37  	// peripheral base address.
    38  	bcm2835.Init(peripheralBase)
    39  }