Move StdRequestType.h, StreamCallbacks.h, USBMode.h from the LowLevel USB driver directory to the HighLevel USB driver directory, where they are more suited.

This commit is contained in:
Dean Camera 2009-04-05 06:27:49 +00:00
parent 01d388f293
commit 7d4cccc22d
25 changed files with 40 additions and 30 deletions

View file

@ -28,7 +28,8 @@
this software.
*/
#include "USBMode.h"
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#define INCLUDE_FROM_DEVCHAPTER9_C

View file

@ -46,8 +46,8 @@
#include "../HighLevel/StdDescriptors.h"
#include "../HighLevel/Events.h"
#include "../HighLevel/StdRequestType.h"
#include "LowLevel.h"
#include "StdRequestType.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)

View file

@ -28,7 +28,8 @@
this software.
*/
#include "USBMode.h"
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#define INCLUDE_FROM_ENDPOINT_C

View file

@ -46,7 +46,7 @@
#include "../HighLevel/USBTask.h"
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
#include "StreamCallbacks.h"
#include "../HighLevel/StreamCallbacks.h"
#endif
/* Enable C linkage for C++ Compilers: */

View file

@ -28,7 +28,8 @@
this software.
*/
#include "USBMode.h"
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#include "Host.h"

View file

@ -28,7 +28,8 @@
this software.
*/
#include "USBMode.h"
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define INCLUDE_FROM_HOSTCHAPTER9_C

View file

@ -44,7 +44,8 @@
#include <stdbool.h>
#include "LowLevel.h"
#include "StdRequestType.h"
#include "../HighLevel/USBMode.h"
#include "../HighLevel/StdRequestType.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)

View file

@ -28,8 +28,6 @@
this software.
*/
#include "USBMode.h"
#include "LowLevel.h"
#if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY))

View file

@ -42,8 +42,10 @@
#include <avr/interrupt.h>
#include <stdbool.h>
#include "USBMode.h"
#include "../HighLevel/USBMode.h"
#include "../../../Common/Common.h"
#include "../HighLevel/USBMode.h"
#include "../HighLevel/Events.h"
#include "../HighLevel/USBTask.h"
#include "../HighLevel/USBInterrupt.h"

View file

@ -27,7 +27,9 @@
arising out of or in connection with the use or performance of
this software.
*/
#include "USBMode.h"
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define INCLUDE_FROM_PIPE_C

View file

@ -46,7 +46,7 @@
#include "../HighLevel/USBTask.h"
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
#include "StreamCallbacks.h"
#include "../HighLevel/StreamCallbacks.h"
#endif
/* Enable C linkage for C++ Compilers: */

View file

@ -1,191 +0,0 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
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
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Contains definitions for the various control request parameters, so that the request details (such as data
* direction, request recipient, etc.) can be extracted via masking.
*/
#ifndef __STDREQTYPE_H__
#define __STDREQTYPE_H__
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for the request type parameter, to indicate the direction of the request data (Host to Device
* or Device to Host). The result of this mask should then be compared to the request direction masks.
*
* \see REQDIR_* macros for masks indicating the request data direction.
*/
#define CONTROL_REQTYPE_DIRECTION 0b10000000
/** Mask for the request type parameter, to indicate the type of request (Device, Class or Vendor
* Specific). The result of this mask should then be compared to the request type masks.
*
* \see REQTYPE_* macros for masks indicating the request type.
*/
#define CONTROL_REQTYPE_TYPE 0b01100000
/** Mask for the request type parameter, to indicate the recipient of the request (Standard, Class
* or Vendor Specific). The result of this mask should then be compared to the request recipient
* masks.
*
* \see REQREC_* macros for masks indicating the request recipient.
*/
#define CONTROL_REQTYPE_RECIPIENT 0b00011111
/** Request data direction mask, indicating that the request data will flow from host to device.
*
* \see CONTROL_REQTYPE_DIRECTION macro.
*/
#define REQDIR_HOSTTODEVICE (0 << 7)
/** Request data direction mask, indicating that the request data will flow from device to host.
*
* \see CONTROL_REQTYPE_DIRECTION macro.
*/
#define REQDIR_DEVICETOHOST (1 << 7)
/** Request type mask, indicating that the request is a standard request.
*
* \see CONTROL_REQTYPE_TYPE macro.
*/
#define REQTYPE_STANDARD (0 << 5)
/** Request type mask, indicating that the request is a class-specific request.
*
* \see CONTROL_REQTYPE_TYPE macro.
*/
#define REQTYPE_CLASS (1 << 5)
/** Request type mask, indicating that the request is a vendor specific request.
*
* \see CONTROL_REQTYPE_TYPE macro.
*/
#define REQTYPE_VENDOR (2 << 5)
/** Request recipient mask, indicating that the request is to be issued to the device as a whole.
*
* \see CONTROL_REQTYPE_RECIPIENT macro.
*/
#define REQREC_DEVICE (0 << 0)
/** Request recipient mask, indicating that the request is to be issued to an interface in the
* currently selected configuration.
*
* \see CONTROL_REQTYPE_RECIPIENT macro.
*/
#define REQREC_INTERFACE (1 << 0)
/** Request recipient mask, indicating that the request is to be issued to an endpoint in the
* currently selected configuration.
*
* \see CONTROL_REQTYPE_RECIPIENT macro.
*/
#define REQREC_ENDPOINT (2 << 0)
/** Request recipient mask, indicating that the request is to be issued to an unspecified element
* in the currently selected configuration.
*
* \see CONTROL_REQTYPE_RECIPIENT macro.
*/
#define REQREC_OTHER (3 << 0)
/** Feature indicator for Clear Feature or Set Feature commands. When used in a Clear Feature
* request this indicates that an endpoint (whose address is given elsewhere in the request
* should have its stall condition cleared. If used in a similar manner inside a Set Feature
* request, this stalls an endpoint.
*/
#define FEATURE_ENDPOINT_HALT 0x00
/** Feature indicator for Clear Feature or Set Feature commands. When used in a Clear Feature
* request this indicates that the remote wakeup enabled device should not issue remote
* wakeup requests until further notice. If used in a similar manner inside a Set Feature
* request, this re-enabled the remote wakeup feature on the device.
*/
#define FEATURE_REMOTE_WAKEUP 0x01
/* Enums: */
/** Enumeration for the various standard request commands. These commands are applicable when the
* request type is REQTYPE_STANDARD (with the exception of REQ_GetDescriptor, which is always
* handled regardless of the request type value).
*
* \see Chapter 9 of the USB 2.0 Specification.
*/
enum USB_Control_Request_t
{
REQ_GetStatus = 0, /**< Implemented in the library for device, endpoint and interface
* recipients. Passed to the user application for other recipients
* via the USB_UnhandledControlPacket() event when received in
* device mode. */
REQ_ClearFeature = 1, /**< Implemented in the library for device, endpoint and interface
* recipients. Passed to the user application for other recipients
* via the USB_UnhandledControlPacket() event when received in
* device mode. */
REQ_SetFeature = 3, /**< Implemented in the library for device, endpoint and interface
* recipients. Passed to the user application for other recipients
* via the USB_UnhandledControlPacket() event when received in
* device mode. */
REQ_SetAddress = 5, /**< Implemented in the library for the device recipient. Passed
* to the user application for other recipients via the
* USB_UnhandledControlPacket() event when received in
* device mode. */
REQ_GetDescriptor = 6, /**< Implemented in the library for all recipients and all request
* types. */
REQ_SetDescriptor = 7, /**< Not implemented in the library, passed to the user application
* via the USB_UnhandledControlPacket() event when received in
* device mode. */
REQ_GetConfiguration = 8, /**< Implemented in the library for the device recipient. Passed
* to the user application for other recipients via the
* USB_UnhandledControlPacket() event when received in
* device mode. */
REQ_SetConfiguration = 9, /**< Implemented in the library for the device recipient. Passed
* to the user application for other recipients via the
* USB_UnhandledControlPacket() event when received in
* device mode. */
REQ_GetInterface = 10, /**< Not implemented in the library, passed to the user application
* via the USB_UnhandledControlPacket() event when received in
* device mode. */
REQ_SetInterface = 11, /**< Not implemented in the library, passed to the user application
* via the USB_UnhandledControlPacket() event when received in
* device mode. */
REQ_SynchFrame = 12, /**< Not implemented in the library, passed to the user application
* via the USB_UnhandledControlPacket() event when received in
* device mode. */
};
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define FEATURE_SELFPOWERED_ENABLED (1 << 0)
#define FEATURE_REMOTE_WAKEUP_ENABLED (1 << 1)
#endif
#endif

View file

@ -1,87 +0,0 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
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
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Macros and enums for the stream callback routines in Endpoint.h and Pipe.c. This module contains the
* code required to easily set up stream callback functions which can be used to force early abort of a
* stream read/write process.
*/
#ifndef __STREAMCALLBACK_H__
#define __STREAMCALLBACK_H__
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Creates a prototype for or begins a stream callback routine. Stream callback routines are small
* routines which are executed during stream read or writes (if the callback-enabled versions of
* these functions are used) which allow the user application to abort the transfer when certain
* arbitrary conditions are met.
*
* Stream callback functions should return a value from the StreamCallback_Return_ErrorCodes_t
* enum.
*
* Usage Example (Device Endpoint, but applicable for Host Pipes also):
* \code
* STREAM_CALLBACK(GlobalNotSet); // Callback Prototype
*
* STREAM_CALLBACK(GlobalNotSet)
* {
* if (MyGlobal == false)
* return ENDPOINT_STREAMCALLBACK_Continue;
* else
* return ENDPOINT_STREAMCALLBACK_Abort;
* }
*
* //...
* // Inside some routine:
* if (Endpoint_Write_Stream_LE(DataBuffer, sizeof(DataBuffer), GlobalNotSet) ==
* ENDPOINT_RWSTREAM_ERROR_CallbackAborted)
* {
* // Do something when the callback aborted the transfer early
* }
* \endcode
*/
#define STREAM_CALLBACK(name) uint8_t name (void)
/** Used with the Endpoint and Pipe stream functions as the callback function parameter, indicating that the stream
* call has no callback function to be called between USB packets.
*/
#define NO_STREAM_CALLBACK NULL
/* Enums: */
/** Enum for the possible error return codes of a stream callback function */
enum StreamCallback_Return_ErrorCodes_t
{
STREAMCALLBACK_Continue = 0, /**< Continue sending or receiving the stream. */
STREAMCALLBACK_Abort = 1, /**< Abort the stream send or receiving process. */
};
#endif

View file

@ -1,77 +0,0 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
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
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
#ifndef __USBMODE_H__
#define __USBMODE_H__
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#if ((defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \
defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || \
defined(__AVR_ATmega32U6__)) && !defined(USB_DEVICE_ONLY))
#define USB_DEVICE_ONLY
#endif
#if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__))
#define USB_LIMITED_CONTROLLER
#elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
#define USB_MODIFIED_FULL_CONTROLLER
#else
#define USB_FULL_CONTROLLER
#endif
#if (!defined(USB_DEVICE_ONLY) && !defined(USB_HOST_ONLY))
#define USB_CAN_BE_BOTH
#define USB_CAN_BE_HOST
#define USB_CAN_BE_DEVICE
#elif defined(USB_HOST_ONLY)
#define USB_CAN_BE_HOST
#define USB_CurrentMode USB_MODE_HOST
#elif defined(USB_DEVICE_ONLY)
#define USB_CAN_BE_DEVICE
#define USB_CurrentMode USB_MODE_DEVICE
#endif
#if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY))
#error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive.
#endif
#if (defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS))
#error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive.
#endif
#if defined(USE_STATIC_OPTIONS)
#define USB_Options USE_STATIC_OPTIONS
#endif
#endif
#endif