Ejemplo n.º 1
0
static void manager (struct plc * plc, signed count, signed pause)

{
	while (count--)
	{
		if (_anyset (plc->flags, PLC_VERSION))
		{
			VersionInfo1 (plc);
		}
		if (_anyset (plc->flags, PLC_ATTRIBUTES))
		{
			Attributes1 (plc);
		}
		if (_anyset (plc->flags, PLC_WATCHDOG_REPORT))
		{
			WatchdogReport (plc);
		}
		if (_anyset (plc->flags, PLC_NVRAM_INFO))
		{
			NVRAMInfo (plc);
		}
		if (_anyset (plc->flags, PLC_SDRAM_INFO))
		{
			SDRAMInfo (plc);
		}
		if (_anyset (plc->flags, PLC_READ_IDENTITY))
		{
			Identity1 (plc);
		}
		if (_anyset (plc->flags, PLC_REMOTEHOSTS))
		{
			RemoteHosts (plc);
		}
		if (_anyset (plc->flags, PLC_NETWORK))
		{
			NetInfo2 (plc);
		}
		if (_anyset (plc->flags, PLC_WRITE_MAC))
		{
			WriteNVM (plc);
		}
		if (_anyset (plc->flags, PLC_READ_MAC))
		{
			ReadFirmware1 (plc);
		}
		if (_anyset (plc->flags, PLC_WRITE_PIB))
		{
			WritePIB (plc);
		}
		if (_anyset (plc->flags, PLC_READ_PIB))
		{
			ReadParameters1 (plc);
		}
		if (_anyset (plc->flags, PLC_HOST_ACTION))
		{
			HostActionResponse (plc);
		}
		if (_anyset (plc->flags, PLC_PUSH_BUTTON))
		{
			PushButton (plc);
		}
		if (_anyset (plc->flags, (PLC_SETLOCALKEY | PLC_SETREMOTEKEY)))
		{
			SetNMK (plc);
		}
		if (_anyset (plc->flags, PLC_FACTORY_DEFAULTS))
		{
			FactoryDefaults (plc);
		}
		if (_anyset (plc->flags, PLC_FLASH_DEVICE))
		{
			FlashNVM (plc);
		}
		if (_anyset (plc->flags, PLC_RESET_DEVICE))
		{
			ResetDevice (plc);
		}
		sleep (pause);
	}
	return;
}
Ejemplo n.º 2
0
signed PLCNetworkInfo (struct plc * plc)

{
	signed status;
	struct channel * channel = (struct channel *)(plc->channel);
	struct message * message = (struct message *)(plc->message);

#ifndef __GNUC__
#pragma pack (push,1)
#endif

	struct __packed vs_sw_ver_request
	{
		struct ethernet_hdr ethernet;
		struct qualcomm_hdr qualcomm;
		uint8_t MSTATUS;
		uint8_t MDEVICEID;
		uint8_t MVERLENGTH;
		char MVERSION [PLC_VERSION_STRING];
	}
	* request = (struct vs_sw_ver_request *) (message);
	struct __packed vs_sw_ver_confirm
	{
		struct ethernet_hdr ethernet;
		struct qualcomm_hdr qualcomm;
		uint8_t MSTATUS;
		uint8_t MDEVICEID;
		uint8_t MVERLENGTH;
		char MVERSION [PLC_VERSION_STRING];
	}
	* confirm = (struct vs_sw_ver_confirm *) (message);

#ifndef __GNUC__
#pragma pack (pop)
#endif

	memset (message, 0, sizeof (* message));
	EthernetHeader (&request->ethernet, channel->peer, channel->host, channel->type);
	QualcommHeader (&request->qualcomm, 0, (VS_SW_VER | MMTYPE_REQ));
	plc->packetsize = (ETHER_MIN_LEN - ETHER_CRC_LEN);
	if (SendMME (plc) <= 0)
	{
		error (PLC_EXIT (plc), errno, CHANNEL_CANTSEND);
		return (-1);
	}
	if (ReadMME (plc, 0, (VS_SW_VER | MMTYPE_CNF)) <= 0)
	{
		error (PLC_EXIT (plc), errno, CHANNEL_CANTREAD);
		return (-1);
	}
	if (confirm->MSTATUS)
	{
		Failure (plc, "Device will not start");
		return (-1);
	}
	chipset (confirm);
	if ((plc->hardwareID = confirm->MDEVICEID) < CHIPSET_AR7400)
	{
		status = NetInfo1 (plc);
	}
	else
	{
		status = NetInfo2 (plc);
	}
	return (status);
}
Ejemplo n.º 3
0
static void manager (struct plc * plc, signed count, signed pause) 

{
	while (count--) 
	{
		if (_anyset (plc->flags, PLC_VERSION)) 
		{
			VersionInfo2 (plc);
		}
		if (_anyset (plc->flags, PLC_ATTRIBUTES)) 
		{
			Attributes2 (plc);
		}
		if (_anyset (plc->flags, PLC_WATCHDOG_REPORT)) 
		{
			WatchdogReport (plc);
		}
		if (_anyset (plc->flags, PLC_NVRAM_INFO)) 
		{
			NVRAMInfo (plc);
		}
		if (_anyset (plc->flags, PLC_READ_IDENTITY)) 
		{
			Identity2 (plc);
		}
		if (_anyset (plc->flags, PLC_REMOTEHOSTS)) 
		{
			RemoteHosts (plc);
		}
		if (_anyset (plc->flags, PLC_NETWORK)) 
		{
			NetInfo2 (plc);
		}
		if (_anyset (plc->flags, PLC_READ_PIB)) 
		{
			ModuleRead (plc, &plc->pib, PLC_MOD_OP_READ_MEMORY, PLC_MODULEID_PARAMETERS, 0);
		}
		if (_anyset (plc->flags, PLC_READ_MAC)) 
		{
			ModuleRead (plc, &plc->nvm, PLC_MOD_OP_READ_MEMORY, PLC_MODULEID_FIRMWARE, 0);
		}
		if (_anyset (plc->flags, PLC_HOST_ACTION)) 
		{
			HostActionResponse (plc);
		}
		if (_anyset (plc->flags, PLC_PUSH_BUTTON)) 
		{
			PushButton (plc);
		}
		if (_anyset (plc->flags, PLC_FACTORY_DEFAULTS)) 
		{
			FactoryDefaults (plc);
		}
		if (_anyset (plc->flags, (PLC_SETLOCALKEY | PLC_SETREMOTEKEY))) 
		{
			SetNMK (plc);
		}
		if (_anyset (plc->flags, PLC_FLASH_DEVICE)) 
		{
			FlashDevice2 (plc);
		}
		if (_anyset (plc->flags, PLC_RESET_DEVICE)) 
		{
			ResetDevice (plc);
		}
		sleep (pause);
	}
	return;
}