# code.\r
\r
all:\r
- make -C 'DFU/' clean\r
- make -C 'DFU/' all\r
+ make -C DFU clean\r
+ make -C DFU all\r
\r
- make -C 'CDC/' clean\r
- make -C 'CDC/' all\r
+ make -C CDC clean\r
+ make -C CDC all\r
\r
- make -C 'TeensyHID/' clean\r
- make -C 'TeensyHID/' all\r
+ make -C TeensyHID clean\r
+ make -C TeensyHID all\r
\r
%:\r
- make -C 'DFU/' $@\r
- make -C 'CDC/' $@\r
- make -C 'TeensyHID/' $@\r
+ make -C DFU $@\r
+ make -C CDC $@\r
+ make -C TeensyHID $@\r
# code.
%:
- make -C ClassDriver/ $@
- make -C LowLevel/ $@
+ make -C ClassDriver $@
+ make -C LowLevel $@
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,\r
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)\r
{\r
- printf("Error Retrieving Configuration Descriptor.\r\n");\r
+ puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
if (HID_Host_ConfigurePipes(&Joystick_HID_Interface,\r
ConfigDescriptorSize, ConfigDescriptorData) != HID_ENUMERROR_NoError)\r
{\r
- printf("Attached Device Not a Valid Joystick.\r\n");\r
+ puts_P(PSTR("Attached Device Not a Valid Joystick.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Setting Device Configuration.\r\n");\r
+ puts_P(PSTR("Error Setting Device Configuration.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (HID_Host_SetReportProtocol(&Joystick_HID_Interface) != 0)\r
{\r
- printf("Error Setting Report Protocol Mode or Not a Valid Joystick.\r\n");\r
+ puts_P(PSTR("Error Setting Report Protocol Mode or Not a Valid Joystick.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("Joystick Enumerated.\r\n");\r
+ puts_P(PSTR("Joystick Enumerated.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,\r
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)\r
{\r
- printf("Error Retrieving Configuration Descriptor.\r\n");\r
+ puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
if (HID_Host_ConfigurePipes(&Keyboard_HID_Interface,\r
ConfigDescriptorSize, ConfigDescriptorData) != HID_ENUMERROR_NoError)\r
{\r
- printf("Attached Device Not a Valid Keyboard.\r\n");\r
+ puts_P(PSTR("Attached Device Not a Valid Keyboard.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Setting Device Configuration.\r\n");\r
+ puts_P(PSTR("Error Setting Device Configuration.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (HID_Host_SetBootProtocol(&Keyboard_HID_Interface) != 0)\r
{\r
- printf("Could not Set Boot Protocol Mode.\r\n");\r
+ puts_P(PSTR("Could not Set Boot Protocol Mode.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("Keyboard Enumerated.\r\n");\r
+ puts_P(PSTR("Keyboard Enumerated.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,\r
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)\r
{\r
- printf("Error Retrieving Configuration Descriptor.\r\n");\r
+ puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
if (HID_Host_ConfigurePipes(&Keyboard_HID_Interface,\r
ConfigDescriptorSize, ConfigDescriptorData) != HID_ENUMERROR_NoError)\r
{\r
- printf("Attached Device Not a Valid Keyboard.\r\n");\r
+ puts_P(PSTR("Attached Device Not a Valid Keyboard.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Setting Device Configuration.\r\n");\r
+ puts_P(PSTR("Error Setting Device Configuration.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (HID_Host_SetReportProtocol(&Keyboard_HID_Interface) != 0)\r
{\r
- printf("Error Setting Report Protocol Mode or Not a Valid Keyboard.\r\n");\r
+ puts_P(PSTR("Error Setting Report Protocol Mode or Not a Valid Keyboard.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("Keyboard Enumerated.\r\n");\r
+ puts_P(PSTR("Keyboard Enumerated.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,\r
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)\r
{\r
- printf("Error Retrieving Configuration Descriptor.\r\n");\r
+ puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
if (MIDI_Host_ConfigurePipes(&Keyboard_MIDI_Interface,\r
ConfigDescriptorSize, ConfigDescriptorData) != MIDI_ENUMERROR_NoError)\r
{\r
- printf("Attached Device Not a Valid MIDI Class Device.\r\n");\r
+ puts_P(PSTR("Attached Device Not a Valid MIDI Class Device.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Setting Device Configuration.\r\n");\r
+ puts_P(PSTR("Error Setting Device Configuration.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("MIDI Device Enumerated.\r\n");\r
+ puts_P(PSTR("MIDI Device Enumerated.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,\r
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)\r
{\r
- printf("Error Retrieving Configuration Descriptor.\r\n");\r
+ puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
if (MS_Host_ConfigurePipes(&FlashDisk_MS_Interface,\r
ConfigDescriptorSize, ConfigDescriptorData) != MS_ENUMERROR_NoError)\r
{\r
- printf("Attached Device Not a Valid Mass Storage Device.\r\n");\r
+ puts_P(PSTR("Attached Device Not a Valid Mass Storage Device.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Setting Device Configuration.\r\n");\r
+ puts_P(PSTR("Error Setting Device Configuration.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("Mass Storage Device Enumerated.\r\n");\r
+ puts_P(PSTR("Mass Storage Device Enumerated.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
uint8_t MaxLUNIndex;\r
if (MS_Host_GetMaxLUN(&FlashDisk_MS_Interface, &MaxLUNIndex))\r
{\r
- printf("Error retrieving max LUN index.\r\n");\r
+ puts_P(PSTR("Error retrieving max LUN index.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("Total LUNs: %d - Using first LUN in device.\r\n", (MaxLUNIndex + 1));\r
+ printf_P(PSTR("Total LUNs: %d - Using first LUN in device.\r\n"), (MaxLUNIndex + 1));\r
\r
if (MS_Host_ResetMSInterface(&FlashDisk_MS_Interface))\r
{\r
- printf("Error resetting Mass Storage interface.\r\n");\r
+ puts_P(PSTR("Error resetting Mass Storage interface.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
SCSI_Request_Sense_Response_t SenseData;\r
if (MS_Host_RequestSense(&FlashDisk_MS_Interface, 0, &SenseData) != 0)\r
{\r
- printf("Error retrieving device sense.\r\n");\r
+ puts_P(PSTR("Error retrieving device sense.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (MS_Host_PreventAllowMediumRemoval(&FlashDisk_MS_Interface, 0, true))\r
{\r
- printf("Error setting Prevent Device Removal bit.\r\n");\r
+ puts_P(PSTR("Error setting Prevent Device Removal bit.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
SCSI_Inquiry_Response_t InquiryData;\r
if (MS_Host_GetInquiryData(&FlashDisk_MS_Interface, 0, &InquiryData))\r
{\r
- printf("Error retrieving device Inquiry data.\r\n");\r
+ puts_P(PSTR("Error retrieving device Inquiry data.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break; \r
}\r
\r
- printf("Vendor \"%.8s\", Product \"%.16s\"\r\n", InquiryData.VendorID, InquiryData.ProductID);\r
+ printf_P(PSTR("Vendor \"%.8s\", Product \"%.16s\"\r\n"), InquiryData.VendorID, InquiryData.ProductID);\r
\r
- printf("Waiting until ready...\r\n");\r
+ puts_P(PSTR("Waiting until ready...\r\n"));\r
\r
for (;;)\r
{\r
/* Check if an error other than a logical command error (device busy) received */\r
if (ErrorCode != MS_ERROR_LOGICAL_CMD_FAILED)\r
{\r
- printf("Error waiting for device to be ready.\r\n");\r
+ puts_P(PSTR("Error waiting for device to be ready.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
}\r
\r
- printf("Retrieving Capacity... ");\r
+ puts_P(PSTR("Retrieving Capacity...\r\n"));\r
\r
SCSI_Capacity_t DiskCapacity;\r
if (MS_Host_ReadDeviceCapacity(&FlashDisk_MS_Interface, 0, &DiskCapacity))\r
{\r
- printf("Error retrieving device capacity.\r\n");\r
+ puts_P(PSTR("Error retrieving device capacity.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("%lu blocks of %lu bytes.\r\n", DiskCapacity.Blocks, DiskCapacity.BlockSize);\r
+ printf_P(PSTR("%lu blocks of %lu bytes.\r\n"), DiskCapacity.Blocks, DiskCapacity.BlockSize);\r
\r
uint8_t BlockBuffer[DiskCapacity.BlockSize];\r
\r
if (MS_Host_ReadDeviceBlocks(&FlashDisk_MS_Interface, 0, 0x00000000, 1, DiskCapacity.BlockSize, BlockBuffer))\r
{\r
- printf("Error reading device block.\r\n");\r
+ puts_P(PSTR("Error reading device block.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("\r\nContents of first block:\r\n");\r
+ puts_P(PSTR("\r\nContents of first block:"));\r
\r
for (uint16_t Chunk = 0; Chunk < (DiskCapacity.BlockSize >> 4); Chunk++)\r
{\r
printf_P(PSTR("%.2X "), CurrByte);\r
}\r
\r
- printf(" ");\r
+ printf_P(PSTR(" "));\r
\r
/* Print out the 16 bytes of the chunk in ASCII format */\r
for (uint8_t ByteOffset = 0; ByteOffset < (1 << 4); ByteOffset++)\r
putchar(isprint(CurrByte) ? CurrByte : '.');\r
}\r
\r
- printf("\r\n");\r
+ printf_P(PSTR("\r\n"));\r
}\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,\r
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)\r
{\r
- printf("Error Retrieving Configuration Descriptor.\r\n");\r
+ puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
if (HID_Host_ConfigurePipes(&Mouse_HID_Interface,\r
ConfigDescriptorSize, ConfigDescriptorData) != HID_ENUMERROR_NoError)\r
{\r
- printf("Attached Device Not a Valid Mouse.\r\n");\r
+ puts_P(PSTR("Attached Device Not a Valid Mouse.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Setting Device Configuration.\r\n");\r
+ puts_P(PSTR("Error Setting Device Configuration.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (HID_Host_SetBootProtocol(&Mouse_HID_Interface) != 0)\r
{\r
- printf("Could not Set Boot Protocol Mode.\r\n");\r
+ puts_P(PSTR("Could not Set Boot Protocol Mode.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("Mouse Enumerated.\r\n");\r
+ puts_P(PSTR("Mouse Enumerated.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,\r
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)\r
{\r
- printf("Error Retrieving Configuration Descriptor.\r\n");\r
+ puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
if (HID_Host_ConfigurePipes(&Mouse_HID_Interface,\r
ConfigDescriptorSize, ConfigDescriptorData) != HID_ENUMERROR_NoError)\r
{\r
- printf("Attached Device Not a Valid Mouse.\r\n");\r
+ puts_P(PSTR("Attached Device Not a Valid Mouse.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Setting Device Configuration.\r\n");\r
+ puts_P(PSTR("Error Setting Device Configuration.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (HID_Host_SetReportProtocol(&Mouse_HID_Interface) != 0)\r
{\r
- printf("Error Setting Report Protocol Mode or Not a Valid Mouse.\r\n");\r
+ puts_P(PSTR("Error Setting Report Protocol Mode or Not a Valid Mouse.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("Mouse Enumerated.\r\n");\r
+ puts_P(PSTR("Mouse Enumerated.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,\r
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)\r
{\r
- printf("Error Retrieving Configuration Descriptor.\r\n");\r
+ puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
if (PRNT_Host_ConfigurePipes(&Printer_PRNT_Interface,\r
ConfigDescriptorSize, ConfigDescriptorData) != PRNT_ENUMERROR_NoError)\r
{\r
- printf("Attached Device Not a Valid Printer Class Device.\r\n");\r
+ puts_P(PSTR("Attached Device Not a Valid Printer Class Device.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Setting Device Configuration.\r\n");\r
+ puts_P(PSTR("Error Setting Device Configuration.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (PRNT_Host_SetBidirectionalMode(&Printer_PRNT_Interface) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Setting Bidirectional Mode.\r\n");\r
+ puts_P(PSTR("Error Setting Bidirectional Mode.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("Printer Device Enumerated.\r\n");\r
+ puts_P(PSTR("Printer Device Enumerated.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
case HOST_STATE_Configured:\r
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);\r
\r
- printf("Retrieving Device ID...\r\n");\r
+ puts_P(PSTR("Retrieving Device ID...\r\n"));\r
\r
char DeviceIDString[300];\r
if (PRNT_Host_GetDeviceID(&Printer_PRNT_Interface, DeviceIDString,\r
sizeof(DeviceIDString)) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Getting Device ID.\r\n");\r
+ puts_P(PSTR("Error Getting Device ID.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("Device ID: %s.\r\n", DeviceIDString);\r
+ printf_P(PSTR("Device ID: %s.\r\n"), DeviceIDString);\r
\r
char TestPageData[] = "\033%-12345X\033E" "LUFA PCL Test Page" "\033E\033%-12345X";\r
uint16_t TestPageLength = strlen(TestPageData);\r
\r
if (PRNT_Host_SendData(&Printer_PRNT_Interface, &TestPageData, TestPageLength) != PIPE_RWSTREAM_NoError)\r
{\r
- printf("Error Sending Page Data.\r\n");\r
+ puts_P(PSTR("Error Sending Page Data.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,\r
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)\r
{\r
- printf("Error Retrieving Configuration Descriptor.\r\n");\r
+ puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
if (RNDIS_Host_ConfigurePipes(&Ethernet_RNDIS_Interface,\r
ConfigDescriptorSize, ConfigDescriptorData) != RNDIS_ENUMERROR_NoError)\r
{\r
- printf("Attached Device Not a Valid RNDIS Class Device.\r\n");\r
+ puts_P(PSTR("Attached Device Not a Valid RNDIS Class Device.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Setting Device Configuration.\r\n");\r
+ puts_P(PSTR("Error Setting Device Configuration.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (RNDIS_Host_InitializeDevice(&Ethernet_RNDIS_Interface) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Initializing Device.\r\n");\r
+ puts_P(PSTR("Error Initializing Device.\r\n"));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break; \r
}\r
\r
- printf("Device Max Transfer Size: %lu bytes.\r\n", Ethernet_RNDIS_Interface.State.DeviceMaxPacketSize);\r
+ printf_P(PSTR("Device Max Transfer Size: %lu bytes.\r\n"), Ethernet_RNDIS_Interface.State.DeviceMaxPacketSize);\r
\r
uint32_t PacketFilter = (REMOTE_NDIS_PACKET_DIRECTED | REMOTE_NDIS_PACKET_BROADCAST | REMOTE_NDIS_PACKET_ALL_MULTICAST);\r
if (RNDIS_Host_SetRNDISProperty(&Ethernet_RNDIS_Interface, OID_GEN_CURRENT_PACKET_FILTER,\r
&PacketFilter, sizeof(PacketFilter)) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Setting Device Packet Filter.\r\n");\r
+ puts_P(PSTR("Error Setting Device Packet Filter.\r\n"));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
if (RNDIS_Host_QueryRNDISProperty(&Ethernet_RNDIS_Interface, OID_GEN_VENDOR_ID,\r
&VendorID, sizeof(VendorID)) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Getting Vendor ID.\r\n");\r
+ puts_P(PSTR("Error Getting Vendor ID.\r\n"));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("Device Vendor ID: 0x%08lX\r\n", VendorID);\r
+ printf_P(PSTR("Device Vendor ID: 0x%08lX\r\n"), VendorID);\r
\r
- printf("RNDIS Device Enumerated.\r\n");\r
+ puts_P(PSTR("RNDIS Device Enumerated.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
uint16_t PacketLength;\r
RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface, &PacketBuffer, &PacketLength);\r
\r
- printf("***PACKET (Size %d)***\r\n", PacketLength);\r
+ printf_P(PSTR("***PACKET (Size %d)***\r\n"), PacketLength);\r
\r
for (uint16_t i = 0; i < PacketLength; i++)\r
printf("%02x ", PacketBuffer[i]);\r
\r
- printf("\r\n\r\n");\r
+ printf_P(PSTR("\r\n\r\n"));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
}\r
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,\r
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)\r
{\r
- printf("Error Retrieving Configuration Descriptor.\r\n");\r
+ puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
if (SImage_Host_ConfigurePipes(&DigitalCamera_SI_Interface,\r
ConfigDescriptorSize, ConfigDescriptorData) != SI_ENUMERROR_NoError)\r
{\r
- printf("Attached Device Not a Valid Still Image Class Device.\r\n");\r
+ puts_P(PSTR("Attached Device Not a Valid Still Image Class Device.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Setting Device Configuration.\r\n");\r
+ puts_P(PSTR("Error Setting Device Configuration.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("Still Image Device Enumerated.\r\n");\r
+ puts_P(PSTR("Still Image Device Enumerated.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
case HOST_STATE_Configured:\r
- printf("Opening Session...\r\n");\r
+ puts_P(PSTR("Opening Session...\r\n"));\r
\r
if (SImage_Host_OpenSession(&DigitalCamera_SI_Interface) != PIPE_RWSTREAM_NoError)\r
{\r
- printf("Could not open PIMA session.\r\n");\r
+ puts_P(PSTR("Could not open PIMA session.\r\n"));\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("Turning off Device...\r\n");\r
+ puts_P(PSTR("Turning off Device...\r\n"));\r
\r
SImage_Host_SendCommand(&DigitalCamera_SI_Interface, 0x1013, 0, NULL);\r
if (SImage_Host_ReceiveResponse(&DigitalCamera_SI_Interface))\r
{\r
- printf("Could not turn off device.\r\n");\r
+ puts_P(PSTR("Could not turn off device.\r\n"));\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break; \r
}\r
\r
- printf("Device Off.\r\n");\r
+ puts_P(PSTR("Device Off.\r\n"));\r
\r
- printf("Closing Session...\r\n");\r
+ puts_P(PSTR("Closing Session...\r\n"));\r
\r
if (SImage_Host_CloseSession(&DigitalCamera_SI_Interface) != PIPE_RWSTREAM_NoError)\r
{\r
- printf("Could not close PIMA session.\r\n");\r
+ puts_P(PSTR("Could not close PIMA session.\r\n"));\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,\r
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)\r
{\r
- printf("Error Retrieving Configuration Descriptor.\r\n");\r
+ puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
if (CDC_Host_ConfigurePipes(&VirtualSerial_CDC_Interface,\r
ConfigDescriptorSize, ConfigDescriptorData) != CDC_ENUMERROR_NoError)\r
{\r
- printf("Attached Device Not a Valid CDC Class Device.\r\n");\r
+ puts_P(PSTR("Attached Device Not a Valid CDC Class Device.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
{\r
- printf("Error Setting Device Configuration.\r\n");\r
+ puts_P(PSTR("Error Setting Device Configuration.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
\r
- printf("CDC Device Enumerated.\r\n");\r
+ puts_P(PSTR("CDC Device Enumerated.\r\n"));\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
# code.
%:
- make -C ClassDriver/ $@
- make -C LowLevel/ $@
+ make -C ClassDriver $@
+ make -C LowLevel $@
# code.
%:
- make -C Device/ $@
- make -C Host/ $@
- make -C DualRole/ $@
+ make -C Device $@
+ make -C Host $@
+ make -C DualRole $@
* \param[in,out] Data Pointer to a number containing an even number of bytes to be reversed\r
* \param[in] Bytes Length of the data in bytes\r
*/\r
- static inline void SwapEndian_n(uint8_t* Data, uint8_t Bytes);\r
- static inline void SwapEndian_n(uint8_t* Data, uint8_t Bytes)\r
+ static inline void SwapEndian_n(void* Data, uint8_t Bytes);\r
+ static inline void SwapEndian_n(void* Data, uint8_t Bytes)\r
{\r
- uint8_t Temp;\r
- \r
+ uint8_t* CurrDataPos = Data;\r
+ \r
while (Bytes)\r
{\r
- Temp = *Data;\r
- *Data = *(Data + Bytes - 1);\r
- *(Data + Bytes - 1) = Temp;\r
+ uint8_t Temp = *CurrDataPos;\r
+ *CurrDataPos = *(CurrDataPos + Bytes - 1);\r
+ *(CurrDataPos + Bytes - 1) = Temp;\r
\r
- Data++;\r
+ CurrDataPos++;\r
Bytes -= 2;\r
}\r
}\r
{\r
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;\r
\r
- SCSICommandBlock->Tag = ++MSInterfaceInfo->State.TransactionTag;\r
+ SCSICommandBlock->Signature = CBW_SIGNATURE;\r
+ SCSICommandBlock->Tag = ++MSInterfaceInfo->State.TransactionTag;\r
\r
if (MSInterfaceInfo->State.TransactionTag == 0xFFFFFFFF)\r
MSInterfaceInfo->State.TransactionTag = 1;\r
\r
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)\r
{\r
- .Signature = CBW_SIGNATURE,\r
.DataTransferLength = sizeof(SCSI_Inquiry_Response_t),\r
.Flags = COMMAND_DIRECTION_DATA_IN,\r
.LUN = LUNIndex,\r
\r
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)\r
{\r
- .Signature = CBW_SIGNATURE,\r
.DataTransferLength = 0,\r
.Flags = COMMAND_DIRECTION_DATA_IN,\r
.LUN = LUNIndex,\r
\r
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)\r
{\r
- .Signature = CBW_SIGNATURE,\r
.DataTransferLength = sizeof(SCSI_Capacity_t),\r
.Flags = COMMAND_DIRECTION_DATA_IN,\r
.LUN = LUNIndex,\r
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, DeviceCapacity)) != PIPE_RWSTREAM_NoError)\r
return ErrorCode;\r
\r
- DeviceCapacity->Blocks = SwapEndian_32(DeviceCapacity->Blocks);\r
- DeviceCapacity->BlockSize = SwapEndian_32(DeviceCapacity->BlockSize);\r
+ SwapEndian_n(&DeviceCapacity->Blocks, sizeof(DeviceCapacity->Blocks));\r
+ SwapEndian_n(&DeviceCapacity->BlockSize, sizeof(DeviceCapacity->BlockSize));\r
\r
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)\r
return ErrorCode;\r
\r
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)\r
{\r
- .Signature = CBW_SIGNATURE,\r
.DataTransferLength = sizeof(SCSI_Request_Sense_Response_t),\r
.Flags = COMMAND_DIRECTION_DATA_IN,\r
.LUN = LUNIndex,\r
\r
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)\r
{\r
- .Signature = CBW_SIGNATURE,\r
.DataTransferLength = 0,\r
.Flags = COMMAND_DIRECTION_DATA_OUT,\r
.LUN = LUNIndex,\r
\r
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)\r
{\r
- .Signature = CBW_SIGNATURE,\r
.DataTransferLength = ((uint32_t)Blocks * BlockSize),\r
.Flags = COMMAND_DIRECTION_DATA_IN,\r
.LUN = LUNIndex,\r
\r
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)\r
{\r
- .Signature = CBW_SIGNATURE,\r
.DataTransferLength = ((uint32_t)Blocks * BlockSize),\r
.Flags = COMMAND_DIRECTION_DATA_OUT,\r
.LUN = LUNIndex,\r
* builds of avrdude at the expense of AVRStudio compatibility\r
* - Removed two-step endpoint/pipe bank clear and switch sequence for smaller, faster endpoint/pipe code\r
* - The USB_Init() function no longer calls sei() - the user is now responsible for enabling interrupts when they are ready\r
+ * for them to be enabled (thanks to Andrei Krainev)\r
*\r
* <b>Fixed:</b>\r
* - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin\r
%:\r
@echo Executing \"make $@\" on all LUFA library elements.\r
@echo\r
- make -C LUFA/ $@ -s\r
- make -C Demos/ $@ -s\r
- make -C Projects/ $@ -s\r
- make -C Bootloaders/ $@ -s\r
+ make -C LUFA $@ -s\r
+ make -C Demos $@ -s\r
+ make -C Projects $@ -s\r
+ make -C Bootloaders $@ -s\r
@echo\r
@echo LUFA \"make $@\" operation complete.\r