* - Standardized the naming scheme given to configuration descriptor sub-elements in the Device mode demos, bootloaders\r
* and projects\r
* - All Class Driver Host mode demos now correctly set the board LEDs to READY once the enumeration process has completed\r
+ * - Added WIN_LIBUSB_COMPAT compile time option to the AVRISP programmer project to make the code compatible with Windows\r
+ * builds of avrdude at the expense of AVRStudio compatibility\r
*\r
* <b>Fixed:</b>\r
* - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
\r
/* Setup AVRISP data Endpoints */\r
- if (!(Endpoint_ConfigureEndpoint(AVRISP_DATA_EPNUM, EP_TYPE_BULK,\r
+ if (!(Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPNUM, EP_TYPE_BULK,\r
ENDPOINT_DIR_OUT, AVRISP_DATA_EPSIZE,\r
ENDPOINT_BANK_SINGLE)))\r
{\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
}\r
+\r
+ #if defined(WIN_LIBUSB_COMPAT)\r
+ if (!(Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK,\r
+ ENDPOINT_DIR_IN, AVRISP_DATA_EPSIZE,\r
+ ENDPOINT_BANK_SINGLE)))\r
+ {\r
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+ }\r
+ #endif\r
}\r
\r
/** Processes incoming V2 Protocol commands from the host, returning a response when required. */\r
if (USB_DeviceState != DEVICE_STATE_Configured)\r
return;\r
\r
- Endpoint_SelectEndpoint(AVRISP_DATA_EPNUM);\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);\r
\r
/* Check to see if a V2 Protocol command has been received */\r
if (Endpoint_IsOUTReceived())\r
* <td>Define to disable VTARGET sampling and reporting on AVR models with an ADC converter. This will cause the programmer\r
* to report a fixed 5V target voltage to the host regardless of the real target voltage.</td> \r
* </tr>\r
+ * <tr>\r
+ * <td>WIN_LIBUSB_COMPAT</td>\r
+ * <td>Makefile CDEFS</td>\r
+ * <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making\r
+ * the code compatible with Windows builds of avrdude using the libUSB driver. Linux platforms are not affected by this\r
+ * option.\r
+ * </tr>\r
* </table>\r
*/\r
{\r
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
\r
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AVRISP_DATA_EPNUM),\r
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AVRISP_DATA_IN_EPNUM),\r
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),\r
.EndpointSize = AVRISP_DATA_EPSIZE,\r
.PollingIntervalMS = 0x00\r
{\r
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
\r
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AVRISP_DATA_EPNUM),\r
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AVRISP_DATA_OUT_EPNUM),\r
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),\r
.EndpointSize = AVRISP_DATA_EPSIZE,\r
.PollingIntervalMS = 0x00\r
#include <LUFA/Drivers/USB/USB.h>\r
\r
/* Macros: */\r
- /** Endpoint number of the AVRISP bidirectional data endpoint. */\r
- #define AVRISP_DATA_EPNUM 2\r
+ #if !defined(WIN_LIBUSB_COMPAT)\r
+ /** Endpoint number of the AVRISP data OUT endpoint. */\r
+ #define AVRISP_DATA_OUT_EPNUM 2\r
+\r
+ /** Endpoint number of the AVRISP data IN endpoint. */\r
+ #define AVRISP_DATA_IN_EPNUM 2\r
+ #else\r
+ /** Endpoint number of the AVRISP data OUT endpoint. */\r
+ #define AVRISP_DATA_OUT_EPNUM 2\r
+\r
+ /** Endpoint number of the AVRISP data IN endpoint. */\r
+ #define AVRISP_DATA_IN_EPNUM 3\r
+ #endif\r
\r
/** Size in bytes of the AVRISP data endpoint. */\r
- #define AVRISP_DATA_EPSIZE 64 \r
+ #define AVRISP_DATA_EPSIZE 64\r
\r
/* Type Defines: */\r
/** Type define for the device configuration descriptor structure. This must be defined in the\r
Endpoint_Read_Stream_LE(&Enter_ISP_Params, sizeof(Enter_ISP_Params), NO_STREAM_CALLBACK);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
uint8_t ResponseStatus = STATUS_CMD_FAILED;\r
Endpoint_Read_Stream_LE(&Leave_ISP_Params, sizeof(Leave_ISP_Params), NO_STREAM_CALLBACK);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
/* Perform pre-exit delay, release the target /RESET, disable the SPI bus and perform the post-exit delay */\r
if (Write_Memory_Params.BytesToWrite > sizeof(Write_Memory_Params.ProgData))\r
{\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
Endpoint_Write_Byte(V2Command);\r
Endpoint_Read_Stream_LE(&Write_Memory_Params.ProgData, Write_Memory_Params.BytesToWrite, NO_STREAM_CALLBACK);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
uint8_t ProgrammingStatus = STATUS_CMD_OK; \r
Read_Memory_Params.BytesToRead = SwapEndian_16(Read_Memory_Params.BytesToRead);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
Endpoint_Write_Byte(V2Command);\r
Endpoint_Read_Stream_LE(&Erase_Chip_Params, sizeof(Erase_Chip_Params), NO_STREAM_CALLBACK);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
uint8_t ResponseStatus = STATUS_CMD_OK;\r
Endpoint_Read_Stream_LE(&Read_FuseLockSigOSCCAL_Params, sizeof(Read_FuseLockSigOSCCAL_Params), NO_STREAM_CALLBACK);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
uint8_t ResponseBytes[4];\r
Endpoint_Read_Stream_LE(&Write_FuseLockSig_Params, sizeof(Write_FuseLockSig_Params), NO_STREAM_CALLBACK);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
/* Send the Fuse or Lock byte program commands as given by the host to the device */\r
Endpoint_Read_Stream_LE(&SPI_Multi_Params.TxData, SPI_Multi_Params.TxBytes, NO_STREAM_CALLBACK);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
Endpoint_Write_Byte(CMD_SPI_MULTI);\r
}\r
\r
Endpoint_WaitUntilReady();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT);\r
}\r
\r
}\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
Endpoint_Write_Byte(V2Command);\r
static void V2Protocol_SignOn(void)\r
{\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
Endpoint_Write_Byte(CMD_SIGN_ON);\r
static void V2Protocol_ResetProtection(void)\r
{\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
Endpoint_Write_Byte(CMD_RESET_PROTECTION);\r
ParamValue = Endpoint_Read_Byte();\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
Endpoint_Write_Byte(V2Command);\r
Endpoint_Read_Stream_BE(&CurrentAddress, sizeof(CurrentAddress), NO_STREAM_CALLBACK);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
MustSetAddress = true;\r
\r
/** MUX mask for the VTARGET ADC channel number */\r
#define VTARGET_ADC_CHANNEL_MASK _GETADCMUXMASK(ADC_CHANNEL, VTARGET_ADC_CHANNEL)\r
+ \r
+ #if !defined(WIN_AVRDUDE_COMPAT)\r
+ #define SELECT_DATA_OUT_ENDPOINT() Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT);\r
+ #else\r
+ #define SELECT_DATA_OUT_ENDPOINT() Endpoint_SelectEndpoint();\r
+ #endif\r
\r
/* External Variables: */\r
extern uint32_t CurrentAddress;\r
Endpoint_Read_Stream_LE(&SetMode_XPROG_Params, sizeof(SetMode_XPROG_Params), NO_STREAM_CALLBACK);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
XPROG_SelectedProtocol = SetMode_XPROG_Params.Protocol;\r
static void XPROGProtocol_EnterXPROGMode(void)\r
{\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
bool NVMBusEnabled;\r
static void XPROGProtocol_LeaveXPROGMode(void)\r
{\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)\r
Erase_XPROG_Params.Address = SwapEndian_32(Erase_XPROG_Params.Address);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
uint8_t EraseCommand;\r
Endpoint_Read_Stream_LE(&WriteMemory_XPROG_Params.ProgData, WriteMemory_XPROG_Params.Length, NO_STREAM_CALLBACK);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)\r
ReadMemory_XPROG_Params.Length = SwapEndian_16(ReadMemory_XPROG_Params.Length);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
uint8_t ReadBuffer[256];\r
Endpoint_Read_Stream_LE(&ReadCRC_XPROG_Params, sizeof(ReadCRC_XPROG_Params), NO_STREAM_CALLBACK);\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
uint32_t MemoryCRC;\r
}\r
\r
Endpoint_ClearOUT();\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);\r
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
\r
Endpoint_Write_Byte(CMD_XPROG);\r
CDEFS += -DENABLE_XPROG_PROTOCOL\r
#CDEFS += -DXPROG_VIA_HARDWARE_USART\r
#CDEFS += -DNO_VTARGET_DETECT\r
+#CDEFS += -DWIN_LIBUSB_COMPAT\r
\r
\r
# Place -D or -U options here for ASM sources\r
{\r
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
\r
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AVRISP_DATA_EPNUM),\r
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AVRISP_DATA_IN_EPNUM),\r
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),\r
.EndpointSize = AVRISP_DATA_EPSIZE,\r
.PollingIntervalMS = 0x00\r
{\r
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
\r
- .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AVRISP_DATA_EPNUM),\r
+ .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AVRISP_DATA_OUT_EPNUM),\r
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),\r
.EndpointSize = AVRISP_DATA_EPSIZE,\r
.PollingIntervalMS = 0x00\r
#include <LUFA/Drivers/USB/USB.h>\r
\r
/* Macros: */\r
- /** Endpoint number of the AVRISP bidirectional data endpoint. */\r
- #define AVRISP_DATA_EPNUM 2\r
+ #if !defined(LIBUSB_FILTERDRV_COMPAT)\r
+ /** Endpoint number of the AVRISP data OUT endpoint. */\r
+ #define AVRISP_DATA_OUT_EPNUM 2\r
\r
+ /** Endpoint number of the AVRISP data IN endpoint. */\r
+ #define AVRISP_DATA_IN_EPNUM 2\r
+ #else\r
+ /** Endpoint number of the AVRISP data OUT endpoint. */\r
+ #define AVRISP_DATA_OUT_EPNUM 2\r
+\r
+ /** Endpoint number of the AVRISP data IN endpoint. */\r
+ #define AVRISP_DATA_IN_EPNUM 3\r
+ #endif\r
+ \r
/** Size in bytes of the AVRISP data endpoint. */\r
#define AVRISP_DATA_EPSIZE 64 \r
\r
if (USB_DeviceState != DEVICE_STATE_Configured)\r
return;\r
\r
- Endpoint_SelectEndpoint(AVRISP_DATA_EPNUM);\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);\r
\r
/* Check to see if a V2 Protocol command has been received */\r
if (Endpoint_IsOUTReceived())\r
/** Event handler for the library USB Configuration Changed event. */\r
void EVENT_USB_Device_ConfigurationChanged(void)\r
{\r
- bool EndpointConfigSuccess;\r
+ bool EndpointConfigSuccess = true;\r
\r
/* Configure the device endpoints according to the selected mode */\r
if (CurrentFirmwareMode == MODE_USART_BRIDGE)\r
{\r
- EndpointConfigSuccess = CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);\r
+ EndpointConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);\r
}\r
else\r
{\r
- EndpointConfigSuccess = Endpoint_ConfigureEndpoint(AVRISP_DATA_EPNUM, EP_TYPE_BULK,\r
- ENDPOINT_DIR_OUT, AVRISP_DATA_EPSIZE,\r
- ENDPOINT_BANK_SINGLE);\r
+ EndpointConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_OUT_EPNUM, EP_TYPE_BULK,\r
+ ENDPOINT_DIR_OUT, AVRISP_DATA_EPSIZE,\r
+ ENDPOINT_BANK_SINGLE);\r
+\r
+ #if defined(WIN_LIBUSB_COMPAT)\r
+ EndpointConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK,\r
+ ENDPOINT_DIR_IN, AVRISP_DATA_EPSIZE,\r
+ ENDPOINT_BANK_SINGLE);\r
+ #endif\r
}\r
\r
if (EndpointConfigSuccess)\r
* <td>RingBuff.h</td>\r
* <td>Defines the maximum number of bytes which can be buffered in each Ring Buffer.</td>\r
* </tr>\r
+ * <tr>\r
+ * <td>WIN_LIBUSB_COMPAT</td>\r
+ * <td>Makefile CDEFS</td>\r
+ * <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making\r
+ * the code compatible with Windows builds of avrdude using the libUSB driver. Linux platforms are not affected by this\r
+ * option.\r
+ * </tr>\r
* </table>\r
*/
\ No newline at end of file
CDEFS += -DAUX_LINE_DDR=DDRB\r
CDEFS += -DAUX_LINE_MASK="(1 << 4)"\r
CDEFS += -DVTARGET_ADC_CHANNEL=2\r
+#CDEFS += -DLIBUSB_FILTERDRV_COMPAT\r
+\r
\r
# Place -D or -U options here for ASM sources\r
ADEFS = -DF_CPU=$(F_CPU)\r