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: usb9.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 USB9_H
|
slime@2
|
37 |
#define USB9_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 |
/******************************************************************************
|
slime@2
|
45 |
* Standard Request Codes
|
slime@2
|
46 |
* USB 2.0 Spec Ref Table 9-4
|
slime@2
|
47 |
*****************************************************************************/
|
slime@2
|
48 |
#define GET_STATUS 0
|
slime@2
|
49 |
#define CLR_FEATURE 1
|
slime@2
|
50 |
#define SET_FEATURE 3
|
slime@2
|
51 |
#define SET_ADR 5
|
slime@2
|
52 |
#define GET_DSC 6
|
slime@2
|
53 |
#define SET_DSC 7
|
slime@2
|
54 |
#define GET_CFG 8
|
slime@2
|
55 |
#define SET_CFG 9
|
slime@2
|
56 |
#define GET_INTF 10
|
slime@2
|
57 |
#define SET_INTF 11
|
slime@2
|
58 |
#define SYNCH_FRAME 12
|
slime@2
|
59 |
|
slime@2
|
60 |
/* Standard Feature Selectors */
|
slime@2
|
61 |
#define DEVICE_REMOTE_WAKEUP 0x01
|
slime@2
|
62 |
#define ENDPOINT_HALT 0x00
|
slime@2
|
63 |
|
slime@2
|
64 |
/******************************************************************************
|
slime@2
|
65 |
* Macro: void mUSBCheckAdrPendingState(void)
|
slime@2
|
66 |
*
|
slime@2
|
67 |
* PreCondition: None
|
slime@2
|
68 |
*
|
slime@2
|
69 |
* Input: None
|
slime@2
|
70 |
*
|
slime@2
|
71 |
* Output: None
|
slime@2
|
72 |
*
|
slime@2
|
73 |
* Side Effects: None
|
slime@2
|
74 |
*
|
slime@2
|
75 |
* Overview: Specialized checking routine, it checks if the device
|
slime@2
|
76 |
* is in the ADDRESS PENDING STATE and services it if it is.
|
slime@2
|
77 |
*
|
slime@2
|
78 |
* Note: None
|
slime@2
|
79 |
*****************************************************************************/
|
slime@2
|
80 |
#define mUSBCheckAdrPendingState() if(usb_device_state==ADR_PENDING_STATE) \
|
slime@2
|
81 |
{ \
|
slime@2
|
82 |
UADDR = SetupPkt.bDevADR._byte; \
|
slime@2
|
83 |
if(UADDR > 0) \
|
slime@2
|
84 |
usb_device_state=ADDRESS_STATE; \
|
slime@2
|
85 |
else \
|
slime@2
|
86 |
usb_device_state=DEFAULT_STATE; \
|
slime@2
|
87 |
}//end if
|
slime@2
|
88 |
|
slime@2
|
89 |
/** E X T E R N S ************************************************************/
|
slime@2
|
90 |
|
slime@2
|
91 |
/** P U B L I C P R O T O T Y P E S *****************************************/
|
slime@2
|
92 |
void USBCheckStdRequest(void);
|
slime@2
|
93 |
|
slime@2
|
94 |
#endif //USB9_H
|