diff options
author | Dean Camera <[email protected]> | 2010-10-12 12:22:11 +0000 |
---|---|---|
committer | Dean Camera <[email protected]> | 2010-10-12 12:22:11 +0000 |
commit | 7aaced1e8bc81ebbf0a1f06fc443ea4707edd1dd (patch) | |
tree | 22251cc704e7d6c209e529727910838f0705145e /LUFA/Drivers/USB/LowLevel/Endpoint.h | |
parent | c1cfffd8eb92aedde76439afa30d8584c4c60043 (diff) | |
download | qmk_firmware-7aaced1e8bc81ebbf0a1f06fc443ea4707edd1dd.tar.gz qmk_firmware-7aaced1e8bc81ebbf0a1f06fc443ea4707edd1dd.zip |
Remove USB_MODE_* macros, replace with a semantically linked USB_Modes_t enum.
Moved the USB device selection logic for ENDPOINT_TOTAL_ENDPOINTS further up in Endpoint.h to where the endpoint bank capabilities are determined, to reduce the total number of device-specific logic.
Change USB_Host_WaitMS() to test and disable the HSOFI interrupt before resuming the bus, so that it does not fire before the delay loop has run.
Add missing const qualifier to the parameter of USB_Host_ClearPipeStall().
Diffstat (limited to 'LUFA/Drivers/USB/LowLevel/Endpoint.h')
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Endpoint.h | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h index acf0c5195a..66f5591f06 100644 --- a/LUFA/Drivers/USB/LowLevel/Endpoint.h +++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h @@ -100,6 +100,8 @@ #define _ENDPOINT_GET_DOUBLEBANK3(MaxSize, DB) (DB) #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) + #define ENDPOINT_DETAILS_MAXEP 7 + #define ENDPOINT_DETAILS_EP0 64, true #define ENDPOINT_DETAILS_EP1 256, true #define ENDPOINT_DETAILS_EP2 64, true @@ -108,6 +110,8 @@ #define ENDPOINT_DETAILS_EP5 64, true #define ENDPOINT_DETAILS_EP6 64, true #else + #define ENDPOINT_DETAILS_MAXEP 5 + #define ENDPOINT_DETAILS_EP0 64, true #define ENDPOINT_DETAILS_EP1 64, false #define ENDPOINT_DETAILS_EP2 64, false @@ -145,78 +149,74 @@ /** Endpoint data direction mask for \ref Endpoint_ConfigureEndpoint(). This indicates that the endpoint * should be initialized in the OUT direction - i.e. data flows from host to device. */ - #define ENDPOINT_DIR_OUT (0 << EPDIR) + #define ENDPOINT_DIR_OUT (0 << EPDIR) /** Endpoint data direction mask for \ref Endpoint_ConfigureEndpoint(). This indicates that the endpoint * should be initialized in the IN direction - i.e. data flows from device to host. */ - #define ENDPOINT_DIR_IN (1 << EPDIR) + #define ENDPOINT_DIR_IN (1 << EPDIR) /** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates * that the endpoint should have one single bank, which requires less USB FIFO memory but results * in slower transfers as only one USB device (the AVR or the host) can access the endpoint's * bank at the one time. */ - #define ENDPOINT_BANK_SINGLE (0 << EPBK0) + #define ENDPOINT_BANK_SINGLE (0 << EPBK0) /** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates * that the endpoint should have two banks, which requires more USB FIFO memory but results * in faster transfers as one USB device (the AVR or the host) can access one bank while the other * accesses the second bank. */ - #define ENDPOINT_BANK_DOUBLE (1 << EPBK0) + #define ENDPOINT_BANK_DOUBLE (1 << EPBK0) /** Endpoint address for the default control endpoint, which always resides in address 0. This is * defined for convenience to give more readable code when used with the endpoint macros. */ - #define ENDPOINT_CONTROLEP 0 + #define ENDPOINT_CONTROLEP 0 #if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__)) /** Default size of the default control endpoint's bank, until altered by the control endpoint bank size * value in the device descriptor. Not available if the FIXED_CONTROL_ENDPOINT_SIZE token is defined. */ - #define ENDPOINT_CONTROLEP_DEFAULT_SIZE 8 + #define ENDPOINT_CONTROLEP_DEFAULT_SIZE 8 #endif /** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's * numerical address in the device. */ - #define ENDPOINT_EPNUM_MASK 0x07 + #define ENDPOINT_EPNUM_MASK 0x07 /** Endpoint direction mask, for masking against endpoint addresses to retrieve the endpoint's * direction for comparing with the ENDPOINT_DESCRIPTOR_DIR_* masks. */ - #define ENDPOINT_EPDIR_MASK 0x80 + #define ENDPOINT_EPDIR_MASK 0x80 /** Endpoint bank size mask, for masking against endpoint addresses to retrieve the endpoint's * bank size in the device. */ - #define ENDPOINT_EPSIZE_MASK 0x7F + #define ENDPOINT_EPSIZE_MASK 0x7F /** Maximum size in bytes of a given endpoint. * - * \param[in] n Endpoint number, a value between 0 and (ENDPOINT_TOTAL_ENDPOINTS - 1) + * \param[in] EPIndex Endpoint number, a value between 0 and (ENDPOINT_TOTAL_ENDPOINTS - 1) */ - #define ENDPOINT_MAX_SIZE(n) _ENDPOINT_GET_MAXSIZE(n) + #define ENDPOINT_MAX_SIZE(EPIndex) _ENDPOINT_GET_MAXSIZE(EPIndex) /** Indicates if the given endpoint supports double banking. * - * \param[in] n Endpoint number, a value between 0 and (ENDPOINT_TOTAL_ENDPOINTS - 1) + * \param[in] EPIndex Endpoint number, a value between 0 and (ENDPOINT_TOTAL_ENDPOINTS - 1) */ - #define ENDPOINT_DOUBLEBANK_SUPPORTED(n) _ENDPOINT_GET_DOUBLEBANK(n) - - #if !defined(CONTROL_ONLY_DEVICE) - #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__) - /** Total number of endpoints (including the default control endpoint at address 0) which may - * be used in the device. Different USB AVR models support different amounts of endpoints, - * this value reflects the maximum number of endpoints for the currently selected AVR model. - */ - #define ENDPOINT_TOTAL_ENDPOINTS 7 - #else - #define ENDPOINT_TOTAL_ENDPOINTS 5 - #endif + #define ENDPOINT_DOUBLEBANK_SUPPORTED(EPIndex) _ENDPOINT_GET_DOUBLEBANK(EPIndex) + + #if !defined(CONTROL_ONLY_DEVICE) || defined(__DOXYGEN__) + /** Total number of endpoints (including the default control endpoint at address 0) which may + * be used in the device. Different USB AVR models support different amounts of endpoints, + * this value reflects the maximum number of endpoints for the currently selected AVR model. + */ + #define ENDPOINT_TOTAL_ENDPOINTS ENDPOINT_DETAILS_MAXEP #else - #define ENDPOINT_TOTAL_ENDPOINTS 1 + #define ENDPOINT_TOTAL_ENDPOINTS 1 #endif /* Enums: */ |