PebbleOS v4.44.0-199-g465b7d28c
Loading...
Searching...
No Matches
Remote processor

Remote processor class. More...

Modules

 SF32LB52 LCPU
 SiFli SF32LB52 low-power CPU.
 

Data Structures

struct  pbl_rproc_ops
 Remote processor operations, implemented by the providers, called with the lock held. More...
 
struct  pbl_rproc_state
 Remote processor state, kept by the class. More...
 
struct  pbl_rproc
 Remote processor. More...
 

Macros

#define PBL_RPROC_STATE_DEFINE(sym)
 Define the state of a remote processor, for providers.
 
#define PBL_RPROC_INIT(sym, _name, _init, _deps, _ops)
 Initializer of a struct pbl_rproc, for providers.
 

Functions

int pbl_rproc_boot (const struct pbl_rproc *rproc)
 Boot a remote processor, or count one more user if it runs.
 
void pbl_rproc_shutdown (const struct pbl_rproc *rproc)
 Release a boot, stopping the remote processor if it was the last one.
 
bool pbl_rproc_is_running (const struct pbl_rproc *rproc)
 Whether a remote processor runs.
 

Variables

const struct pbl_device_class pbl_rproc_class
 Class of the remote processors.
 

Detailed Description

Remote processor class.

A remote processor runs its own firmware, which the provider boots and halts. Clients reach the firmware through resources the provider describes, such as mailbox channels and shared memory, and hold the processor running between pbl_rproc_boot() and pbl_rproc_shutdown():

ret = pbl_rproc_boot(rproc);
// talk to the firmware
void pbl_rproc_shutdown(const struct pbl_rproc *rproc)
Release a boot, stopping the remote processor if it was the last one.
int pbl_rproc_boot(const struct pbl_rproc *rproc)
Boot a remote processor, or count one more user if it runs.

Boots are counted: the first one starts the processor and the last shutdown stops it. Both may wait, so call them from thread context.


Data Structure Documentation

◆ pbl_rproc_state

struct pbl_rproc_state

Remote processor state, kept by the class.

Data Fields
struct pbl_mutex lock Serializes boot and shutdown.
uint8_t power Number of boots not yet shut down.

◆ pbl_rproc

struct pbl_rproc

Remote processor.

Data Fields
struct pbl_device dev Device.
const struct pbl_rproc_ops * ops Operations.
struct pbl_rproc_state * state State.

Macro Definition Documentation

◆ PBL_RPROC_INIT

#define PBL_RPROC_INIT (   sym,
  _name,
  _init,
  _deps,
  _ops 
)
Value:
{ \
.dev = PBL_DEVICE_INIT_CLASS(sym, _name, _init, nullptr, _deps, &pbl_rproc_class), \
.ops = (_ops), \
.state = &sym##_rproc_state, \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _deps, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:143
const struct pbl_device_class pbl_rproc_class
Class of the remote processors.

Initializer of a struct pbl_rproc, for providers.

Parameters
symRemote processor symbol, with its PBL_RPROC_STATE_DEFINE().
_nameDevice name.
_initDevice init function.
_depsDevice dependencies.
_opsOperations.

◆ PBL_RPROC_STATE_DEFINE

#define PBL_RPROC_STATE_DEFINE (   sym)
Value:
static struct pbl_rproc_state sym##_rproc_state = {.lock = PBL_MUTEX_INITIALIZER}
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:129
struct pbl_mutex lock
Serializes boot and shutdown.
Definition remoteproc.h:47
Remote processor state, kept by the class.
Definition remoteproc.h:45
#define PBL_MUTEX_INITIALIZER
Static initializer for an unlocked mutex.
Definition mutex.h:50

Define the state of a remote processor, for providers.

Parameters
symRemote processor symbol.

Function Documentation

◆ pbl_rproc_boot()

int pbl_rproc_boot ( const struct pbl_rproc *  rproc)

Boot a remote processor, or count one more user if it runs.

Parameters
rprocRemote processor.
Returns
0 on success, -ENODEV if it is not ready, or a negative errno from the provider.

◆ pbl_rproc_is_running()

bool pbl_rproc_is_running ( const struct pbl_rproc *  rproc)

Whether a remote processor runs.

Parameters
rprocRemote processor.

◆ pbl_rproc_shutdown()

void pbl_rproc_shutdown ( const struct pbl_rproc *  rproc)

Release a boot, stopping the remote processor if it was the last one.

Parameters
rprocRemote processor, booted.

Variable Documentation

◆ pbl_rproc_class

const struct pbl_device_class pbl_rproc_class
extern

Class of the remote processors.