drivers/comedi/drivers/ni_routes.h

Source file repositories/reference/linux-study-clean/drivers/comedi/drivers/ni_routes.h

File Facts

System
Linux kernel
Corpus path
drivers/comedi/drivers/ni_routes.h
Extension
.h
Size
11447 bytes
Lines
330
Domain
Driver Families
Bucket
drivers/comedi
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ni_route_set {
	int dest;
	int n_src;
	int *src;
};

/**
 * struct ni_device_routes - List of all src->dest sets for a particular device.
 * @device: Name of board/device (e.g. pxi-6733).
 * @n_route_sets: Number of route sets that are valid for this device.
 * @routes: List of route sets that are valid for this device.
 */
struct ni_device_routes {
	const char *device;
	int n_route_sets;
	struct ni_route_set *routes;
};

/**
 * struct ni_route_tables - Register values and valid routes for a device.
 * @valid_routes: Pointer to a all valid route sets for a single device.
 * @route_values: Pointer to register values for all routes for the family to
 *		  which the device belongs.
 *
 * Link to the valid src->dest routes and the register values used to assign
 * such routes for that particular device.
 */
struct ni_route_tables {
	const struct ni_device_routes *valid_routes;
	const u8 *route_values;
};

/*
 * ni_assign_device_routes() - Assign the proper lookup table for NI signal
 *			       routing to the specified NI device.
 *
 * Return: -ENODATA if assignment was not successful; 0 if successful.
 */
int ni_assign_device_routes(const char *device_family,
			    const char *board_name,
			    const char *alt_board_name,
			    struct ni_route_tables *tables);

/*
 * ni_find_route_set() - Finds the proper route set with the specified
 *			 destination.
 * @destination: Destination of which to search for the route set.
 * @valid_routes: Pointer to device routes within which to search.
 *
 * Return: NULL if no route_set is found with the specified @destination;
 *	otherwise, a pointer to the route_set if found.
 */
const struct ni_route_set *
ni_find_route_set(const int destination,
		  const struct ni_device_routes *valid_routes);

/*
 * ni_route_set_has_source() - Determines whether the given source is in
 *			       included given route_set.
 *
 * Return: true if found; false otherwise.
 */
bool ni_route_set_has_source(const struct ni_route_set *routes, const int src);

/*
 * ni_route_to_register() - Validates and converts the specified signal route
 *			    (src-->dest) to the value used at the appropriate
 *			    register.
 * @src:	global-identifier for route source
 * @dest:	global-identifier for route destination
 * @tables:	pointer to relevant set of routing tables.
 *
 * Generally speaking, most routes require the first six bits and a few require
 * 7 bits.  Special handling is given for the return value when the route is to
 * be handled by the RTSI sub-device.  In this case, the returned register may
 * not be sufficient to define the entire route path, but rather may only
 * indicate the intermediate route.  For example, if the route must go through
 * the RGOUT0 pin, the (src->RGOUT0) register value will be returned.
 * Similarly, if the route must go through the NI_RTSI_BRD lines, the BIT(6)
 * will be set:
 *
 * if route does not need RTSI_BRD lines:
 *   bits 0:7 : register value
 *              for a route that must go through RGOUT0 pin, this will be equal
 *              to the (src->RGOUT0) register value.
 * else: * route is (src->RTSI_BRD(x), RTSI_BRD(x)->TRIGGER_LINE(i)) *
 *   bits 0:5 : zero
 *   bits 6   : set to 1
 *   bits 7:7 : zero
 *

Annotation

Implementation Notes