|
Files |
file | main.c |
Data Structures |
struct | class_list |
| The list of device classes. More...
|
struct | dev_class |
struct | dev_class_info |
| Provides n-to-m mapping between function nodes and classes - each function can register in an arbitrary number of classes and each class can contain an arbitrary number of device functions. More...
|
struct | dev_node |
| Device node in the device tree. More...
|
struct | dev_tree |
| Represents device tree. More...
|
struct | driver |
| Driver structure. More...
|
struct | driver_list |
| The list of drivers. More...
|
struct | fun_node |
| Function node in the device tree. More...
|
struct | match_id |
| Ids of device models used for device-to-driver matching. More...
|
struct | match_id_list |
| List of ids for matching devices to drivers sorted according to match scores in descending order. More...
|
Defines |
#define | DEVICE_BUCKETS 256 |
#define | DEVMAN_NAME_MAXLEN 256 |
#define | DEVMAP_CLASS_NAMESPACE "class" |
#define | DEVMAP_DEVICE_NAMESPACE "devices" |
#define | DEVMAP_SEPARATOR '\\' |
#define | DRIVER_DEFAULT_STORE "/drv" |
#define | MATCH_EXT ".ma" |
#define | NAME "devman" |
Typedefs |
typedef class_list | class_list_t |
| The list of device classes.
|
typedef dev_class_info | dev_class_info_t |
| Provides n-to-m mapping between function nodes and classes - each function can register in an arbitrary number of classes and each class can contain an arbitrary number of device functions.
|
typedef dev_node | dev_node_t |
typedef dev_tree | dev_tree_t |
| Represents device tree.
|
typedef sysarg_t | devman_handle_t |
typedef driver_list | driver_list_t |
| The list of drivers.
|
typedef driver | driver_t |
| Representation of device driver.
|
typedef fun_node | fun_node_t |
typedef match_id_list | match_id_list_t |
| List of ids for matching devices to drivers sorted according to match scores in descending order.
|
typedef match_id | match_id_t |
| Ids of device models used for device-to-driver matching.
|
Enumerations |
enum | client_to_devman_t |
enum | device_state_t |
| The state of the device.
|
enum | devman_interface_t |
enum | devman_to_driver_t |
enum | driver_state_t { DRIVER_NOT_STARTED = 0,
DRIVER_STARTING,
DRIVER_RUNNING
} |
enum | driver_to_devman_t |
enum | fun_type_t { fun_invalid = 0,
fun_inner,
fun_exposed
} |
Functions |
void | add_dev_class_no_lock (class_list_t *class_list, dev_class_t *cl) |
void | add_device (int phone, driver_t *drv, dev_node_t *dev, dev_tree_t *tree) |
| Pass a device to running driver.
|
void | add_driver (driver_list_t *drivers_list, driver_t *drv) |
| Add a driver to the list of drivers.
|
dev_class_info_t * | add_function_to_class (fun_node_t *fun, dev_class_t *cl, const char *base_dev_name) |
| Add the device function to the class.
|
static void | add_match_id (match_id_list_t *ids, match_id_t *id) |
bool | assign_driver (dev_node_t *dev, driver_list_t *drivers_list, dev_tree_t *tree) |
| Find suitable driver for a device and assign the driver to it.
|
static int | assign_driver_fibril (void *arg) |
void | attach_driver (dev_node_t *dev, driver_t *drv) |
| Assign a driver to a device.
|
void | class_add_devmap_function (class_list_t *class_list, dev_class_info_t *cli) |
void | clean_driver (driver_t *drv) |
| Device driver structure clean-up.
|
static void | clean_match_ids (match_id_list_t *ids) |
char * | clone_string (const char *s) |
static int | compute_match_score (match_id_t *driver, match_id_t *device) |
| Compute compound score of driver and device.
|
dev_class_t * | create_dev_class (void) |
| Create device class.
|
dev_class_info_t * | create_dev_class_info (void) |
| Create device class info.
|
char * | create_dev_name_for_class (dev_class_t *cl, const char *base_dev_name) |
| Create unique device name within the class.
|
dev_node_t * | create_dev_node (void) |
| Create a new device node.
|
driver_t * | create_driver (void) |
| Allocate and initialize a new driver structure.
|
fun_node_t * | create_fun_node (void) |
| Create a new function node.
|
static match_id_t * | create_match_id (void) |
bool | create_root_nodes (dev_tree_t *tree) |
| Create root device and function node in the device tree.
|
void | delete_dev_node (dev_node_t *dev) |
| Delete a device node.
|
void | delete_driver (driver_t *drv) |
| Delete device driver structure.
|
void | delete_fun_node (fun_node_t *fun) |
| Delete a function node.
|
static void | delete_match_id (match_id_t *id) |
static hash_index_t | devices_hash (unsigned long key[]) |
static void | devices_remove_callback (link_t *item) |
static void | devman_add_function (ipc_callid_t callid, ipc_call_t *call) |
| Handle function registration.
|
static void | devman_add_function_to_class (ipc_callid_t callid, ipc_call_t *call) |
static void | devman_connection (ipc_callid_t iid, ipc_call_t *icall) |
| Function for handling connections to device manager.
|
static void | devman_connection_client (ipc_callid_t iid, ipc_call_t *icall) |
| Function for handling connections from a client to the device manager.
|
static void | devman_connection_devmapper (ipc_callid_t iid, ipc_call_t *icall) |
| Function for handling connections from a client forwarded by the device mapper to the device manager.
|
static void | devman_connection_driver (ipc_callid_t iid, ipc_call_t *icall) |
| Function for handling connections from a driver to the device manager.
|
static int | devman_devices_compare (unsigned long key[], hash_count_t keys, link_t *item) |
static driver_t * | devman_driver_register (void) |
| Register running driver.
|
static void | devman_forward (ipc_callid_t iid, ipc_call_t *icall, bool drv_to_parent) |
static void | devman_function_get_handle (ipc_callid_t iid, ipc_call_t *icall) |
| Find handle for the device instance identified by the device's path in the device tree.
|
static void | devman_function_get_handle_by_class (ipc_callid_t iid, ipc_call_t *icall) |
| Find handle for the device instance identified by device class name.
|
static int | devman_functions_compare (unsigned long key[], hash_count_t keys, link_t *item) |
static void | devman_get_device_path_by_handle (ipc_callid_t iid, ipc_call_t *icall) |
| Find device path by its handle.
|
static bool | devman_init (void) |
| Initialize device manager internal structures.
|
static int | devman_receive_match_id (match_id_list_t *match_ids) |
| Receive device match ID from the device's parent driver and add it to the list of devices match ids.
|
static int | devman_receive_match_ids (sysarg_t match_count, match_id_list_t *match_ids) |
| Receive device match IDs from the device's parent driver and add them to the list of devices match ids.
|
static int | devmap_devices_class_compare (unsigned long key[], hash_count_t keys, link_t *item) |
static int | devmap_functions_compare (unsigned long key[], hash_count_t keys, link_t *item) |
static void | devmap_register_class_dev (dev_class_info_t *cli) |
void | devmap_register_tree_function (fun_node_t *fun, dev_tree_t *tree) |
| Create devmap path and name for the function.
|
driver_t * | find_best_match_driver (driver_list_t *drivers_list, dev_node_t *node) |
| Lookup the best matching driver for the specified device in the list of drivers.
|
dev_class_t * | find_dev_class_no_lock (class_list_t *class_list, const char *class_name) |
dev_class_info_t * | find_dev_in_class (dev_class_t *dev_class, const char *dev_name) |
dev_node_t * | find_dev_node (dev_tree_t *tree, devman_handle_t handle) |
| Find the device node structure of the device witch has the specified handle.
|
dev_node_t * | find_dev_node_no_lock (dev_tree_t *tree, devman_handle_t handle) |
| Find the device node structure of the device witch has the specified handle.
|
fun_node_t * | find_devmap_class_function (class_list_t *classes, devmap_handle_t devmap_handle) |
fun_node_t * | find_devmap_tree_function (dev_tree_t *tree, devmap_handle_t devmap_handle) |
driver_t * | find_driver (driver_list_t *drv_list, const char *drv_name) |
| Find device driver in the list of device drivers.
|
fun_node_t * | find_fun_node (dev_tree_t *tree, devman_handle_t handle) |
| Find the function node with the specified handle.
|
fun_node_t * | find_fun_node_by_class (class_list_t *class_list, const char *class_name, const char *dev_name) |
| Find function node by its class name and index.
|
fun_node_t * | find_fun_node_by_path (dev_tree_t *tree, char *path) |
| Find function node with a specified path in the device tree.
|
fun_node_t * | find_fun_node_in_device (dev_node_t *dev, const char *name) |
| Find function with a specified name belonging to given device.
|
fun_node_t * | find_fun_node_no_lock (dev_tree_t *tree, devman_handle_t handle) |
| Find the function node with the specified handle.
|
fun_node_t * | find_node_child (fun_node_t *pfun, const char *name) |
| Find child function node with a specified name.
|
void | free_not_null (const void *ptr) |
char * | get_abs_path (const char *base_path, const char *name, const char *ext) |
dev_class_t * | get_dev_class (class_list_t *class_list, char *class_name) |
bool | get_driver_info (const char *base_path, const char *name, driver_t *drv) |
| Get information about a driver.
|
int | get_match_score (driver_t *, dev_node_t *) |
size_t | get_new_class_dev_idx (dev_class_t *cl) |
size_t | get_nonspace_len (const char *str) |
char * | get_path_elem_end (char *path) |
void | init_class_list (class_list_t *class_list) |
bool | init_device_tree (dev_tree_t *tree, driver_list_t *drivers_list) |
| Initialize the device tree.
|
void | init_driver (driver_t *drv) |
| Initialize device driver structure.
|
void | init_driver_list (driver_list_t *drv_list) |
| Initialize the list of device driver's.
|
static void | init_match_ids (match_id_list_t *id_list) |
static int | init_running_drv (void *drv) |
| Initialize driver which has registered itself as running and ready.
|
void | initialize_running_driver (driver_t *driver, dev_tree_t *tree) |
| Finish the initialization of a driver after it has succesfully started and after it has registered itself by the device manager.
|
bool | insert_dev_node (dev_tree_t *tree, dev_node_t *dev, fun_node_t *pfun) |
| Insert new device into device tree.
|
bool | insert_fun_node (dev_tree_t *tree, fun_node_t *fun, char *fun_name, dev_node_t *dev) |
| Insert new function into device tree.
|
int | lookup_available_drivers (driver_list_t *drivers_list, const char *dir_path) |
| Lookup drivers in the directory.
|
int | main (int argc, char *argv[]) |
| Main entry point.
|
bool | parse_match_ids (char *buf, match_id_list_t *ids) |
| Read match ids and associated match scores from a string.
|
static void | pass_devices_to_driver (driver_t *driver, dev_tree_t *tree) |
| Notify driver about the devices to which it was assigned.
|
char * | read_match_id (char **buf) |
| Read match id at the specified position of a string and set the position in the string to the first character following the id.
|
bool | read_match_ids (const char *conf_path, match_id_list_t *ids) |
| Read match ids and associated match scores from a file.
|
void | replace_char (char *str, char orig, char repl) |
ssize_t | safe_read (int fd, void *buffer, size_t size) |
static bool | set_fun_path (fun_node_t *fun, fun_node_t *parent) |
| Create and set device's full path in device tree.
|
bool | skip_spaces (char **buf) |
bool | start_driver (driver_t *drv) |
| Start a driver.
|
void | tree_add_devmap_function (dev_tree_t *tree, fun_node_t *fun) |
Variables |
static class_list_t | class_list |
static dev_tree_t | device_tree |
static hash_table_operations_t | devman_devices_ops |
static hash_table_operations_t | devman_functions_ops |
static hash_table_operations_t | devmap_devices_class_ops |
static hash_table_operations_t | devmap_devices_ops |
static driver_list_t | drivers_list |