Esempio n. 1
0
int pci_config_space_read_8(async_sess_t *sess, uint32_t address, uint8_t *val)
{
	sysarg_t res = 0;
	
	async_exch_t *exch = async_exchange_begin(sess);
	int rc = async_req_2_1(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
	    IPC_M_CONFIG_SPACE_READ_8, address, &res);
	async_exchange_end(exch);
	
	*val = (uint8_t) res;
	return rc;
}
Esempio n. 2
0
/**
 * Get current level of a control item.
 * @param[in] exch IPC exchange connected to the device.
 * @param[in] item The control item controlling the channel.
 * @param[in] channel The channel index.
 * @param[out] level Currently set value.
 * @return Error code.
 */
int audio_mixer_get_item_level(async_exch_t *exch, unsigned item,
    unsigned *level)
{
	if (!exch)
		return EINVAL;
	sysarg_t current;
	const int ret = async_req_2_1(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
	    IPC_M_AUDIO_MIXER_GET_ITEM_LEVEL, item, &current);
	if (ret == EOK && level)
		*level = current;
	return ret;
}
Esempio n. 3
0
/** Get number of virtues that can be enabled yet.
 *
 * Count: < 0 => Virtue of this type can be never used
 *        = 0 => No more virtues can be enabled
 *        > 0 => #count virtues can be enabled yet
 *
 * @param[in]  dev_sess
 * @param[in]  type     Virtue type
 * @param[out] count    Number of virtues
 *
 * @return EOK If the operation was successfully completed
 *
 */
int nic_wol_virtue_get_caps(async_sess_t *dev_sess, nic_wv_type_t type,
    int *count)
{
	assert(count);
	
	sysarg_t _count;
	
	async_exch_t *exch = async_exchange_begin(dev_sess);
	int rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
	    NIC_WOL_VIRTUE_GET_CAPS, (sysarg_t) type, &_count);
	async_exchange_end(exch);
	
	*count = (int) _count;
	return rc;
}
Esempio n. 4
0
int inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
{
	sysarg_t local_addr;
	async_exch_t *exch = async_exchange_begin(inet_sess);

	int rc = async_req_2_1(exch, INET_GET_SRCADDR, remote->ipv4,
	    tos, &local_addr);
	async_exchange_end(exch);

	if (rc != EOK)
		return rc;

	local->ipv4 = local_addr;
	return EOK;
}
Esempio n. 5
0
/** Query the current interrupt/poll mode of the NIC
 *
 * @param[in]  dev_sess
 * @param[out] mode     Current poll mode
 * @param[out] period   Period used in periodic polling.
 *                      Can be NULL.
 *
 * @return EOK If the operation was successfully completed
 *
 */
int nic_poll_get_mode(async_sess_t *dev_sess, nic_poll_mode_t *mode,
    struct timeval *period)
{
	assert(mode);
	
	sysarg_t _mode;
	
	async_exch_t *exch = async_exchange_begin(dev_sess);
	
	int rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
	    NIC_POLL_GET_MODE, period != NULL, &_mode);
	if (rc != EOK) {
		async_exchange_end(exch);
		return rc;
	}
	
	*mode = (nic_poll_mode_t) _mode;
	
	if (period != NULL)
		rc = async_data_read_start(exch, period, sizeof(struct timeval));
	
	async_exchange_end(exch);
	return rc;
}