From d66f227ccef46a65e17b06d31c82c30158ae36a5 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Mon, 25 Jan 2010 12:01:02 +0000 Subject: Neaten Webserver project code. --- Projects/Incomplete/Webserver/Webserver.c | 32 +------------------------------ 1 file changed, 1 insertion(+), 31 deletions(-) (limited to 'Projects/Incomplete/Webserver/Webserver.c') diff --git a/Projects/Incomplete/Webserver/Webserver.c b/Projects/Incomplete/Webserver/Webserver.c index c0ceeed78..1bc658fb4 100644 --- a/Projects/Incomplete/Webserver/Webserver.c +++ b/Projects/Incomplete/Webserver/Webserver.c @@ -71,8 +71,6 @@ int main(void) { SetupHardware(); - puts_P(PSTR(ESC_FG_CYAN "RNDIS Host Demo running.\r\n" ESC_FG_WHITE)); - LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); for (;;) @@ -88,7 +86,6 @@ int main(void) if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData, sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful) { - printf("Error Retrieving Configuration Descriptor.\r\n"); LEDs_SetAllLEDs(LEDMASK_USB_ERROR); USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; @@ -97,7 +94,6 @@ int main(void) if (RNDIS_Host_ConfigurePipes(&Ethernet_RNDIS_Interface, ConfigDescriptorSize, ConfigDescriptorData) != RNDIS_ENUMERROR_NoError) { - printf("Attached Device Not a Valid RNDIS Class Device.\r\n"); LEDs_SetAllLEDs(LEDMASK_USB_ERROR); USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; @@ -105,7 +101,6 @@ int main(void) if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful) { - printf("Error Setting Device Configuration.\r\n"); LEDs_SetAllLEDs(LEDMASK_USB_ERROR); USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; @@ -113,21 +108,15 @@ int main(void) if (RNDIS_Host_InitializeDevice(&Ethernet_RNDIS_Interface) != HOST_SENDCONTROL_Successful) { - printf("Error Initializing Device.\r\n"); - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; } - printf("Device Max Transfer Size: %lu bytes.\r\n", Ethernet_RNDIS_Interface.State.DeviceMaxPacketSize); - uint32_t PacketFilter = (REMOTE_NDIS_PACKET_DIRECTED | REMOTE_NDIS_PACKET_BROADCAST); if (RNDIS_Host_SetRNDISProperty(&Ethernet_RNDIS_Interface, OID_GEN_CURRENT_PACKET_FILTER, &PacketFilter, sizeof(PacketFilter)) != HOST_SENDCONTROL_Successful) { - printf("Error Setting Device Packet Filter.\r\n"); - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; @@ -137,22 +126,14 @@ int main(void) if (RNDIS_Host_QueryRNDISProperty(&Ethernet_RNDIS_Interface, OID_802_3_CURRENT_ADDRESS, &MACAddress, sizeof(MACAddress)) != HOST_SENDCONTROL_Successful) { - printf("Error Getting MAC Address.\r\n"); - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; } - printf("MAC Address: 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\r\n", - MACAddress.addr[0], MACAddress.addr[1], MACAddress.addr[2], - MACAddress.addr[3], MACAddress.addr[4], MACAddress.addr[5]); - uip_setethaddr(MACAddress); LEDs_SetAllLEDs(LEDMASK_USB_READY); - - printf("RNDIS Device Enumerated.\r\n"); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: @@ -253,7 +234,6 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ - SerialStream_Init(9600, false); LEDs_Init(); USB_Init(); @@ -273,7 +253,7 @@ void SetupHardware(void) uip_setdraddr(&GatewayIPAddress); /* HTTP Webserver Initialization */ - uip_listen(HTONS(80)); + WebserverApp_Init(); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and @@ -281,7 +261,6 @@ void SetupHardware(void) */ void EVENT_USB_Host_DeviceAttached(void) { - puts_P(PSTR("Device Attached.\r\n")); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } @@ -290,7 +269,6 @@ void EVENT_USB_Host_DeviceAttached(void) */ void EVENT_USB_Host_DeviceUnattached(void) { - puts_P(PSTR("\r\nDevice Unattached.\r\n")); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } @@ -307,9 +285,6 @@ void EVENT_USB_Host_HostError(const uint8_t ErrorCode) { USB_ShutDown(); - printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n" - " -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode); - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); for(;;); } @@ -319,10 +294,5 @@ void EVENT_USB_Host_HostError(const uint8_t ErrorCode) */ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) { - printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n" - " -- Error Code %d\r\n" - " -- Sub Error Code %d\r\n" - " -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState); - LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } -- cgit v1.2.3