All USB class drivers are now automatically included when LUFA/Drivers/USB.h is included, and no longer need to be seperately included.
All LowLevel demos changed to use the constants and types defined in the USB class drivers.
This commit is contained in:
parent
8f3bee7d86
commit
b37d77eab3
208 changed files with 589 additions and 2910 deletions
|
|
@ -32,8 +32,8 @@
|
|||
#include "../../HighLevel/USBMode.h"
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
|
||||
#define __INCLUDE_FROM_CDC_CLASS_HOST_C
|
||||
#define __INCLUDE_FROM_CDC_DRIVER
|
||||
#define __INCLUDE_FROM_CDC_HOST_C
|
||||
#include "CDC.h"
|
||||
|
||||
uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@
|
|||
*
|
||||
* Host mode driver for the library USB CDC Class driver.
|
||||
*
|
||||
* \note This file should not be included directly. It is automatically included as needed by the class driver
|
||||
* dispatch header located in LUFA/Drivers/USB/Class/CDC.h.
|
||||
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
|
||||
* dispatch header located in LUFA/Drivers/USB.h.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_USBClassCDC
|
||||
|
|
@ -67,9 +67,13 @@
|
|||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_CDC_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/CDC.h instead.
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
|
||||
#endif
|
||||
|
||||
#if defined(__INCLUDE_FROM_CDC_HOST_C) && defined(NO_STREAM_CALLBACKS)
|
||||
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Type Defines: */
|
||||
/** \brief CDC Class Host Mode Configuration and State Structure.
|
||||
|
|
@ -116,21 +120,12 @@
|
|||
*/
|
||||
} ControlLineStates; /**< Current states of the virtual serial port's control lines between the device and host. */
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second. */
|
||||
uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the
|
||||
* \ref CDC_LineEncodingFormats_t enum.
|
||||
*/
|
||||
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
|
||||
* \ref CDC_LineEncodingParity_t enum.
|
||||
*/
|
||||
uint8_t DataBits; /**< Bits of data per character of the virtual serial port. */
|
||||
} LineEncoding; /**< Line encoding used in the virtual serial port, for the device's information. This is generally
|
||||
* only used if the virtual serial port data is to be reconstructed on a physical UART. When set
|
||||
* by the host application, the \ref CDC_Host_SetLineEncoding() function must be called to push
|
||||
* the changes to the device.
|
||||
*/
|
||||
CDC_LineEncoding_t LineEncoding; /**< Line encoding used in the virtual serial port, for the device's information.
|
||||
* This is generally only used if the virtual serial port data is to be
|
||||
* reconstructed on a physical UART. When set by the host application, the
|
||||
* \ref CDC_Host_SetLineEncoding() function must be called to push the changes
|
||||
* to the device.
|
||||
*/
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
|
|
@ -320,7 +315,7 @@
|
|||
#define CDC_DATA_PROTOCOL 0x00
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_CDC_CLASS_HOST_C)
|
||||
#if defined(__INCLUDE_FROM_CDC_HOST_C)
|
||||
static int CDC_Host_putchar(char c,
|
||||
FILE* Stream) ATTR_NON_NULL_PTR_ARG(2);
|
||||
static int CDC_Host_getchar(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
#include "../../HighLevel/USBMode.h"
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
|
||||
#define __INCLUDE_FROM_HID_CLASS_HOST_C
|
||||
#define __INCLUDE_FROM_HID_DRIVER
|
||||
#define __INCLUDE_FROM_HID_HOST_C
|
||||
#include "HID.h"
|
||||
|
||||
uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@
|
|||
*
|
||||
* Host mode driver for the library USB HID Class driver.
|
||||
*
|
||||
* \note This file should not be included directly. It is automatically included as needed by the class driver
|
||||
* dispatch header located in LUFA/Drivers/USB/Class/HID.h.
|
||||
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
|
||||
* dispatch header located in LUFA/Drivers/USB.h.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_USBClassHID
|
||||
|
|
@ -66,9 +66,14 @@
|
|||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_HID_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/HID.h instead.
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
|
||||
#endif
|
||||
|
||||
#if defined(__INCLUDE_FROM_HID_HOST_C) && defined(NO_STREAM_CALLBACKS)
|
||||
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Error code for some HID Host functions, indicating a logical (and not hardware) error. */
|
||||
|
|
@ -296,7 +301,7 @@
|
|||
#define HID_INTERFACE_CLASS 0x03
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_HID_CLASS_HOST_C)
|
||||
#if defined(__INCLUDE_FROM_HID_HOST_C)
|
||||
static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t DCOMP_HID_Host_NextHID(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t DCOMP_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include "../../HighLevel/USBMode.h"
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
|
||||
#define __INCLUDE_FROM_HID_DRIVER
|
||||
#include "HIDParser.h"
|
||||
|
||||
uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
|
||||
|
|
|
|||
|
|
@ -58,10 +58,6 @@
|
|||
#ifndef __HIDPARSER_H__
|
||||
#define __HIDPARSER_H__
|
||||
|
||||
/* Macros: */
|
||||
#define __INCLUDE_FROM_USB_DRIVER
|
||||
#define __INCLUDE_FROM_HID_DRIVER
|
||||
|
||||
/* Includes: */
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
#include "../../HighLevel/USBMode.h"
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
|
||||
#define __INCLUDE_FROM_MIDI_CLASS_HOST_C
|
||||
#define __INCLUDE_FROM_MIDI_DRIVER
|
||||
#define __INCLUDE_FROM_MIDI_HOST_C
|
||||
#include "MIDI.h"
|
||||
|
||||
uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo,
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@
|
|||
*
|
||||
* Host mode driver for the library USB MIDI Class driver.
|
||||
*
|
||||
* \note This file should not be included directly. It is automatically included as needed by the class driver
|
||||
* dispatch header located in LUFA/Drivers/USB/Class/MIDI.h.
|
||||
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
|
||||
* dispatch header located in LUFA/Drivers/USB.h.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_USBClassMIDI
|
||||
|
|
@ -64,7 +64,11 @@
|
|||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_MIDI_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/MIDI.h instead.
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
|
||||
#endif
|
||||
|
||||
#if defined(__INCLUDE_FROM_MIDI_HOST_C) && defined(NO_STREAM_CALLBACKS)
|
||||
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
|
|
@ -190,7 +194,7 @@
|
|||
#define MIDI_STREAMING_PROTOCOL 0x00
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_MIDI_CLASS_HOST_C)
|
||||
#if defined(__INCLUDE_FROM_MIDI_HOST_C)
|
||||
static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
#include "../../HighLevel/USBMode.h"
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
|
||||
#define __INCLUDE_FROM_MS_CLASS_HOST_C
|
||||
#define __INCLUDE_FROM_MS_DRIVER
|
||||
#define __INCLUDE_FROM_MASSSTORAGE_HOST_C
|
||||
#include "MassStorage.h"
|
||||
|
||||
uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
||||
|
|
@ -309,7 +309,7 @@ uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo)
|
|||
USB_ControlRequest = (USB_Request_Header_t)
|
||||
{
|
||||
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
|
||||
.bRequest = REQ_MassStorageReset,
|
||||
.bRequest = MS_REQ_MassStorageReset,
|
||||
.wValue = 0,
|
||||
.wIndex = MSInterfaceInfo->State.InterfaceNumber,
|
||||
.wLength = 0,
|
||||
|
|
@ -328,7 +328,7 @@ uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
|||
USB_ControlRequest = (USB_Request_Header_t)
|
||||
{
|
||||
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
|
||||
.bRequest = REQ_GetMaxLUN,
|
||||
.bRequest = MS_REQ_GetMaxLUN,
|
||||
.wValue = 0,
|
||||
.wIndex = MSInterfaceInfo->State.InterfaceNumber,
|
||||
.wLength = 1,
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@
|
|||
*
|
||||
* Host mode driver for the library USB Mass Storage Class driver.
|
||||
*
|
||||
* \note This file should not be included directly. It is automatically included as needed by the class driver
|
||||
* dispatch header located in LUFA/Drivers/USB/Class/MassStorage.h.
|
||||
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
|
||||
* dispatch header located in LUFA/Drivers/USB.h.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_USBClassMS
|
||||
|
|
@ -64,7 +64,11 @@
|
|||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_MS_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/MassStorage.h instead.
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
|
||||
#endif
|
||||
|
||||
#if defined(__INCLUDE_FROM_MASSSTORAGE_HOST_C) && defined(NO_STREAM_CALLBACKS)
|
||||
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
|
|
@ -313,9 +317,6 @@
|
|||
#define MASS_STORE_SUBCLASS 0x06
|
||||
#define MASS_STORE_PROTOCOL 0x50
|
||||
|
||||
#define REQ_MassStorageReset 0xFF
|
||||
#define REQ_GetMaxLUN 0xFE
|
||||
|
||||
#define CBW_SIGNATURE 0x43425355UL
|
||||
#define CSW_SIGNATURE 0x53425355UL
|
||||
|
||||
|
|
@ -325,7 +326,7 @@
|
|||
#define COMMAND_DATA_TIMEOUT_MS 10000
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_MS_CLASS_HOST_C)
|
||||
#if defined(__INCLUDE_FROM_MASSSTORAGE_HOST_C)
|
||||
static uint8_t DCOMP_MS_Host_NextMSInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t DCOMP_MS_Host_NextMSInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
#include "../../HighLevel/USBMode.h"
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
|
||||
#define __INCLUDE_FROM_PRINTER_CLASS_HOST_C
|
||||
#define __INCLUDE_FROM_PRINTER_DRIVER
|
||||
#define __INCLUDE_FROM_PRINTER_HOST_C
|
||||
#include "Printer.h"
|
||||
|
||||
uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
|
||||
|
|
@ -175,7 +175,7 @@ uint8_t PRNT_Host_GetPortStatus(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceIn
|
|||
USB_ControlRequest = (USB_Request_Header_t)
|
||||
{
|
||||
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
|
||||
.bRequest = REQ_GetPortStatus,
|
||||
.bRequest = PRNT_REQ_GetPortStatus,
|
||||
.wValue = 0,
|
||||
.wIndex = PRNTInterfaceInfo->State.InterfaceNumber,
|
||||
.wLength = sizeof(uint8_t),
|
||||
|
|
@ -191,7 +191,7 @@ uint8_t PRNT_Host_SoftReset(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo)
|
|||
USB_ControlRequest = (USB_Request_Header_t)
|
||||
{
|
||||
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
|
||||
.bRequest = REQ_SoftReset,
|
||||
.bRequest = PRNT_REQ_SoftReset,
|
||||
.wValue = 0,
|
||||
.wIndex = PRNTInterfaceInfo->State.InterfaceNumber,
|
||||
.wLength = 0,
|
||||
|
|
@ -345,7 +345,7 @@ uint8_t PRNT_Host_GetDeviceID(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo
|
|||
USB_ControlRequest = (USB_Request_Header_t)
|
||||
{
|
||||
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
|
||||
.bRequest = REQ_GetDeviceID,
|
||||
.bRequest = PRNT_REQ_GetDeviceID,
|
||||
.wValue = 0,
|
||||
.wIndex = PRNTInterfaceInfo->State.InterfaceNumber,
|
||||
.wLength = sizeof(DeviceIDStringLength),
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@
|
|||
*
|
||||
* Host mode driver for the library USB Printer Class driver.
|
||||
*
|
||||
* \note This file should not be included directly. It is automatically included as needed by the class driver
|
||||
* dispatch header located in LUFA/Drivers/USB/Class/Printer.h.
|
||||
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
|
||||
* dispatch header located in LUFA/Drivers/USB.h.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_USBClassPrinter
|
||||
|
|
@ -64,7 +64,11 @@
|
|||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_PRINTER_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/Printer.h instead.
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
|
||||
#endif
|
||||
|
||||
#if defined(__INCLUDE_FROM_PRINTER_HOST_C) && defined(NO_STREAM_CALLBACKS)
|
||||
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
|
|
@ -265,12 +269,8 @@
|
|||
#define PRINTER_SUBCLASS 0x01
|
||||
#define PRINTER_PROTOCOL 0x02
|
||||
|
||||
#define REQ_GetDeviceID 0
|
||||
#define REQ_GetPortStatus 1
|
||||
#define REQ_SoftReset 2
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_PRINTER_CLASS_HOST_C)
|
||||
#if defined(__INCLUDE_FROM_PRINTER_HOST_C)
|
||||
static uint8_t DCOMP_PRNT_Host_NextPRNTInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t DCOMP_PRNT_Host_NextPRNTInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
#include "../../HighLevel/USBMode.h"
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
|
||||
#define __INCLUDE_FROM_RNDIS_CLASS_HOST_C
|
||||
#define __INCLUDE_FROM_RNDIS_DRIVER
|
||||
#define __INCLUDE_FROM_RNDIS_HOST_C
|
||||
#include "RNDIS.h"
|
||||
|
||||
uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@
|
|||
*
|
||||
* Host mode driver for the library USB RNDIS Class driver.
|
||||
*
|
||||
* \note This file should not be included directly. It is automatically included as needed by the class driver
|
||||
* dispatch header located in LUFA/Drivers/USB/Class/RNDIS.h.
|
||||
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
|
||||
* dispatch header located in LUFA/Drivers/USB.h.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_USBClassRNDIS
|
||||
|
|
@ -68,7 +68,11 @@
|
|||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_RNDIS_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/RNDIS.h instead.
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
|
||||
#endif
|
||||
|
||||
#if defined(__INCLUDE_FROM_RNDIS_HOST_C) && defined(NO_STREAM_CALLBACKS)
|
||||
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
|
|
@ -267,7 +271,7 @@
|
|||
#define RNDIS_DATA_PROTOCOL 0x00
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_RNDIS_CLASS_HOST_C)
|
||||
#if defined(__INCLUDE_FROM_RNDIS_HOST_C)
|
||||
static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
|
||||
void* Buffer,
|
||||
const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1)
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
#include "../../HighLevel/USBMode.h"
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
|
||||
#define __INCLUDE_FROM_SI_CLASS_HOST_C
|
||||
#define __INCLUDE_FROM_SI_DRIVER
|
||||
#define __INCLUDE_FROM_STILLIMAGE_HOST_C
|
||||
#include "StillImage.h"
|
||||
|
||||
uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
||||
|
|
@ -163,7 +163,7 @@ uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor)
|
|||
}
|
||||
|
||||
uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
||||
SI_PIMA_Container_t* const PIMAHeader)
|
||||
PIMA_Container_t* const PIMAHeader)
|
||||
{
|
||||
uint8_t ErrorCode;
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
}
|
||||
|
||||
uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
||||
SI_PIMA_Container_t* const PIMAHeader)
|
||||
PIMA_Container_t* const PIMAHeader)
|
||||
{
|
||||
uint16_t TimeoutMSRem = COMMAND_DATA_TIMEOUT_MS;
|
||||
uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber();
|
||||
|
|
@ -243,7 +243,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
|
|||
|
||||
Pipe_Read_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NO_STREAM_CALLBACK);
|
||||
|
||||
if (PIMAHeader->Type == SI_PIMA_CONTAINER_ResponseBlock)
|
||||
if (PIMAHeader->Type == PIMA_CONTAINER_ResponseBlock)
|
||||
{
|
||||
uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0));
|
||||
|
||||
|
|
@ -316,7 +316,7 @@ bool SI_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
|
|||
}
|
||||
|
||||
uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
||||
SI_PIMA_Container_t* const PIMAHeader)
|
||||
PIMA_Container_t* const PIMAHeader)
|
||||
{
|
||||
uint8_t ErrorCode;
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
|
|||
Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
ErrorCode = Pipe_Read_Stream_LE(PIMAHeader, sizeof(SI_PIMA_Container_t), NO_STREAM_CALLBACK);
|
||||
ErrorCode = Pipe_Read_Stream_LE(PIMAHeader, sizeof(PIMA_Container_t), NO_STREAM_CALLBACK);
|
||||
|
||||
Pipe_ClearIN();
|
||||
Pipe_Freeze();
|
||||
|
|
@ -344,10 +344,10 @@ uint8_t SI_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
|
|||
SIInterfaceInfo->State.TransactionID = 0;
|
||||
SIInterfaceInfo->State.IsSessionOpen = false;
|
||||
|
||||
SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
|
||||
PIMA_Container_t PIMABlock = (PIMA_Container_t)
|
||||
{
|
||||
.DataLength = PIMA_COMMAND_SIZE(1),
|
||||
.Type = SI_PIMA_CONTAINER_CommandBlock,
|
||||
.Type = PIMA_CONTAINER_CommandBlock,
|
||||
.Code = 0x1002,
|
||||
.Params = {1},
|
||||
};
|
||||
|
|
@ -358,7 +358,7 @@ uint8_t SI_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
|
|||
if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
|
||||
if ((PIMABlock.Type != PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
|
||||
return SI_ERROR_LOGICAL_CMD_FAILED;
|
||||
|
||||
SIInterfaceInfo->State.IsSessionOpen = true;
|
||||
|
|
@ -373,10 +373,10 @@ uint8_t SI_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
|
||||
PIMA_Container_t PIMABlock = (PIMA_Container_t)
|
||||
{
|
||||
.DataLength = PIMA_COMMAND_SIZE(1),
|
||||
.Type = SI_PIMA_CONTAINER_CommandBlock,
|
||||
.Type = PIMA_CONTAINER_CommandBlock,
|
||||
.Code = 0x1003,
|
||||
.Params = {1},
|
||||
};
|
||||
|
|
@ -389,7 +389,7 @@ uint8_t SI_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
|
|||
|
||||
SIInterfaceInfo->State.IsSessionOpen = false;
|
||||
|
||||
if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
|
||||
if ((PIMABlock.Type != PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
|
||||
return SI_ERROR_LOGICAL_CMD_FAILED;
|
||||
|
||||
return PIPE_RWSTREAM_NoError;
|
||||
|
|
@ -405,10 +405,10 @@ uint8_t SI_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
|
||||
PIMA_Container_t PIMABlock = (PIMA_Container_t)
|
||||
{
|
||||
.DataLength = PIMA_COMMAND_SIZE(TotalParams),
|
||||
.Type = SI_PIMA_CONTAINER_CommandBlock,
|
||||
.Type = PIMA_CONTAINER_CommandBlock,
|
||||
.Code = Operation,
|
||||
};
|
||||
|
||||
|
|
@ -423,7 +423,7 @@ uint8_t SI_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
uint8_t SI_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
|
||||
{
|
||||
uint8_t ErrorCode;
|
||||
SI_PIMA_Container_t PIMABlock;
|
||||
PIMA_Container_t PIMABlock;
|
||||
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
|
||||
return HOST_SENDCONTROL_DeviceDisconnected;
|
||||
|
|
@ -431,7 +431,7 @@ uint8_t SI_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
|
|||
if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
|
||||
if ((PIMABlock.Type != PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
|
||||
return SI_ERROR_LOGICAL_CMD_FAILED;
|
||||
|
||||
return PIPE_RWSTREAM_NoError;
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@
|
|||
*
|
||||
* Host mode driver for the library USB Still Image Class driver.
|
||||
*
|
||||
* \note This file should not be included directly. It is automatically included as needed by the class driver
|
||||
* dispatch header located in LUFA/Drivers/USB/Class/StillImage.h.
|
||||
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
|
||||
* dispatch header located in LUFA/Drivers/USB.h.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_USBClassSI
|
||||
|
|
@ -64,7 +64,11 @@
|
|||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_SI_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/StillImage.h instead.
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
|
||||
#endif
|
||||
|
||||
#if defined(__INCLUDE_FROM_STILLIMAGE_HOST_C) && defined(NO_STREAM_CALLBACKS)
|
||||
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
|
|
@ -184,7 +188,7 @@
|
|||
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
||||
SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
|
||||
PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
|
||||
ATTR_NON_NULL_PTR_ARG(2);
|
||||
|
||||
/** Receives a raw PIMA block header to the device. This can be used to receive arbitrary PIMA blocks from the device with
|
||||
|
|
@ -199,7 +203,7 @@
|
|||
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
||||
SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
|
||||
PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
|
||||
ATTR_NON_NULL_PTR_ARG(2);
|
||||
|
||||
/** Sends a given PIMA command to the attached device, filling out the PIMA command header's Transaction ID automatically.
|
||||
|
|
@ -256,7 +260,7 @@
|
|||
* returned a logical command failure.
|
||||
*/
|
||||
uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
||||
SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
|
||||
PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
|
||||
ATTR_NON_NULL_PTR_ARG(2);
|
||||
|
||||
/** Sends arbitrary data to the attached device, for use in the data phase of PIMA commands which require data
|
||||
|
|
@ -314,7 +318,7 @@
|
|||
#define COMMAND_DATA_TIMEOUT_MS 10000
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_SI_CLASS_HOST_C)
|
||||
#if defined(__INCLUDE_FROM_STILLIMAGE_HOST_C)
|
||||
static uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue