Skip to content

Commit

Permalink
Update BMFW MCP usb stack
Browse files Browse the repository at this point in the history
  • Loading branch information
TravisRo committed Jul 2, 2021
1 parent a22710a commit 2872dd8
Show file tree
Hide file tree
Showing 24 changed files with 6,452 additions and 2,846 deletions.
47 changes: 32 additions & 15 deletions BmFW/MCP/Microchip/Include/Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
*********************************************************************
* FileName: Compiler.h
* Dependencies: None
* Processor: PIC18, PIC24F, PIC24H, PIC24E, dsPIC30F, dsPIC33F,
* dsPIC33E, PIC32
* Compiler: Microchip C32 v1.00 or higher
* Microchip C30 v3.01 or higher
* Microchip C18 v3.13 or higher
* HI-TECH PICC-18 PRO 9.63 or higher
* Processor: PIC10, PIC12, PIC16, PIC18, PIC24, dsPIC, PIC32
* Compiler: Microchip C32 v2.02 or higher
* Microchip C30 v3.31 or higher
* Microchip C18 v3.40 or higher
* HI-TECH PICC-18 PRO 9.66 or higher
* HI-TECH PICC PRO V9.81 or higher
* Company: Microchip Technology, Inc.
*
* Software License Agreement
*
* Copyright (C) 2002-2010 Microchip Technology Inc. All rights
* Copyright (C) 2012 Microchip Technology Inc. All rights
* reserved.
*
* Microchip licenses to you the right to use, modify, copy, and
Expand Down Expand Up @@ -51,6 +51,8 @@
* 11/07/2007 Reorganized and simplified
* 03/31/2010 Removed dependency on WORD and DWORD typedefs
* 04/14/2010 Added defines to uniquely identify each compiler
* 10/13/2010 Added support for PIC10, PIC12, and PIC16 with PICC compiler
* 02/15/2012 Added re-define check for Nop, ClrWdt, Reset, Sleep
********************************************************************/
#ifndef __COMPILER_H
#define __COMPILER_H
Expand All @@ -67,6 +69,10 @@
#endif
#define COMPILER_HITECH_PICC18
#include <htc.h>
#elif (defined(_PIC12) || defined(_PIC14) || defined(_PIC14E)) && defined(HI_TECH_C)
// PIC10/12/16 processor with (Microchip) HI-TECH PICC compiler
#define COMPILER_HITECH_PICC
#include <htc.h>
#elif (defined(__PIC24F__) || defined(__PIC24FK__)) && defined(__C30__) // Microchip C30 compiler
// PIC24F processor
#define COMPILER_MPLAB_C30
Expand Down Expand Up @@ -149,8 +155,8 @@


// Definitions that apply to all 8-bit products
// (PIC18)
#if defined(__18CXX)
// (PIC10, PIC12, PIC16, PIC18)
#if defined(__18CXX) || defined(COMPILER_HITECH_PICC)
#define __attribute__(a)

#define FAR far
Expand All @@ -160,13 +166,22 @@
#define ROM rom
#endif

// HI TECH PICC-18 specific defines
#if defined(COMPILER_HITECH_PICC18)
// HI TECH specific defines
#if defined(COMPILER_HITECH_PICC18) || defined(COMPILER_HITECH_PICC)
#define ROM const
#define rom
#define Nop() asm("NOP");
#define ClrWdt() asm("CLRWDT");
#define Reset() asm("RESET");
#ifndef Nop()
#define Nop() asm("NOP");
#endif
#ifndef ClrWdt()
#define ClrWdt() asm("CLRWDT");
#endif
#ifndef Reset()
#define Reset() asm("RESET");
#endif
#ifndef Sleep()
#define Sleep() asm("SLEEP");
#endif
#endif

// Definitions that apply to all 16-bit and 32-bit products
Expand All @@ -182,7 +197,9 @@

// 32-bit specific defines (PIC32)
#if defined(__PIC32MX__)
#define persistent
#if (__C32_VERSION__ < 200)
#define persistent
#endif
#define far
#define FAR
#define Reset() SoftReset()
Expand Down
1 change: 1 addition & 0 deletions BmFW/MCP/Microchip/Include/GenericTypeDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
1.4 08/08/08 Remove LSB/MSB Macros, adopted by Peripheral lib
1.5 08/14/08 Simplify file header
2.0 07/13/09 Updated for new release of coding standards
3.1 05/28/10 MiWi DE 3.1
*******************************************************************/

#ifndef __GENERIC_TYPE_DEFS_H_
Expand Down
24 changes: 12 additions & 12 deletions BmFW/MCP/Microchip/Include/USB/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
Software License Agreement:
The software supplied herewith by Microchip Technology Incorporated
(the Company) for its PICmicro® Microcontroller is intended and
supplied to you, the Companys customer, for use solely and
(the "Company") for its PICmicro(r) Microcontroller is intended and
supplied to you, the Company's customer, for use solely and
exclusively on Microchip PICmicro Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Expand All @@ -76,7 +76,7 @@
civil liability for the breach of the terms and conditions of this
license.
THIS SOFTWARE IS PROVIDED IN AN AS IS CONDITION. NO WARRANTIES,
THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
Expand All @@ -92,7 +92,7 @@
Change History:
Rev Description
---------- -----------
2.6 - 2.7a No change except stack revision number
2.6 - 2.9 No change except stack revision number
********************************************************************/
//DOM-IGNORE-END

Expand All @@ -112,22 +112,22 @@

#include "usb_config.h" // Must be defined by the application

#include "usb/usb_common.h" // Common USB library definitions
#include "usb/usb_ch9.h" // USB device framework definitions
#include "USB/usb_common.h" // Common USB library definitions
#include "USB/usb_ch9.h" // USB device framework definitions

#if defined( USB_SUPPORT_DEVICE )
#include "usb/usb_device.h" // USB Device abstraction layer interface
#include "USB/usb_device.h" // USB Device abstraction layer interface
#endif

#if defined( USB_SUPPORT_HOST )
#include "usb/usb_host.h" // USB Host abstraction layer interface
#include "USB/usb_host.h" // USB Host abstraction layer interface
#endif

#if defined ( USB_SUPPORT_OTG )
#include "usb/usb_otg.h"
#include "USB/usb_otg.h"
#endif

#include "usb/usb_hal.h" // Hardware Abstraction Layer interface
#include "USB/usb_hal.h" // Hardware Abstraction Layer interface

// *****************************************************************************
// *****************************************************************************
Expand All @@ -136,8 +136,8 @@
// *****************************************************************************

#define USB_MAJOR_VER 2 // Firmware version, major release number.
#define USB_MINOR_VER 7 // Firmware version, minor release number.
#define USB_DOT_VER 1 // Firmware version, dot release number.
#define USB_MINOR_VER 9 // Firmware version, minor release number.
#define USB_DOT_VER 0 // Firmware version, dot release number.

#endif // _USB_H_
/*************************************************************************
Expand Down
6 changes: 3 additions & 3 deletions BmFW/MCP/Microchip/Include/USB/usb_ch9.h
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ This is used in the descriptors.
#define _BULK 0x02 //Bulk Transfer

#define _INTERRUPT 0x03 //Interrupt Transfer
#if defined(__18CXX) || defined(__C30__)
#if defined(__18CXX) || defined(__C30__) || defined __XC16__
#define _INT 0x03 //Interrupt Transfer
#endif

Expand All @@ -606,8 +606,8 @@ This is used in the descriptors.
#define _FE (0x01<<4) //Feedback endpoint
#define _IE (0x02<<4) //Implicit feedback Data endpoint

//These are the directional indicators used for USBTransferOnePacket()
// and other functions that compute addresses of, and manipulate, BDT entries.
//These are the directional indicators used for the USBTransferOnePacket()
// function.
#define OUT_FROM_HOST 0
#define IN_TO_HOST 1

Expand Down
34 changes: 34 additions & 0 deletions BmFW/MCP/Microchip/Include/USB/usb_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,24 @@ typedef enum
// Note that the DataEventHandler is called from within the USB interrupt, so
// it is critical that it return in time for the next isochronous data packet.
EVENT_DATA_ISOC_WRITE,

// In Host mode, this event gives the application layer the option to reject
// a client driver that was selected by the stack. This is needed when multiple
// devices are supported by class level support, but one configuration and client
// driver is preferred over another. Since configuration number is not guaranteed,
// the stack cannot do this automatically. This event is issued only when
// looking through configuration descriptors; the driver selected at the device
// level cannot be overridden, since there shouldn't be any other options to
// choose from.
EVENT_OVERRIDE_CLIENT_DRIVER_SELECTION,

// In host mode, this event is thrown for every millisecond that passes. Like all
// events, this is thrown from the USBHostTasks() or USBTasks() routine so its
// timeliness will be determined by the rate that these functions are called. If
// they are not called very often, then the 1ms events will build up and be
// dispatched as the USBTasks() or USBHostTasks() functions are called (one event
// per call to these functions.
EVENT_1MS,

// Class-defined event offsets start here:
EVENT_GENERIC_BASE = 400, // Offset for Generic class events
Expand Down Expand Up @@ -399,6 +417,22 @@ typedef struct _vbus_power_data
} USB_VBUS_POWER_EVENT_DATA;


// *****************************************************************************
/* USB_OVERRIDE_CLIENT_DRIVER_EVENT_DATA Data
This data structure is passed to the application layer when a client driver is
select, in case multiple client drivers can support a particular device.
*/
typedef struct _override_client_driver_data
{
WORD idVendor;
WORD idProduct;
BYTE bDeviceClass;
BYTE bDeviceSubClass;
BYTE bDeviceProtocol;
} USB_OVERRIDE_CLIENT_DRIVER_EVENT_DATA;


// *****************************************************************************
/* EVT_STALL Data
Expand Down
Loading

0 comments on commit 2872dd8

Please sign in to comment.