firmware/usbctrltrf.h
changeset 2 2f55e5dd591d
equal deleted inserted replaced
1:f08135942074 2:2f55e5dd591d
       
     1 /*********************************************************************
       
     2  *
       
     3  *                Microchip USB C18 Firmware Version 1.0
       
     4  *
       
     5  *********************************************************************
       
     6  * FileName:        usbctrltrf.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 USBCTRLTRF_H
       
    37 #define USBCTRLTRF_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 /* Control Transfer States */
       
    45 #define WAIT_SETUP          0
       
    46 #define CTRL_TRF_TX         1
       
    47 #define CTRL_TRF_RX         2
       
    48 
       
    49 /* USB PID: Token Types - See chapter 8 in the USB specification */
       
    50 #define SETUP_TOKEN         0b00001101
       
    51 #define OUT_TOKEN           0b00000001
       
    52 #define IN_TOKEN            0b00001001
       
    53 
       
    54 /* bmRequestType Definitions */
       
    55 #define HOST_TO_DEV         0
       
    56 #define DEV_TO_HOST         1
       
    57 
       
    58 #define STANDARD            0x00
       
    59 #define CLASS               0x01
       
    60 #define VENDOR              0x02
       
    61 
       
    62 #define RCPT_DEV            0
       
    63 #define RCPT_INTF           1
       
    64 #define RCPT_EP             2
       
    65 #define RCPT_OTH            3
       
    66 
       
    67 /** E X T E R N S ************************************************************/
       
    68 extern byte ctrl_trf_session_owner;
       
    69 
       
    70 extern POINTER pSrc;
       
    71 extern POINTER pDst;
       
    72 extern WORD wCount;
       
    73 
       
    74 /** P U B L I C  P R O T O T Y P E S *****************************************/
       
    75 void USBCtrlEPService(void);
       
    76 void USBCtrlTrfTxService(void);
       
    77 void USBCtrlTrfRxService(void);
       
    78 void USBCtrlEPServiceComplete(void);
       
    79 void USBPrepareForNextSetupTrf(void);
       
    80 
       
    81 
       
    82 #endif //USBCTRLTRF_H