mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-19 06:40:45 +00:00
update msc driver
This commit is contained in:
parent
3ed83c4d98
commit
047bc5eeb1
@ -155,12 +155,12 @@ tusb_error_t led_blinking_subtask(void)
|
||||
{
|
||||
OSAL_SUBTASK_BEGIN
|
||||
|
||||
static uint32_t led_on_mask = 0;
|
||||
static bool led_state = false;
|
||||
|
||||
osal_task_delay(led_blink_interval_ms);
|
||||
|
||||
board_leds(led_on_mask, 1 - led_on_mask);
|
||||
led_on_mask = 1 - led_on_mask; // toggle
|
||||
board_led_control(BOARD_LED0, led_state);
|
||||
led_state = 1 - led_state; // toggle
|
||||
|
||||
// uint32_t btn_mask;
|
||||
// btn_mask = board_buttons();
|
||||
|
@ -57,8 +57,8 @@
|
||||
#define TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE 64
|
||||
|
||||
//------------- CLASS -------------//
|
||||
#define TUSB_CFG_DEVICE_HID_KEYBOARD 1
|
||||
#define TUSB_CFG_DEVICE_HID_MOUSE 1
|
||||
#define TUSB_CFG_DEVICE_HID_KEYBOARD 0
|
||||
#define TUSB_CFG_DEVICE_HID_MOUSE 0
|
||||
#define TUSB_CFG_DEVICE_HID_GENERIC 0 // not supported yet
|
||||
#define TUSB_CFG_DEVICE_MSC 1
|
||||
#define TUSB_CFG_DEVICE_CDC 1
|
||||
|
@ -228,7 +228,7 @@ tusb_error_t cdcd_control_request_subtask(uint8_t port, tusb_control_request_t c
|
||||
{
|
||||
OSAL_SUBTASK_INVOKED( usbd_control_xfer_substak(port, (tusb_dir_t) p_request->bmRequestType_bit.direction,
|
||||
(uint8_t*) &cdcd_line_coding[port], min16_of(sizeof(cdc_line_coding_t), p_request->wLength)), err );
|
||||
// TODO notify application on xfer completea
|
||||
// TODO notify application on xfer complete
|
||||
}
|
||||
else if (CDC_REQUEST_SET_CONTROL_LINE_STATE == p_request->bRequest )
|
||||
{
|
||||
|
@ -123,26 +123,29 @@ tusb_error_t mscd_open(uint8_t port, tusb_descriptor_interface_t const * p_inter
|
||||
|
||||
tusb_error_t mscd_control_request_subtask(uint8_t port, tusb_control_request_t const * p_request)
|
||||
{
|
||||
ASSERT(p_request->bmRequestType_bit.type == TUSB_REQ_TYPE_CLASS, TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT);
|
||||
OSAL_SUBTASK_BEGIN
|
||||
|
||||
tusb_error_t err;
|
||||
|
||||
TU_ASSERT(p_request->bmRequestType_bit.type == TUSB_REQ_TYPE_CLASS, TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT);
|
||||
|
||||
mscd_interface_t * p_msc = &mscd_data;
|
||||
|
||||
switch(p_request->bRequest)
|
||||
if(MSC_REQUEST_RESET == p_request->bRequest)
|
||||
{
|
||||
case MSC_REQUEST_RESET:
|
||||
tusb_dcd_control_xfer(port, TUSB_DIR_OUT, NULL, 0, false);
|
||||
break;
|
||||
|
||||
case MSC_REQUEST_GET_MAX_LUN:
|
||||
p_msc->scsi_data[0] = p_msc->max_lun; // Note: lpc11/13u need xfer data's address to be aligned 64 -> make use of scsi_data instead of using max_lun directly
|
||||
tusb_dcd_control_xfer(port, TUSB_DIR_IN, p_msc->scsi_data, 1, false);
|
||||
break;
|
||||
|
||||
default:
|
||||
return TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT;
|
||||
usbd_control_status(port, TUSB_DIR_IN);
|
||||
}
|
||||
else if (MSC_REQUEST_GET_MAX_LUN == p_request->bRequest)
|
||||
{
|
||||
// Note: lpc11/13u need xfer data's address to be aligned 64 -> make use of scsi_data instead of using max_lun directly
|
||||
p_msc->scsi_data[0] = p_msc->max_lun;
|
||||
OSAL_SUBTASK_INVOKED( usbd_control_xfer_substak(port, TUSB_DIR_IN, p_msc->scsi_data, 1), err);
|
||||
}else
|
||||
{
|
||||
SUBTASK_RETURN(TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT);
|
||||
}
|
||||
|
||||
return TUSB_ERROR_NONE;
|
||||
OSAL_SUBTASK_END
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
Loading…
x
Reference in New Issue
Block a user