![]() |
RTEMS 6.3
|
Driver Manager Interface. More...
#include <rtems.h>#include <drvmgr/drvmgr_list.h>#include <stdint.h>#include <rtems/score/basedefs.h>#include <rtems/score/smpimpl.h>Go to the source code of this file.
Data Structures | |
| struct | drvmgr_bus_params |
| struct | drvmgr_bus_ops |
| struct | drvmgr_func |
| union | drvmgr_key_value |
| struct | drvmgr_key |
| struct | drvmgr_drv_res |
| struct | drvmgr_bus_res |
| struct | drvmgr_map_entry |
| struct | drvmgr_bus |
| struct | drvmgr_dev |
| struct | drvmgr_drv_ops |
| struct | drvmgr_drv |
| struct | drvmgr_rw_arg |
Macros | |
| #define | DRVMGR_LEVEL_MAX 4 |
| #define | DRVMGR_USE_LOCKS 1 |
| #define | BUS_LIST_HEAD(list) |
| #define | BUS_LIST_TAIL(list) |
| #define | DEV_LIST_HEAD(list) |
| #define | DEV_LIST_TAIL(list) |
| #define | DRV_LIST_HEAD(list) |
| #define | DRV_LIST_TAIL(list) |
| #define | DRVMGR_BUS_TYPE_NONE 0 |
| #define | DRVMGR_BUS_TYPE_ROOT 1 |
| #define | DRVMGR_BUS_TYPE_PCI 2 |
| #define | DRVMGR_BUS_TYPE_AMBAPP 3 |
| #define | DRVMGR_BUS_TYPE_LEON2_AMBA 4 |
| #define | DRVMGR_BUS_TYPE_AMBAPP_DIST 5 |
| #define | DRVMGR_BUS_TYPE_SPW_RMAP 6 |
| #define | DRVMGR_BUS_TYPE_AMBAPP_RMAP 7 |
| #define | DRIVER_ID_BUS_MASK 0x00000000000000FFULL |
| #define | DRIVER_ID_RSV_MASK 0xFF00000000000000ULL |
| #define | DRIVER_ID_DEV_MASK 0x00FFFFFFFFFFFF00ULL |
| #define | DRIVER_ID(busid, devid) |
| #define | DRIVER_BUSID_GET(id) |
| #define | DRIVER_DEVID_GET(id) |
| #define | DRIVER_ROOTBUS_ID(bus_type) |
| #define | DRIVER_ROOT_ID DRIVER_ROOTBUS_ID(DRVMGR_BUS_TYPE_ROOT) |
| #define | DRIVER_PCIBUS_ID DRIVER_ROOTBUS_ID(DRVMGR_BUS_TYPE_PCI) |
| #define | DRIVER_GRLIB_AMBAPP_ID DRIVER_ROOTBUS_ID(DRVMGR_BUS_TYPE_AMBAPP) |
| #define | DRIVER_LEON2_AMBA_ID DRIVER_ROOTBUS_ID(DRVMGR_BUS_TYPE_LEON2_AMBA) |
| #define | DRIVER_AMBAPP_DIST_ID DRIVER_ROOTBUS_ID(DRVMGR_BUS_TYPE_AMBAPP_DIST) |
| #define | BUS_OPS_NUM (sizeof(struct drvmgr_bus_ops)/sizeof(void (*)(void))) |
| #define | DRVMGR_FUNC(_ID_, _FUNC_) |
| #define | DRVMGR_FUNC_END {0, NULL} |
| #define | DRVMGR_KEY_EMPTY {NULL, DRVMGR_KT_NONE, {0}} |
| #define | DRVMGR_RES_EMPTY {0, 0, NULL} |
| #define | MMAP_EMPTY {0, 0, 0} |
| #define | DRVMGR_TRANSLATE_ONE2ONE NULL |
| #define | DRVMGR_TRANSLATE_NO_BRIDGE ((void *)1) |
| #define | BUS_STATE_INIT_FAILED 0x00000001 |
| #define | BUS_STATE_LIST_INACTIVE 0x00001000 |
| #define | BUS_STATE_DEPEND_FAILED 0x00000004 |
| #define | DEV_STATE_INIT_FAILED 0x00000001 |
| #define | DEV_STATE_INIT_DONE 0x00000002 |
| #define | DEV_STATE_DEPEND_FAILED 0x00000004 |
| #define | DEV_STATE_UNITED 0x00000100 |
| #define | DEV_STATE_REMOVED 0x00000200 |
| #define | DEV_STATE_IGNORED 0x00000400 |
| #define | DEV_STATE_LIST_INACTIVE 0x00001000 |
| #define | DRVMGR_OPS_NUM(x) |
| #define | DRVMGR_FED_BF 1 |
| #define | DRVMGR_FED_DF 0 |
| #define | DRVMGR_TR_REVERSE 0x1 |
| #define | DRVMGR_TR_PATH 0x2 |
| #define | DRVMGR_FUNCID(major, minor) |
| #define | DRVMGR_FUNCID_NONE 0 |
| #define | DRVMGR_FUNCID_END DRVMGR_FUNCID(DRVMGR_FUNCID_NONE, 0) |
| #define | RW_SIZE_1 0x00001 |
| #define | RW_SIZE_2 0x00002 |
| #define | RW_SIZE_4 0x00004 |
| #define | RW_SIZE_8 0x00008 |
| #define | RW_SIZE_ANY 0x00000 |
| #define | RW_SIZE(id) |
| #define | RW_DIR_ANY 0x00000 |
| #define | RW_READ 0x00000 |
| #define | RW_WRITE 0x00010 |
| #define | RW_SET 0x00020 |
| #define | RW_DIR(id) |
| #define | RW_RAW 0x00000 |
| #define | RW_LITTLE 0x00040 |
| #define | RW_BIG 0x00080 |
| #define | RW_ENDIAN(id) |
| #define | RW_TYPE_ANY 0x00000 |
| #define | RW_REG 0x00100 |
| #define | RW_MEM 0x00200 |
| #define | RW_MEMREG 0x00300 |
| #define | RW_CFG 0x00400 |
| #define | RW_TYPE(id) |
| #define | RW_ARG 0x01000 |
| #define | RW_ERR 0x02000 |
| #define | DRVMGR_RWFUNC(minor) |
| #define | PRINT_DEVS_FAILED 0x01 |
| #define | PRINT_DEVS_ASSIGNED 0x02 |
| #define | PRINT_DEVS_UNASSIGNED 0x04 |
| #define | PRINT_DEVS_IGNORED 0x08 |
| #define | PRINT_DEVS_ALL |
| #define | OPTION_DEV_GENINFO 0x00000001 |
| #define | OPTION_DEV_BUSINFO 0x00000002 |
| #define | OPTION_DEV_DRVINFO 0x00000004 |
| #define | OPTION_DRV_DEVS 0x00000100 |
| #define | OPTION_BUS_DEVS 0x00010000 |
| #define | OPTION_RECURSIVE 0x01000000 |
| #define | OPTION_INFO_ALL 0xffffffff |
Typedefs | |
| typedef void(*) | drvmgr_isr(void *arg) |
| typedef void(*) | drvmgr_drv_reg_func(void) |
| typedef uint8_t(*) | drvmgr_r8(uint8_t *srcadr) |
| typedef uint16_t(*) | drvmgr_r16(uint16_t *srcadr) |
| typedef uint32_t(*) | drvmgr_r32(uint32_t *srcadr) |
| typedef uint64_t(*) | drvmgr_r64(uint64_t *srcadr) |
| typedef void(*) | drvmgr_w8(uint8_t *dstadr, uint8_t data) |
| typedef void(*) | drvmgr_w16(uint16_t *dstadr, uint16_t data) |
| typedef void(*) | drvmgr_w32(uint32_t *dstadr, uint32_t data) |
| typedef void(*) | drvmgr_w64(uint64_t *dstadr, uint64_t data) |
| typedef int(*) | drvmgr_rmem(void *dest, const void *src, int n) |
| typedef int(*) | drvmgr_wmem(void *dest, const void *src, int n) |
| typedef int(*) | drvmgr_memset(void *dstadr, int c, size_t n) |
| typedef uint8_t(*) | drvmgr_r8_arg(uint8_t *srcadr, void *a) |
| typedef uint16_t(*) | drvmgr_r16_arg(uint16_t *srcadr, void *a) |
| typedef uint32_t(*) | drvmgr_r32_arg(uint32_t *srcadr, void *a) |
| typedef uint64_t(*) | drvmgr_r64_arg(uint64_t *srcadr, void *a) |
| typedef void(*) | drvmgr_w8_arg(uint8_t *dstadr, uint8_t data, void *a) |
| typedef void(*) | drvmgr_w16_arg(uint16_t *dstadr, uint16_t data, void *a) |
| typedef void(*) | drvmgr_w32_arg(uint32_t *dstadr, uint32_t data, void *a) |
| typedef void(*) | drvmgr_w64_arg(uint64_t *dstadr, uint64_t data, void *a) |
| typedef int(*) | drvmgr_rmem_arg(void *dest, const void *src, int n, void *a) |
| typedef int(*) | drvmgr_wmem_arg(void *dest, const void *src, int n, void *a) |
| typedef int(*) | drvmgr_memset_arg(void *dstadr, int c, size_t n, void *a) |
| typedef void(*) | drvmgr_rw_err(struct drvmgr_rw_arg *a, struct drvmgr_bus *bus, int funcid, void *adr) |
Enumerations | |
| enum | { DRVMGR_OBJ_NONE = 0 , DRVMGR_OBJ_DRV = 1 , DRVMGR_OBJ_BUS = 2 , DRVMGR_OBJ_DEV = 3 } |
| enum | drvmgr_kt { DRVMGR_KT_ANY = -1 , DRVMGR_KT_NONE = 0 , DRVMGR_KT_INT = 1 , DRVMGR_KT_STRING = 2 , DRVMGR_KT_POINTER = 3 } |
| enum | { DRVMGR_OK = 0 , DRVMGR_NOMEM = 1 , DRVMGR_EIO = 2 , DRVMGR_EINVAL = 3 , DRVMGR_ENOSYS = 4 , DRVMGR_TIMEDOUT = 5 , DRVMGR_EBUSY = 6 , DRVMGR_ENORES = 7 , DRVMGR_FAIL = -1 } |
| enum | drvmgr_tr_opts { CPUMEM_TO_DMA = 0x0 , CPUMEM_FROM_DMA = 0x1 , DMAMEM_TO_CPU = 0x2 , DMAMEM_FROM_CPU = 0x3 } |
| enum | { FUNCID_NONE = 0x000 , FUNCID_RW = 0x001 } |
Functions | |
| void | _DRV_Manager_initialization (void) |
| void | _DRV_Manager_init_level (int level) |
| int | drvmgr_init (void) |
| void | drvmgr_init_update (void) |
| int | drvmgr_root_drv_register (struct drvmgr_drv *drv) |
| int | drvmgr_drv_register (struct drvmgr_drv *drv) |
| int | drvmgr_dev_register (struct drvmgr_dev *dev) |
| int | drvmgr_dev_unregister (struct drvmgr_dev *dev) |
| int | drvmgr_bus_register (struct drvmgr_bus *bus) |
| int | drvmgr_bus_unregister (struct drvmgr_bus *bus) |
| int | drvmgr_children_unregister (struct drvmgr_bus *bus) |
| int | drvmgr_dev_drv_separate (struct drvmgr_dev *dev) |
| int | drvmgr_alloc_dev (struct drvmgr_dev **pdev, int extra) |
| int | drvmgr_alloc_bus (struct drvmgr_bus **pbus, int extra) |
| void | drvmgr_bus_res_add (struct drvmgr_bus *bus, struct drvmgr_bus_res *bres) |
| int | drvmgr_keys_get (struct drvmgr_dev *dev, struct drvmgr_key **keys) |
| struct drvmgr_key * | drvmgr_key_get (struct drvmgr_key *keys, char *key_name) |
| union drvmgr_key_value * | drvmgr_key_val_get (struct drvmgr_key *keys, char *key_name, enum drvmgr_kt key_type) |
| union drvmgr_key_value * | drvmgr_dev_key_get (struct drvmgr_dev *dev, char *key_name, enum drvmgr_kt key_type) |
| intptr_t | drvmgr_for_each_dev (intptr_t(*func)(struct drvmgr_dev *dev, void *arg), void *arg, int options) |
| int | drvmgr_get_dev (struct drvmgr_drv *drv, int minor, struct drvmgr_dev **pdev) |
| int | drvmgr_freq_get (struct drvmgr_dev *dev, int options, unsigned int *freq_hz) |
| int | drvmgr_on_rootbus (struct drvmgr_dev *dev) |
| int | drvmgr_get_dev_prefix (struct drvmgr_dev *dev, char *dev_prefix) |
| int | drvmgr_interrupt_register (struct drvmgr_dev *dev, int index, const char *info, drvmgr_isr isr, void *arg) |
| int | drvmgr_interrupt_unregister (struct drvmgr_dev *dev, int index, drvmgr_isr isr, void *arg) |
| int | drvmgr_interrupt_clear (struct drvmgr_dev *dev, int index) |
| int | drvmgr_interrupt_unmask (struct drvmgr_dev *dev, int index) |
| int | drvmgr_interrupt_mask (struct drvmgr_dev *dev, int index) |
| unsigned int | drvmgr_translate (struct drvmgr_dev *dev, unsigned int options, void *src_address, void **dst_address) |
| unsigned int | drvmgr_translate_bus (struct drvmgr_bus *from, struct drvmgr_bus *to, int reverse, void *src_address, void **dst_address) |
| int | drvmgr_translate_check (struct drvmgr_dev *dev, unsigned int options, void *src_address, void **dst_address, unsigned int size) |
| int | drvmgr_func_get (void *obj, int funcid, void **func) |
| int | drvmgr_func_call (void *obj, int funcid, void *a, void *b, void *c, void *d) |
| void | drvmgr_rw_memset (void *dstadr, int c, size_t n, void *a, drvmgr_wmem_arg wmem) |
| int | drvmgr_for_each_listdev (struct drvmgr_list *devlist, unsigned int state_set_mask, unsigned int state_clr_mask, int(*func)(struct drvmgr_dev *dev, void *arg), void *arg) |
| void | drvmgr_summary (void) |
| void | drvmgr_print_devs (unsigned int options) |
| void | drvmgr_print_topo (void) |
| void | drvmgr_print_mem (void) |
| void | drvmgr_info (void *id, unsigned int options) |
| void | drvmgr_info_dev (struct drvmgr_dev *dev, unsigned int options) |
| void | drvmgr_info_bus (struct drvmgr_bus *bus, unsigned int options) |
| void | drvmgr_info_drv (struct drvmgr_drv *drv, unsigned int options) |
| void | drvmgr_info_devs_on_bus (struct drvmgr_bus *bus, unsigned int options) |
| void | drvmgr_info_devs (unsigned int options) |
| void | drvmgr_info_drvs (unsigned int options) |
| void | drvmgr_info_buses (unsigned int options) |
| struct drvmgr_drv * | drvmgr_drv_by_id (uint64_t id) |
| struct drvmgr_drv * | drvmgr_drv_by_name (const char *name) |
| struct drvmgr_dev * | drvmgr_dev_by_name (const char *name) |
Driver Manager Interface.
| #define BUS_LIST_HEAD | ( | list | ) |
| #define BUS_LIST_TAIL | ( | list | ) |
| #define DEV_LIST_HEAD | ( | list | ) |
| #define DEV_LIST_TAIL | ( | list | ) |
| #define DRIVER_BUSID_GET | ( | id | ) |
| #define DRIVER_DEVID_GET | ( | id | ) |
| #define DRIVER_ID | ( | busid, | |
| devid ) |
| #define DRIVER_ROOTBUS_ID | ( | bus_type | ) |
| #define DRV_LIST_HEAD | ( | list | ) |
| #define DRV_LIST_TAIL | ( | list | ) |
| #define DRVMGR_FED_BF 1 |
Calls func() for every device found in the device tree, regardless of device state or if a driver is assigned. With the options argument the user can decide to do either a depth-first or a breadth-first search.
If the function func() returns a non-zero value then for_each_dev will return imediatly with the same return value as func() returned.
| func | Function called on each device |
| arg | Custom function argument |
| options | Search Options, see DRVMGR_FED_* |
| #define DRVMGR_FUNC | ( | _ID_, | |
| _FUNC_ ) |
| #define DRVMGR_FUNCID | ( | major, | |
| minor ) |
| #define DRVMGR_OPS_NUM | ( | x | ) |
| #define DRVMGR_RWFUNC | ( | minor | ) |
| #define PRINT_DEVS_ALL |
| #define RW_DIR | ( | id | ) |
| #define RW_ENDIAN | ( | id | ) |
| #define RW_SIZE | ( | id | ) |
| #define RW_TYPE | ( | id | ) |
| typedef void(*) drvmgr_drv_reg_func(void) |
Structure defines a function pointer called when driver manager is ready for drivers to register themselfs. Used to select drivers available to the driver manager.
| enum drvmgr_tr_opts |
Force masking/disable an interrupt on the interrupt controller, this is not normally performed since this will stop all other (shared) ISRs to be disabled until _unmask() is called.
| dev | Device to mask interrupt for. |
| index | Index is used to identify the IRQ number if hardware has multiple IRQ sources. Normally Index is set to 0 to indicated the first and only IRQ source. A negative index is interpreted as a absolute bus IRQ number. |
drvmgr_translate() translation options
|
extern |
Take all devices into init level 'level', all devices registered later will directly be taken into this level as well, ensuring that all registerd devices has been taken into the level.
|
extern |
Initialize data structures of the driver management system. Calls predefined register driver functions so that drivers can register themselves.
|
extern |
Allocate a bus structure, if no memory available rtems_error_fatal_occurred is called. The 'extra' argment tells how many bytes extra space is to be allocated after the device structure, this is typically used for "businfo" structures. The extra space is always aligned to a 4-byte boundary.
|
extern |
Allocate a device structure, if no memory available rtems_error_fatal_occurred is called. The 'extra' argment tells how many bytes extra space is to be allocated after the device structure, this is typically used for "businfo" structures. The extra space is always aligned to a 4-byte boundary.
|
extern |
Register a bus
|
extern |
Add resources to a bus, typically used by a bus driver.
| bus | The Bus to add the resources to. |
| res | An array with Driver resources, all together are called bus resources. |
|
extern |
Unregister a bus
|
extern |
Unregister all child devices of a bus.
This function is called from the bus driver, from a "safe" state where devices will not be added or removed on this particular bus at this time
|
extern |
Get Device by Device Name
|
extern |
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.
| dev | The device to search resource for. |
| key_name | The key name to search for |
| key_type | The key type expected. |
|
extern |
Register a device
|
extern |
Remove a device, and all its children devices if device is a bus device. The device driver will be requested to remove the device and once gone from bus, device and driver list the device is put into a inactive list for debugging (this is optional by using remove argument).
Removing the Root Bus Device is not supported.
| remove | If non-zero the device will be deallocated, and not put into the inacitve list. |
|
extern |
Get Driver by Driver ID
|
extern |
Get Driver by Driver Name
|
extern |
Register a driver
|
extern |
Calls func() for every device found matching the search requirements of set_mask and clr_mask. Each bit set in set_mask must be set in the device state bit mask (dev->state), and Each bit in the clr_mask must be cleared in the device state bit mask (dev->state). There are three special cases:
If the function func() returns a non-zero value then for_each_dev will return imediatly with the same return value as func() returned.
| devlist | The list to iterate though searching for devices. |
| state_set_mask | Defines the bits that must be set in dev->state |
| state_clr_mask | Defines the bits that must be cleared in dev->state |
| func | Function called on each |
|
extern |
Get Bus frequency in Hertz. Frequency is stored into address of freq_hz.
| dev | The Device to get Bus frequency for. |
| options | Bus-type specific options |
| freq_hz | Location where Bus Frequency will be stored. |
|
extern |
Lookup function and call it directly with the four optional arguments
|
extern |
Get function pointer from Device Driver or Bus Driver.
Returns 0 if function is available
|
extern |
Get Device pointer from Driver and Driver minor number
| drv | Driver the device is united with. |
| minor | Driver minor number assigned to device. |
| pdev | Location where the Device point will be stored. |
|
extern |
Get device name prefix, this name can be used to register a unique name in the bus->error filesystem or to get an idea where the device is located.
| dev | The Device to get the device Prefix for. |
| dev_prefix | Location where the prefix will be stored. |
|
extern |
Print information about a driver manager object (device, driver, bus)
|
extern |
Get information about a bus
|
extern |
Get information about all buses in the system
|
extern |
Get information about a device
|
extern |
Get information about all devices in the system (on all buses)
|
extern |
Get information about all devices on a bus
|
extern |
Get information about a driver
|
extern |
Get information about all drivers in the system
|
extern |
Init driver manager all in one go, will call _DRV_Manager_initialization(), then _DRV_Manager_init_level([1..DRVMGR_LEVEL_MAX]). Typically called from Init task when user wants to initilize driver manager after startup, otherwise not used.
|
extern |
Clear (ACK) pending interrupt
| dev | Device to clear interrupt for. |
| index | Index is used to identify the IRQ number if hardware has multiple IRQ sources. Normally Index is set to 0 to indicated the first and only IRQ source. A negative index is interpreted as a absolute bus IRQ number. |
| isr | Interrupt Service Routine, previously registered. |
| arg | Optional ISR argument, previously registered. |
|
extern |
Force masking/disable an interrupt on the interrupt controller, this is not normally performed since this will stop all other (shared) ISRs to be disabled until _unmask() is called.
| dev | Device to mask interrupt for. |
| index | Index is used to identify the IRQ number if hardware has multiple IRQ sources. Normally Index is set to 0 to indicated the first and only IRQ source. A negative index is interpreted as a absolute bus IRQ number. |
|
extern |
Register a shared interrupt handler. Since this service is shared among interrupt drivers/handlers the handler[arg] must be installed before the interrupt can be cleared or disabled. The handler is by default disabled after registration.
| index | Index is used to identify the IRQ number if hardware has multiple IRQ sources. Normally Index is set to 0 to indicated the first and only IRQ source. A negative index is interpreted as a absolute bus IRQ number. |
| isr | Interrupt Service Routine. |
| arg | Optional ISR argument. |
|
extern |
Force unmasking/enableing an interrupt on the interrupt controller, this is not normally used, if used the caller has masked/disabled the interrupt just before.
| dev | Device to clear interrupt for. |
| index | Index is used to identify the IRQ number if hardware has multiple IRQ sources. Normally Index is set to 0 to indicated the first and only IRQ source. A negative index is interpreted as a absolute bus IRQ number. |
| isr | Interrupt Service Routine, previously registered. |
| arg | Optional ISR argument, previously registered. |
|
extern |
Unregister an interrupt handler. This also disables the interrupt before unregistering the interrupt handler.
| index | Index is used to identify the IRQ number if hardware has multiple IRQ sources. Normally Index is set to 0 to indicated the first and only IRQ source. A negative index is interpreted as a absolute bus IRQ number. |
| isr | Interrupt Service Routine, previously registered. |
| arg | Optional ISR argument, previously registered. |
|
extern |
Return the one key that matches key name from a driver keys array. The keys can be obtained using drvmgr_keys_get().
| keys | An array of keys ended with DRVMGR_KEY_EMPTY to search among. |
| key_name | Name of key to search for among the keys. |
|
extern |
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.
| keys | An array of keys ended with DRVMGR_KEY_EMPTY to search among. |
| key_name | Name of key to search for among the keys. |
| key_type | Data Type of value. INTEGER, ADDRESS, STRING. |
|
extern |
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.
| dev | Device to find resources for |
| key | Location where the pointer to the driver resource array (drvmgr_drv_res->keys) is stored. |
|
extern |
Return 0 if dev is not located on the root bus, 1 if on root bus
|
extern |
Print devices with certain condictions met according to 'options'
|
extern |
Print the memory usage Only accounts for data structures. Not for the text size.
|
extern |
Print device/bus topology
|
extern |
Register Root Bus device driver
|
extern |
Print number of devices, buses and drivers
|
extern |
Translate an address on one bus to an address on another bus.
The device determines source or destination bus, the root bus is always the other bus. It is assumed that the CPU is located on the root bus or that it can access it without address translation (mapped 1:1). The CPU is thus assumed to be located on level 0 top most in the bus hierarchy.
If no map is present in the bus driver src_address is translated 1:1 (just copied).
Addresses are typically converted up-streams from the DMA unit towards the CPU (DMAMEM_TO_CPU) or down-streams towards DMA hardware from the CPU (CPUMEM_TO_DMA) over one or multiple bridges depending on bus architecture. See 'enum drvmgr_tr_opts' for other translation direction options. For example: Two common operations is to translate a CPU accessible RAM address to an address that DMA units can access (dev=DMA-unit, CPUMEM_TO_DMA, src_address=CPU-RAM-ADR) and to translate an address of a PCI resource for example RAM mapped into a PCI BAR to an CPU accessible address (dev=PCI-device, DMAMEM_TO_CPU, src_address=PCI-BAR-ADR).
Source address is translated and the result is put into *dst_address, if the address is not accessible on the other bus -1 is returned.
| dev | Device to translate addresses for |
| options | Tanslation direction options, see enum drvmgr_tr_opts |
| src_address | Address to translate |
| dst_address | Location where translated address is stored |
Returns 0 if unable to translate. The remaining length from the given address of the map is returned on success, for example if a map starts at 0x40000000 of size 0x100000 the result will be 0x40000 if the address was translated into 0x400C0000. If dev is on root-bus no translation is performed 0xffffffff is returned and src_address is stored in *dst_address.