OpenCores
URL https://opencores.org/ocsvn/usb_device_core/usb_device_core/trunk

Subversion Repositories usb_device_core

[/] [usb_device_core/] [trunk/] [sw/] [usbf_defs.h] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 ultra_embe
#ifndef __USBF_DEFS_H__
2
#define __USBF_DEFS_H__
3
 
4
//-----------------------------------------------------------------
5
// Macros:
6
//-----------------------------------------------------------------
7
// For Little Endian CPUs
8
#define USB_BYTE_SWAP16(n)          (n)
9
// For Big Endian CPUs
10
//#define USB_BYTE_SWAP16(n)        ((((unsigned short)((n) & 0xff)) << 8) | (((n) & 0xff00) >> 8))
11
 
12
#define LO_BYTE(w)                  ((unsigned char)(w))
13
#define HI_BYTE(w)                  ((unsigned char)(((unsigned short)(w) >> 8) & 0xFF))
14
 
15
#define MIN(a,b)                    ((a)<=(b)?(a):(b))
16
 
17
//-----------------------------------------------------------------
18
// Defines:
19
//-----------------------------------------------------------------
20
 
21
// Device class
22
#define DEV_CLASS_RESERVED      0x00
23
#define DEV_CLASS_AUDIO         0x01
24
#define DEV_CLASS_COMMS         0x02
25
#define DEV_CLASS_HID           0x03
26
#define DEV_CLASS_MONITOR       0x04
27
#define DEV_CLASS_PHY_IF        0x05
28
#define DEV_CLASS_POWER         0x06
29
#define DEV_CLASS_PRINTER       0x07
30
#define DEV_CLASS_STORAGE       0x08
31
#define DEV_CLASS_HUB           0x09
32
#define DEV_CLASS_TMC           0xFE
33
#define DEV_CLASS_VENDOR_CUSTOM 0xFF
34
 
35
// Standard requests (via SETUP packets)
36
#define REQ_GET_STATUS        0x00
37
#define REQ_CLEAR_FEATURE     0x01
38
#define REQ_SET_FEATURE       0x03
39
#define REQ_SET_ADDRESS       0x05
40
#define REQ_GET_DESCRIPTOR    0x06
41
#define REQ_SET_DESCRIPTOR    0x07
42
#define REQ_GET_CONFIGURATION 0x08
43
#define REQ_SET_CONFIGURATION 0x09
44
#define REQ_GET_INTERFACE     0x0A
45
#define REQ_SET_INTERFACE     0x0B
46
#define REQ_SYNC_FRAME        0x0C
47
 
48
// Descriptor types
49
#define DESC_DEVICE             0x01
50
#define DESC_CONFIGURATION      0x02
51
#define DESC_STRING             0x03
52
#define DESC_INTERFACE          0x04
53
#define DESC_ENDPOINT           0x05
54
#define DESC_DEV_QUALIFIER      0x06
55
#define DESC_OTHER_SPEED_CONF   0x07
56
#define DESC_IF_POWER           0x08
57
 
58
// Endpoints
59
#define ENDPOINT_DIR_MASK       (1 << 7)
60
#define ENDPOINT_DIR_IN         (1 << 7)
61
#define ENDPOINT_DIR_OUT        (0 << 7)
62
#define ENDPOINT_ADDR_MASK      (0x7F)
63
#define ENDPOINT_TYPE_MASK      (0x3)
64
#define ENDPOINT_TYPE_CONTROL   (0)
65
#define ENDPOINT_TYPE_ISO       (1)
66
#define ENDPOINT_TYPE_BULK      (2)
67
#define ENDPOINT_TYPE_INTERRUPT (3)
68
 
69
// Device Requests (bmRequestType)
70
#define USB_RECIPIENT_MASK       0x1F
71
#define USB_RECIPIENT_DEVICE     0x00
72
#define USB_RECIPIENT_INTERFACE  0x01
73
#define USB_RECIPIENT_ENDPOINT   0x02
74
#define USB_REQUEST_TYPE_MASK    0x60
75
#define USB_STANDARD_REQUEST     0x00
76
#define USB_CLASS_REQUEST        0x20
77
#define USB_VENDOR_REQUEST       0x40
78
 
79
// USB device addresses are 7-bits
80
#define USB_ADDRESS_MASK        0x7F
81
 
82
// USB Feature Selectors
83
#define USB_FEATURE_ENDPOINT_STATE      0x0000
84
#define USB_FEATURE_REMOTE_WAKEUP       0x0001
85
#define USB_FEATURE_TEST_MODE           0x0002
86
 
87
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.