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

     1  // Raspberry Pi 2 support for tamago/arm
     2  // https://github.com/f-secure-foundry/tamago
     3  //
     4  // Copyright (c) the pi2 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 pi2 provides hardware initialization, automatically on import, for
    10  // the Raspberry Pi 2 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 pi2
    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  // On the Raspberry Pi2+ peripheral addresses are remapped from their hardware
    25  // 'bus' address to the 0x3f000000 'physical' address.
    26  const peripheralBase = 0x3f000000
    27  
    28  type board struct{}
    29  
    30  // Board provides access to the capabilities of the Pi2.
    31  var Board pi.Board = &board{}
    32  
    33  // Init takes care of the lower level SoC initialization triggered early in
    34  // runtime setup.
    35  //
    36  //go:linkname Init runtime.hwinit
    37  func Init() {
    38  	// Defer to generic BCM2835 initialization, with Pi 2
    39  	// peripheral base address.
    40  	bcm2835.Init(peripheralBase)
    41  }