diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-09-06 04:15:35 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-09-06 04:15:35 +0000 |
commit | 064e6a2f32719da5b7ed2ff3a8a32c5788e753d0 (patch) | |
tree | 1445c628dbba4a44b983a6856203a79fc597554f /LUFA | |
parent | 6783bc4594177833d2b1047d77316e38cfe6a629 (diff) | |
download | lufa-064e6a2f32719da5b7ed2ff3a8a32c5788e753d0.tar.gz lufa-064e6a2f32719da5b7ed2ff3a8a32c5788e753d0.tar.bz2 lufa-064e6a2f32719da5b7ed2ff3a8a32c5788e753d0.zip |
Changed Still Image Host class driver to auto-fill TransactionID element of sent headers depending on the current session state.
CDC based demos and project now work under 64 bit versions of Windows (thanks to Ronny Hanson, Thomas Bleeker).
The Benito Programmer project now has its own unique VID/PID pair allocated from the Atmel donated LUFA VID/PID pool.
Diffstat (limited to 'LUFA')
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/StillImage.c | 52 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/StillImage.h | 6 | ||||
-rw-r--r-- | LUFA/ManPages/ChangeLog.txt | 2 | ||||
-rw-r--r-- | LUFA/ManPages/LUFAPoweredProjects.txt | 2 | ||||
-rw-r--r-- | LUFA/ManPages/VIDAndPIDValues.txt | 2 |
5 files changed, 49 insertions, 15 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.c b/LUFA/Drivers/USB/Class/Host/StillImage.c index a3b150848..ecaed3a89 100644 --- a/LUFA/Drivers/USB/Class/Host/StillImage.c +++ b/LUFA/Drivers/USB/Class/Host/StillImage.c @@ -153,10 +153,7 @@ static uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* SIInterfaceI {
uint8_t ErrorCode;
- if (SIInterfaceInfo->State.IsSessionOpen)
- PIMAHeader->TransactionID = SIInterfaceInfo->State.TransactionID++;
- else
- PIMAHeader->TransactionID = 0;
+ PIMAHeader->TransactionID = SIInterfaceInfo->State.TransactionID++;
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
@@ -164,15 +161,12 @@ static uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* SIInterfaceI if ((ErrorCode = Pipe_Write_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
- if (PIMAHeader->Type == CType_CommandBlock)
- {
- uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0));
+ uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0));
- if (ParamBytes)
- {
- if ((ErrorCode = Pipe_Write_Stream_LE(&PIMAHeader->Params, ParamBytes, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
- return ErrorCode;
- }
+ if (ParamBytes)
+ {
+ if ((ErrorCode = Pipe_Write_Stream_LE(&PIMAHeader->Params, ParamBytes, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
+ return ErrorCode;
}
Pipe_ClearOUT();
@@ -318,14 +312,13 @@ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* SIInterfaceInfo) .Params = {},
};
- SIInterfaceInfo->State.TransactionID = 1;
-
if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
if ((ErrorCode = SImage_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
+ SIInterfaceInfo->State.TransactionID = 0;
SIInterfaceInfo->State.IsSessionOpen = true;
return PIPE_RWSTREAM_NoError;
@@ -354,6 +347,37 @@ uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* SIInterfaceInfo) SIInterfaceInfo->State.IsSessionOpen = false;
+ if ((PIMABlock.Type != CType_ResponseBlock) || (PIMABlock.Code != 0x2001))
+ return SI_ERROR_LOGICAL_CMD_FAILED;
+
+ return PIPE_RWSTREAM_NoError;
+}
+
+uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, uint16_t Operation, uint8_t UsedParams,
+ uint32_t Param1, uint32_t Param2, uint32_t Param3, void* DataBuff)
+{
+ if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
+ return HOST_SENDCONTROL_DeviceDisconnect;
+
+ uint8_t ErrorCode;
+
+ SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
+ {
+ .DataLength = PIMA_COMMAND_SIZE(UsedParams),
+ .Type = CType_CommandBlock,
+ .Code = Operation,
+ .Params = {Param1, Param2, Param3},
+ };
+
+ if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
+ return ErrorCode;
+
+ if ((ErrorCode = SImage_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
+ return ErrorCode;
+
+ if ((PIMABlock.Type != CType_ResponseBlock) || (PIMABlock.Code != 0x2001))
+ return SI_ERROR_LOGICAL_CMD_FAILED;
+
return PIPE_RWSTREAM_NoError;
}
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.h b/LUFA/Drivers/USB/Class/Host/StillImage.h index 7e33fc4b1..75f76eb8e 100644 --- a/LUFA/Drivers/USB/Class/Host/StillImage.h +++ b/LUFA/Drivers/USB/Class/Host/StillImage.h @@ -54,6 +54,9 @@ #endif
/* Public Interface - May be used in end-application: */
+ /* Macros: */
+ #define SI_ERROR_LOGICAL_CMD_FAILED 0xC0
+
/* Type Defines: */
typedef struct
{
@@ -125,6 +128,9 @@ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* SIInterfaceInfo);
uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* SIInterfaceInfo);
+
+ uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, uint16_t Operation, uint8_t UsedParams,
+ uint32_t Param1, uint32_t Param2, uint32_t Param3, void* DataBuff);
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 60f00ed15..db91efe7b 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -36,6 +36,7 @@ * - Changed HIDParser to only zero out important values in the Parsed HID Report Item Information structure to save cycles
* - The HID report parser now always processed FEATURE items - HID_ENABLE_FEATURE_PROCESSING token now has no effect
* - The HID report parser now always ignores constant-data items, HID_INCLUDE_CONSTANT_DATA_ITEMS token now has no effect
+ * - The Benito Programmer project now has its own unique VID/PID pair allocated from the Atmel donated LUFA VID/PID pool
*
* <b>Fixed:</b>
* - Fixed possible lockup in the CDC device class driver, when the host sends data that is a multiple of the
@@ -54,6 +55,7 @@ * routine, so that ignored callbacks don't cause incorrect data to be sent
* - Fixed StillImageHost not correctly freezing and unfreezing data pipes while waiting for a response block header
* - Fixed error in PrinterHost preventing the full page data from being sent to the attached device
+ * - CDC based demos and project now work under 64 bit versions of Windows (thanks to Ronny Hanson, Thomas Bleeker)
*
*
* \section Sec_ChangeLog090810 Version 090810
diff --git a/LUFA/ManPages/LUFAPoweredProjects.txt b/LUFA/ManPages/LUFAPoweredProjects.txt index 752bf7b2b..f58dc88f0 100644 --- a/LUFA/ManPages/LUFAPoweredProjects.txt +++ b/LUFA/ManPages/LUFAPoweredProjects.txt @@ -33,6 +33,7 @@ * - Bicycle POV: http://www.code.google.com/p/bicycleledpov/
* - CAMTRIG, a remote Camera Trigger device: http://code.astraw.com/projects/motmot/camtrig
* - "Fingerlicking Wingdinger" (WARNING: Bad Language if no Javascript), a MIDI controller - http://noisybox.net/electronics/wingdinger/
+ * - Garmin GPS USB to NMEA standard serial sentence translator: http://github.com/nall/garmin-transmogrifier/tree/master
* - Opendous-JTAG, an open source JTAG device: http://code.google.com/p/opendous-jtag/
* - Openkubus, an open source hardware-based authentication dongle: http://code.google.com/p/openkubus/
* - Orbee, a USB connected RGB Orb for notifications: http://www.franksworkshop.com.au/Electronics/Orbee/Orbee.htm
@@ -51,4 +52,5 @@ * - ARPS Locator: http://la3t.hamradio.no/lab//?id=tracker_en
* - Digital Survey Instruments Magnetometer and Pointer: http://www.digitalsurveyinstruments.com/
* - Lightweight CC110x USB dongle for 868MHz Protocols: http://busware.de/tiki-index.php?page=CUL
+ * - BAP, A tiny LUFA based AVR Programmer: http://www.busware.de/tiki-index.php?page=BAP
*/
\ No newline at end of file diff --git a/LUFA/ManPages/VIDAndPIDValues.txt b/LUFA/ManPages/VIDAndPIDValues.txt index 296098fc5..e0259141c 100644 --- a/LUFA/ManPages/VIDAndPIDValues.txt +++ b/LUFA/ManPages/VIDAndPIDValues.txt @@ -228,7 +228,7 @@ * 0x2060
* </td>
* <td>
- * <i>Currently Unallocated</i>
+ * <i>Benito Programmer Project</i>
* </td>
* </tr>
*
|