ocotp

package
Version: v0.0.0-...-d73fcdd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package ocotp implements a driver for the NXP On-Chip OTP Controller (OCOTP_CTRL), included in i.MX6 series SoCs to interface with on-chip fuses, including write operation.

WARNING: Fusing SoC OTPs is an **irreversible** action that permanently fuses values on the device. This means that any errors in the process, or lost fused data such as cryptographic key material, might result in a **bricked** device.

The use of this package is therefore **at your own risk**.

This package is only meant to be used with `GOOS=tamago GOARCH=arm` as supported by the TamaGo framework for bare metal Go on ARM SoCs, see https://github.com/f-secure-foundry/tamago.

Index

Constants

View Source
const (
	OCOTP_BASE = 0x021bc000

	OCOTP_CTRL          = OCOTP_BASE
	CTRL_WRUNLOCK       = 16
	CTRL_RELOAD_SHADOWS = 10
	CTRL_ERROR          = 9
	CTRL_BUSY           = 8
	CTRL_ADDR           = 0

	OCOTP_CTRL_CLR = OCOTP_BASE + 0x0008
	OCOTP_DATA     = OCOTP_BASE + 0x0020

	OCOTP_VERSION = OCOTP_BASE + 0x0090
	VERSION_MAJOR = 24
	VERSION_MINOR = 16
	VERSION_STEP  = 0

	OCOTP_BANK0_WORD0 = OCOTP_BASE + 0x0400
)

OCOTP registers (p2388, 37.5 OCOTP Memory Map/Register Definition, IMX6ULLRM).

View Source
const (
	// WordSize represents the number of bytes per OTP word.
	WordSize = 4
	// BankSize represents the number of words per OTP bank.
	BankSize = 8
)

Configuration constants

Variables

View Source
var Timeout = 10 * time.Millisecond

Timeout for OCOTP controller operations

Functions

func Blow

func Blow(bank int, word int, value uint32) (err error)

Blow fuses a value in the argument bank and word location. (p2384, 37.3.1.3 Fuse and Shadow Register Writes, IMX6ULLRM).

WARNING: Fusing SoC OTPs is an **irreversible** action that permanently fuses values on the device. This means that any errors in the process, or lost fused data such as cryptographic key material, might result in a **bricked** device.

The use of this function is therefore **at your own risk**.

func Init

func Init() (err error)

Init initializes the OCOTP controller instance.

func Read

func Read(bank int, word int) (value uint32, err error)

Read returns the value in the argument bank and word location.

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL