RTEMS CPU Kit with SuperCore  4.11.3
Functions
drvmgr_res.c File Reference
#include <string.h>
#include <drvmgr/drvmgr.h>
Include dependency graph for drvmgr_res.c:

Functions

int drvmgr_keys_get (struct drvmgr_dev *dev, struct drvmgr_key **keys)
 Find all the resource keys for a device among all driver resources on a bus. More...
 
struct drvmgr_keydrvmgr_key_get (struct drvmgr_key *keys, char *key_name)
 Return the one key that matches key name from a driver keys array. More...
 
union drvmgr_key_valuedrvmgr_key_val_get (struct drvmgr_key *keys, char *key_name, enum drvmgr_kt key_type)
 Extract key value from the key in the keys array matching name and type. More...
 
union drvmgr_key_valuedrvmgr_dev_key_get (struct drvmgr_dev *dev, char *key_name, enum drvmgr_kt key_type)
 Get key value from the bus resources matching [device, key name, key type] if no matching key is found NULL is returned. More...
 

Function Documentation

◆ drvmgr_dev_key_get()

union drvmgr_key_value* drvmgr_dev_key_get ( struct drvmgr_dev dev,
char *  key_name,
enum drvmgr_kt  key_type 
)

Get key value from the bus resources matching [device, key name, key type] if no matching key is found NULL is returned.

This is typically used by device drivers to find a particular device resource.

Parameters
devThe device to search resource for.
key_nameThe key name to search for
key_typeThe key type expected.
Returns
Returns NULL if no value found matching Key Name and Key Type was found for device.

References drvmgr_key_val_get(), and drvmgr_keys_get().

◆ drvmgr_key_get()

struct drvmgr_key* drvmgr_key_get ( struct drvmgr_key keys,
char *  key_name 
)

Return the one key that matches key name from a driver keys array.

The keys can be obtained using drvmgr_keys_get().

Parameters
keysAn array of keys ended with DRVMGR_KEY_EMPTY to search among.
key_nameName of key to search for among the keys.

Referenced by drvmgr_key_val_get(), and drvmgr_keys_get().

◆ drvmgr_key_val_get()

union drvmgr_key_value* drvmgr_key_val_get ( struct drvmgr_key keys,
char *  key_name,
enum drvmgr_kt  key_type 
)

Extract key value from the key in the keys array matching name and type.

This function calls drvmgr_keys_get to get the key requested (from key name), then determines if the type is correct. A pointer to the key value is returned.

Parameters
keysAn array of keys ended with DRVMGR_KEY_EMPTY to search among.
key_nameName of key to search for among the keys.
key_typeData Type of value. INTEGER, ADDRESS, STRING.
Returns
Returns NULL if no value found matching Key Name and Key Type.

References drvmgr_key_get().

Referenced by drvmgr_dev_key_get().

◆ drvmgr_keys_get()

int drvmgr_keys_get ( struct drvmgr_dev dev,
struct drvmgr_key **  keys 
)

Find all the resource keys for a device among all driver resources on a bus.

Typically used by a device driver to get configuration options.

Parameters
devDevice to find resources for
keyLocation where the pointer to the driver resource array (drvmgr_drv_res->keys) is stored.

References drvmgr_dev::drv, drvmgr_drv_res::drv_id, drvmgr_drv::drv_id, drvmgr_key_get(), drvmgr_drv_res::keys, drvmgr_drv_res::minor_bus, drvmgr_dev::minor_bus, drvmgr_bus_res::next, drvmgr_dev::parent, drvmgr_bus::reslist, and drvmgr_bus_res::resource.

Referenced by drvmgr_dev_key_get().