Exemple #1
0
/*
 * []----
 * | sbc_write_cmplt -- deal with end game of write
 * |
 * | See if all of the data for this write operation has been dealt
 * | with. If so, send a final acknowledgement back to the transport.
 * | If not, update the offset, calculate the next transfer size, and
 * | start the process again.
 * []---
 */
static void
sbc_write_cmplt(emul_handle_t e)
{
	disk_io_t	*io	= (disk_io_t *)e;
	t10_cmd_t	*cmd	= io->da_cmd;

	if ((io->da_offset + io->da_data_len) < (io->da_lba_cnt * 512)) {
		if (io->da_data_alloc == True) {
			io->da_data_alloc = False;
			free(io->da_data);
		}

		io->da_offset	+= io->da_data_len;
		io->da_data_len	= MIN(cmd->c_lu->l_targ->s_maxout,
		    (io->da_lba_cnt * 512) - io->da_offset);
		sbc_write(cmd, cmd->c_cdb, cmd->c_cdb_len);
		return;
	}
	sbc_io_free(io);
	trans_send_complete(cmd, STATUS_GOOD);
}
Exemple #2
0
int charger_set_option(int option)
{
	return sbc_write(BQ24735_CHARGE_OPTION, option);
}
Exemple #3
0
int charger_set_input_current(int input_current)
{
	return sbc_write(BQ24735_INPUT_CURRENT,
			 CURRENT_TO_REG(input_current, R_AC));
}
Exemple #4
0
int charger_set_voltage(int voltage)
{
	return sbc_write(SB_CHARGING_VOLTAGE, voltage);
}
Exemple #5
0
int charger_set_current(int current)
{
	current = charger_closest_current(current);

	return sbc_write(SB_CHARGING_CURRENT, CURRENT_TO_REG(current, R_SNS));
}