Ejemplo n.º 1
0
static int		send_os    (CalcHandle* handle, FlashContent* content)
{
	uint8_t status, value;

	if(content == NULL)
		return -1;

	tifiles_hexdump(content->data_part + content->data_length - 16, 16);

	TRYF(nsp_session_open(handle, SID_OS_INSTALL));

	TRYF(nsp_cmd_s_os_install(handle, content->data_length));
	TRYF(nsp_cmd_r_os_install(handle));

	TRYF(nsp_cmd_s_os_contents(handle, 253, content->data_part));
	TRYF(nsp_cmd_r_status(handle, &status));
	TRYF(nsp_cmd_s_os_contents(handle, content->data_length - 253, content->data_part + 253));

	update_->cnt2 = 0;
	update_->max2 = 100;
	update_->pbar();

	do
	{
		TRYF(nsp_cmd_r_progress(handle, &value));

		update_->cnt2 = value;
		update_->pbar();
	} while(value < 100 );

	TRYF(nsp_session_close(handle));

	return 0;
}
Ejemplo n.º 2
0
static int		send_os    (CalcHandle* handle, FlashContent* content)
{
	int ret;

	if (content == NULL)
	{
		return -1;
	}

	tifiles_hexdump(content->data_part + content->data_length - 16, 16);

	do
	{
		ret = nsp_session_open(handle, NSP_SID_OS_INSTALL);
		if (!ret)
		{
			uint8_t value;

			ret = nsp_cmd_s_os_install(handle, content->data_length);
			if (ret)
			{
				break;
			}
			ret = nsp_cmd_r_os_install(handle);
			if (!ret)
			{
				uint8_t status;
				ret = nsp_cmd_s_os_contents(handle, 253, content->data_part);
				if (ret)
				{
					break;
				}
				ret = nsp_cmd_r_status(handle, &status);
				if (ret)
				{
					break;
				}
				ret = nsp_cmd_s_os_contents(handle, content->data_length - 253, content->data_part + 253);
				if (ret)
				{
					break;
				}
			}

			update_->cnt2 = 0;
			update_->max2 = 100;
			update_->pbar();

			do
			{
				ret = nsp_cmd_r_progress(handle, &value);
				if (ret)
				{
					break;
				}

				update_->cnt2 = value;
				update_->pbar();
			} while (value < 100);

			DO_CLOSE_SESSION(handle);
		}
	} while (0);

	return ret;
}