Prusa MINI Firmware overview
|
Go to the documentation of this file.
65 #define ValBit(VAR,POS) (VAR & (1 << POS))
66 #define SetBit(VAR,POS) (VAR |= (1 << POS))
67 #define ClrBit(VAR,POS) (VAR &= ((1 << POS)^255))
69 #define LE16(addr) (((uint16_t)(*((uint8_t *)(addr))))\
70 + (((uint16_t)(*(((uint8_t *)(addr)) + 1))) << 8))
72 #define LE16S(addr) (uint16_t)(LE16((addr)))
74 #define LE32(addr) ((((uint32_t)(*(((uint8_t *)(addr)) + 0))) + \
75 (((uint32_t)(*(((uint8_t *)(addr)) + 1))) << 8) + \
76 (((uint32_t)(*(((uint8_t *)(addr)) + 2))) << 16) + \
77 (((uint32_t)(*(((uint8_t *)(addr)) + 3))) << 24)))
79 #define LE64(addr) ((((uint64_t)(*(((uint8_t *)(addr)) + 0))) + \
80 (((uint64_t)(*(((uint8_t *)(addr)) + 1))) << 8) +\
81 (((uint64_t)(*(((uint8_t *)(addr)) + 2))) << 16) +\
82 (((uint64_t)(*(((uint8_t *)(addr)) + 3))) << 24) +\
83 (((uint64_t)(*(((uint8_t *)(addr)) + 4))) << 32) +\
84 (((uint64_t)(*(((uint8_t *)(addr)) + 5))) << 40) +\
85 (((uint64_t)(*(((uint8_t *)(addr)) + 6))) << 48) +\
86 (((uint64_t)(*(((uint8_t *)(addr)) + 7))) << 56)))
89 #define LE24(addr) ((((uint32_t)(*(((uint8_t *)(addr)) + 0))) + \
90 (((uint32_t)(*(((uint8_t *)(addr)) + 1))) << 8) + \
91 (((uint32_t)(*(((uint8_t *)(addr)) + 2))) << 16)))
94 #define LE32S(addr) (int32_t)(LE32((addr)))
98 #define USB_LEN_DESC_HDR 0x02
99 #define USB_LEN_DEV_DESC 0x12
100 #define USB_LEN_CFG_DESC 0x09
101 #define USB_LEN_IF_DESC 0x09
102 #define USB_LEN_EP_DESC 0x07
103 #define USB_LEN_OTG_DESC 0x03
104 #define USB_LEN_SETUP_PKT 0x08
107 #define USB_REQ_DIR_MASK 0x80
112 #define USB_REQ_TYPE_STANDARD 0x00
113 #define USB_REQ_TYPE_CLASS 0x20
114 #define USB_REQ_TYPE_VENDOR 0x40
115 #define USB_REQ_TYPE_RESERVED 0x60
118 #define USB_REQ_RECIPIENT_DEVICE 0x00
119 #define USB_REQ_RECIPIENT_INTERFACE 0x01
120 #define USB_REQ_RECIPIENT_ENDPOINT 0x02
121 #define USB_REQ_RECIPIENT_OTHER 0x03
125 #define USB_REQ_GET_STATUS 0x00
126 #define USB_REQ_CLEAR_FEATURE 0x01
127 #define USB_REQ_SET_FEATURE 0x03
128 #define USB_REQ_SET_ADDRESS 0x05
129 #define USB_REQ_GET_DESCRIPTOR 0x06
130 #define USB_REQ_SET_DESCRIPTOR 0x07
131 #define USB_REQ_GET_CONFIGURATION 0x08
132 #define USB_REQ_SET_CONFIGURATION 0x09
133 #define USB_REQ_GET_INTERFACE 0x0A
134 #define USB_REQ_SET_INTERFACE 0x0B
135 #define USB_REQ_SYNCH_FRAME 0x0C
138 #define USB_DESC_TYPE_DEVICE 1
139 #define USB_DESC_TYPE_CONFIGURATION 2
140 #define USB_DESC_TYPE_STRING 3
141 #define USB_DESC_TYPE_INTERFACE 4
142 #define USB_DESC_TYPE_ENDPOINT 5
143 #define USB_DESC_TYPE_DEVICE_QUALIFIER 6
144 #define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION 7
145 #define USB_DESC_TYPE_INTERFACE_POWER 8
146 #define USB_DESC_TYPE_HID 0x21
147 #define USB_DESC_TYPE_HID_REPORT 0x22
150 #define USB_DEVICE_DESC_SIZE 18
151 #define USB_CONFIGURATION_DESC_SIZE 9
152 #define USB_HID_DESC_SIZE 9
153 #define USB_INTERFACE_DESC_SIZE 9
154 #define USB_ENDPOINT_DESC_SIZE 7
158 #define USB_DESC_DEVICE ((USB_DESC_TYPE_DEVICE << 8) & 0xFF00)
159 #define USB_DESC_CONFIGURATION ((USB_DESC_TYPE_CONFIGURATION << 8) & 0xFF00)
160 #define USB_DESC_STRING ((USB_DESC_TYPE_STRING << 8) & 0xFF00)
161 #define USB_DESC_INTERFACE ((USB_DESC_TYPE_INTERFACE << 8) & 0xFF00)
162 #define USB_DESC_ENDPOINT ((USB_DESC_TYPE_INTERFACE << 8) & 0xFF00)
163 #define USB_DESC_DEVICE_QUALIFIER ((USB_DESC_TYPE_DEVICE_QUALIFIER << 8) & 0xFF00)
164 #define USB_DESC_OTHER_SPEED_CONFIGURATION ((USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION << 8) & 0xFF00)
165 #define USB_DESC_INTERFACE_POWER ((USB_DESC_TYPE_INTERFACE_POWER << 8) & 0xFF00)
166 #define USB_DESC_HID_REPORT ((USB_DESC_TYPE_HID_REPORT << 8) & 0xFF00)
167 #define USB_DESC_HID ((USB_DESC_TYPE_HID << 8) & 0xFF00)
170 #define USB_EP_TYPE_CTRL 0x00
171 #define USB_EP_TYPE_ISOC 0x01
172 #define USB_EP_TYPE_BULK 0x02
173 #define USB_EP_TYPE_INTR 0x03
175 #define USB_EP_DIR_OUT 0x00
176 #define USB_EP_DIR_IN 0x80
177 #define USB_EP_DIR_MSK 0x80
179 #ifndef USBH_MAX_PIPES_NBR
180 #define USBH_MAX_PIPES_NBR 15
183 #define USBH_DEVICE_ADDRESS_DEFAULT 0
184 #define USBH_MAX_ERROR_COUNT 2
185 #define USBH_DEVICE_ADDRESS 1
193 #define USBH_CONFIGURATION_DESCRIPTOR_SIZE (USB_CONFIGURATION_DESC_SIZE \
194 + USB_INTERFACE_DESC_SIZE\
195 + (USBH_MAX_NUM_ENDPOINTS * USB_ENDPOINT_DESC_SIZE))
198 #define CONFIG_DESC_wTOTAL_LENGTH (ConfigurationDescriptorData.ConfigDescfield.\
199 ConfigurationDescriptor.wTotalLength)
421 #if (USBH_KEEP_CFG_DESCRIPTOR == 1)
466 #if (USBH_USE_OS == 1)
474 #if defined ( __GNUC__ )
476 #define __weak __attribute__((weak))
479 #define __packed __attribute__((__packed__))
Definition: usbh_def.h:381
Definition: usbh_def.h:389
USBH_OSEventTypeDef
Definition: usbh_def.h:393
: Header for usbh_conf.c file.
uint16_t idVendor
Definition: usbh_def.h:249
USB_Setup_TypeDef setup
Definition: usbh_def.h:412
struct _USBH_HandleTypeDef USBH_HandleTypeDef
Definition: usbh_def.h:337
Definition: usbh_def.h:362
uint8_t * buff
Definition: usbh_def.h:409
Definition: usbh_def.h:371
uint8_t bDeviceClass
Definition: usbh_def.h:242
Definition: usbh_def.h:367
uint8_t bLength
Definition: usbh_def.h:288
Definition: usbh_def.h:308
uint8_t bNumEndpoints
Definition: usbh_def.h:276
Definition: usbh_def.h:348
Definition: usbh_def.h:365
Definition: usbh_def.h:398
uint8_t current_interface
Definition: usbh_def.h:428
TaskHandle_t osThreadId
Definition: cmsis_os.h:283
Definition: usbh_def.h:387
USBH_InterfaceDescTypeDef Itf_Desc[USBH_MAX_NUM_INTERFACES]
Definition: usbh_def.h:296
uint8_t bRequest
Definition: usbh_def.h:222
Definition: usbh_def.h:419
Definition: usbh_def.h:215
USBH_EpDescTypeDef Ep_Desc[USBH_MAX_NUM_ENDPOINTS]
Definition: usbh_def.h:281
HOST_StateTypeDef
Definition: usbh_def.h:326
union _USB_Setup USB_Setup_TypeDef
CMD_StateTypeDef RequestState
Definition: usbh_def.h:454
Definition: usbh_def.h:339
Definition: usbh_def.h:335
CMD_StateTypeDef
Definition: usbh_def.h:377
USBH_DevDescTypeDef DevDesc
Definition: usbh_def.h:429
uint8_t bInterfaceNumber
Definition: usbh_def.h:274
Definition: usbh_def.h:350
uint16_t_uint8_t wIndex
Definition: usbh_def.h:224
Definition: usbh_def.h:386
uint16_t length
Definition: usbh_def.h:410
uint8_t bConfigurationValue
Definition: usbh_def.h:292
Definition: usbh_def.h:331
Definition: usbh_def.h:334
uint16_t bcdDevice
Definition: usbh_def.h:251
uint16_t bcdUSB
Definition: usbh_def.h:241
uint8_t bDeviceProtocol
Definition: usbh_def.h:244
__IO uint32_t Timer
Definition: usbh_def.h:461
Definition: usbh_def.h:363
uint8_t iManufacturer
Definition: usbh_def.h:252
Definition: usbh_def.h:450
Definition: usbh_def.h:333
void * pData
Definition: usbh_def.h:446
Definition: usbh_def.h:388
USBH_CtrlTypeDef Control
Definition: usbh_def.h:455
Definition: usbh_def.h:385
QueueHandle_t osMessageQId
Definition: cmsis_os.h:303
uint16_t_uint8_t wValue
Definition: usbh_def.h:223
Definition: usbh_def.h:270
uint8_t address
Definition: usbh_def.h:425
Definition: usbh_def.h:320
uint8_t id
Definition: usbh_def.h:462
Definition: usbh_def.h:330
Definition: usbh_def.h:328
#define USBH_MAX_SIZE_CONFIGURATION
Definition: usbh_conf.h:114
Definition: usbh_def.h:329
struct _EndpointDescriptor USBH_EpDescTypeDef
Definition: usbh_def.h:364
Definition: usbh_def.h:259
Definition: usbh_def.h:340
Definition: usbh_def.h:379
USBH_CfgDescTypeDef CfgDesc
Definition: usbh_def.h:430
Definition: usbh_def.h:321
uint8_t bNumConfigurations
Definition: usbh_def.h:255
uint8_t bDescriptorType
Definition: usbh_def.h:289
Definition: usbh_def.h:309
Definition: usbh_def.h:346
Definition: usbh_def.h:380
uint16_t_uint8_t wLength
Definition: usbh_def.h:225
uint8_t lsb
Definition: usbh_def.h:208
Definition: usbh_def.h:396
struct _InterfaceDescriptor USBH_InterfaceDescTypeDef
Definition: usbh_def.h:351
Definition: usbh_def.h:353
uint8_t ClassCode
Definition: usbh_def.h:440
Definition: usbh_def.h:372
#define USBH_MAX_NUM_SUPPORTED_CLASS
Definition: usbh_conf.h:111
Definition: usbh_def.h:304
Definition: usbh_def.h:399
Definition: usbh_def.h:368
void
Definition: png.h:1083
Definition: usbh_def.h:286
ENUM_StateTypeDef
Definition: usbh_def.h:344
Definition: usbh_def.h:347
USBH_DeviceTypeDef device
Definition: usbh_def.h:456
uint8_t speed
Definition: usbh_def.h:426
Definition: usbh_def.h:361
Definition: usbh_def.h:397
__IO uint8_t is_connected
Definition: usbh_def.h:427
CTRL_StateTypeDef state
Definition: usbh_def.h:413
uint8_t msb
Definition: usbh_def.h:207
uint8_t pipe_size
Definition: usbh_def.h:408
uint32_t Pipes[15]
Definition: usbh_def.h:460
Definition: usbh_def.h:352
uint8_t bmAttributes
Definition: usbh_def.h:264
uint8_t iProduct
Definition: usbh_def.h:253
struct _DeviceDescriptor USBH_DevDescTypeDef
Definition: usbh_def.h:404
Definition: usbh_def.h:319
Definition: usbh_def.h:237
uint8_t bMaxPacketSize
Definition: usbh_def.h:248
Definition: usbh_def.h:390
uint8_t bNumInterfaces
Definition: usbh_def.h:291
uint8_t bLength
Definition: usbh_def.h:239
uint8_t pipe_in
Definition: usbh_def.h:406
uint8_t iConfiguration
Definition: usbh_def.h:293
const uint8_t[]
Definition: 404_html.c:3
Definition: usbh_def.h:366
#define USBH_MAX_NUM_ENDPOINTS
Definition: usbh_conf.h:99
struct _ConfigurationDescriptor USBH_CfgDescTypeDef
uint8_t bDescriptorType
Definition: usbh_def.h:262
struct _USB_Setup::_SetupPkt_Struc b
CTRL_StateTypeDef
Definition: usbh_def.h:357
USBH_StatusTypeDef
Definition: usbh_def.h:302
uint16_t idProduct
Definition: usbh_def.h:250
Definition: usbh_def.h:360
ENUM_StateTypeDef EnumState
Definition: usbh_def.h:453
struct _DescHeader USBH_DescHeader_t
uint8_t bMaxPower
Definition: usbh_def.h:295
Definition: usbh_def.h:202
uint8_t bInterfaceProtocol
Definition: usbh_def.h:279
uint8_t bInterfaceSubClass
Definition: usbh_def.h:278
uint8_t bDeviceSubClass
Definition: usbh_def.h:243
USBH_ClassTypeDef * pClass[USBH_MAX_NUM_SUPPORTED_CLASS]
Definition: usbh_def.h:457
uint16_t timer
Definition: usbh_def.h:411
uint8_t errorcount
Definition: usbh_def.h:414
Definition: usbh_def.h:332
uint8_t bLength
Definition: usbh_def.h:232
uint32_t ClassNumber
Definition: usbh_def.h:459
uint8_t pipe_out
Definition: usbh_def.h:407
uint8_t iInterface
Definition: usbh_def.h:280
void * pData
Definition: usbh_def.h:463
Definition: usbh_def.h:359
uint16_t w
Definition: usbh_def.h:204
USBH_SpeedTypeDef
Definition: usbh_def.h:317
uint8_t iSerialNumber
Definition: usbh_def.h:254
#define USBH_MAX_DATA_BUFFER
Definition: usbh_conf.h:117
Definition: usbh_def.h:306
Definition: usbh_def.h:305
uint16_t wTotalLength
Definition: usbh_def.h:290
Definition: usbh_def.h:205
uint8_t bDescriptorType
Definition: usbh_def.h:233
Definition: usbh_def.h:219
uint8_t bInterval
Definition: usbh_def.h:266
void(* pUser)(struct _USBH_HandleTypeDef *pHandle, uint8_t id)
Definition: usbh_def.h:464
const char * Name
Definition: usbh_def.h:439
#define USBH_MAX_NUM_INTERFACES
Definition: usbh_conf.h:102
uint8_t bDescriptorType
Definition: usbh_def.h:273
USBH_URBStateTypeDef
Definition: usbh_def.h:384
uint8_t bmRequestType
Definition: usbh_def.h:221
uint8_t bLength
Definition: usbh_def.h:261
USBH_ClassTypeDef * pActiveClass
Definition: usbh_def.h:458
uint8_t bmAttributes
Definition: usbh_def.h:294
__IO HOST_StateTypeDef gState
Definition: usbh_def.h:452
Definition: usbh_def.h:395
uint8_t bDescriptorType
Definition: usbh_def.h:240
uint8_t bAlternateSetting
Definition: usbh_def.h:275
Definition: usbh_def.h:338
uint16_t wMaxPacketSize
Definition: usbh_def.h:265
Definition: usbh_def.h:349
uint8_t bEndpointAddress
Definition: usbh_def.h:263
Definition: usbh_def.h:336
Definition: usbh_def.h:307
uint32_t d8[2]
Definition: usbh_def.h:217
uint8_t bLength
Definition: usbh_def.h:272
uint8_t bInterfaceClass
Definition: usbh_def.h:277
Definition: usbh_def.h:369
Definition: usbh_def.h:437
Definition: usbh_def.h:370