firmware/usbctrltrf.h
author root@rika
Thu, 23 Apr 2009 20:55:41 +0200
changeset 33 7a0c4b0354ba
parent 2 2f55e5dd591d
permissions -rw-r--r--
updated documentation
slime@2
     1
/*********************************************************************
slime@2
     2
 *
slime@2
     3
 *                Microchip USB C18 Firmware Version 1.0
slime@2
     4
 *
slime@2
     5
 *********************************************************************
slime@2
     6
 * FileName:        usbctrltrf.h
slime@2
     7
 * Dependencies:    See INCLUDES section below
slime@2
     8
 * Processor:       PIC18
slime@2
     9
 * Compiler:        C18 2.30.01+
slime@2
    10
 * Company:         Microchip Technology, Inc.
slime@2
    11
 *
slime@2
    12
 * Software License Agreement
slime@2
    13
 *
slime@2
    14
 * The software supplied herewith by Microchip Technology Incorporated
slime@2
    15
 * (the “Company”) for its PICmicro® Microcontroller is intended and
slime@2
    16
 * supplied to you, the Company’s customer, for use solely and
slime@2
    17
 * exclusively on Microchip PICmicro Microcontroller products. The
slime@2
    18
 * software is owned by the Company and/or its supplier, and is
slime@2
    19
 * protected under applicable copyright laws. All rights are reserved.
slime@2
    20
 * Any use in violation of the foregoing restrictions may subject the
slime@2
    21
 * user to criminal sanctions under applicable laws, as well as to
slime@2
    22
 * civil liability for the breach of the terms and conditions of this
slime@2
    23
 * license.
slime@2
    24
 *
slime@2
    25
 * THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
slime@2
    26
 * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
slime@2
    27
 * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
slime@2
    28
 * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
slime@2
    29
 * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
slime@2
    30
 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
slime@2
    31
 *
slime@2
    32
 * Author               Date        Comment
slime@2
    33
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
slime@2
    34
 * Rawin Rojvanit       11/19/04    Original.
slime@2
    35
 ********************************************************************/
slime@2
    36
#ifndef USBCTRLTRF_H
slime@2
    37
#define USBCTRLTRF_H
slime@2
    38
slime@2
    39
/** I N C L U D E S **********************************************************/
slime@2
    40
#include "typedefs.h"
slime@2
    41
slime@2
    42
/** D E F I N I T I O N S ****************************************************/
slime@2
    43
slime@2
    44
/* Control Transfer States */
slime@2
    45
#define WAIT_SETUP          0
slime@2
    46
#define CTRL_TRF_TX         1
slime@2
    47
#define CTRL_TRF_RX         2
slime@2
    48
slime@2
    49
/* USB PID: Token Types - See chapter 8 in the USB specification */
slime@2
    50
#define SETUP_TOKEN         0b00001101
slime@2
    51
#define OUT_TOKEN           0b00000001
slime@2
    52
#define IN_TOKEN            0b00001001
slime@2
    53
slime@2
    54
/* bmRequestType Definitions */
slime@2
    55
#define HOST_TO_DEV         0
slime@2
    56
#define DEV_TO_HOST         1
slime@2
    57
slime@2
    58
#define STANDARD            0x00
slime@2
    59
#define CLASS               0x01
slime@2
    60
#define VENDOR              0x02
slime@2
    61
slime@2
    62
#define RCPT_DEV            0
slime@2
    63
#define RCPT_INTF           1
slime@2
    64
#define RCPT_EP             2
slime@2
    65
#define RCPT_OTH            3
slime@2
    66
slime@2
    67
/** E X T E R N S ************************************************************/
slime@2
    68
extern byte ctrl_trf_session_owner;
slime@2
    69
slime@2
    70
extern POINTER pSrc;
slime@2
    71
extern POINTER pDst;
slime@2
    72
extern WORD wCount;
slime@2
    73
slime@2
    74
/** P U B L I C  P R O T O T Y P E S *****************************************/
slime@2
    75
void USBCtrlEPService(void);
slime@2
    76
void USBCtrlTrfTxService(void);
slime@2
    77
void USBCtrlTrfRxService(void);
slime@2
    78
void USBCtrlEPServiceComplete(void);
slime@2
    79
void USBPrepareForNextSetupTrf(void);
slime@2
    80
slime@2
    81
slime@2
    82
#endif //USBCTRLTRF_H