Increase timeout of Mass Storage and Still Image host commands to 10 seconds (up from 5) to account for slow-processing devices.

Added brace guards to macros with parameters to prevent unintended changed evaluation of the macro expression.

Minor code cleanups (remove redundant comments, fix spacing, etc.).
This commit is contained in:
Dean Camera 2009-12-09 00:50:55 +00:00
parent 2281750b5f
commit 7ace314cc1
61 changed files with 133 additions and 122 deletions

View file

@ -65,7 +65,7 @@
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY (LEDS_LED2)
#define LEDMASK_USB_BUSY LEDS_LED2
/* Function Prototypes: */
void SetupHardware(void);

View file

@ -64,7 +64,7 @@
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY (LEDS_LED2)
#define LEDMASK_USB_BUSY LEDS_LED2
/* Function Prototypes: */
void SetupHardware(void);

View file

@ -64,7 +64,7 @@
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY (LEDS_LED2)
#define LEDMASK_USB_BUSY LEDS_LED2
/* Function Prototypes: */
void SetupHardware(void);

View file

@ -32,7 +32,7 @@
#define _CONFIGDESCRIPTOR_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/USB/USB.h>
#include "BluetoothHost.h"

View file

@ -32,7 +32,7 @@
#define _DEVICEDESCRIPTOR_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/USB/USB.h>
#include "BluetoothHost.h"

View file

@ -37,13 +37,13 @@
#define _CONFIGDESCRIPTOR_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/USB/USB.h>
#include "GenericHIDHost.h"
/* Macros: */
/** Interface Class value for the Human Interface Device class */
#define HID_CLASS 0x03
#define HID_CLASS 0x03
/** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */
#define MAX_CONFIG_DESCRIPTOR_SIZE 512

View file

@ -54,13 +54,13 @@
/* Macros: */
/** Pipe number for the HID data IN pipe */
#define HID_DATA_IN_PIPE 1
#define HID_DATA_IN_PIPE 1
/** Pipe number for the HID data OUT pipe */
#define HID_DATA_OUT_PIPE 2
#define HID_DATA_OUT_PIPE 2
/** HID Class specific request to send a HID report to the device. */
#define REQ_SetReport 0x09
#define REQ_SetReport 0x09
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1

View file

@ -37,7 +37,7 @@
#define _CONFIGDESCRIPTOR_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/USB/USB.h>
#include "HIDReport.h"

View file

@ -54,7 +54,7 @@
/* Macros: */
/** Pipe number for the joystick report data pipe */
#define JOYSTICK_DATAPIPE 1
#define JOYSTICK_DATAPIPE 1
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1

View file

@ -37,7 +37,7 @@
#define _CONFIGDESCRIPTOR_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/USB/USB.h>
#include "KeyboardHost.h"

View file

@ -37,7 +37,7 @@
#define _CONFIGDESCRIPTOR_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/USB/USB.h>
#include "HIDReport.h"

View file

@ -49,7 +49,7 @@
/* Macros: */
/** Pipe number for the keyboard report data pipe */
#define KEYBOARD_DATAPIPE 1
#define KEYBOARD_DATAPIPE 1
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1

View file

@ -37,7 +37,7 @@
#define _CONFIGDESCRIPTOR_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/USB/USB.h>
#include "MIDIHost.h"

View file

@ -37,7 +37,7 @@
#define _CONFIGDESCRIPTOR_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/USB/USB.h>
#include "MassStorageHost.h"

View file

@ -64,7 +64,7 @@
#define COMMAND_DIRECTION_DATA_IN (1 << 7)
/** Timeout period between the issuing of a CBW to a device, and the reception of the first packet */
#define COMMAND_DATA_TIMEOUT_MS 2000
#define COMMAND_DATA_TIMEOUT_MS 10000
/** Pipe number of the Mass Storage data IN pipe */
#define MASS_STORE_DATA_IN_PIPE 1

View file

@ -70,7 +70,7 @@
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY (LEDS_LED2)
#define LEDMASK_USB_BUSY LEDS_LED2
/* Function Prototypes: */
void MassStorage_Task(void);

View file

@ -37,7 +37,7 @@
#define _CONFIGDESCRIPTOR_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/USB/USB.h>
#include "MouseHost.h"

View file

@ -54,10 +54,10 @@
/* Macros: */
/** Pipe number for the mouse data IN pipe */
#define MOUSE_DATAPIPE 1
#define MOUSE_DATAPIPE 1
/** HID Class Specific request to set the report protocol mode */
#define REQ_SetProtocol 0x0B
#define REQ_SetProtocol 0x0B
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1

View file

@ -37,7 +37,7 @@
#define _CONFIGDESCRIPTOR_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/USB/USB.h>
#include "HIDReport.h"

View file

@ -54,7 +54,7 @@
/* Macros: */
/** Pipe number for the mouse report data pipe */
#define MOUSE_DATAPIPE 1
#define MOUSE_DATAPIPE 1
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1

View file

@ -67,7 +67,7 @@
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY (LEDS_LED2)
#define LEDMASK_USB_BUSY LEDS_LED2
/* Function Prototypes: */
void EVENT_USB_Host_DeviceAttached(void);

View file

@ -37,7 +37,7 @@
#define _CONFIGDESCRIPTOR_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/USB/USB.h>
#include "RNDISEthernetHost.h"

View file

@ -67,7 +67,7 @@
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY (LEDS_LED2)
#define LEDMASK_USB_BUSY LEDS_LED2
/* Type Defines: */
/** Type define for a RNDIS notification message, for transmission to the RNDIS host via the notification

View file

@ -37,7 +37,7 @@
#define _CONFIGDESCRIPTOR_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/USB/USB.h>
#include "StillImageHost.h"

View file

@ -37,7 +37,7 @@
#define _STILL_IMAGE_COMMANDS_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h> // USB Functionality
#include <LUFA/Drivers/USB/USB.h>
#include "PIMACodes.h"
@ -55,10 +55,10 @@
*
* \param[in] chars Total number of Unicode characters in the string
*/
#define UNICODE_STRING_LENGTH(chars) (chars << 1)
#define UNICODE_STRING_LENGTH(chars) ((chars) << 1)
/** Timeout period between the issuing of a command to a device, and the reception of the first packet */
#define COMMAND_DATA_TIMEOUT_MS 5000
#define COMMAND_DATA_TIMEOUT_MS 10000
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
* a command container.
@ -66,7 +66,7 @@
* \param[in] params Number of parameters which are to be sent in the Param field of the container
*/
#define PIMA_COMMAND_SIZE(params) ((sizeof(PIMA_SendBlock) - sizeof(PIMA_SendBlock.Params)) + \
(params * sizeof(PIMA_SendBlock.Params[0])))
((params) * sizeof(PIMA_SendBlock.Params[0])))
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
* a data container.

View file

@ -66,7 +66,7 @@
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY (LEDS_LED2)
#define LEDMASK_USB_BUSY LEDS_LED2
/* Function Prototypes: */
void StillImage_Task(void);