~/bend-docscommunity

src/dev/pflash.bend checks

raw source on the hub · import 0x79c2f5323029fcb91b9cbd02db6800f6/src/dev/pflash.bend as Pflash

3 imports
import Base
import ../lib/bytes.bend as B
import ../vmm/abi.bend as V

Types

type Pflash source · line 29 · raw

Data

type PfOut source · line 33 · raw

Data

A write's result: the new state and the host commands, in order.

Definitions

def Pflash.new source · line 36 · raw

Pflash

def Pflash.block_size source · line 39 · raw

U32

def Pflash.status source · line 42 · raw

U32

def Pflash.dual source · line 46 · raw

@+x:U32 -> U32

A value in both 16-bit halves.

def Pflash.mode source · line 49 · raw

@f:Pflash -> U32

def Pflash.register source · line 58 · raw

@+mode:U32 -> @off:U32 -> U32

What a read at off answers in a mode that is not read array: the status, the identifier (manufacturer 0x89 at word 0, device 0x18 at word 1, block lock status 0, unlocked, at word 2 of a block), or the CFI query ("QRY" at words 16..18).

def Pflash.read source · line 68 · raw

@f:Pflash -> @off:U32 -> Maybe<&2, U32>

A read at off: None in read-array mode (the host's bytes answer it), else the register of the mode.

def Pflash.command source · line 74 · raw

@+c:U32 -> U32

The mode a command selects (modes 0..3 accept commands).

def Pflash.block source · line 84 · raw

@+off:U32 -> U32

def Pflash.next source · line 88 · raw

@+m:U32 -> @+at:U32 -> @+n:U32 -> @+d:List<&2, U32> -> @+off:U32 -> @+v:U32 -> Pflash

The state after a write in mode m (the host commands follow separately).

def Pflash.effects source · line 97 · raw

@+m:U32 -> @+at:U32 -> @+d:List<&2, U32> -> @+off:U32 -> @+v:U32 -> List<&2, 0x79c2f5323029fcb91b9cbd02db6800f6/src/vmm/abi.FlashCmd>

The data commands of a write in mode m.

def Pflash.around source · line 105 · raw

@+was:U32 -> @+now:U32 -> @+cmds:List<&2, 0x79c2f5323029fcb91b9cbd02db6800f6/src/vmm/abi.FlashCmd> -> List<&2, 0x79c2f5323029fcb91b9cbd02db6800f6/src/vmm/abi.FlashCmd>

FlashMap commands around a mode change: unmap before leaving read array, map after returning to it.

def Pflash.write.fin source · line 110 · raw

@+was:U32 -> @f:Pflash -> @cmds:List<&2, 0x79c2f5323029fcb91b9cbd02db6800f6/src/vmm/abi.FlashCmd> -> PfOut

def Pflash.write source · line 115 · raw

@f:Pflash -> @+off:U32 -> @+v:U32 -> PfOut

A 32-bit write of v at offset off of the bank.