PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions
device.h File Reference
#include <stdint.h>
#include <pbl/kernel/compiler.h>
#include <pbl/kernel/section.h>

Data Structures

struct  pbl_device_state
 Runtime state of a device. More...
 
struct  pbl_device
 A hardware device. More...
 

Macros

#define PBL_DEVICE_DEPS(...)   ((const struct pbl_device *const[]){__VA_ARGS__, nullptr})
 Static dependency list for struct pbl_device::deps.
 
#define PBL_DEVICE_STATE_DEFINE(sym)   static struct pbl_device_state sym##_device_state
 Define the runtime state of device instance sym.
 
#define PBL_DEVICE_INIT(sym, _name, _init, _parent, _deps)
 Initializer for the struct pbl_device of device instance sym.
 
#define PBL_DEVICE_TABLE_SECTION   PBL_SECTION(".pbl_devices")
 
#define PBL_DEVICE_REGISTER(sym, dev)    static const struct pbl_device *const sym##_device_entry PBL_USED PBL_DEVICE_TABLE_SECTION = (dev)
 Add a device to the table pbl_device_init_all() walks.
 

Enumerations

enum  pbl_device_status { PBL_DEVICE_UNINIT , PBL_DEVICE_INITIALIZING , PBL_DEVICE_READY , PBL_DEVICE_FAILED }
 Device status. More...
 

Functions

int pbl_device_init (const struct pbl_device *dev)
 Initialize a device, its parent and deps first.
 
bool pbl_device_is_ready (const struct pbl_device *dev)
 Check whether a device is initialized.
 
int pbl_device_init_all (void)
 Initialize every registered device.
 
int pbl_device_init_children (const struct pbl_device *parent)
 Initialize every registered device whose parent is parent.