PebbleOS v4.47.0-1312-gf1984a001
Loading...
Searching...
No Matches
SoC information

SoC information class. More...

Data Structures

struct  pbl_socinfo
 SoC information. More...
 

Macros

#define PBL_SOCINFO_DEFINE(sym, _name, _uid)
 Define the SoC information.
 

Functions

size_t pbl_socinfo_get_unique_id_size (const struct pbl_socinfo *si)
 Get the size of the unique ID.
 
int pbl_socinfo_get_unique_id (const struct pbl_socinfo *si, void *buf, size_t len)
 Read the unique ID.
 

Variables

const struct pbl_socinfo *const SOCINFO
 The SoC.
 

Detailed Description

SoC information class.

Facts about the SoC, such as its unique ID, read from the block holding them.

uint8_t uid[16];
if ((len <= sizeof(uid)) && (pbl_socinfo_get_unique_id(SOCINFO, uid, sizeof(uid)) == 0)) {
...
}
size_t pbl_socinfo_get_unique_id_size(const struct pbl_socinfo *si)
Get the size of the unique ID.
int pbl_socinfo_get_unique_id(const struct pbl_socinfo *si, void *buf, size_t len)
Read the unique ID.
const struct pbl_socinfo *const SOCINFO
The SoC.

Data Structure Documentation

◆ pbl_socinfo

struct pbl_socinfo

SoC information.

Data Fields
struct pbl_device dev Device.
struct pbl_nvmem_cell uid Cell of the unique ID.

Macro Definition Documentation

◆ PBL_SOCINFO_DEFINE

#define PBL_SOCINFO_DEFINE (   sym,
  _name,
  _uid 
)
Value:
const struct pbl_socinfo sym = { \
.dev = PBL_DEVICE_INIT_CLASS(sym, _name, nullptr, nullptr, &pbl_socinfo_class), \
.uid = _uid, \
}; \
PBL_DEVICE_REGISTER(sym, &sym.dev)
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:153
struct pbl_device dev
Device.
Definition socinfo.h:32
SoC information.
Definition socinfo.h:30

Define the SoC information.

Parameters
symSymbol of the device.
_nameName.
_uidCell of the unique ID, from PBL_NVMEM_CELL().

Function Documentation

◆ pbl_socinfo_get_unique_id()

int pbl_socinfo_get_unique_id ( const struct pbl_socinfo *  si,
void *  buf,
size_t  len 
)

Read the unique ID.

Parameters
siSoC information.
[out]bufUnique ID.
lenSize of buf in bytes, at least pbl_socinfo_get_unique_id_size().
Returns
0, -ENODEV if the device or its memory is not ready, -EINVAL if buf is too small, or a negative errno from the memory.

◆ pbl_socinfo_get_unique_id_size()

size_t pbl_socinfo_get_unique_id_size ( const struct pbl_socinfo *  si)

Get the size of the unique ID.

Parameters
siSoC information.
Returns
Size of the unique ID, in bytes.

Variable Documentation

◆ SOCINFO

const struct pbl_socinfo* const SOCINFO
extern

The SoC.