- get or release a controller handle
cc [ flag... ] file... –lrsm [ library... ] #include <rsmapi.h> int rsm_get_controller(char *name, rsmapi_controller_handle_t *controller);
int rsm_get_controller_attr(rsmapi_controller_handle_t chdl, rsmapi_controller_attr_t *attr);
int rsm_release_controller(rsmapi_controller_handle_t chdl);
The controller functions provide mechanisms for obtaining access to a controller, determining the characteristics of the controller, and releasing the controller.
The rsm_get_controller() function acquires a controller handle through the controller argument. The name argument is the specific controller instance (for example, "sci0" or "loopback"). This controller handle is used for subsequent RSMAPI calls.
The rsm_get_controller_attr() function obtains a controller's attributes through the attr argument. The chdl argument is the controller handle obtained by the rsm_get_controller() call. The attribute structure is defined in the <rsmapi> header.
The rsm_release_controller() function releases the resources associated with the controller identified by the controller handle chdl, obtained by calling rsm_get_controller(). Each rsm_release_controller() call must have a corresponding rsm_get_controller() call. It is illegal to access a controller or segments exported or imported using a released controller.
Upon successful completion, these functions return 0. Otherwise, an error value is returned to indicate the error.
The rsm_get_controller(), rsm_get_controller_attr(), and rsm_release_controller() functions can return the following errors:
Invalid controller handle.
The rsm_get_controller() and rsm_get_controller_attr() functions can return the following errors:
The rsm_get_controller() function can return the following errors:
Controller not present.
Invalid library version.
See attributes(5) for descriptions of the following attributes: