Documentation ¶
Overview ¶
Package flash provides higher-level functions such as reading, erasing, writing and programming the flash chip.
Index ¶
- type Flash
- func (f *Flash) EraseAt(n int64, off int64) (int64, error)
- func (f *Flash) FillFromSFDP() error
- func (f *Flash) ProgramAt(p []byte, off int64) (int, error)
- func (f *Flash) ReadAt(p []byte, off int64) (int, error)
- func (f *Flash) ReadJEDECID() (uint32, error)
- func (f *Flash) SFDP() *sfdp.SFDP
- func (f *Flash) SFDPReader() *SFDPReader
- func (f *Flash) Size() int64
- func (f *Flash) WriteAt(p []byte, off int64) (int, error)
- type SFDPReader
- type SPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flash ¶
type Flash struct { // Chip is derived from SFDP or looking up // the chip via the ID. chips.Chip // contains filtered or unexported fields }
Flash provides operations for SPI flash chips.
func (*Flash) EraseAt ¶
EraseAt erases n bytes from offset off. Both parameters must be aligned to sectorSize.
func (*Flash) FillFromSFDP ¶ added in v0.13.0
FillFromSFDP fills the Flash struct with parameters from the SFDP. Querying the SFDP is a bit messy, for each type of parameter, so this code pulls the SFDP parameters into struct members. It also makes the creation of chips a bit easier, when we do not have an SFDP.
func (*Flash) ReadJEDECID ¶
ReadJEDECID reads the flash chip's JEDEC ID.
func (*Flash) SFDPReader ¶
func (f *Flash) SFDPReader() *SFDPReader
SFDPReader is used to read from the SFDP address space.
type SFDPReader ¶
type SFDPReader Flash
SFDPReader is a wrapper around Flash where the ReadAt function reads from the SFDP address space.
Directories ¶
Path | Synopsis |
---|---|
Package chips contains chips known to work with the flash tool.
|
Package chips contains chips known to work with the flash tool. |
Package op contains available SPI opcodes.
|
Package op contains available SPI opcodes. |
Package sfdp reads the SFDP (Serial Flash Discoverable Parameters) from a flash chip where supported.
|
Package sfdp reads the SFDP (Serial Flash Discoverable Parameters) from a flash chip where supported. |
Package spimock provides a fake SPI flash part for unit testing.
|
Package spimock provides a fake SPI flash part for unit testing. |