firmware/usb9.h
changeset 2 2f55e5dd591d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/firmware/usb9.h	Tue Jan 29 22:31:52 2008 +0100
     1.3 @@ -0,0 +1,94 @@
     1.4 +/*********************************************************************
     1.5 + *
     1.6 + *                Microchip USB C18 Firmware Version 1.0
     1.7 + *
     1.8 + *********************************************************************
     1.9 + * FileName:        usb9.h
    1.10 + * Dependencies:    See INCLUDES section below
    1.11 + * Processor:       PIC18
    1.12 + * Compiler:        C18 2.30.01+
    1.13 + * Company:         Microchip Technology, Inc.
    1.14 + *
    1.15 + * Software License Agreement
    1.16 + *
    1.17 + * The software supplied herewith by Microchip Technology Incorporated
    1.18 + * (the “Company”) for its PICmicro® Microcontroller is intended and
    1.19 + * supplied to you, the Company’s customer, for use solely and
    1.20 + * exclusively on Microchip PICmicro Microcontroller products. The
    1.21 + * software is owned by the Company and/or its supplier, and is
    1.22 + * protected under applicable copyright laws. All rights are reserved.
    1.23 + * Any use in violation of the foregoing restrictions may subject the
    1.24 + * user to criminal sanctions under applicable laws, as well as to
    1.25 + * civil liability for the breach of the terms and conditions of this
    1.26 + * license.
    1.27 + *
    1.28 + * THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
    1.29 + * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
    1.30 + * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
    1.31 + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
    1.32 + * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
    1.33 + * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
    1.34 + *
    1.35 + * Author               Date        Comment
    1.36 + *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1.37 + * Rawin Rojvanit       11/19/04    Original.
    1.38 + ********************************************************************/
    1.39 +#ifndef USB9_H
    1.40 +#define USB9_H
    1.41 +
    1.42 +/** I N C L U D E S **********************************************************/
    1.43 +#include "typedefs.h"
    1.44 +
    1.45 +/** D E F I N I T I O N S ****************************************************/
    1.46 +
    1.47 +/******************************************************************************
    1.48 + * Standard Request Codes
    1.49 + * USB 2.0 Spec Ref Table 9-4
    1.50 + *****************************************************************************/
    1.51 +#define GET_STATUS  0
    1.52 +#define CLR_FEATURE 1
    1.53 +#define SET_FEATURE 3
    1.54 +#define SET_ADR     5
    1.55 +#define GET_DSC     6
    1.56 +#define SET_DSC     7
    1.57 +#define GET_CFG     8
    1.58 +#define SET_CFG     9
    1.59 +#define GET_INTF    10
    1.60 +#define SET_INTF    11
    1.61 +#define SYNCH_FRAME 12
    1.62 +
    1.63 +/* Standard Feature Selectors */
    1.64 +#define DEVICE_REMOTE_WAKEUP    0x01
    1.65 +#define ENDPOINT_HALT           0x00
    1.66 +
    1.67 +/******************************************************************************
    1.68 + * Macro:           void mUSBCheckAdrPendingState(void)
    1.69 + *
    1.70 + * PreCondition:    None
    1.71 + *
    1.72 + * Input:           None
    1.73 + *
    1.74 + * Output:          None
    1.75 + *
    1.76 + * Side Effects:    None
    1.77 + *
    1.78 + * Overview:        Specialized checking routine, it checks if the device
    1.79 + *                  is in the ADDRESS PENDING STATE and services it if it is.
    1.80 + *
    1.81 + * Note:            None
    1.82 + *****************************************************************************/
    1.83 +#define mUSBCheckAdrPendingState()  if(usb_device_state==ADR_PENDING_STATE) \
    1.84 +                                    {                                       \
    1.85 +                                        UADDR = SetupPkt.bDevADR._byte;     \
    1.86 +                                        if(UADDR > 0)                       \
    1.87 +                                            usb_device_state=ADDRESS_STATE; \
    1.88 +                                        else                                \
    1.89 +                                            usb_device_state=DEFAULT_STATE; \
    1.90 +                                    }//end if
    1.91 +
    1.92 +/** E X T E R N S ************************************************************/
    1.93 +
    1.94 +/** P U B L I C  P R O T O T Y P E S *****************************************/
    1.95 +void USBCheckStdRequest(void);
    1.96 +
    1.97 +#endif //USB9_H