firmware/usb9.h
author root@rika
Thu, 23 Apr 2009 20:55:41 +0200
changeset 33 7a0c4b0354ba
parent 2 2f55e5dd591d
permissions -rw-r--r--
updated documentation
     1 /*********************************************************************
     2  *
     3  *                Microchip USB C18 Firmware Version 1.0
     4  *
     5  *********************************************************************
     6  * FileName:        usb9.h
     7  * Dependencies:    See INCLUDES section below
     8  * Processor:       PIC18
     9  * Compiler:        C18 2.30.01+
    10  * Company:         Microchip Technology, Inc.
    11  *
    12  * Software License Agreement
    13  *
    14  * The software supplied herewith by Microchip Technology Incorporated
    15  * (the “Company”) for its PICmicro® Microcontroller is intended and
    16  * supplied to you, the Company’s customer, for use solely and
    17  * exclusively on Microchip PICmicro Microcontroller products. The
    18  * software is owned by the Company and/or its supplier, and is
    19  * protected under applicable copyright laws. All rights are reserved.
    20  * Any use in violation of the foregoing restrictions may subject the
    21  * user to criminal sanctions under applicable laws, as well as to
    22  * civil liability for the breach of the terms and conditions of this
    23  * license.
    24  *
    25  * THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
    26  * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
    27  * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
    28  * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
    29  * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
    30  * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
    31  *
    32  * Author               Date        Comment
    33  *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    34  * Rawin Rojvanit       11/19/04    Original.
    35  ********************************************************************/
    36 #ifndef USB9_H
    37 #define USB9_H
    38 
    39 /** I N C L U D E S **********************************************************/
    40 #include "typedefs.h"
    41 
    42 /** D E F I N I T I O N S ****************************************************/
    43 
    44 /******************************************************************************
    45  * Standard Request Codes
    46  * USB 2.0 Spec Ref Table 9-4
    47  *****************************************************************************/
    48 #define GET_STATUS  0
    49 #define CLR_FEATURE 1
    50 #define SET_FEATURE 3
    51 #define SET_ADR     5
    52 #define GET_DSC     6
    53 #define SET_DSC     7
    54 #define GET_CFG     8
    55 #define SET_CFG     9
    56 #define GET_INTF    10
    57 #define SET_INTF    11
    58 #define SYNCH_FRAME 12
    59 
    60 /* Standard Feature Selectors */
    61 #define DEVICE_REMOTE_WAKEUP    0x01
    62 #define ENDPOINT_HALT           0x00
    63 
    64 /******************************************************************************
    65  * Macro:           void mUSBCheckAdrPendingState(void)
    66  *
    67  * PreCondition:    None
    68  *
    69  * Input:           None
    70  *
    71  * Output:          None
    72  *
    73  * Side Effects:    None
    74  *
    75  * Overview:        Specialized checking routine, it checks if the device
    76  *                  is in the ADDRESS PENDING STATE and services it if it is.
    77  *
    78  * Note:            None
    79  *****************************************************************************/
    80 #define mUSBCheckAdrPendingState()  if(usb_device_state==ADR_PENDING_STATE) \
    81                                     {                                       \
    82                                         UADDR = SetupPkt.bDevADR._byte;     \
    83                                         if(UADDR > 0)                       \
    84                                             usb_device_state=ADDRESS_STATE; \
    85                                         else                                \
    86                                             usb_device_state=DEFAULT_STATE; \
    87                                     }//end if
    88 
    89 /** E X T E R N S ************************************************************/
    90 
    91 /** P U B L I C  P R O T O T Y P E S *****************************************/
    92 void USBCheckStdRequest(void);
    93 
    94 #endif //USB9_H