Commit 74353374 authored by Dean Camera's avatar Dean Camera
Browse files

All Class Driver Host mode demos now correctly set the board LEDs to READY...

All Class Driver Host mode demos now correctly set the board LEDs to READY once the enumeration process has completed.

Fixed Still Image Host class driver not resetting the transaction ID when a new session is opened, fixed driver not sending a valid session ID to the device.
parent b8db5fc1
......@@ -115,9 +115,8 @@ int main(void)
break;
}
LEDs_SetAllLEDs(LEDS_NO_LEDS);
printf("Joystick Enumerated.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
......
......@@ -111,6 +111,7 @@ int main(void)
}
printf("Keyboard Enumerated.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
......
......@@ -115,9 +115,8 @@ int main(void)
break;
}
LEDs_SetAllLEDs(LEDS_NO_LEDS);
printf("Keyboard Enumerated.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
......
......@@ -101,6 +101,7 @@ int main(void)
}
printf("MIDI Device Enumerated.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
......
......@@ -101,6 +101,7 @@ int main(void)
}
printf("Mass Storage Device Enumerated.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
......
......@@ -111,6 +111,7 @@ int main(void)
}
printf("Mouse Enumerated.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
......
......@@ -115,9 +115,8 @@ int main(void)
break;
}
LEDs_SetAllLEDs(LEDS_NO_LEDS);
printf("Mouse Enumerated.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
......
......@@ -108,6 +108,7 @@ int main(void)
}
printf("Printer Device Enumerated.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
......
......@@ -143,6 +143,7 @@ int main(void)
printf("Device Vendor ID: 0x%08lX\r\n", VendorID);
printf("RNDIS Device Enumerated.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
......
......@@ -88,7 +88,7 @@ int main(void)
if (SImage_Host_ConfigurePipes(&DigitalCamera_SI_Interface,
ConfigDescriptorSize, ConfigDescriptorData) != SI_ENUMERROR_NoError)
{
printf("Attached Device Not a Valid CDC Class Device.\r\n");
printf("Attached Device Not a Valid Still Image Class Device.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
......@@ -103,6 +103,7 @@ int main(void)
}
printf("Still Image Device Enumerated.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
......
......@@ -103,6 +103,7 @@ int main(void)
}
printf("CDC Device Enumerated.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
......
......@@ -167,7 +167,6 @@ void StillImage_Task(void)
}
puts_P(PSTR("Still Image Device Enumerated.\r\n"));
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
......
......@@ -87,7 +87,7 @@
*
* \param[in] channel MIDI channel number to address
*/
#define MIDI_CHANNEL(channel) (channel - 1)
#define MIDI_CHANNEL(channel) ((channel) - 1)
/* Type Defines: */
/** Type define for an Audio class specific MIDI streaming interface descriptor. This indicates to the host
......
......@@ -63,23 +63,23 @@
*
* \return Number of bytes of the given unicode string
*/
#define UNICODE_STRING_LENGTH(chars) (chars << 1)
#define UNICODE_STRING_LENGTH(chars) ((chars) << 1)
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
* a command container.
*
* \param[in] params Number of parameters which are to be sent in the Param field of the container
*/
#define PIMA_COMMAND_SIZE(params) ((sizeof(SI_PIMA_Container_t) - sizeof(((SI_PIMA_Container_t*)NULL)->Params)) + \
(params * sizeof(uint32_t)))
#define PIMA_COMMAND_SIZE(params) ((sizeof(SI_PIMA_Container_t) - 12) + \
((params) * sizeof(uint32_t)))
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
* a data container.
*
* \param[in] datalen Length in bytes of the data in the container
*/
#define PIMA_DATA_SIZE(datalen) ((sizeof(SI_PIMA_Container_t) - sizeof(((SI_PIMA_Container_t*)NULL)->Params)) + \
datalen)
#define PIMA_DATA_SIZE(datalen) ((sizeof(SI_PIMA_Container_t) - 12) + \
(datalen))
/* Enums: */
/** Enum for the possible PIMA contains types. */
......@@ -122,7 +122,7 @@
uint16_t Type; /**< Container type, a value from the PIMA_Container_Types_t enum */
uint16_t Code; /**< Command, event or response code of the container */
uint32_t TransactionID; /**< Unique container ID to link blocks together */
uint32_t Params[5]; /**< Block parameters to be issued along with the block code (command blocks only) */
uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only) */
} SI_PIMA_Container_t;
/* Disable C linkage for C++ Compilers: */
......
......@@ -315,12 +315,15 @@ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
uint8_t ErrorCode;
SIInterfaceInfo->State.TransactionID = 0;
SIInterfaceInfo->State.IsSessionOpen = false;
SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
{
.DataLength = PIMA_COMMAND_SIZE(0),
.DataLength = PIMA_COMMAND_SIZE(1),
.Type = CType_CommandBlock,
.Code = 0x1002,
.Params = {},
.Params = {1},
};
if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
......@@ -332,7 +335,6 @@ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
if ((PIMABlock.Type != CType_ResponseBlock) || (PIMABlock.Code != 0x2001))
return SI_ERROR_LOGICAL_CMD_FAILED;
SIInterfaceInfo->State.TransactionID = 0;
SIInterfaceInfo->State.IsSessionOpen = true;
return PIPE_RWSTREAM_NoError;
......@@ -347,10 +349,10 @@ uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
{
.DataLength = PIMA_COMMAND_SIZE(0),
.DataLength = PIMA_COMMAND_SIZE(1),
.Type = CType_CommandBlock,
.Code = 0x1003,
.Params = {},
.Params = {1},
};
if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
......
......@@ -23,6 +23,7 @@
* - Double bank CDC endpoints in the XPLAIN Bridge project, re-enable JTAG once the mode selection pin has been sampled.
* - Standardized the naming scheme given to configuration descriptor sub-elements in the Device mode demos, bootloaders
* and projects
* - All Class Driver Host mode demos now correctly set the board LEDs to READY once the enumeration process has completed
*
* <b>Fixed:</b>
* - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin
......@@ -34,6 +35,8 @@
* - Fixed LowLevel MassStorage demo broken on the U2 AVRs due to double-banked endpoints
* - Fixed compilation error in the AudioInput demos when MICROPHONE_BIASED_TO_HALF_RAIL is defined (thanks to C. Scott Ananian)
* - Fixed incorrect definition of HID_ALIGN_DATA() causing incorrect HID report item data alignment
* - Fixed Still Image Host class driver not resetting the transaction ID when a new session is opened, fixed driver not sending
* a valid session ID to the device
*
* \section Sec_ChangeLog100219 Version 100219
*
......
......@@ -21,6 +21,7 @@
* - AT90USB162 Breadboard PCB (Russian): http://microsin.ru/content/view/685/44/
* - Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/wiki/benito
* - Bumble-B, yet another AT90USB162 development board: http://fletchtronics.net/bumble-b
* - JM-DB-U2, an ATMEGA32U2 development board: http://u2.mattair.net/index.html
* - Micropendous, an open design/source set of AVR USB development boards: http://micropendous.org/
* - Nanduino, a do-it-yourself AT90USB162 board: http://www.makestuff.eu/wordpress/?page_id=569
* - Teensy and Teensy++, two other AVR USB development boards: http://www.pjrc.com/teensy/index.html
......
......@@ -7,6 +7,7 @@
*/
/*
Copyright 2010 OBinou (obconseil [at] gmail [dot] com)
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
......@@ -18,7 +19,6 @@
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
......
......@@ -7,6 +7,7 @@
*/
/*
Copyright 2010 OBinou (obconseil [at] gmail [dot] com)
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
......
......@@ -7,6 +7,7 @@
*/
/*
Copyright 2010 OBinou (obconseil [at] gmail [dot] com)
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment