Example #1
0
flim::flim(flib_link_flesin* link) {
  m_rfflim = std::unique_ptr<register_file>(new register_file_bar(
      link->bar(),
      (link->base_addr() + (1 << RORC_DMA_CMP_SEL) + (1 << RORC_C_LINK_SEL))));
  if (hardware_id() != 0x4844) {
    std::stringstream msg;
    msg << "FLIM not reachable; found ID: " << std::hex << hardware_id();
    throw FlibException(msg.str());
  }
  if (hardware_ver() != 3) {
    std::stringstream msg;
    msg << "FLIM hardware version not supported; found ver: " << hardware_ver();
    throw FlibException(msg.str());
  }
}
Example #2
0
int _cdecl wmain(int argc, wchar_t** argv)
{
	bool show_usage = false;
	int exit_code = EXIT_FAILURE;
	bool reboot_required = false;

	if (argc <= 1)
	{
		show_usage = true;
	} else
	{
		std::wstring command(argv[1]);

		if (command == TEXT("install"))
		{
			if (argc <= 3)
			{
				show_usage = true;
			} else
			{
				std::wstring inf(argv[2]);
				std::wstring hardware_id(argv[3]);

				if (install(inf, hardware_id, reboot_required))
				{
					exit_code = reboot_required ? EXIT_REBOOT_REQUIRED : EXIT_SUCCESS;

					std::wcerr << "Installation of \"" << inf << "\" (" << hardware_id << ") succeeded." << std::endl;
					
					if (reboot_required)
					{
						std::wcerr << "A reboot is required to complete the operation." << std::endl;
					}
				} else
				{
					std::wcerr << "Installation of \"" << inf << "\" (" << hardware_id << ") failed." << std::endl;
				}
			}
		} else if (command == TEXT("remove"))
		{
			if (argc <= 2)
			{
				show_usage = true;
			} else
			{
				std::wstring hardware_id(argv[2]);

				if (remove(hardware_id, reboot_required))
				{
					exit_code = reboot_required ? EXIT_REBOOT_REQUIRED : EXIT_SUCCESS;

					std::wcerr << "Removal of \"" << hardware_id << "\" succeeded." << std::endl;

					if (reboot_required)
					{
						std::wcerr << "A reboot is required to complete the operation." << std::endl;
					}
				} else
				{
					std::wcerr << "Removal of \"" << hardware_id << "\" failed." << std::endl;
				}
			}
		} else
		{
			std::wcerr << "Unknown command \"" << command << "\"." << std::endl;
			show_usage = true;
		}
	}

	if (show_usage)
	{
		std::wcerr << "Usage:\ttap-setup.exe install <inf> <hardware_id>" << std::endl;
		std::wcerr << "      \ttap-setup.exe remove <hardware_id>" << std::endl;
		std::wcerr << std::endl;
		std::wcerr << "Returns 0 on success, 1 on failure and 2 if a reboot is required to complete the operation." << std::endl;

		exit_code = EXIT_FAILURE;
	}

	return exit_code;
}