mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-06-26 19:12:09 +00:00
Conversion of old incomplete SideShow demo to new APIs.
This commit is contained in:
parent
bf041e8bbf
commit
f51017f8fb
@ -154,7 +154,7 @@ USB_OSCompatibleIDDescriptor_t PROGMEM DevCompatIDs =
|
|||||||
SubCompatibleID: "UNIV1"}
|
SubCompatibleID: "UNIV1"}
|
||||||
};
|
};
|
||||||
|
|
||||||
uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||||
{
|
{
|
||||||
const uint8_t DescriptorType = (wValue >> 8);
|
const uint8_t DescriptorType = (wValue >> 8);
|
||||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||||
@ -165,30 +165,30 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
|
|||||||
switch (DescriptorType)
|
switch (DescriptorType)
|
||||||
{
|
{
|
||||||
case DTYPE_Device:
|
case DTYPE_Device:
|
||||||
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor);
|
Address = (void*)&DeviceDescriptor;
|
||||||
Size = sizeof(USB_Descriptor_Device_t);
|
Size = sizeof(USB_Descriptor_Device_t);
|
||||||
break;
|
break;
|
||||||
case DTYPE_Configuration:
|
case DTYPE_Configuration:
|
||||||
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor);
|
Address = (void*)&ConfigurationDescriptor;
|
||||||
Size = sizeof(USB_Descriptor_Configuration_t);
|
Size = sizeof(USB_Descriptor_Configuration_t);
|
||||||
break;
|
break;
|
||||||
case DTYPE_String:
|
case DTYPE_String:
|
||||||
switch (DescriptorNumber)
|
switch (DescriptorNumber)
|
||||||
{
|
{
|
||||||
case 0x00:
|
case 0x00:
|
||||||
Address = DESCRIPTOR_ADDRESS(LanguageString);
|
Address = (void*)&LanguageString;
|
||||||
Size = pgm_read_byte(&LanguageString.Header.Size);
|
Size = pgm_read_byte(&LanguageString.Header.Size);
|
||||||
break;
|
break;
|
||||||
case 0x01:
|
case 0x01:
|
||||||
Address = DESCRIPTOR_ADDRESS(ManufacturerString);
|
Address = (void*)&ManufacturerString;
|
||||||
Size = pgm_read_byte(&ManufacturerString.Header.Size);
|
Size = pgm_read_byte(&ManufacturerString.Header.Size);
|
||||||
break;
|
break;
|
||||||
case 0x02:
|
case 0x02:
|
||||||
Address = DESCRIPTOR_ADDRESS(ProductString);
|
Address = (void*)&ProductString;
|
||||||
Size = pgm_read_byte(&ProductString.Header.Size);
|
Size = pgm_read_byte(&ProductString.Header.Size);
|
||||||
break;
|
break;
|
||||||
case 0x03:
|
case 0x03:
|
||||||
Address = DESCRIPTOR_ADDRESS(SerialNumberString);
|
Address = (void*)&SerialNumberString;
|
||||||
Size = pgm_read_byte(&SerialNumberString.Header.Size);
|
Size = pgm_read_byte(&SerialNumberString.Header.Size);
|
||||||
break;
|
break;
|
||||||
case 0xEE:
|
case 0xEE:
|
||||||
@ -197,7 +197,7 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
|
|||||||
our device is Sideshow compatible. Most people would be happy using the normal
|
our device is Sideshow compatible. Most people would be happy using the normal
|
||||||
0xFF 0x?? 0x?? Class/Subclass/Protocol values like the USBIF intended. */
|
0xFF 0x?? 0x?? Class/Subclass/Protocol values like the USBIF intended. */
|
||||||
|
|
||||||
Address = DESCRIPTOR_ADDRESS(OSDescriptorString);
|
Address = (void*)&OSDescriptorString;
|
||||||
Size = pgm_read_byte(&OSDescriptorString.Header.Size);
|
Size = pgm_read_byte(&OSDescriptorString.Header.Size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -221,7 +221,7 @@ bool USB_GetOSFeatureDescriptor(const uint16_t wValue, const uint8_t wIndex,
|
|||||||
/* Only the Extended Device Compatibility descriptor is supported */
|
/* Only the Extended Device Compatibility descriptor is supported */
|
||||||
if (wIndex == EXTENDED_COMPAT_ID_DESCRIPTOR)
|
if (wIndex == EXTENDED_COMPAT_ID_DESCRIPTOR)
|
||||||
{
|
{
|
||||||
Address = DESCRIPTOR_ADDRESS(DevCompatIDs);
|
Address = (void*)&DevCompatIDs;
|
||||||
Size = sizeof(USB_OSCompatibleIDDescriptor_t);
|
Size = sizeof(USB_OSCompatibleIDDescriptor_t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
} USB_OSCompatibleIDDescriptor_t;
|
} USB_OSCompatibleIDDescriptor_t;
|
||||||
|
|
||||||
/* Function Prototypes: */
|
/* Function Prototypes: */
|
||||||
uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
||||||
ATTR_WARN_UNUSED_RESULT ATTR_WEAK ATTR_NON_NULL_PTR_ARG(3);
|
ATTR_WARN_UNUSED_RESULT ATTR_WEAK ATTR_NON_NULL_PTR_ARG(3);
|
||||||
|
|
||||||
bool USB_GetOSFeatureDescriptor(const uint16_t wValue, const uint8_t wIndex,
|
bool USB_GetOSFeatureDescriptor(const uint16_t wValue, const uint8_t wIndex,
|
||||||
|
@ -48,162 +48,98 @@
|
|||||||
constraints, new content can be requested as needed.
|
constraints, new content can be requested as needed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
USB Mode: Device
|
|
||||||
USB Class: Sideshow Device (Microsoft Only)
|
|
||||||
USB Subclass: Bulk Only
|
|
||||||
Relevant Standards: Microsoft Sideshow Specification
|
|
||||||
Microsoft OS Descriptors Specification
|
|
||||||
XML Specification
|
|
||||||
Usable Speeds: Full Speed Mode
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "Sideshow.h"
|
#include "Sideshow.h"
|
||||||
|
|
||||||
/* Project Tags, for reading out using the ButtLoad project */
|
/** Main program entry point. This routine contains the overall program flow, including initial
|
||||||
BUTTLOADTAG(ProjName, "LUFA Sideshow App");
|
* setup of all components and the main program loop.
|
||||||
BUTTLOADTAG(BuildTime, __TIME__);
|
*/
|
||||||
BUTTLOADTAG(BuildDate, __DATE__);
|
|
||||||
BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
|
|
||||||
|
|
||||||
/* Scheduler Task List */
|
|
||||||
TASK_LIST
|
|
||||||
{
|
|
||||||
{ Task: USB_USBTask , TaskStatus: TASK_STOP },
|
|
||||||
{ Task: USB_Sideshow , TaskStatus: TASK_STOP },
|
|
||||||
};
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
|
{
|
||||||
|
SetupHardware();
|
||||||
|
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
SideShow_Task();
|
||||||
|
USB_USBTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Configures the board hardware and chip peripherals for the demo's functionality. */
|
||||||
|
void SetupHardware(void)
|
||||||
{
|
{
|
||||||
/* Disable watchdog if enabled by bootloader/fuses */
|
/* Disable watchdog if enabled by bootloader/fuses */
|
||||||
MCUSR &= ~(1 << WDRF);
|
MCUSR &= ~(1 << WDRF);
|
||||||
wdt_disable();
|
wdt_disable();
|
||||||
|
|
||||||
/* Disable Clock Division */
|
/* Disable clock division */
|
||||||
SetSystemClockPrescaler(0);
|
clock_prescale_set(clock_div_1);
|
||||||
|
|
||||||
/* Hardware Initialization */
|
/* Hardware Initialization */
|
||||||
SerialStream_Init(9600, false);
|
|
||||||
LEDs_Init();
|
LEDs_Init();
|
||||||
HWB_Init();
|
|
||||||
|
|
||||||
/* Indicate USB not ready */
|
|
||||||
LEDs_SetAllLEDs(LEDS_LED1 | LEDS_LED3);
|
|
||||||
|
|
||||||
/* Initialize Scheduler so that it can be used */
|
|
||||||
Scheduler_Init();
|
|
||||||
|
|
||||||
/* Initialize USB Subsystem */
|
|
||||||
USB_Init();
|
USB_Init();
|
||||||
|
SerialStream_Init(9600, false);
|
||||||
/* Scheduling - routine never returns, so put this last in the main function */
|
|
||||||
Scheduler_Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EVENT_HANDLER(USB_Connect)
|
void EVENT_USB_Connect(void)
|
||||||
{
|
{
|
||||||
/* Start USB management task */
|
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
|
||||||
Scheduler_SetTaskMode(USB_USBTask, TASK_RUN);
|
|
||||||
|
|
||||||
/* Indicate USB enumerating */
|
|
||||||
LEDs_SetAllLEDs(LEDS_LED1 | LEDS_LED4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EVENT_HANDLER(USB_Disconnect)
|
void EVENT_USB_Disconnect(void)
|
||||||
{
|
{
|
||||||
/* Stop running mass storage and USB management tasks */
|
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
|
||||||
Scheduler_SetTaskMode(USB_Sideshow, TASK_STOP);
|
|
||||||
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);
|
|
||||||
|
|
||||||
/* Indicate USB not ready */
|
|
||||||
LEDs_SetAllLEDs(LEDS_LED1 | LEDS_LED3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EVENT_HANDLER(USB_ConfigurationChanged)
|
void EVENT_USB_ConfigurationChanged(void)
|
||||||
{
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||||
|
|
||||||
/* Setup Sideshow In and Out Endpoints */
|
/* Setup Sideshow In and Out Endpoints */
|
||||||
Endpoint_ConfigureEndpoint(SIDESHOW_IN_EPNUM, EP_TYPE_BULK,
|
if (!(Endpoint_ConfigureEndpoint(SIDESHOW_IN_EPNUM, EP_TYPE_BULK,
|
||||||
ENDPOINT_DIR_IN, SIDESHOW_IO_EPSIZE,
|
ENDPOINT_DIR_IN, SIDESHOW_IO_EPSIZE,
|
||||||
ENDPOINT_BANK_SINGLE);
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
Endpoint_ConfigureEndpoint(SIDESHOW_OUT_EPNUM, EP_TYPE_BULK,
|
if (!(Endpoint_ConfigureEndpoint(SIDESHOW_OUT_EPNUM, EP_TYPE_BULK,
|
||||||
ENDPOINT_DIR_OUT, SIDESHOW_IO_EPSIZE,
|
ENDPOINT_DIR_OUT, SIDESHOW_IO_EPSIZE,
|
||||||
ENDPOINT_BANK_SINGLE);
|
ENDPOINT_BANK_SINGLE)))
|
||||||
|
{
|
||||||
/* Indicate USB connected and ready */
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
LEDs_SetAllLEDs(LEDS_LED2 | LEDS_LED4);
|
}
|
||||||
|
|
||||||
/* Start Sideshow task */
|
|
||||||
Scheduler_SetTaskMode(USB_Sideshow, TASK_RUN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EVENT_HANDLER(USB_UnhandledControlPacket)
|
void EVENT_USB_UnhandledControlPacket(void)
|
||||||
{
|
{
|
||||||
/* Process UFI specific control requests */
|
/* Process UFI specific control requests */
|
||||||
switch (bRequest)
|
switch (USB_ControlRequest.bRequest)
|
||||||
{
|
{
|
||||||
case REQ_GetOSFeatureDescriptor:
|
case REQ_GetOSFeatureDescriptor:
|
||||||
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_VENDOR | REQREC_DEVICE))
|
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_VENDOR | REQREC_DEVICE))
|
||||||
{
|
{
|
||||||
uint16_t wValue = Endpoint_Read_Word_LE();
|
|
||||||
uint16_t wIndex = Endpoint_Read_Word_LE();
|
|
||||||
uint16_t wLength = Endpoint_Read_Word_LE();
|
|
||||||
|
|
||||||
void* DescriptorPointer;
|
void* DescriptorPointer;
|
||||||
uint16_t DescriptorSize;
|
uint16_t DescriptorSize;
|
||||||
|
|
||||||
bool SendZLP = true;
|
if (!(USB_GetOSFeatureDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex,
|
||||||
|
&DescriptorPointer, &DescriptorSize)))
|
||||||
if (!(USB_GetOSFeatureDescriptor(wValue, wIndex, &DescriptorPointer, &DescriptorSize)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Endpoint_ClearSetupReceived();
|
|
||||||
|
|
||||||
if (wLength > DescriptorSize)
|
|
||||||
wLength = DescriptorSize;
|
|
||||||
|
|
||||||
while (wLength && (!(Endpoint_IsSetupOUTReceived())))
|
|
||||||
{
|
{
|
||||||
while (!(Endpoint_IsSetupINReady()));
|
|
||||||
|
|
||||||
while (wLength && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
|
|
||||||
{
|
|
||||||
#if defined(USE_RAM_DESCRIPTORS)
|
|
||||||
Endpoint_Write_Byte(*((uint8_t*)DescriptorPointer++));
|
|
||||||
#elif defined (USE_EEPROM_DESCRIPTORS)
|
|
||||||
Endpoint_Write_Byte(eeprom_read_byte(DescriptorPointer++));
|
|
||||||
#else
|
|
||||||
Endpoint_Write_Byte(pgm_read_byte(DescriptorPointer++));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wLength--;
|
|
||||||
}
|
|
||||||
|
|
||||||
SendZLP = (Endpoint_BytesInEndpoint() == USB_ControlEndpointSize);
|
|
||||||
Endpoint_ClearSetupIN();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Endpoint_IsSetupOUTReceived())
|
|
||||||
{
|
|
||||||
Endpoint_ClearSetupOUT();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SendZLP)
|
Endpoint_ClearSETUP();
|
||||||
{
|
|
||||||
while (!(Endpoint_IsSetupINReady()));
|
|
||||||
Endpoint_ClearSetupIN();
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!(Endpoint_IsSetupOUTReceived()));
|
Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);
|
||||||
Endpoint_ClearSetupOUT();
|
Endpoint_ClearOUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TASK(USB_Sideshow)
|
void SideShow_Task(void)
|
||||||
{
|
{
|
||||||
/* Check if the USB System is connected to a Host */
|
/* Check if the USB System is connected to a Host */
|
||||||
if (USB_IsConnected)
|
if (USB_IsConnected)
|
||||||
@ -212,7 +148,7 @@ TASK(USB_Sideshow)
|
|||||||
Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM);
|
Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM);
|
||||||
|
|
||||||
/* Check to see if a new SideShow message has been received */
|
/* Check to see if a new SideShow message has been received */
|
||||||
if (Endpoint_ReadWriteAllowed())
|
if (Endpoint_IsReadWriteAllowed())
|
||||||
{
|
{
|
||||||
/* Process the received SideShow message */
|
/* Process the received SideShow message */
|
||||||
Sideshow_ProcessCommandPacket();
|
Sideshow_ProcessCommandPacket();
|
||||||
|
@ -34,31 +34,40 @@
|
|||||||
/* Includes: */
|
/* Includes: */
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <avr/wdt.h>
|
#include <avr/wdt.h>
|
||||||
|
#include <avr/power.h>
|
||||||
|
|
||||||
#include "Descriptors.h"
|
#include "Descriptors.h"
|
||||||
#include "SideshowCommands.h"
|
#include "SideshowCommands.h"
|
||||||
|
|
||||||
#include <LUFA/Version.h> // Library Version Information
|
#include <LUFA/Version.h>
|
||||||
#include <LUFA/Common/ButtLoadTag.h> // PROGMEM tags readable by the ButtLoad project
|
#include <LUFA/Drivers/USB/USB.h>
|
||||||
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
|
#include <LUFA/Drivers/Board/LEDs.h>
|
||||||
#include <LUFA/Drivers/Board/HWB.h> // HWB button driver
|
#include <LUFA/Drivers/Peripheral/SerialStream.h>
|
||||||
#include <LUFA/Drivers/Board/LEDs.h> // LEDs driver
|
|
||||||
#include <LUFA/Drivers/Board/Dataflash.h> // Dataflash chip driver
|
|
||||||
#include <LUFA/Scheduler/Scheduler.h> // Simple scheduler for task management
|
|
||||||
#include <LUFA/Drivers/AT90USBXXX/Serial_Stream.h> // Serial stream driver
|
|
||||||
|
|
||||||
/* Macros: */
|
/* Macros: */
|
||||||
#define REQ_GetOSFeatureDescriptor 0x01
|
#define REQ_GetOSFeatureDescriptor 0x01
|
||||||
|
|
||||||
#define EXTENDED_COMPAT_ID_DESCRIPTOR 0x0004
|
#define EXTENDED_COMPAT_ID_DESCRIPTOR 0x0004
|
||||||
|
|
||||||
/* Task Definitions: */
|
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
|
||||||
TASK(USB_Sideshow);
|
#define LEDMASK_USB_NOTREADY LEDS_LED1
|
||||||
|
|
||||||
/* Event Handlers: */
|
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
|
||||||
HANDLES_EVENT(USB_Connect);
|
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
|
||||||
HANDLES_EVENT(USB_Disconnect);
|
|
||||||
HANDLES_EVENT(USB_ConfigurationChanged);
|
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
|
||||||
HANDLES_EVENT(USB_UnhandledControlPacket);
|
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
|
||||||
|
|
||||||
|
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
|
||||||
|
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
|
||||||
|
|
||||||
|
/* Function Prototypes: */
|
||||||
|
void SetupHardware(void);
|
||||||
|
void SideShow_Task(void);
|
||||||
|
|
||||||
|
void EVENT_USB_Connect(void);
|
||||||
|
void EVENT_USB_Disconnect(void);
|
||||||
|
void EVENT_USB_ConfigurationChanged(void);
|
||||||
|
void EVENT_USB_UnhandledControlPacket(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -105,14 +105,14 @@ void Sideshow_ProcessCommandPacket(void)
|
|||||||
PacketHeader.Length -= sizeof(SideShow_PacketHeader_t);
|
PacketHeader.Length -= sizeof(SideShow_PacketHeader_t);
|
||||||
|
|
||||||
Endpoint_Discard_Stream(PacketHeader.Length);
|
Endpoint_Discard_Stream(PacketHeader.Length);
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
PacketHeader.Length = sizeof(SideShow_PacketHeader_t);
|
PacketHeader.Length = sizeof(SideShow_PacketHeader_t);
|
||||||
PacketHeader.Type.NAK = true;
|
PacketHeader.Type.NAK = true;
|
||||||
|
|
||||||
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
||||||
Endpoint_Write_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t));
|
Endpoint_Write_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
|
|
||||||
printf(" UNK");
|
printf(" UNK");
|
||||||
}
|
}
|
||||||
@ -120,11 +120,11 @@ void Sideshow_ProcessCommandPacket(void)
|
|||||||
|
|
||||||
static void SideShow_Ping(SideShow_PacketHeader_t* PacketHeader)
|
static void SideShow_Ping(SideShow_PacketHeader_t* PacketHeader)
|
||||||
{
|
{
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
||||||
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SideShow_Sync(SideShow_PacketHeader_t* PacketHeader)
|
static void SideShow_Sync(SideShow_PacketHeader_t* PacketHeader)
|
||||||
@ -132,7 +132,7 @@ static void SideShow_Sync(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
GUID_t ProtocolGUID;
|
GUID_t ProtocolGUID;
|
||||||
|
|
||||||
Endpoint_Read_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
|
Endpoint_Read_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
if (memcmp(&ProtocolGUID, (uint32_t[])STANDARD_PROTOCOL_GUID, sizeof(GUID_t)) != 0)
|
if (memcmp(&ProtocolGUID, (uint32_t[])STANDARD_PROTOCOL_GUID, sizeof(GUID_t)) != 0)
|
||||||
PacketHeader->Type.NAK = true;
|
PacketHeader->Type.NAK = true;
|
||||||
@ -140,31 +140,31 @@ static void SideShow_Sync(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
||||||
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
||||||
Endpoint_Write_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
|
Endpoint_Write_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SideShow_GetCurrentUser(SideShow_PacketHeader_t* PacketHeader)
|
static void SideShow_GetCurrentUser(SideShow_PacketHeader_t* PacketHeader)
|
||||||
{
|
{
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + sizeof(uint32_t) + UserSID.LengthInBytes;
|
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + sizeof(uint32_t) + UserSID.LengthInBytes;
|
||||||
|
|
||||||
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
||||||
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
||||||
SideShow_Write_Unicode_String(&UserSID);
|
SideShow_Write_Unicode_String(&UserSID);
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SideShow_SetCurrentUser(SideShow_PacketHeader_t* PacketHeader)
|
static void SideShow_SetCurrentUser(SideShow_PacketHeader_t* PacketHeader)
|
||||||
{
|
{
|
||||||
SideShow_Read_Unicode_String(&UserSID, sizeof(UserSID.UnicodeString));
|
SideShow_Read_Unicode_String(&UserSID, sizeof(UserSID.UnicodeString));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
|
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
|
||||||
|
|
||||||
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
||||||
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SideShow_GetCapabilities(SideShow_PacketHeader_t* PacketHeader)
|
static void SideShow_GetCapabilities(SideShow_PacketHeader_t* PacketHeader)
|
||||||
@ -173,7 +173,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
SideShow_PropertyData_t PropertyData;
|
SideShow_PropertyData_t PropertyData;
|
||||||
|
|
||||||
Endpoint_Read_Stream_LE(&Property, sizeof(SideShow_PropertyKey_t));
|
Endpoint_Read_Stream_LE(&Property, sizeof(SideShow_PropertyKey_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
printf(" ID: %lu", Property.PropertyID);
|
printf(" ID: %lu", Property.PropertyID);
|
||||||
|
|
||||||
@ -276,13 +276,13 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SideShow_GetString(SideShow_PacketHeader_t* PacketHeader, void* UnicodeStruct)
|
static void SideShow_GetString(SideShow_PacketHeader_t* PacketHeader, void* UnicodeStruct)
|
||||||
{
|
{
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) +
|
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) +
|
||||||
sizeof(uint32_t) + ((Unicode_String_t*)UnicodeStruct)->LengthInBytes;
|
sizeof(uint32_t) + ((Unicode_String_t*)UnicodeStruct)->LengthInBytes;
|
||||||
@ -290,7 +290,7 @@ static void SideShow_GetString(SideShow_PacketHeader_t* PacketHeader, void* Unic
|
|||||||
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
||||||
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
||||||
SideShow_Write_Unicode_String(UnicodeStruct);
|
SideShow_Write_Unicode_String(UnicodeStruct);
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* PacketHeader)
|
static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* PacketHeader)
|
||||||
@ -298,7 +298,7 @@ static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
uint8_t TotalInstalledApplications = SideShow_GetTotalApplications();
|
uint8_t TotalInstalledApplications = SideShow_GetTotalApplications();
|
||||||
uint16_t GadgetGUIDBytes = (TotalInstalledApplications * sizeof(GUID_t));
|
uint16_t GadgetGUIDBytes = (TotalInstalledApplications * sizeof(GUID_t));
|
||||||
|
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) +
|
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) +
|
||||||
sizeof(uint32_t) + GadgetGUIDBytes;
|
sizeof(uint32_t) + GadgetGUIDBytes;
|
||||||
@ -313,14 +313,14 @@ static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
Endpoint_Write_Stream_LE(&InstalledApplications[App].ApplicationID, sizeof(GUID_t));
|
Endpoint_Write_Stream_LE(&InstalledApplications[App].ApplicationID, sizeof(GUID_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SideShow_GetSupportedEndpoints(SideShow_PacketHeader_t* PacketHeader)
|
static void SideShow_GetSupportedEndpoints(SideShow_PacketHeader_t* PacketHeader)
|
||||||
{
|
{
|
||||||
GUID_t SupportedEndpointGUID = (GUID_t){Chunks: SIMPLE_CONTENT_FORMAT_GUID};
|
GUID_t SupportedEndpointGUID = (GUID_t){Chunks: SIMPLE_CONTENT_FORMAT_GUID};
|
||||||
|
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + sizeof(uint32_t) + sizeof(GUID_t);
|
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + sizeof(uint32_t) + sizeof(GUID_t);
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ static void SideShow_GetSupportedEndpoints(SideShow_PacketHeader_t* PacketHeader
|
|||||||
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
||||||
Endpoint_Write_DWord_LE(1);
|
Endpoint_Write_DWord_LE(1);
|
||||||
Endpoint_Write_Stream_LE(&SupportedEndpointGUID, sizeof(GUID_t));
|
Endpoint_Write_Stream_LE(&SupportedEndpointGUID, sizeof(GUID_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SideShow_AddApplication(SideShow_PacketHeader_t* PacketHeader)
|
static void SideShow_AddApplication(SideShow_PacketHeader_t* PacketHeader)
|
||||||
@ -348,7 +348,7 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
PacketHeader->Length -= sizeof(SideShow_PacketHeader_t) + sizeof(GUID_t);
|
PacketHeader->Length -= sizeof(SideShow_PacketHeader_t) + sizeof(GUID_t);
|
||||||
|
|
||||||
Endpoint_Discard_Stream(PacketHeader->Length);
|
Endpoint_Discard_Stream(PacketHeader->Length);
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
PacketHeader->Type.NAK = true;
|
PacketHeader->Type.NAK = true;
|
||||||
}
|
}
|
||||||
@ -362,7 +362,7 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
SideShow_Discard_Byte_Stream();
|
SideShow_Discard_Byte_Stream();
|
||||||
SideShow_Discard_Byte_Stream();
|
SideShow_Discard_Byte_Stream();
|
||||||
SideShow_Discard_Byte_Stream();
|
SideShow_Discard_Byte_Stream();
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
CurrApp->InUse = true;
|
CurrApp->InUse = true;
|
||||||
CurrApp->HaveContent = false;
|
CurrApp->HaveContent = false;
|
||||||
@ -373,7 +373,7 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
|
|
||||||
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
||||||
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SideShow_DeleteApplication(SideShow_PacketHeader_t* PacketHeader)
|
static void SideShow_DeleteApplication(SideShow_PacketHeader_t* PacketHeader)
|
||||||
@ -381,7 +381,7 @@ static void SideShow_DeleteApplication(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
GUID_t ApplicationGUID;
|
GUID_t ApplicationGUID;
|
||||||
|
|
||||||
Endpoint_Read_Stream_LE(&ApplicationGUID, sizeof(GUID_t));
|
Endpoint_Read_Stream_LE(&ApplicationGUID, sizeof(GUID_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
SideShow_Application_t* AppToDelete = SideShow_GetApplicationFromGUID(&ApplicationGUID);
|
SideShow_Application_t* AppToDelete = SideShow_GetApplicationFromGUID(&ApplicationGUID);
|
||||||
|
|
||||||
@ -396,19 +396,19 @@ static void SideShow_DeleteApplication(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
|
|
||||||
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
||||||
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SideShow_DeleteAllApplications(SideShow_PacketHeader_t* PacketHeader)
|
static void SideShow_DeleteAllApplications(SideShow_PacketHeader_t* PacketHeader)
|
||||||
{
|
{
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
for (uint8_t App = 0; App < MAX_APPLICATIONS; App++)
|
for (uint8_t App = 0; App < MAX_APPLICATIONS; App++)
|
||||||
InstalledApplications[App].InUse = false;
|
InstalledApplications[App].InUse = false;
|
||||||
|
|
||||||
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
||||||
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SideShow_AddContent(SideShow_PacketHeader_t* PacketHeader)
|
static void SideShow_AddContent(SideShow_PacketHeader_t* PacketHeader)
|
||||||
@ -432,13 +432,13 @@ static void SideShow_AddContent(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
PacketHeader->Type.NAK = true;
|
PacketHeader->Type.NAK = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
|
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
|
||||||
|
|
||||||
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
||||||
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SideShow_DeleteContent(SideShow_PacketHeader_t* PacketHeader)
|
static void SideShow_DeleteContent(SideShow_PacketHeader_t* PacketHeader)
|
||||||
@ -450,7 +450,7 @@ static void SideShow_DeleteContent(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t));
|
Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t));
|
||||||
Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t));
|
Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t));
|
||||||
Endpoint_Read_Stream_LE(&ContentID, sizeof(uint32_t));
|
Endpoint_Read_Stream_LE(&ContentID, sizeof(uint32_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
SideShow_Application_t* Application = SideShow_GetApplicationFromGUID(&ApplicationID);
|
SideShow_Application_t* Application = SideShow_GetApplicationFromGUID(&ApplicationID);
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ static void SideShow_DeleteContent(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
|
|
||||||
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
||||||
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SideShow_DeleteAllContent(SideShow_PacketHeader_t* PacketHeader)
|
static void SideShow_DeleteAllContent(SideShow_PacketHeader_t* PacketHeader)
|
||||||
@ -473,7 +473,7 @@ static void SideShow_DeleteAllContent(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
|
|
||||||
Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t));
|
Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t));
|
||||||
Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t));
|
Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearOUT();
|
||||||
|
|
||||||
SideShow_Application_t* Application = SideShow_GetApplicationFromGUID(&ApplicationID);
|
SideShow_Application_t* Application = SideShow_GetApplicationFromGUID(&ApplicationID);
|
||||||
|
|
||||||
@ -486,5 +486,5 @@ static void SideShow_DeleteAllContent(SideShow_PacketHeader_t* PacketHeader)
|
|||||||
|
|
||||||
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
|
||||||
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
|
||||||
Endpoint_ClearCurrentBank();
|
Endpoint_ClearIN();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# Hey Emacs, this is a -*- makefile -*-
|
# Hey Emacs, this is a -*- makefile -*-
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
|
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
|
||||||
|
# >> Modified for use with the LUFA project. <<
|
||||||
#
|
#
|
||||||
# Released to the Public Domain
|
# Released to the Public Domain
|
||||||
#
|
#
|
||||||
@ -13,6 +14,9 @@
|
|||||||
# Sander Pool
|
# Sander Pool
|
||||||
# Frederik Rouleau
|
# Frederik Rouleau
|
||||||
# Carlos Lamas
|
# Carlos Lamas
|
||||||
|
# Dean Camera
|
||||||
|
# Opendous Inc.
|
||||||
|
# Denver Gingerich
|
||||||
#
|
#
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# On command line:
|
# On command line:
|
||||||
@ -28,6 +32,21 @@
|
|||||||
# make program = Download the hex file to the device, using avrdude.
|
# make program = Download the hex file to the device, using avrdude.
|
||||||
# Please customize the avrdude settings below first!
|
# Please customize the avrdude settings below first!
|
||||||
#
|
#
|
||||||
|
# make dfu = Download the hex file to the device, using dfu-programmer (must
|
||||||
|
# have dfu-programmer installed).
|
||||||
|
#
|
||||||
|
# make flip = Download the hex file to the device, using Atmel FLIP (must
|
||||||
|
# have Atmel FLIP installed).
|
||||||
|
#
|
||||||
|
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
|
||||||
|
# (must have dfu-programmer installed).
|
||||||
|
#
|
||||||
|
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
|
||||||
|
# (must have Atmel FLIP installed).
|
||||||
|
#
|
||||||
|
# make doxygen = Generate DoxyGen documentation for the project (must have
|
||||||
|
# DoxyGen installed)
|
||||||
|
#
|
||||||
# make debug = Start either simulavr or avarice as specified for debugging,
|
# make debug = Start either simulavr or avarice as specified for debugging,
|
||||||
# with avr-gdb or avr-insight as the front end for debugging.
|
# with avr-gdb or avr-insight as the front end for debugging.
|
||||||
#
|
#
|
||||||
@ -44,7 +63,7 @@
|
|||||||
MCU = at90usb1287
|
MCU = at90usb1287
|
||||||
|
|
||||||
|
|
||||||
# Target board (see library BoardTypes.h documentation, USER or blank for projects not requiring
|
# Target board (see library "Board Types" documentation, USER or blank for projects not requiring
|
||||||
# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
|
# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
|
||||||
# "Board" inside the application directory.
|
# "Board" inside the application directory.
|
||||||
BOARD = USBKEY
|
BOARD = USBKEY
|
||||||
@ -71,12 +90,26 @@ BOARD = USBKEY
|
|||||||
F_CPU = 8000000
|
F_CPU = 8000000
|
||||||
|
|
||||||
|
|
||||||
|
# Input clock frequency.
|
||||||
|
# This will define a symbol, F_CLOCK, in all source code files equal to the
|
||||||
|
# input clock frequency (before any prescaling is performed). This value may
|
||||||
|
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||||
|
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||||
|
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||||
|
# at the end, this will be done automatically to create a 32-bit value in your
|
||||||
|
# source code.
|
||||||
|
#
|
||||||
|
# If no clock division is performed on the input clock inside the AVR (via the
|
||||||
|
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||||
|
F_CLOCK = 8000000
|
||||||
|
|
||||||
|
|
||||||
# Output format. (can be srec, ihex, binary)
|
# Output format. (can be srec, ihex, binary)
|
||||||
FORMAT = ihex
|
FORMAT = ihex
|
||||||
|
|
||||||
|
|
||||||
# Target file name (without extension).
|
# Target file name (without extension).
|
||||||
TARGET = Sideshow
|
TARGET = SideShow
|
||||||
|
|
||||||
|
|
||||||
# Object files directory
|
# Object files directory
|
||||||
@ -85,6 +118,10 @@ TARGET = Sideshow
|
|||||||
OBJDIR = .
|
OBJDIR = .
|
||||||
|
|
||||||
|
|
||||||
|
# Path to the LUFA library
|
||||||
|
LUFA_PATH = ../../../..
|
||||||
|
|
||||||
|
|
||||||
# List C source files here. (C dependencies are automatically generated.)
|
# List C source files here. (C dependencies are automatically generated.)
|
||||||
SRC = $(TARGET).c \
|
SRC = $(TARGET).c \
|
||||||
Descriptors.c \
|
Descriptors.c \
|
||||||
@ -92,16 +129,18 @@ SRC = $(TARGET).c \
|
|||||||
SideshowCommands.c \
|
SideshowCommands.c \
|
||||||
SideshowApplications.c \
|
SideshowApplications.c \
|
||||||
SideshowContent.c \
|
SideshowContent.c \
|
||||||
../../LUFA/Scheduler/Scheduler.c \
|
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
|
||||||
../../LUFA/Drivers/USB/LowLevel/LowLevel.c \
|
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
|
||||||
../../LUFA/Drivers/USB/LowLevel/Endpoint.c \
|
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
|
||||||
../../LUFA/Drivers/USB/LowLevel/DevChapter9.c \
|
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
|
||||||
../../LUFA/Drivers/USB/HighLevel/USBTask.c \
|
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
|
||||||
../../LUFA/Drivers/USB/HighLevel/USBInterrupt.c \
|
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
|
||||||
../../LUFA/Drivers/USB/HighLevel/Events.c \
|
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
|
||||||
../../LUFA/Drivers/USB/HighLevel/StdDescriptors.c \
|
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \
|
||||||
../../LUFA/Drivers/AT90USBXXX/Serial_Stream.c \
|
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
|
||||||
../../LUFA/Drivers/AT90USBXXX/Serial.c \
|
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
|
||||||
|
$(LUFA_PATH)/LUFA/Drivers/Peripheral/SerialStream.c \
|
||||||
|
$(LUFA_PATH)/LUFA/Drivers/Peripheral/Serial.c \
|
||||||
|
|
||||||
|
|
||||||
# List C++ source files here. (C dependencies are automatically generated.)
|
# List C++ source files here. (C dependencies are automatically generated.)
|
||||||
@ -135,7 +174,7 @@ DEBUG = dwarf-2
|
|||||||
# Each directory must be seperated by a space.
|
# Each directory must be seperated by a space.
|
||||||
# Use forward slashes for directory separators.
|
# Use forward slashes for directory separators.
|
||||||
# For a directory that has spaces, enclose it in quotes.
|
# For a directory that has spaces, enclose it in quotes.
|
||||||
EXTRAINCDIRS = ../../
|
EXTRAINCDIRS = $(LUFA_PATH)/
|
||||||
|
|
||||||
|
|
||||||
# Compiler flag to set the C Standard level.
|
# Compiler flag to set the C Standard level.
|
||||||
@ -147,9 +186,10 @@ CSTANDARD = -std=gnu99
|
|||||||
|
|
||||||
|
|
||||||
# Place -D or -U options here for C sources
|
# Place -D or -U options here for C sources
|
||||||
CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES
|
CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)
|
||||||
CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY
|
||||||
CDEFS += -DNO_STREAM_CALLBACKS
|
CDEFS += -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DUSE_SINGLE_DEVICE_CONFIGURATION
|
||||||
|
CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||||
|
|
||||||
|
|
||||||
# Place -D or -U options here for ASM sources
|
# Place -D or -U options here for ASM sources
|
||||||
@ -422,7 +462,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
|
|||||||
|
|
||||||
|
|
||||||
# Default target.
|
# Default target.
|
||||||
all: begin gccversion sizebefore build checkhooks checklibmode sizeafter end
|
all: begin gccversion sizebefore build checkhooks checklibmode checkboard sizeafter end
|
||||||
|
|
||||||
# Change the build target to build a HEX file or a library.
|
# Change the build target to build a HEX file or a library.
|
||||||
build: elf hex eep lss sym
|
build: elf hex eep lss sym
|
||||||
@ -468,10 +508,10 @@ sizeafter:
|
|||||||
checkhooks: build
|
checkhooks: build
|
||||||
@echo
|
@echo
|
||||||
@echo ------- Unhooked LUFA Events -------
|
@echo ------- Unhooked LUFA Events -------
|
||||||
@$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \
|
@$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \
|
||||||
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
|
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
|
||||||
echo "(None)"
|
echo "(None)"
|
||||||
@echo ----- End Unhooked LUFA Events -----
|
@echo ------------------------------------
|
||||||
|
|
||||||
checklibmode:
|
checklibmode:
|
||||||
@echo
|
@echo
|
||||||
@ -481,6 +521,12 @@ checklibmode:
|
|||||||
|| echo "No specific mode (both device and host mode allowable)."
|
|| echo "No specific mode (both device and host mode allowable)."
|
||||||
@echo ------------------------------------
|
@echo ------------------------------------
|
||||||
|
|
||||||
|
checkboard:
|
||||||
|
@echo
|
||||||
|
@echo ---------- Selected Board ----------
|
||||||
|
@echo Selected board model is $(BOARD).
|
||||||
|
@echo ------------------------------------
|
||||||
|
|
||||||
# Display compiler version information.
|
# Display compiler version information.
|
||||||
gccversion :
|
gccversion :
|
||||||
@$(CC) --version
|
@$(CC) --version
|
||||||
@ -491,6 +537,26 @@ gccversion :
|
|||||||
program: $(TARGET).hex $(TARGET).eep
|
program: $(TARGET).hex $(TARGET).eep
|
||||||
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
|
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
|
||||||
|
|
||||||
|
flip: $(TARGET).hex
|
||||||
|
batchisp -hardware usb -device $(MCU) -operation erase f
|
||||||
|
batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
|
||||||
|
batchisp -hardware usb -device $(MCU) -operation start reset 0
|
||||||
|
|
||||||
|
dfu: $(TARGET).hex
|
||||||
|
dfu-programmer $(MCU) erase
|
||||||
|
dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
|
||||||
|
dfu-programmer $(MCU) reset
|
||||||
|
|
||||||
|
flip-ee: $(TARGET).hex $(TARGET).eep
|
||||||
|
copy $(TARGET).eep $(TARGET)eep.hex
|
||||||
|
batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
|
||||||
|
batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
|
||||||
|
batchisp -hardware usb -device $(MCU) -operation start reset 0
|
||||||
|
|
||||||
|
dfu-ee: $(TARGET).hex $(TARGET).eep
|
||||||
|
dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
|
||||||
|
dfu-programmer $(MCU) reset
|
||||||
|
|
||||||
|
|
||||||
# Generate avr-gdb config/init file which does the following:
|
# Generate avr-gdb config/init file which does the following:
|
||||||
# define the reset signal, load the target file, connect to target, and set
|
# define the reset signal, load the target file, connect to target, and set
|
||||||
@ -634,6 +700,7 @@ clean_binary:
|
|||||||
clean_list:
|
clean_list:
|
||||||
@echo $(MSG_CLEANING)
|
@echo $(MSG_CLEANING)
|
||||||
$(REMOVE) $(TARGET).eep
|
$(REMOVE) $(TARGET).eep
|
||||||
|
$(REMOVE) $(TARGET)eep.hex
|
||||||
$(REMOVE) $(TARGET).cof
|
$(REMOVE) $(TARGET).cof
|
||||||
$(REMOVE) $(TARGET).elf
|
$(REMOVE) $(TARGET).elf
|
||||||
$(REMOVE) $(TARGET).map
|
$(REMOVE) $(TARGET).map
|
||||||
@ -652,6 +719,9 @@ doxygen:
|
|||||||
@doxygen Doxygen.conf
|
@doxygen Doxygen.conf
|
||||||
@echo Documentation Generation Complete.
|
@echo Documentation Generation Complete.
|
||||||
|
|
||||||
|
clean_doxygen:
|
||||||
|
rm -rf Documentation
|
||||||
|
|
||||||
# Create object files directory
|
# Create object files directory
|
||||||
$(shell mkdir $(OBJDIR) 2>/dev/null)
|
$(shell mkdir $(OBJDIR) 2>/dev/null)
|
||||||
|
|
||||||
@ -661,8 +731,8 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
|
|||||||
|
|
||||||
|
|
||||||
# Listing of phony targets.
|
# Listing of phony targets.
|
||||||
.PHONY : all checkhooks checklibmode begin \
|
.PHONY : all checkhooks checklibmode checkboard \
|
||||||
finish end sizebefore sizeafter gccversion \
|
begin finish end sizebefore sizeafter gccversion \
|
||||||
build elf hex eep lss sym coff extcoff \
|
build elf hex eep lss sym coff extcoff clean \
|
||||||
clean clean_list clean_binary program debug \
|
clean_list clean_binary program debug gdb-config \
|
||||||
gdb-config doxygen
|
doxygen dfu flip flip-ee dfu-ee
|
@ -5,9 +5,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
========== TODO: ===========
|
========== TODO: ===========
|
||||||
- Document new class drivers (in progress)
|
- Document new device class drivers (in progress)
|
||||||
- Add standardized descriptor names to class driver structures, controlled by USE_NONSTANDARD_DESCRIPTOR_NAMES
|
- Made new host class drivers
|
||||||
|
- Document new host class drivers
|
||||||
- Convert Host mode demos to class drivers
|
- Convert Host mode demos to class drivers
|
||||||
|
- Add in old Host mode demos, convert to schedulerless
|
||||||
|
- Add in incomplete host mode demos
|
||||||
|
- Add standardized descriptor names to class driver structures, controlled by USE_NONSTANDARD_DESCRIPTOR_NAMES
|
||||||
- Remake AVRStudio projects to reflect file structure changes
|
- Remake AVRStudio projects to reflect file structure changes
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user