-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-- updating files to v2.18 MLA update --
• Added support for XC8 v2.00 and later • Remove support for C18 • Fix typo when using PIC32MM0064GPM028 device • Add missing header files for printer host, generic host, and MIDI host • Update bytes transferred in HID host from uint8_t to uint16_t to allow for more than 255 bytes of transferred data • Move to use bit flag names for interrupts on PIC24F/dsPIC33 instead of register names so interrupt flag moving to different register is no longer an issue • Adding explicit casts to remove compiler warnings • Adding fixed memory address for SerialState information in CDC device driver for dual port RAM devices. Previously this would cause RAM corruption and invalid values as the USB module may not be able to access the variable based on where it linked • Fix issue where GetStatus(ENDPOINT = 0) would result in null pointer reference
- Loading branch information
1 parent
31d333c
commit d28cc13
Showing
14 changed files
with
117 additions
and
97 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ please contact [email protected] | |
specific version of the library is being used. | ||
*/ | ||
#define USB_MAJOR_VER 2 // Firmware version, major release number. | ||
#define USB_MINOR_VER 13 // Firmware version, minor release number. | ||
#define USB_MINOR_VER 18 // Firmware version, minor release number. | ||
#define USB_DOT_VER 0 // Firmware version, dot release number. | ||
|
||
#endif // _USB_H_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,9 @@ please contact [email protected] | |
#include <stdint.h> | ||
|
||
#if defined(__XC8) | ||
#define __attribute__(a) | ||
#define PACKED | ||
#else | ||
#define PACKED __attribute__((packed)) | ||
#endif | ||
|
||
// ***************************************************************************** | ||
|
@@ -66,7 +68,7 @@ please contact [email protected] | |
This struct defines the structure of a USB Device Descriptor. | ||
*/ | ||
typedef struct __attribute__ ((packed)) _USB_DEVICE_DESCRIPTOR | ||
typedef struct PACKED _USB_DEVICE_DESCRIPTOR | ||
{ | ||
uint8_t bLength; // Length of this descriptor. | ||
uint8_t bDescriptorType; // DEVICE descriptor type (USB_DESCRIPTOR_DEVICE). | ||
|
@@ -90,7 +92,7 @@ typedef struct __attribute__ ((packed)) _USB_DEVICE_DESCRIPTOR | |
This struct defines the structure of a USB Configuration Descriptor. | ||
*/ | ||
typedef struct __attribute__ ((packed)) _USB_CONFIGURATION_DESCRIPTOR | ||
typedef struct PACKED _USB_CONFIGURATION_DESCRIPTOR | ||
{ | ||
uint8_t bLength; // Length of this descriptor. | ||
uint8_t bDescriptorType; // CONFIGURATION descriptor type (USB_DESCRIPTOR_CONFIGURATION). | ||
|
@@ -113,7 +115,7 @@ typedef struct __attribute__ ((packed)) _USB_CONFIGURATION_DESCRIPTOR | |
This struct defines the structure of a USB Interface Descriptor. | ||
*/ | ||
typedef struct __attribute__ ((packed)) _USB_INTERFACE_DESCRIPTOR | ||
typedef struct PACKED _USB_INTERFACE_DESCRIPTOR | ||
{ | ||
uint8_t bLength; // Length of this descriptor. | ||
uint8_t bDescriptorType; // INTERFACE descriptor type (USB_DESCRIPTOR_INTERFACE). | ||
|
@@ -132,7 +134,7 @@ typedef struct __attribute__ ((packed)) _USB_INTERFACE_DESCRIPTOR | |
This struct defines the structure of a USB Endpoint Descriptor. | ||
*/ | ||
typedef struct __attribute__ ((packed)) _USB_ENDPOINT_DESCRIPTOR | ||
typedef struct PACKED _USB_ENDPOINT_DESCRIPTOR | ||
{ | ||
uint8_t bLength; // Length of this descriptor. | ||
uint8_t bDescriptorType; // ENDPOINT descriptor type (USB_DESCRIPTOR_ENDPOINT). | ||
|
@@ -197,7 +199,7 @@ This struct defines the structure of a USB OTG Descriptor. Note that this | |
structure may need to be packed, or even accessed as uint8_ts, to properly access | ||
the correct fields when used on some device architectures. | ||
*/ | ||
typedef struct __attribute__ ((packed)) _USB_OTG_DESCRIPTOR | ||
typedef struct PACKED _USB_OTG_DESCRIPTOR | ||
{ | ||
uint8_t bLength; // Length of this descriptor. | ||
uint8_t bDescriptorType; // OTG descriptor type (USB_DESCRIPTOR_OTG). | ||
|
@@ -221,7 +223,7 @@ typedef struct __attribute__ ((packed)) _USB_OTG_DESCRIPTOR | |
// array of unicode characters making up the string, must be allocated | ||
// immediately following this header with no padding between them. | ||
|
||
typedef struct __attribute__ ((packed)) _USB_STRING_DSC | ||
typedef struct PACKED _USB_STRING_DSC | ||
{ | ||
uint8_t bLength; // Size of this descriptor | ||
uint8_t bDescriptorType; // Type, USB_DSC_STRING | ||
|
@@ -240,7 +242,7 @@ typedef struct __attribute__ ((packed)) _USB_STRING_DSC | |
// If so, it may need to implement the the device qualifier and other | ||
// speed descriptors. | ||
|
||
typedef struct __attribute__ ((packed)) _USB_DEVICE_QUALIFIER_DESCRIPTOR | ||
typedef struct PACKED _USB_DEVICE_QUALIFIER_DESCRIPTOR | ||
{ | ||
uint8_t bLength; // Size of this descriptor | ||
uint8_t bType; // Type, always USB_DESCRIPTOR_DEVICE_QUALIFIER | ||
|
@@ -263,18 +265,18 @@ typedef struct __attribute__ ((packed)) _USB_DEVICE_QUALIFIER_DESCRIPTOR | |
// | ||
// Note: Refer to the USB 2.0 specification for additional details on the | ||
// usage of the setup packet and standard device requests. | ||
typedef union __attribute__ ((packed)) | ||
typedef union PACKED | ||
{ | ||
/** Standard Device Requests ***********************************/ | ||
struct __attribute__ ((packed)) | ||
struct PACKED | ||
{ | ||
uint8_t bmRequestType; //from table 9-2 of USB2.0 spec | ||
uint8_t bRequest; //from table 9-2 of USB2.0 spec | ||
uint16_t wValue; //from table 9-2 of USB2.0 spec | ||
uint16_t wIndex; //from table 9-2 of USB2.0 spec | ||
uint16_t wLength; //from table 9-2 of USB2.0 spec | ||
}; | ||
struct __attribute__ ((packed)) | ||
struct PACKED | ||
{ | ||
unsigned :8; | ||
unsigned :8; | ||
|
@@ -311,7 +313,7 @@ typedef union __attribute__ ((packed)) | |
} byte; | ||
} W_Length; | ||
}; | ||
struct __attribute__ ((packed)) | ||
struct PACKED | ||
{ | ||
unsigned Recipient:5; //Device,Interface,Endpoint,Other | ||
unsigned RequestType:2; //Standard,Class,Vendor,Reserved | ||
|
@@ -324,7 +326,7 @@ typedef union __attribute__ ((packed)) | |
unsigned :8; | ||
unsigned :8; | ||
}; | ||
struct __attribute__ ((packed)) | ||
struct PACKED | ||
{ | ||
union // offset description | ||
{ // ------ ------------------------ | ||
|
@@ -337,7 +339,7 @@ typedef union __attribute__ ((packed)) | |
}; | ||
}requestInfo; | ||
}; | ||
struct __attribute__ ((packed)) | ||
struct PACKED | ||
{ | ||
unsigned :8; | ||
unsigned :8; | ||
|
@@ -347,7 +349,7 @@ typedef union __attribute__ ((packed)) | |
unsigned :8; | ||
unsigned :8; | ||
}; | ||
struct __attribute__ ((packed)) | ||
struct PACKED | ||
{ | ||
unsigned :8; | ||
unsigned :8; | ||
|
@@ -358,7 +360,7 @@ typedef union __attribute__ ((packed)) | |
unsigned :8; | ||
unsigned :8; | ||
}; | ||
struct __attribute__ ((packed)) | ||
struct PACKED | ||
{ | ||
unsigned :8; | ||
unsigned :8; | ||
|
@@ -369,7 +371,7 @@ typedef union __attribute__ ((packed)) | |
unsigned :8; | ||
unsigned :8; | ||
}; | ||
struct __attribute__ ((packed)) | ||
struct PACKED | ||
{ | ||
unsigned :8; | ||
unsigned :8; | ||
|
@@ -380,7 +382,7 @@ typedef union __attribute__ ((packed)) | |
unsigned :8; | ||
unsigned :8; | ||
}; | ||
struct __attribute__ ((packed)) | ||
struct PACKED | ||
{ | ||
unsigned :8; | ||
unsigned :8; | ||
|
@@ -391,7 +393,7 @@ typedef union __attribute__ ((packed)) | |
unsigned :8; | ||
unsigned :8; | ||
}; | ||
struct __attribute__ ((packed)) | ||
struct PACKED | ||
{ | ||
unsigned :8; | ||
unsigned :8; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,11 @@ please contact [email protected] | |
#include "usb_config.h" | ||
|
||
#if defined(__XC8) | ||
#define __attribute__(a) | ||
#define PACKED | ||
#define ALIGNED | ||
#else | ||
#define PACKED __attribute__((packed)) | ||
#define ALIGNED __attribute__((aligned)) | ||
#endif | ||
|
||
/** DEFINITIONS ****************************************************/ | ||
|
@@ -1987,9 +1991,9 @@ typedef union | |
// Definition of the PIPE structure | ||
// This structure is used to keep track of data that is sent out | ||
// of the stack automatically. | ||
typedef struct __attribute__ ((packed)) | ||
typedef struct PACKED | ||
{ | ||
union __attribute__ ((packed)) | ||
union PACKED | ||
{ | ||
//Various options of pointers that are available to | ||
// get the data from | ||
|
@@ -1998,9 +2002,9 @@ typedef struct __attribute__ ((packed)) | |
uint16_t *wRam; | ||
const uint16_t *wRom; | ||
}pSrc; | ||
union __attribute__ ((packed)) | ||
union PACKED | ||
{ | ||
struct __attribute__ ((packed)) | ||
struct PACKED | ||
{ | ||
//is this transfer from RAM or const? | ||
uint8_t ctrl_trf_mem :1; | ||
|
@@ -2013,23 +2017,23 @@ typedef struct __attribute__ ((packed)) | |
}bits; | ||
uint8_t Val; | ||
}info; | ||
uint16_t_VAL __attribute__((aligned)) wCount; | ||
uint16_t_VAL ALIGNED wCount; | ||
}IN_PIPE; | ||
|
||
extern USB_VOLATILE IN_PIPE inPipes[]; | ||
|
||
typedef struct __attribute__ ((packed)) | ||
typedef struct PACKED | ||
{ | ||
union __attribute__ ((packed)) | ||
union PACKED | ||
{ | ||
//Various options of pointers that are available to | ||
// get the data from | ||
uint8_t *bRam; | ||
uint16_t *wRam; | ||
}pDst; | ||
union __attribute__ ((packed)) | ||
union PACKED | ||
{ | ||
struct __attribute__ ((packed)) | ||
struct PACKED | ||
{ | ||
uint8_t reserved :7; | ||
//is this PIPE currently in use | ||
|
@@ -2049,6 +2053,6 @@ extern USB_VOLATILE uint8_t USBTicksSinceSuspendEnd; | |
/******************************************************************************/ | ||
/* DOM-IGNORE-END */ | ||
|
||
#include <usb_hal.h> | ||
#include "usb_hal.h" | ||
|
||
#endif //USB_DEVICE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,12 @@ please contact [email protected] | |
#include <stdint.h> | ||
#include "fileio.h" | ||
|
||
#if defined(__XC8) | ||
#define PACKED | ||
#else | ||
#define PACKED __attribute__((packed)) | ||
#endif | ||
|
||
/** D E F I N I T I O N S ****************************************************/ | ||
|
||
/* MSD Interface Class Code */ | ||
|
@@ -266,7 +272,7 @@ typedef union | |
typedef union | ||
{ | ||
uint8_t v[2]; | ||
struct __attribute__((__packed__)) | ||
struct PACKED | ||
{ | ||
uint8_t LB; | ||
uint8_t HB; | ||
|
@@ -415,12 +421,12 @@ typedef union | |
} USB_MSD_CMD_SPECIFIC_INFO; | ||
|
||
/* Fixed format if Desc bit of request sense cbw is 0 */ | ||
typedef union __attribute__((packed)){ | ||
typedef union PACKED{ | ||
struct | ||
{ | ||
uint8_t _byte[18]; | ||
}; | ||
struct __attribute__((packed)){ | ||
struct PACKED{ | ||
unsigned ResponseCode:7; // b6-b0 is Response Code Fixed or descriptor format | ||
unsigned VALID:1; // Set to 1 to indicate information field is a valid value | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ please contact [email protected] | |
#include <string.h> | ||
|
||
#include "usb_config.h" | ||
#include "fixed_address_memory.h" | ||
|
||
#ifdef __cplusplus // Provide C++ Compatability | ||
extern "C" { | ||
|
@@ -183,7 +184,11 @@ please contact [email protected] | |
|
||
//----- Definitions for BDT address -------------------------------------------- | ||
#define BDT_BASE_ADDR 0x2000 | ||
#if(__XC8_VERSION < 2000) | ||
#define BDT_BASE_ADDR_TAG @ BDT_BASE_ADDR | ||
#else | ||
#define BDT_BASE_ADDR_TAG __at(BDT_BASE_ADDR) | ||
#endif | ||
#define BDT_ENTRY_SIZE 4 | ||
|
||
#if (USB_PING_PONG_MODE == USB_PING_PONG__NO_PING_PONG) | ||
|
@@ -200,8 +205,13 @@ please contact [email protected] | |
#define CTRL_TRF_SETUP_ADDR BDT_BASE_ADDR + (BDT_ENTRY_SIZE * BDT_NUM_ENTRIES) | ||
#define CTRL_TRF_DATA_ADDR CTRL_TRF_SETUP_ADDR + USB_EP0_BUFF_SIZE | ||
|
||
#if(__XC8_VERSION < 2000) | ||
#define CTRL_TRF_SETUP_ADDR_TAG @ CTRL_TRF_SETUP_ADDR | ||
#define CTRL_TRF_DATA_ADDR_TAG @ CTRL_TRF_DATA_ADDR | ||
#else | ||
#define CTRL_TRF_SETUP_ADDR_TAG __at(CTRL_TRF_SETUP_ADDR) | ||
#define CTRL_TRF_DATA_ADDR_TAG __at(CTRL_TRF_DATA_ADDR) | ||
#endif | ||
|
||
//----- Deprecated definitions - will be removed at some point of time---------- | ||
//--------- Deprecated in v2.2 | ||
|
Oops, something went wrong.