1 /******************************************************************************* 2 * Copyright 2019-2020 Microchip FPGA Embedded Systems Solutions. 3 * 4 * SPDX-License-Identifier: MIT 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to 8 * deal in the Software without restriction, including without limitation the 9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 * sell copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in 14 * all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22 * IN THE SOFTWARE. 23 * 24 * PolarFire SoC MSS USB Driver Stack 25 * USB Logical Layer (USB-LL) 26 * USBD driver 27 * 28 * USBD driver public API. 29 */ 30 31 /*=========================================================================*//** 32 @mainpage PolarFire SoC MSS USB driver 33 USBD driver 34 35 @section intro_sec Introduction 36 The USB Device Driver (USBD) is part of USB-LL layer of the MSS USB driver 37 stack. The USBD driver implements the core functionality of the USB device 38 mode operations. The USBD driver is responsible for the following 39 functionalities. 40 • USB Device Enumeration 41 • USB Standard request handling 42 • USB Suspend, Resume and Reset handling 43 • Endpoint management 44 • USB transfers management 45 • USBD-Class call-back interface 46 • Application call-back interface 47 48 @section theory_op Theory of Operation 49 The following steps are involved in the operation of MSS USB: 50 • Configuration 51 • Initialization 52 • USBD-Class Interface 53 • Application Interface 54 • Data transfer 55 The USBD driver operation depends on user configuration provided in 56 mss_usb_config.h. 57 58 Configuration 59 The following parameter must be defined in the mss_usb_config.h file to 60 operate the MSS USB block in the USB device mode. 61 62 MSS_USB_PERIPHERAL_MODE Configures the MSS USB driver stack to operate 63 in the USB device mode. 64 65 Initialization 66 The USBD driver must be initialized by calling the MSS_USBD_init() 67 initialization function with a parameter to select Hi Speed (HS) mode or 68 Full Speed (FS) mode. The USB enumeration process is handled internally by 69 this driver. The application only needs to provide the required application 70 specific information (descriptors) by using MSS_USBD_set_desc_cb_handler() and 71 the MSS_USBD_set_class_cb_handler() functions to this driver. 72 73 Note: The USB low speed operation in device mode is not supported by the 74 MSS USB hardware block. 75 76 USBD-Class Call-back Interface 77 This driver encapsulates the generic USB protocol functionality from the USB 78 class functionality. The USBD driver needs the USBD-Class driver to implement 79 a set of call-back functions implementing the class specific functionality. 80 This driver provides a data type mss_usbd_class_cb_t which must be 81 implemented by the USBD-Class drivers. This data type is the collection of 82 call-back functions which must be implemented by the USBD-Class driver. 83 Implementing all the elements of this structure may not be necessary for a 84 specific USB class. The USBD-Class driver must define a structure of type 85 mss_usbd_class_cb_t and implement its required elements. The USBD-Class 86 driver must pass a pointer to this structure to the USBD driver using the 87 MSS_USBD_set_class_cb_handler() function. 88 89 Application Call-back Interface 90 The application is required to provide the device specific descriptors during 91 enumeration process, namely; device descriptor, device Qualifier descriptor 92 and strings descriptors. 93 These functions are elements of data structure of type mss_usbd_user_descr_cb_t. 94 This structure must be defined and all the required elements of this structure 95 must be implemented in the user application source code. The pointer to this 96 structure must be passed to the USBD driver using the 97 MSS_USBD_set_desc_cb_handler() function. 98 99 Data transfer 100 The USB Device uses ‘Endpoints’ for data transfer. The transmit endpoint and 101 receive endpoint need to be configured for their respective configuration 102 parameters before using them for data transfer. The functions 103 MSS_USBD_tx_ep_configure() and MSS_USBD_rx_ep_configure() must be used to 104 configure transmit endpoint and receive endpoint respectively. 105 106 The application must use the MSS_USBD_tx_ep_write() function to start data 107 transmission on a transmit endpoint. This function prepares the driver to 108 transmit data to the Host. However, actual transmission happens on receiving 109 IN packet from the USB Host. This function is non-blocking. The USBD-Class 110 driver will be informed of the data transfer completion by a call of its 111 call-back function. Transfer errors are also communicated to the USB-Class 112 driver by a call to its call-back function. Please refer the USBD-Class 113 interface section above for more details. 114 115 This driver must first be prepared for it this driver must first be prepared. 116 To receive data from the USB Host. The application must use the 117 MSS_USBD_rx_ep_read_prepare() function for this purpose. This function is 118 non-blocking. The USBD-Class driver will be informed of the reception of data 119 by a call to its call-back function. Receive errors are also communicated to 120 the USB-Class driver by a call to its call-back function. Please refer the 121 USBD-Class Interface section above for more details. 122 123 The USBD driver supports Bulk transfers using the DMA inside MSS USB or without 124 using the internal DMA. It is advised that the USBD driver is configured to 125 use the internal DMA in order to free up the application from transferring data 126 to/from MSS USB hardware block. However, the internal DMA can access only 127 aligned address. Care must be taken that the buffer address provided to the 128 USBD driver must be modulo-4. This is not a requirement when the MSS USB driver 129 is configured not to use internal DMA. 130 131 The functions MSS_USBD_tx_ep_stall() or MSS_USBD_rx_ep_stall() function must 132 be used when the USBD-Class driver needs to stall a particular endpoint. 133 The stall condition on an endpoint can be cleared using the 134 MSS_USBD_tx_ep_clr_error() and MSS_USBD_rx_ep_clr_error() functions on 135 respective endpoint. However, note that, different USB classes have different 136 requirement for clearing the stall condition. E.g. MSC device class needs the 137 stall to be cleared by the USB host rather than the firmware running on the 138 MSC device. 139 140 The control endpoint is significantly different in compared to a transmit 141 endpoint or a receive endpoint. The control endpoint can be used for both 142 transmitting data to the host or receiving data from the host. Separate 143 functions are provided to configure and perform data transfers over control 144 endpoint. The MSS_USBD_cep_configure() function must be used to configure the 145 control endpoint. The function MSS_USBD_cep_write() and 146 MSS_USBD_cep_read_prepare() must be used to transmit and receive data over 147 control endpoint respectively. 148 149 The stall condition on control endpoint is handled by the USBD driver 150 internally because the control endpoint is shared by the USBD driver and the 151 USBD-Class driver. The USBD-Class driver must provide meaningful return value 152 in the call-back functions related to the control endpoint. The USBD driver 153 will appropriately handle the stall condition on the control endpoint 154 depending on these return values. 155 156 *//*=========================================================================*/ 157 158 #ifndef __MSS_USB_DEVICE_H_ 159 #define __MSS_USB_DEVICE_H_ 160 161 #include "mss_usb_common_cif.h" 162 #include "mss_usb_device_cif.h" 163 164 #ifdef MSS_USB_DEVICE_ENABLED 165 166 /***************************************************************************//** 167 Constant values exported from USBD driver 168 ******************************************************************************/ 169 /* 170 The following constants are used to specify whether or not the internal DMA 171 must be used for the data transfers. These values must be used as parameter 172 to the MSS_USBD_tx_ep_configure() and the MSS_USBD_rx_ep_configure() functions. 173 */ 174 #define DMA_DISABLE 0u 175 #define DMA_ENABLE 1u 176 177 /* 178 The following constants are used to specify whether or not a bulk transfers 179 ends with a zero length packet when transfer size is exact multiple of 180 wMaxPacketSize. These values should be used as parameter to the 181 MSS_USBD_tx_ep_configure() and the MSS_USBD_rx_ep_configure() functions. 182 */ 183 #define NO_ZLP_TO_XFR 0u 184 #define ADD_ZLP_TO_XFR 1u 185 186 /* 187 The following constants are used as the return values for the call-back functions, 188 implemented by the USBD-Class driver as part of mss_usbd_class_cb_t type, which 189 are called by the USBD driver. The USBD driver uses these values to infer 190 whether or not the call-back function was successfully executed. The current 191 control transfer is stalled if the return value is USB_FAIL. 192 */ 193 #define USB_FAIL 0u 194 #define USB_SUCCESS 1u 195 196 197 extern volatile uint8_t capture_start; 198 extern volatile uint32_t counter_start; 199 extern volatile uint32_t counter_end; 200 extern volatile uint32_t counter_end1; 201 202 extern volatile uint32_t g_sys_tick_cntr; 203 extern volatile uint32_t g_sys_tick_start; 204 extern volatile uint32_t g_sys_tick_end; 205 206 extern volatile uint32_t g_rd_sys_tick_start; 207 extern volatile uint32_t g_rd_sys_tick_end; 208 209 /***************************************************************************//** 210 Data structures exported by the USBD driver 211 ******************************************************************************/ 212 213 /***************************************************************************//** 214 mss_usbd_user_descr_cb 215 The mss_usbd_user_descr_cb_t provides the prototype of the structure that must 216 be implemented by the application to provide the call-back functions which 217 will be called by the USBD driver to get the user descriptor information. 218 219 usbd_device_descriptor 220 The function pointed by the usbd_device_descriptor element will be called when 221 the USB device receives from USB host the GET_DESCRIPTOR command requesting 222 the device descriptor. This function must return a pointer to the device 223 descriptor and provide the length of the descriptor in the return parameter. 224 225 usbd_device_qual_descriptor 226 The function pointed by the usbd_device_qual_descriptor element will be called 227 when the USB device receives from USB host the GET_DESCRIPTOR command 228 requesting the device qualifier descriptor. This function must return a 229 pointer to the device qualifier descriptor and provide the length of the 230 descriptor in the return parameter. 231 232 usbd_string_descriptor 233 The function pointed by the usbd_string_descriptor element will be called when 234 the USB device receives from USB host the GET_DESCRIPTOR command requesting 235 specific string descriptor. Requested string descriptor number is provided in 236 parameter index. This function must return a pointer to the requested string 237 descriptor and provide the length of the string descriptor in the return 238 parameter length. 239 */ 240 typedef struct mss_usbd_user_descr_cb { 241 uint8_t* (*usbd_device_descriptor)(uint32_t* length); 242 243 uint8_t* (*usbd_device_qual_descriptor)(mss_usb_device_speed_t speed, 244 uint32_t* length); 245 246 uint8_t* (*usbd_string_descriptor)(uint8_t index, uint32_t* length); 247 } mss_usbd_user_descr_cb_t; 248 249 /***************************************************************************//** 250 mss_usbd_setup_pkt_t 251 The mss_usbd_setup_pkt_t provides the prototype of the structure for the setup 252 packet sent by the host. All the parameters of this structure are as per the 253 standard setup packet defined in the USB2.0 specification. 254 255 request_type 256 The request_type parameter provides the information on the type of the request 257 sent by the host. The meaning of this parameter is exactly as defined by the 258 USB2.0 specification. 259 260 request 261 The request parameter is the actual request sent by the host. The meaning of 262 this parameter is exactly as defined by the USB2.0 specification. 263 264 value 265 The value parameter is the value associated with the request. The meaning of 266 this parameter is exactly as defined by the USB2.0 specification. 267 268 index 269 The index parameter is the index information associated with the request. 270 The meaning of this parameter is exactly as defined by the USB2.0 specification. 271 272 length 273 The length parameter provides the length of the data associated with the request. 274 The meaning of this parameter is exactly as defined by the USB2.0 specification. 275 */ 276 typedef struct { 277 uint8_t request_type; 278 uint8_t request; 279 uint16_t value; 280 uint16_t index; 281 uint16_t length; 282 } mss_usbd_setup_pkt_t; 283 284 /***************************************************************************//** 285 mss_usb_class_cb 286 The mss_usbd_class_cb_t provides the prototype of the structure that must be 287 implemented by the USBD-class driver to provide the call-back functions which 288 will be called by the USBD driver on specific events on the USB bus. 289 290 usbd_class_init 291 The function pointed by the usbd_class_init element will be called when the USB 292 device receives SET_CONFIGURATION request from USB host with a non-zero cfgidx 293 number. The parameter cfgidx indicates the configuration number that must be 294 set by the USB device. The USB device goes into the MSS_USB_CONFIGURED_STATE 295 on receiving this command. The musb_speed parameter indicates the USB speed at 296 which the MSS USB is operating. The speed of operation is determined during 297 enumeration process. 298 299 usbd_class_release 300 The function pointed by the usbd_class_release element will be called when the 301 USB device receives SET_CONFIGURATION request from USB host with a cfgidx = 0. 302 The parameter cfgidx indicates the configuration number that must be set by 303 the USB device. The USB device goes into the MSS_USB_ADDRESS_STATE on receiving 304 this command. It will also be called when the device is disconnected from the 305 host. The disconnect event is detected by the USBD driver and is communicated 306 to the class driver using this element by passing the parameter cfgidf = 0xFF. 307 On detecting the disconnect event, the USB device goes into the 308 MSS_USB_NOT_ATTACHED_STATE state. 309 310 usbd_class_get_descriptor 311 The function pointed by the usbd_class_get_descriptor element will be called 312 when the USB device receives GET_DESCRIPTOR request from the USB host 313 requesting a class specific descriptor. The parameter recipient indicates the 314 intended recipient by the USB host (endpoint, interface or device). The 315 parameter type indicates the type of descriptor requested. The musb_speed 316 parameter indicates the USB speed at which the MSS USB is operating. The speed 317 of operation is determined during enumeration process. The musb_speed 318 parameter must be used to provide speed dependent descriptors. 319 320 usbd_class_process_request 321 The function pointed by the usbd_class_process_request element will be called 322 when the USB device receives class specific request from USB host. The 323 parameter setup_pkt is the pointer to the setup packet sent by the host. The 324 parameters buf_p and length are used for the data which might be associated 325 with the current setup packet. If the host requests data from the device, the 326 USBD-Class driver must provide the address of the buffer containing the data 327 in buf_p parameter and the length of this buffer in bytes in length parameter. 328 If the host wants to send data to the device then USBD-Class driver must 329 provide the address of the buffer where the data must be placed in buf_p 330 parameter and the size of the buffer in bytes in the length parameter. For the 331 zero data length request the buf_p and the length parameters are not meaningful. 332 333 usbd_class_tx_done 334 The function pointed by the usbd_class_tx_done element will be called when the 335 data is transferred on previously configured transmit endpoint. The endpoint 336 on which data is transmitted is indicated by parameter num. The parameter 337 status indicates the error status of the transmit transaction. A non-zero 338 status value indicates that there was an error occurred in the last receive 339 transaction. 340 341 usbd_class_rx_done 342 The function pointed by the usbd_class_rx_done element will be called when data 343 is received on previously configured receive endpoint. The endpoint on which 344 data is received is indicated by parameter num. The parameter status indicates 345 the error status of the receive transaction. A non-zero status value indicates 346 that there was an error occurred in the last receive transaction. The rx_count 347 parameter indicates the number of bytes received in the last receive 348 transaction. 349 350 usbd_class_cep_tx_done 351 The function pointed by the usbd_class_cep_tx_done element will be called when 352 a data packet is transmitted on the previously configured control endpoint. 353 The data buffer was provided to this driver using the usbd_class_process_request 354 call-back before the usbd_class_cep_tx_done call-back was called. The parameter 355 status indicates error status of the transmit transaction. A non-zero status 356 value indicates that there was error in last transmit transaction. 357 358 usbd_class_cep_rx_done 359 The function pointed by the usbd_class_cep_rx_done element will be called when 360 a data packet is received on previously configured control endpoint. The 361 received data is stored in the buffer which was previously provided by the 362 usbd_class_process_request call-back before usbd_class_cep_rx_done is called. 363 The parameter status indicates the error status of the receive transaction. 364 A non-zero status value indicates that there was an error occurred in the last 365 receive transaction. 366 */ 367 typedef struct mss_usbd_class_cb { 368 uint8_t(*usbd_class_init)(uint8_t cfgidx, mss_usb_device_speed_t musb_speed); 369 uint8_t(*usbd_class_release)(uint8_t cfgidx); 370 371 uint8_t*(*usbd_class_get_descriptor)(uint8_t recepient, 372 uint8_t type, 373 uint32_t* length, 374 mss_usb_device_speed_t musb_speed); 375 376 uint8_t(*usbd_class_process_request)(mss_usbd_setup_pkt_t* setup_pkt, 377 uint8_t** buf_p, 378 uint32_t* length); 379 380 uint8_t(*usbd_class_tx_done)(mss_usb_ep_num_t num, uint8_t status); 381 uint8_t(*usbd_class_rx_done)(mss_usb_ep_num_t num, 382 uint8_t status, 383 uint32_t rx_count); 384 385 uint8_t(*usbd_class_cep_tx_done)(uint8_t status); 386 uint8_t(*usbd_class_cep_rx_done)(uint8_t status); 387 388 } mss_usbd_class_cb_t; 389 390 /***************************************************************************//** 391 Data structures which are internally used by USBD driver 392 ******************************************************************************/ 393 #ifdef MSS_USB_DEVICE_TEST_MODE 394 typedef struct mss_usbd_user_test_cb { 395 void(*test_ep_rx)(mss_usb_ep_num_t num, uint8_t status, uint32_t rx_count); 396 void(*test_ep_tx_complete)(mss_usb_ep_num_t num, uint8_t status); 397 398 void(*test_cep_setup)(uint8_t status); 399 void(*test_cep_rx)(uint8_t status); 400 void(*test_cep_tx_complete)(uint8_t status); 401 402 void(*test_sof)(uint8_t status); 403 void(*test_reset)(void); 404 void(*test_suspend)(void); 405 void(*test_resume)(void); 406 void(*test_disconnect)(void); 407 408 } mss_usbd_user_test_cb_t; 409 #endif 410 411 /******************************************************************************* 412 Exported functions from USBD driver 413 ******************************************************************************/ 414 415 /***************************************************************************//** 416 @brief MSS_USBD_init() 417 The MSS_USBD_init() function must be used to initialize the USB driver in 418 device mode. The desired operating speed is specified as parameter. 419 420 When selecting MSS_USB_DEVICE_HS, the MSS USB will try to negotiate for high 421 speed during enumeration process. The actual speed of operation depends on 422 the host the device is connected to. If the host is only a full speed host, 423 then MSS USB will appear as a full speed device. This will also be the case 424 when the MSS USB is connected to a host through a USB 1.x hub. 425 426 Note: When MSS_USB_DEVICE_FS is selected, MSS USB will never negotiate for 427 High speed. It will always appear as a full speed device only. 428 429 @param speed 430 The speed parameter specifies the USB speed at which the USB driver and the 431 MSS USB core must operate. 432 Valid values for this parameter are 433 MSS_USB_DEVICE_HS 434 MSS_USB_DEVICE_FS 435 436 @return 437 This function does not return a value. 438 439 Example: 440 @code 441 MSS_USBD_init(MSS_USB_DEVICE_FS); 442 MSS_USBD_set_descr_cb_handler(&flash_drive_descriptors_cb); 443 444 @endcode 445 */ 446 void 447 MSS_USBD_init 448 ( 449 mss_usb_device_speed_t speed 450 ); 451 452 /***************************************************************************//** 453 @brief MSS_USBD_set_descr_cb_handler() 454 The MSS_USBD_set_desc_cb_handler() function must be used to provide the 455 application call-back interface functions to the USBD driver which will be 456 called by this driver to get the USB user descriptor. 457 458 @param user_desc_cb 459 The user_desc_cb parameter provides the address of the structure of type 460 mss_usbd_user_descriptors_cb_t which is implemented by the class driver or 461 the application. 462 463 @return 464 This function does not return a value. 465 466 Example: 467 @code 468 469 MSS_USBD_init(MSS_USB_DEVICE_FS); 470 471 MSS_USBD_set_descr_cb_handler(&flash_drive_descriptors_cb); 472 473 @endcode 474 */ 475 void 476 MSS_USBD_set_descr_cb_handler 477 ( 478 mss_usbd_user_descr_cb_t* user_desc_cb 479 ); 480 481 /***************************************************************************//** 482 @brief MSS_USBD_set_class_cb_handler() 483 The MSS_USBD_set_class_cb_handler() function must be used to provide the 484 call-back functions to the driver which will be called by this driver to 485 indicate the specific events happening on the USB Bus. 486 487 @param class_cb 488 The class_cb parameter provides the address of the structure of type 489 mss_usbd_class_cb_t which is implemented by the USBD-Class driver. 490 491 @return 492 This function does not return a value. 493 494 Example: 495 @code 496 void 497 MSS_USBD_MSC_init 498 ( 499 mss_usbd_msc_media_t* media_ops, 500 mss_usb_device_speed_t speed 501 ) 502 { 503 g_usbd_msc_media_ops = media_ops; 504 g_usbd_msc_user_speed = speed; 505 506 MSS_USBD_set_class_cb_handler(&usb_msd_class_cb); 507 } 508 @endcode 509 */ 510 void 511 MSS_USBD_set_class_cb_handler 512 ( 513 mss_usbd_class_cb_t* class_cb 514 ); 515 516 /***************************************************************************//** 517 @brief MSS_USBD_cep_configure() 518 The MSS_USBD_cep_configure() function is used to configure the control 519 endpoint (EP0) for the control transactions and enables the control endpoint 520 interrupt. Other Properties of the control endpoint are fixed as listed below. 521 Transfer type – Control Transfer. 522 FIFO address – 0x00 523 FIFO Size - 0x40 (64 decimal) 524 525 This function must be called before any other function for the control 526 endpoint. 527 528 @param max_pkt_size 529 The max_pkt_size parameter is the maximum packet size used for control 530 transfer. This value must match with the bMaxPacketSize0 value in the device 531 descriptor. 532 533 @return 534 This function does not return a value. 535 536 Example: 537 @code 538 MSS_USBD_cep_configure(64u); 539 MSS_USBD_cep_read_prepare((uint8_t*)&g_setup_pkt, 8u); 540 @endcode 541 */ 542 void 543 MSS_USBD_cep_configure 544 ( 545 uint8_t max_pkt_size 546 ); 547 548 /***************************************************************************//** 549 @brief MSS_USBD_cep_read_prepare() 550 The MSS_USBD_cep_read_prepare() function prepares the previously configured 551 control endpoint to receive data. After calling this function, the USBD 552 driver is ready to read data received on the next OUT packet. This function 553 prepares the MSS USB hardware block to copy the received data into the 554 provided buffer. This function copies the number of bytes specified by the 555 length parameter from the control endpoint RX FIFO. Extra bytes found in the 556 RX FIFO are discarded. 557 558 @param addr 559 The addr parameter specifies the address of the receive buffer where the 560 data from the RX FIFO is copied by this driver. 561 562 @param length 563 The length parameter specifies the length of the receive buffer in bytes. 564 565 @return 566 This function does not return a value. 567 568 Example: 569 @code 570 MSS_USBD_cep_configure(64u); 571 MSS_USBD_cep_read_prepare((uint8_t*)&g_setup_pkt, 8u); 572 @endcode 573 */ 574 void 575 MSS_USBD_cep_read_prepare 576 ( 577 uint8_t * addr, 578 uint32_t length 579 ); 580 581 /***************************************************************************//** 582 @brief MSS_USBD_cep_write() 583 The MSS_USBD_cep_write() function loads the control endpoint FIFO with the 584 data from the buffer specified as parameter. The data will be transmitted 585 over USB on receiving the next IN token. If the length parameter value is 586 more than the max_pkt_size parameter for control endpoint then this functions 587 loads number of bytes equal to the max_pkt_size value. The max_pkt_size 588 parameter was provided to this driver using MSS_USBD_cep_configure() function. 589 590 @param addr 591 The addr parameter specifies the address of the buffer containing the data 592 to be copied to the control endpoint buffer. 593 594 @param length 595 The length parameter specifies the length of the provided buffer in bytes. 596 597 @return 598 This function does not return a value. 599 600 Example: 601 @code 602 MSS_USBD_cep_write(buf, length); 603 @endcode 604 */ 605 void 606 MSS_USBD_cep_write 607 ( 608 uint8_t * addr, 609 uint32_t length 610 ); 611 612 /***************************************************************************//** 613 @brief MSS_USBD_cep_flush_fifo() 614 The MSS_USBD_cep_flush_fifo() function is used to flush the content of the 615 control endpoint FIFO. This function is typically used to empty the FIFO in 616 case there were errors reported on the last data transaction on control 617 endpoint. 618 619 @param 620 This function does not take any parameter. 621 622 @return 623 This function does not return a value. 624 625 Example: 626 @code 627 MSS_USBD_cep_flush_fifo(); 628 @endcode 629 */ 630 void 631 MSS_USBD_cep_flush_fifo 632 ( 633 void 634 ); 635 636 /***************************************************************************//** 637 @brief MSS_USBD_cep_enable_irq() 638 The MSS_USBD_cep_enable_irq() function is used to enable the control endpoint 639 interrupt. 640 641 @param 642 This function does not take any parameter. 643 644 @return 645 This function does not return a value. 646 647 Example: 648 @code 649 MSS_USBD_cep_enable_irq(); 650 @endcode 651 */ 652 void 653 MSS_USBD_cep_enable_irq 654 ( 655 void 656 ); 657 658 /***************************************************************************//** 659 @brief MSS_USBD_cep_disable_irq() 660 The MSS_USBD_cep_disable_irq() function is used to disable the control endpoint 661 interrupt. 662 663 @param 664 This function does not take any parameter. 665 666 @return 667 This function does not return a value. 668 669 Example: 670 @code 671 MSS_USBD_cep_disable_irq(); 672 @endcode 673 */ 674 void 675 MSS_USBD_cep_disable_irq 676 ( 677 void 678 ); 679 680 /***************************************************************************//** 681 @brief MSS_USBD_tx_ep_configure() 682 The MSS_USBD_tx_ep_configure() function configures the transmit endpoint 683 with the configuration values provided as parameters. After initializing the 684 core, this function must be called before any other function for the desired 685 transmit endpoint. 686 687 Note: This driver does not make any assumptions on the FIFO size and FIFO 688 address, to provide complete flexibility in configuring the FIFOs. The user 689 is responsible to make sure that the endpoint FIFO does not overlap with 690 other endpoint FIFO space. 691 692 693 @param ep_num 694 The ep_num parameter is the endpoint number which is to be configured. 695 The endpoint number must be of the type mss_usb_ep_num_t. 696 697 @param fifo_addr 698 The fifo_addr parameter is the address of the FIFO in the MSS_USB internal 699 RAM. Valid FIFO address values are from 0x00 to 0xFFF8. The FIFO address 700 must be a multiple of 8. If the value provided is not a multiple of 8, then 701 the immediate lower value which is a multiple of 8 is taken as the FIFO 702 address. E.g. If the provided value is 0x09, the actual value taken by the 703 driver is 0x08. If the provided value is less than 0x08 then the FIFO 704 address is taken as 0x00. 705 706 @param fifo_size 707 The fifo_size parameter is the endpoint FIFO size in the MSS USB core 708 internal RAM. Valid FIFO size values are 8, 16, 32, 64, 128, 512, 1024, 709 2048, 4096. The MSS USB core assigns 8 byte FIFO by default if the FIFO size 710 is not configured. 711 712 @param max_pkt_size 713 The max_pkt_size parameter is the maximum packet size of the USB transfer 714 on this endpoint. This value must be equal to the maximum packet size as 715 mentioned in the endpoint descriptor for this endpoint which is used during 716 enumeration process. 717 718 Note: This value must be less than or equal to the FIFO size value. 719 720 @param num_usb_pkt 721 The num_usb_pkt parameter has different meanings for different types of 722 transfers. 723 724 Low bandwidth ISO/interrupt transfers – This parameter must always be ‘1u’. 725 This parameter represents the number of packets transferred in one (micro) 726 frame. 727 728 High bandwidth ISO transfers – This parameter represents the number of 729 packets transferred in one (Micro) frame. In this case, this parameter can 730 have a value of 1, 2 or 3. High bandwidth ISO transfers are not yet implemented. 731 732 Bulk transfers. – For Bulk transfer this value must always be ‘1u’. This 733 parameter is used with the auto-amalgamation/auto-split feature where it 734 indicates the number of bulk packets to be auto-amalgamated/auto-split in a 735 bulk transfer. The auto-amalgamation/auto-split feature is not available yet. 736 737 @param dma_enable 738 The dma_enable parameter specifies whether or not the internal DMA must be 739 used for the data transfer from the provided buffer to the USB FIFO. 740 741 @param dma_channel 742 The dma_channel parameter specifies the internal DMA channel to be used for 743 the data transfers. The DMA channel will be associated with the selected 744 endpoint. Unique DMA channel must be selected to transfer data on individual 745 endpoints. This parameter is ignored when the dma_enable parameter indicates 746 that the DMA must not be used. 747 748 @param xfr_type 749 The xfr_type parameter specifies the type of transfer to be performed on the 750 selected endpoint. All other types of transfers (Interrupt, Isochronous, and 751 Bulk) can be selected except control transfer. 752 753 @param add_zlp 754 The add_zlp parameter indicates whether a zero length packet (ZLP) must be 755 sent if the transfer is an exact multiple of wMaxPacketSize. This parameter 756 is only applicable for Bulk transfers. This parameter is ignored for all 757 other transfer types. 758 759 @return 760 This function does not return a value. 761 762 Example: 763 @code 764 uint8_t 765 usbd_hid_init_cb 766 ( 767 uint8_t cfgidx, 768 mss_usb_device_speed_t musb_speed 769 ) 770 { 771 g_tx_complete_status = 1; 772 MSS_USBD_tx_ep_configure(HID_INTR_TX_EP, 773 HID_INTR_TX_EP_FIFO_ADDR, 774 HID_INTR_TX_EP_MAX_PKT_SIZE, 775 HID_INTR_TX_EP_MAX_PKT_SIZE, 776 1, 777 DMA_DISABLE, 778 MSS_USB_DMA_CHANNEL1, 779 MSS_USB_XFR_INTERRUPT, 780 NO_ZLP_TO_XFR); 781 782 g_usb_hid_state = USBD_HID_CONFIGURED; 783 return SUCCESS; 784 } 785 @endcode 786 */ 787 void 788 MSS_USBD_tx_ep_configure 789 ( 790 mss_usb_ep_num_t ep_num, 791 uint16_t fifo_addr, 792 uint16_t fifo_size, 793 uint16_t max_pkt_size, 794 uint8_t num_usb_pkt, 795 uint8_t dma_enable, 796 mss_usb_dma_channel_t dma_channel, 797 mss_usb_xfr_type_t xfr_type, 798 uint32_t add_zlp 799 ); 800 801 /***************************************************************************//** 802 @brief MSS_USBD_tx_ep_write() 803 The MSS_USBD_tx_ep_write() function writes the data provided by the user 804 into the previously configured transmit endpoint FIFO. After calling this 805 function, the data in the endpoint FIFO is transmitted on the USB bus on 806 receiving the next IN token from the USB Host. A callback function will be 807 called to indicate successful data-in transaction after complete data has 808 been transferred. 809 810 @param ep_num 811 The ep_num parameter specifies the endpoint number on which the data is to 812 be transmitted. 813 814 @param addr 815 The addr parameter is the address of the buffer provided by the user from 816 which the data is copied to the selected endpoint buffer. 817 818 @param Length 819 The length parameter specifies the length of the data buffer in bytes. 820 821 @return 822 This function does not return a value. 823 824 Example: 825 @code 826 void 827 usbd_msc_send_data 828 ( 829 uint8_t* buf, 830 uint32_t len 831 ) 832 { 833 834 g_bot_state = BOT_DATA_TX; 835 MSS_USBD_tx_ep_write(MSS_USB_TX_EP_1, buf, len); 836 g_current_command_csw.data_residue -= len; 837 } 838 @endcode 839 */ 840 void 841 MSS_USBD_tx_ep_write 842 ( 843 mss_usb_ep_num_t ep_num, 844 uint8_t * addr, 845 uint32_t length 846 ); 847 848 /***************************************************************************//** 849 @brief MSS_USBD_tx_ep_stall() 850 The MSS_USBD_tx_ep_stall() function is used to send a stall condition on the 851 specified transmit endpoint. 852 853 @param ep_num 854 The ep_num parameter specifies the transmit endpoint number which is to be 855 stalled. 856 857 @return 858 This function does not return a value. 859 860 Example: 861 @code 862 if(g_current_command_csw.status == SCSI_COMMAND_FAILED) 863 { 864 MSS_USBD_tx_ep_stall(MSS_USB_TX_EP_1); 865 } 866 @endcode 867 */ 868 void 869 MSS_USBD_tx_ep_stall 870 ( 871 mss_usb_ep_num_t ep_num 872 ); 873 874 /***************************************************************************//** 875 @brief MSS_USBD_tx_ep_clr_stall() 876 The MSS_USBD_tx_ep_clr_stall() function is used to clear a stall condition on 877 the previously stalled transmit endpoint. 878 879 @param ep_num 880 The ep_num parameter specifies the transmit endpoint number on which the 881 stall condition is to be cleared. 882 883 @return 884 This function does not return a value. 885 886 Example: 887 @code 888 MSS_USBD_tx_ep_clr_stall(MSS_USB_TX_EP_1); 889 @endcode 890 */ 891 void 892 MSS_USBD_tx_ep_clr_stall 893 ( 894 mss_usb_ep_num_t ep_num 895 ); 896 897 /***************************************************************************//** 898 @brief MSS_USBD_tx_ep_flush_fifo() 899 The MSS_USBD_tx_ep_flush_fifo() function is used to flush the content of the 900 specified transmit endpoint FIFO. This function is typically used to flush 901 the Transmit FIFO in case there were errors reported during the last transmit 902 operation on the specified transmit endpoint. 903 904 @param ep_num 905 The ep_num parameter specifies the transmit endpoint number whose content 906 is to be flushed. 907 908 @return 909 This function does not return a value. 910 911 Example: 912 @code 913 MSS_USBD_tx_ep_flush_fifo(MSS_USB_TX_EP_1); 914 @endcode 915 */ 916 void 917 MSS_USBD_tx_ep_flush_fifo 918 ( 919 mss_usb_ep_num_t ep_num 920 ); 921 922 /***************************************************************************//** 923 @brief MSS_USBD_tx_ep_is_fifo_notempty() 924 The MSS_USBD_tx_ep_fifo_notempty() function is used to know whether or not the 925 transmit endpoint FIFO is empty. 926 927 @param ep_num 928 The ep_num parameter specifies the transmit endpoint number whose FIFO is 929 to be checked. 930 931 @return 932 A non zero return value indicates that there is at least one packet in the 933 transmit endpoint FIFO. 934 935 Example: 936 @code 937 @endcode 938 */ 939 uint8_t 940 MSS_USBD_tx_ep_is_fifo_notempty 941 ( 942 mss_usb_ep_num_t epnum 943 ); 944 945 /***************************************************************************//** 946 @brief MSS_USBD_tx_ep_enable_irq() 947 The MSS_USBD_tx_ep_enable_irq() function is used to enable interrupt on the 948 selected transmit endpoint. 949 950 @param ep_num 951 The ep_num parameter specifies the transmit endpoint number on which the 952 interrupt is to be enabled. 953 954 @return 955 This function does not return a value. 956 957 Example: 958 @code 959 MSS_USBD_tx_ep_enable_irq(MSS_USB_TX_EP_1); 960 @endcode 961 */ 962 void 963 MSS_USBD_tx_ep_enable_irq 964 ( 965 mss_usb_ep_num_t epnum 966 ); 967 968 /***************************************************************************//** 969 @brief MSS_USBD_tx_ep_disable_irq() 970 The MSS_USBD_tx_ep_disable_irq() function is used to disable interrupt on the 971 selected transmit endpoint. 972 973 @param ep_num 974 The ep_num parameter specifies the transmit endpoint number on which the 975 interrupt is to be disabled. 976 977 @return 978 This function does not return a value. 979 980 Example: 981 @code 982 MSS_USBD_tx_ep_disable_irq(MSS_USB_TX_EP_1); 983 @endcode 984 */ 985 void 986 MSS_USBD_tx_ep_disable_irq 987 ( 988 mss_usb_ep_num_t epnum 989 ); 990 991 /***************************************************************************//** 992 @brief MSS_USBD_set_isoupdate() 993 The MSS_USBD_set_isoupdate() function is used to make the transmit endpoint 994 wait for transmitting the data until a SOF packet is received. After calling 995 this function, from the time data is deemed ready, the isochronous transmit 996 endpoint is forced to wait for an SOF token before IN token is received. 997 If IN token is received before an SOF token, then a zero length data packet 998 will be sent. 999 1000 Note: All the transmit endpoint which use isochronous transfers are affected 1001 by this function. 1002 1003 @param 1004 This function does not take any parameters. 1005 1006 @return 1007 This function does not return a value. 1008 1009 Example: 1010 @code 1011 MSS_USBD_set_isoupdate(); 1012 @endcode 1013 */ 1014 void 1015 MSS_USBD_set_isoupdate 1016 ( 1017 void 1018 ); 1019 1020 /***************************************************************************//** 1021 @brief MSS_USBD_clr_isoupdate() 1022 The MSS_USBD_clr_isoupdate() function is used to configure all the 1023 isochronous transmit endpoint such that, once the data is deemed ready, 1024 isochronous endpoint will not wait for SOF token to arrive before IN token. 1025 Data will be transmitted on the next received IN token. This is the default 1026 behaviour of an isochronous transmit endpoint. This function has effect only 1027 if the endpoint was previously configured by MSS_USBD_set_isoupdate() 1028 function. 1029 1030 Note: All the transmit endpoint which use Isochronous transfers are affected 1031 by this function. 1032 1033 @param 1034 This function does not take any parameters. 1035 1036 @return 1037 This function does not return a value. 1038 1039 Example: 1040 @code 1041 MSS_USBD_clr_isoupdate(); 1042 @endcode 1043 */ 1044 void 1045 MSS_USBD_clr_isoupdate 1046 ( 1047 void 1048 ); 1049 1050 /***************************************************************************//** 1051 @brief MSS_USBD_rx_ep_configure() 1052 The MSS_USBD_rx_ep_configure() function configures the receive endpoint with 1053 the configuration values provided as parameters. After initializing the core, 1054 this function must be called before any other function for the desired 1055 receive endpoint. 1056 1057 Note: This driver does not make any assumptions on the FIFO size and FIFO 1058 address to provide complete flexibility in configuring the FIFOs. The User 1059 is responsible to make sure that the endpoint FIFO does not overlap with 1060 other endpoint FIFO space. 1061 1062 @param ep_num 1063 The ep_num parameter is the endpoint number on which the USB transfers are 1064 to be performed. The endpoint number must be provided using the 1065 mss_usb_ep_num_t type. 1066 1067 @param fifo_addr 1068 The fifo_addr parameter is the address of the FIFO in the internal RAM in 1069 the MSS USB core. Valid FIFO address values are from 0x00 to 0xFFF8. The 1070 FIFO address must be a multiple of 8. If the provided value is not a 1071 multiple of 8, then the immediate lower value which is a multiple of 8 is 1072 taken as the FIFO address. E.g. If the provided value is 0x09, the actual 1073 value taken by the driver is 0x08. If the provided value is less than 0x08 1074 then the FIFO address is taken as 0x00. 1075 1076 @param fifo_size 1077 The fifo_size parameter provides the endpoint FIFO size in the MSS USB core 1078 internal RAM. The Valid FIFO size values are 8, 16, 32, 64, 128, 512, 1024, 1079 2048, 4096. The MSS USB core assigns 8 byte FIFO by default if the FIFO 1080 size is not configured. 1081 1082 @param max_pkt_size 1083 The max_pkt_size parameter provides the maximum packet size of the USB 1084 transfer. This value must be equal to the maximum packet size as mentioned 1085 in the endpoint descriptor which is used during enumeration process. 1086 1087 Note: This value must be less than or equal to the FIFO size value. 1088 1089 @param num_usb_pkt 1090 The num_usb_pkt parameter has different meanings for different types of 1091 transfers. 1092 1093 Low bandwidth ISO/interrupt transfers – This parameter must always be ‘1u’. 1094 This parameter represents the number of packets transferred in one (micro) 1095 frame. 1096 1097 High bandwidth ISO transfers – This parameter represents the number of 1098 packets transferred in one (Micro) frame. In this case, this parameter can 1099 have a value of 1 2 or 3. High bandwidth ISO transfers are not yet implemented. 1100 1101 Bulk transfers. – For Bulk transfer this value must always be ‘1u’. This 1102 parameter is used with the auto-amalgamation/auto-split feature where it 1103 indicates number of bulk packets to be auto-amalgamated/auto-split in bulk 1104 transfer. The auto-amalgamation/auto-split feature is implemented but not 1105 yet tested. 1106 1107 @param dma_enable 1108 The dma_enable parameter specifies whether or not the internal DMA must be 1109 used for the data transfer from the provided buffer to the USB FIFO. 1110 1111 @param dma_channel 1112 The dma_channel parameter specifies the internal DMA channel to be used for 1113 the data transfers. DMA channel will be associated with the selected endpoint. 1114 A unique DMA channel must be selected to transfer data on individual 1115 endpoints. This parameter is ignored when dma_enable parameter indicates 1116 that the DMA must not be used. 1117 1118 @param xfr_type 1119 The xfr_type parameter specifies the type of transfer to be performed on 1120 the selected endpoint. All types of transfers (Interrupt, Isochronous, and 1121 Bulk) can be selected except control transfer. 1122 1123 @param add_zlp 1124 The add_zlp parameter indicates whether to expect a zero length packet (ZLP) 1125 if the transfer is exact multiple of wMaxPacketSize. This parameter is only 1126 applicable for Bulk transfers. This parameter is ignored for all other 1127 transfer types. 1128 1129 @return 1130 This function does not return a value. 1131 1132 1133 Example: 1134 @code 1135 MSS_USBD_rx_ep_configure(MSS_USB_RX_EP_1, 1136 0x100u, 1137 bulk_rxep_fifo_sz, 1138 bulk_rxep_maxpktsz, 1139 1u, 1140 DMA_ENABLE, 1141 MSS_USB_DMA_CHANNEL1, 1142 MSS_USB_XFR_BULK, 1143 NO_ZLP_TO_XFR); 1144 1145 MSS_USBD_rx_ep_read_prepare(MSS_USB_RX_EP_1, 1146 (uint8_t*)&g_bot_cbw, 1147 31u); 1148 @endcode 1149 */ 1150 1151 void 1152 MSS_USBD_rx_ep_configure 1153 ( 1154 mss_usb_ep_num_t ep_num, 1155 uint16_t fifo_addr, 1156 uint16_t fifo_size, 1157 uint16_t max_pkt_size, 1158 uint8_t num_usb_pkt, 1159 uint8_t dma_enable, 1160 mss_usb_dma_channel_t dma_channel, 1161 mss_usb_xfr_type_t xfr_type, 1162 uint32_t add_zlp 1163 ); 1164 1165 /***************************************************************************//** 1166 @brief MSS_USBD_rx_ep_read_prepare() 1167 The MSS_USBD_rx_ep_read_prepare() function prepares the specified receive 1168 endpoint for receiving data over USB. The MSS_USBD_rx_ep_configure() 1169 function must be called before calling this function. After calling this 1170 function, data will be received on the selected endpoint when the data 1171 arrives with the next OUT packet. 1172 1173 @param ep_num 1174 The ep_num parameter specifies the endpoint number on which the data is 1175 to be received. 1176 1177 @param addr 1178 The addr parameter is the address of the buffer to which the received data 1179 is copied from the selected endpoint buffer. 1180 1181 @param length 1182 The length parameter specifies the length of the buffer in bytes. 1183 1184 @return 1185 This function does not return a value. 1186 1187 Example: 1188 @code 1189 MSS_USBD_rx_ep_configure(MSS_USB_RX_EP_1, 1190 0x100u, 1191 bulk_rxep_fifo_sz, 1192 bulk_rxep_maxpktsz, 1193 1u, 1194 DMA_ENABLE, 1195 MSS_USB_DMA_CHANNEL1, 1196 MSS_USB_XFR_BULK, 1197 NO_ZLP_TO_XFR); 1198 1199 MSS_USBD_rx_ep_read_prepare(MSS_USB_RX_EP_1, 1200 (uint8_t*)&g_bot_cbw, 1201 31u); 1202 1203 @endcode 1204 */ 1205 void 1206 MSS_USBD_rx_ep_read_prepare 1207 ( 1208 mss_usb_ep_num_t ep_num, 1209 uint8_t* addr, 1210 uint32_t length 1211 ); 1212 1213 /***************************************************************************//** 1214 @brief MSS_USBD_rx_ep_stall() 1215 The MSS_USBD_rx_ep_stall() function is used to send a stall condition on the 1216 specified receive endpoint. 1217 1218 @param ep_num 1219 The ep_num parameter specifies the receive endpoint number which is to be 1220 stalled. 1221 1222 @return 1223 This function does not return a value. 1224 1225 Example: 1226 @code 1227 MSS_USBD_rx_ep_stall(MSS_USB_RX_EP_1); 1228 @endcode 1229 */ 1230 void 1231 MSS_USBD_rx_ep_stall 1232 ( 1233 mss_usb_ep_num_t ep_num 1234 ); 1235 1236 /***************************************************************************//** 1237 @brief MSS_USBD_rx_ep_clr_stall() 1238 The MSS_USBD_rx_ep_clr_stall() function is used to clear a stall condition on 1239 the previously stalled receive endpoint. 1240 1241 @param ep_num 1242 The ep_num parameter specifies the receive endpoint number on which the 1243 stall condition is to be cleared. 1244 1245 @return 1246 This function does not return a value. 1247 1248 Example: 1249 @code 1250 MSS_USBD_rx_ep_clr_stall(MSS_USB_RX_EP_1); 1251 @endcode 1252 */ 1253 void 1254 MSS_USBD_rx_ep_clr_stall 1255 ( 1256 mss_usb_ep_num_t ep_num 1257 ); 1258 1259 /***************************************************************************//** 1260 @brief MSS_USBD_rx_ep_flush_fifo() 1261 The MSS_USBD_rx_ep_flush_fifo() function is used to flush the content of 1262 the selected receive endpoint FIFO. This function is typically used when 1263 there were errors reported with the last USB OUT transaction. 1264 1265 @param ep_num 1266 The ep_num parameter specifies the receive endpoint number whose content is 1267 to be flushed. 1268 1269 @return 1270 This function does not return a value. 1271 1272 Example: 1273 @code 1274 MSS_USBD_rx_ep_flush_fifo(MSS_USB_RX_EP_1); 1275 @endcode 1276 */ 1277 void 1278 MSS_USBD_rx_ep_flush_fifo 1279 ( 1280 mss_usb_ep_num_t ep_num 1281 ); 1282 1283 /***************************************************************************//** 1284 @brief MSS_USBD_rx_ep_is_fifo_full() 1285 The MSS_USBD_rx_ep_is_fifo_full() function is used to find out whether or not 1286 selected receive endpoint FIFO is full. 1287 1288 @param ep_num 1289 The ep_num parameter specifies the receive endpoint number whose FIFO needs 1290 to be checked. 1291 1292 @return 1293 This function does not return a value. 1294 1295 Example: 1296 @code 1297 MSS_USBD_rx_ep_is_fifo_full(MSS_USB_RX_EP_1); 1298 @endcode 1299 */ 1300 uint8_t 1301 MSS_USBD_rx_ep_is_fifo_full 1302 ( 1303 mss_usb_ep_num_t epnum 1304 ); 1305 1306 /***************************************************************************//** 1307 @brief MSS_USBD_rx_ep_enable_irq() 1308 The MSS_USBD_rx_ep_enable_irq() function is used to enable interrupt on the 1309 specified receive endpoint. 1310 1311 @param ep_num 1312 The ep_num parameter specifies the receive endpoint number on which the 1313 interrupt is to be enabled. 1314 1315 @return 1316 This function does not return a value. 1317 1318 Example: 1319 @code 1320 MSS_USBD_rx_ep_enable_irq(MSS_USB_RX_EP_1); 1321 @endcode 1322 */ 1323 void 1324 MSS_USBD_rx_ep_enable_irq 1325 ( 1326 mss_usb_ep_num_t epnum 1327 ); 1328 1329 /***************************************************************************//** 1330 @brief MSS_USBD_rx_ep_disable_irq() 1331 The MSS_USBD_rx_ep_disable_irq() function is used to disable interrupt on the 1332 specified receive endpoint. 1333 1334 @param ep_num 1335 The ep_num parameter specifies the receive endpoint number on which the 1336 interrupt is to be disabled. 1337 1338 @return 1339 This function does not return a value. 1340 1341 Example: 1342 @code 1343 MSS_USBD_rx_ep_disable_irq(MSS_USB_RX_EP_1); 1344 @endcode 1345 */ 1346 void 1347 MSS_USBD_rx_ep_disable_irq 1348 ( 1349 mss_usb_ep_num_t epnum 1350 ); 1351 1352 /***************************************************************************//** 1353 @brief MSS_USBD_get_dev_address() 1354 The MSS_USBD_get_dev_address() function is used to read the current USB 1355 address by which the host addresses this device. By default this address is 1356 0x00. This address gets updated during the enumeration process when the USB 1357 host assigns a non-zero address to this device using the SET_ADDRESS request. 1358 1359 @param 1360 This function does not take any parameter. 1361 1362 @return 1363 This function returns 8-bit value indicating the current USB address to which 1364 this device responds over USB. 1365 1366 Example: 1367 @code 1368 MSS_USBD_get_dev_address(); 1369 @endcode 1370 */ 1371 uint8_t 1372 MSS_USBD_get_dev_address 1373 ( 1374 void 1375 ); 1376 1377 /***************************************************************************//** 1378 @brief MSS_USBD_get_hwcore_info() 1379 1380 1381 @param 1382 1383 1384 @return 1385 1386 1387 Example: 1388 @code 1389 1390 @endcode 1391 */ 1392 void 1393 MSS_USBD_get_hwcore_info 1394 ( 1395 mss_usb_core_info_t* hw_info 1396 ); 1397 1398 #endif //MSS_USB_DEVICE_ENABLED 1399 1400 #endif /* __MSS_USB_DEVICE_H_ */ 1401