Exemplo n.º 1
0
static size_t loc_count_services_internal(async_exch_t *exch,
    service_id_t ns_handle)
{
	sysarg_t count;
	int retval = async_req_1_1(exch, LOC_GET_SERVICE_COUNT, ns_handle,
	    &count);
	if (retval != EOK)
		return 0;
	
	return count;
}
Exemplo n.º 2
0
loc_object_type_t loc_id_probe(service_id_t handle)
{
	async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER);
	
	sysarg_t type;
	int retval = async_req_1_1(exch, LOC_ID_PROBE, handle, &type);
	
	loc_exchange_end(exch);
	
	if (retval != EOK)
		return LOC_OBJECT_NONE;
	
	return (loc_object_type_t) type;
}
Exemplo n.º 3
0
/** Determine if defective (erroneous) packets are received.
 *
 * @param[in]  dev_sess
 * @param[out] mode     Bitmask specifying allowed errors
 *
 * @return EOK If the operation was successfully completed
 *
 */
int nic_defective_get_mode(async_sess_t *dev_sess, uint32_t *mode)
{
	assert(mode);
	
	sysarg_t _mode;
	
	async_exch_t *exch = async_exchange_begin(dev_sess);
	int rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
	    NIC_DEFECTIVE_GET_MODE, &_mode);
	async_exchange_end(exch);
	
	*mode = (uint32_t) _mode;
	
	return rc;
}
Exemplo n.º 4
0
/** Determine if broadcast packets are received.
 *
 * @param[in]  dev_sess
 * @param[out] mode     Current operation mode
 *
 * @return EOK If the operation was successfully completed
 *
 */
int nic_broadcast_get_mode(async_sess_t *dev_sess, nic_broadcast_mode_t *mode)
{
	assert(mode);
	
	sysarg_t _mode;
	
	async_exch_t *exch = async_exchange_begin(dev_sess);
	int rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
	    NIC_BROADCAST_GET_MODE, &_mode);
	async_exchange_end(exch);
	
	*mode = (nic_broadcast_mode_t) _mode;
	
	return rc;
}
Exemplo n.º 5
0
/** Request status of the cable (plugged/unplugged)
 *
 * @param[in]  dev_sess
 * @param[out] cable_state Current cable state
 *
 * @return EOK If the operation was successfully completed
 *
 */
int nic_get_cable_state(async_sess_t *dev_sess, nic_cable_state_t *cable_state)
{
	assert(cable_state);
	
	sysarg_t _cable_state;
	
	async_exch_t *exch = async_exchange_begin(dev_sess);
	int rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
	    NIC_GET_CABLE_STATE, &_cable_state);
	async_exchange_end(exch);
	
	*cable_state = (nic_cable_state_t) _cable_state;
	
	return rc;
}
Exemplo n.º 6
0
/** Read the current battery charge level from the device
 *
 * @param sess     Session of the device
 * @param level    Battery charge level (0 - 100)
 *
 * @return         EOK on success or a negative error code
 */
int
battery_charge_level_get(async_sess_t *sess, int *level)
{
	sysarg_t charge_level;

	async_exch_t *exch = async_exchange_begin(sess);

	int const rc = async_req_1_1(exch, DEV_IFACE_ID(BATTERY_DEV_IFACE),
	    BATTERY_CHARGE_LEVEL_GET, &charge_level);

	async_exchange_end(exch);

	if (rc == EOK)
		*level = (int) charge_level;

	return rc;
}
Exemplo n.º 7
0
/** Read the current battery status from the device
 *
 * @param sess     Session of the device
 * @param status   Current status of the battery
 *
 * @return         EOK on success or a negative error code
 */
int
battery_status_get(async_sess_t *sess, battery_status_t *batt_status)
{
	sysarg_t status;

	async_exch_t *exch = async_exchange_begin(sess);

	int const rc = async_req_1_1(exch, DEV_IFACE_ID(BATTERY_DEV_IFACE),
	    BATTERY_STATUS_GET, &status);

	async_exchange_end(exch);

	if (rc == EOK)
		*batt_status = (battery_status_t) status;

	return rc;
}
Exemplo n.º 8
0
int ahci_get_block_size(async_sess_t *sess, size_t *blocks_size)
{
	async_exch_t *exch = async_exchange_begin(sess);
	if (!exch)
		return EINVAL;
	
	sysarg_t bs;
	int rc = async_req_1_1(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
	    IPC_M_AHCI_GET_BLOCK_SIZE, &bs);
	
	async_exchange_end(exch);
	
	if (rc == EOK)
		*blocks_size = (size_t) bs;
	
	return rc;
}