-
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.
Merging in changes from 2016-04-27 release:
* Removed requirement to implement system_config.h for USB. Stack now only uses usb_config.h for configuration. * USBInitialize() and USBTasks() removed. Use USBDeviceTasks()/USBHostTasks() or USBHostInit()/USBDeviceInit() as required. * Fixed dereferencing type-punned pointer will break strict-aliasing warning on full optimization. * Added MSDTransferTerminated() function. * Added error checking for NULL data handler * Added return for case in USBHostDeviceStatus() for when the device state variable was invalid value. * Fixed error when parsing HID descriptors resulting in invalid errors reported on well formed HID report descriptors. * Added support for the PIC24FJ1024GB610 family devices.
- Loading branch information
1 parent
b7d7045
commit 62fe6a5
Showing
23 changed files
with
208 additions
and
228 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 |
---|---|---|
|
@@ -42,8 +42,7 @@ please contact [email protected] | |
#ifndef _USB_H_ | ||
#define _USB_H_ | ||
|
||
#include "system.h" | ||
#include "system_config.h" // Must be defined by the application | ||
#include "usb_config.h" | ||
|
||
#include "usb_common.h" // Common USB library definitions | ||
#include "usb_ch9.h" // USB device framework definitions | ||
|
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 |
---|---|---|
|
@@ -47,9 +47,6 @@ please contact [email protected] | |
#include <stdbool.h> | ||
#include <stdint.h> | ||
|
||
#include "system.h" | ||
#include "system_config.h" | ||
|
||
// ***************************************************************************** | ||
// ***************************************************************************** | ||
// Section: USB Constants | ||
|
@@ -465,108 +462,6 @@ stalled (ie. bit 0 = EP0, bit 1 = EP1, etc.) | |
|
||
typedef bool (*USB_EVENT_HANDLER) ( USB_EVENT event, void *data, unsigned int size ); | ||
|
||
|
||
// ***************************************************************************** | ||
// ***************************************************************************** | ||
// Section: USB Application Program Interface (API) Routines | ||
// ***************************************************************************** | ||
// ***************************************************************************** | ||
|
||
/**************************************************************************** | ||
Function: | ||
bool USBInitialize ( unsigned long flags ) | ||
Summary: | ||
This interface initializes the variables of the USB host stack. | ||
Description: | ||
This interface initializes the USB stack. | ||
Precondition: | ||
None | ||
Parameters: | ||
flags - reserved | ||
Return Values: | ||
true - Initialization successful | ||
false - Initialization failure | ||
Remarks: | ||
This interface is implemented as a macro that can be defined by the | ||
application or by default is defined correctly for the stack mode. | ||
***************************************************************************/ | ||
|
||
#ifndef USBInitialize | ||
#if defined( USB_SUPPORT_DEVICE ) | ||
#if defined( USB_SUPPORT_HOST ) | ||
#if defined( USB_SUPPORT_OTG ) | ||
#error "USB OTG is not yet supported." | ||
#else | ||
#define USBInitialize(f) \ | ||
(USBDEVInitialize(f) && USBHostInit(f)) ? \ | ||
true : false | ||
#endif | ||
#else | ||
#define USBInitialize(f) USBDeviceInit() | ||
#endif | ||
#else | ||
#if defined( USB_SUPPORT_HOST ) | ||
#define USBInitialize(f) USBHostInit(f) | ||
#else | ||
#error "Application must define support mode in usb_config.h" | ||
#endif | ||
#endif | ||
#endif | ||
|
||
|
||
/**************************************************************************** | ||
Function: | ||
void USBTasks( void ) | ||
Summary: | ||
This function executes the tasks for USB operation. | ||
Description: | ||
This function executes the tasks for USB host operation. It must be | ||
executed on a regular basis to keep everything functioning. | ||
Precondition: | ||
USBInitialize() has been called. | ||
Parameters: | ||
None | ||
Returns: | ||
None | ||
Remarks: | ||
This interface is implemented as a macro that can be defined by the | ||
application or by default is defined correctly for the stack mode. | ||
***************************************************************************/ | ||
|
||
#ifndef USBTasks // Implemented as a macro that can be overridden. | ||
#if defined( USB_SUPPORT_DEVICE ) | ||
#if defined( USB_SUPPORT_HOST ) | ||
#if defined( USB_SUPPORT_OTG ) | ||
#error "USB OTG is not yet supported." | ||
#else | ||
#define USBTasks() {USBHostTasks(); USBHALHandleBusEvent();} | ||
#endif | ||
#else | ||
#define USBTasks() USBDeviceTasks() | ||
#endif | ||
#else | ||
#if defined( USB_SUPPORT_HOST ) | ||
#define USBTasks() USBHostTasks() | ||
#else | ||
#error "Application must define support mode in usb_config.h" | ||
#endif | ||
#endif | ||
#endif | ||
|
||
#define USB_PING_PONG__NO_PING_PONG 0x00 //0b00 | ||
#define USB_PING_PONG__EP0_OUT_ONLY 0x01 //0b01 | ||
#define USB_PING_PONG__FULL_PING_PONG 0x02 //0b10 | ||
|
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 |
---|---|---|
|
@@ -38,9 +38,10 @@ please contact [email protected] | |
#ifndef _USB_DEVICE_H | ||
#define _USB_DEVICE_H | ||
|
||
#include "usb_common.h" | ||
#include <stdint.h> | ||
|
||
#include "usb_common.h" | ||
#include "usb_config.h" | ||
|
||
#if defined(__XC8) | ||
#define __attribute__(a) | ||
|
@@ -2040,14 +2041,6 @@ typedef struct __attribute__ ((packed)) | |
CTRL_TRF_RETURN (*pFunc)(CTRL_TRF_PARAMS); | ||
}OUT_PIPE; | ||
|
||
/************* DWF - SHOULD BE REIMPLEMENTED AS AN EVENT *******************/ | ||
//#if defined(ENABLE_EP0_DATA_RECEIVED_CALLBACK) | ||
// void USBCBEP0DataReceived(void); | ||
// #define USBCB_EP0_DATA_RECEIVED() USBCBEP0DataReceived() | ||
//#else | ||
// #define USBCB_EP0_DATA_RECEIVED() | ||
//#endif | ||
|
||
extern USB_VOLATILE bool RemoteWakeup; | ||
extern USB_VOLATILE bool USBBusIsSuspended; | ||
extern USB_VOLATILE USB_DEVICE_STATE USBDeviceState; | ||
|
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 |
---|---|---|
|
@@ -28,7 +28,7 @@ please contact [email protected] | |
/*****************************************************************************/ | ||
|
||
#include "system.h" | ||
#include "system_config.h" | ||
#include "usb_config.h" | ||
|
||
#include <stdint.h> | ||
#include <string.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 |
---|---|---|
|
@@ -26,12 +26,13 @@ please contact [email protected] | |
/****** include files ********************************************************/ | ||
/*****************************************************************************/ | ||
|
||
#include <xc.h> | ||
|
||
#include <stdint.h> | ||
#include <stdbool.h> | ||
#include <string.h> | ||
#include <system.h> | ||
|
||
#include "system_config.h" | ||
#include "usb_config.h" | ||
|
||
#ifdef __cplusplus // Provide C++ Compatability | ||
extern "C" { | ||
|
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 |
---|---|---|
|
@@ -47,8 +47,7 @@ please contact [email protected] | |
|
||
#include <string.h> | ||
|
||
#include "system.h" | ||
#include "system_config.h" | ||
#include "usb_config.h" | ||
|
||
#ifdef __cplusplus // Provide C++ Compatability | ||
extern "C" { | ||
|
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,8 +26,8 @@ please contact [email protected] | |
/****** include files ********************************************************/ | ||
/*****************************************************************************/ | ||
|
||
#include "system.h" | ||
#include "system_config.h" | ||
#include <xc.h> | ||
#include "usb_config.h" | ||
|
||
#include <stdint.h> | ||
#include <string.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 |
---|---|---|
|
@@ -27,7 +27,7 @@ please contact [email protected] | |
/*****************************************************************************/ | ||
|
||
#include "system.h" | ||
#include "system_config.h" | ||
#include "usb_config.h" | ||
|
||
#include <stdint.h> | ||
#include <string.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 |
---|---|---|
|
@@ -26,11 +26,12 @@ please contact [email protected] | |
/****** include files ********************************************************/ | ||
/*****************************************************************************/ | ||
|
||
#include "system.h" | ||
#include "system_config.h" | ||
#include <xc.h> | ||
|
||
#include <stdint.h> | ||
#include <string.h> | ||
|
||
#include "usb_config.h" | ||
#include "usb_common.h" | ||
|
||
/*****************************************************************************/ | ||
|
@@ -75,6 +76,9 @@ please contact [email protected] | |
|| defined(__PIC24FJ64GB410__) || defined(__PIC24FJ64GB412__) || defined(__PIC24FJ64GB406__) | ||
#define DEVICE_SPECIFIC_IEC_REGISTER_COUNT 8 //Number of IECx registers implemented in the microcontroller (varies from device to device, make sure this is set correctly for the intended CPU) | ||
#define USB_HAL_VBUSTristate() {TRISFbits.TRISF7 = 1;} | ||
#elif defined(__PIC24FJ1024GB610__) || defined(__PIC24FJ512GB610__) || defined(__PIC24FJ256GB610__) || defined(__PIC24FJ128GB610__) || defined(__PIC24FJ1024GB606__) || defined(__PIC24FJ512GB606__) || defined(__PIC24FJ256GB606__) || defined(__PIC24FJ128GB606__) | ||
#define DEVICE_SPECIFIC_IEC_REGISTER_COUNT 8 //Number of IECx registers implemented in the microcontroller (varies from device to device, make sure this is set correctly for the intended CPU) | ||
#define USB_HAL_VBUSTristate() {TRISFbits.TRISF7 = 1;} | ||
#else | ||
#error "Unknown processor type selected. Refer to device datasheet and update the definition for DEVICE_SPECIFIC_IEC_REGISTER_COUNT." | ||
//#define DEVICE_SPECIFIC_IEC_REGISTER_COUNT 8 // <--- Update this number with the real number for your device and uncomment (and delete the above #error). | ||
|
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 |
---|---|---|
|
@@ -23,7 +23,7 @@ please contact [email protected] | |
#define __USBHOSTMSDSCSI_H__ | ||
|
||
#include "usb.h" | ||
#include "system_config.h" | ||
#include "usb_config.h" | ||
#include "fileio.h" | ||
|
||
// ***************************************************************************** | ||
|
Oops, something went wrong.