usb: add SoF event

Start of Frame events can now be accessed from USB classes.
This will be useful when implementing idle rate functionality.

Signed-off-by: Marcin Szymczyk <Marcin.Szymczyk@nordicsemi.no>
This commit is contained in:
Marcin Szymczyk 2018-11-22 11:58:51 +01:00 committed by Anas Nashif
parent 0d222025d6
commit e4c447aac3
12 changed files with 29 additions and 0 deletions

View file

@ -999,6 +999,9 @@ static void usbd_event_handler(nrfx_usbd_evt_t const *const p_event)
usbd_status_code_update(USB_DC_RESET);
break;
case NRFX_USBD_EVT_SOF:
#ifdef CONFIG_USB_DEVICE_SOF
usbd_status_code_update(USB_DC_SOF);
#endif
break;
case NRFX_USBD_EVT_EPTRANSFER:

View file

@ -59,6 +59,8 @@ enum usb_dc_status_code {
USB_DC_SET_HALT,
/** Clear Feature ENDPOINT_HALT received */
USB_DC_CLEAR_HALT,
/** Start of Frame received */
USB_DC_SOF,
/** Initial USB connection status */
USB_DC_UNKNOWN
};

View file

@ -108,6 +108,8 @@ static void status_cb(enum usb_dc_status_code status, const u8_t *param)
case USB_DC_CONFIGURED:
in_ready_cb();
break;
case USB_DC_SOF:
break;
default:
LOG_DBG("status %u unhandled", status);
break;

View file

@ -61,6 +61,9 @@ config USB_COMPOSITE_BUFFER_SIZE
default 256 if USB_DEVICE_NETWORK_RNDIS
default 64
config USB_DEVICE_SOF
bool "Enable Start of Frame processing in events"
config USB_DEVICE_BOS
bool "Enable USB Binary Device Object Store (BOS)"

View file

@ -231,6 +231,8 @@ static void bluetooth_status_cb(enum usb_dc_status_code status,
case USB_DC_RESUME:
LOG_DBG("USB device resumed");
break;
case USB_DC_SOF:
break;
case USB_DC_UNKNOWN:
default:
LOG_DBG("USB unknown state");

View file

@ -425,6 +425,8 @@ static void cdc_acm_dev_status_cb(enum usb_dc_status_code status,
case USB_DC_RESUME:
LOG_DBG("USB device resumed");
break;
case USB_DC_SOF:
break;
case USB_DC_UNKNOWN:
default:
LOG_DBG("USB unknown state");

View file

@ -122,6 +122,8 @@ static void hid_status_cb(enum usb_dc_status_code status, const u8_t *param)
case USB_DC_RESUME:
LOG_DBG("USB device resumed");
break;
case USB_DC_SOF:
break;
case USB_DC_UNKNOWN:
default:
LOG_DBG("USB unknown state");

View file

@ -832,6 +832,8 @@ static void mass_storage_status_cb(enum usb_dc_status_code status,
case USB_DC_INTERFACE:
LOG_DBG("USB interface selected");
break;
case USB_DC_SOF:
break;
case USB_DC_UNKNOWN:
default:
LOG_DBG("USB unknown state");

View file

@ -388,6 +388,9 @@ static void ecm_status_cb(enum usb_dc_status_code status, const u8_t *param)
LOG_DBG("USB unhandlded state: %d", status);
break;
case USB_DC_SOF:
break;
case USB_DC_UNKNOWN:
default:
LOG_DBG("USB unknown state: %d", status);

View file

@ -262,6 +262,9 @@ static void eem_status_cb(enum usb_dc_status_code status, const u8_t *param)
LOG_DBG("USB unhandlded state: %d", status);
break;
case USB_DC_SOF:
break;
case USB_DC_UNKNOWN:
default:
LOG_DBG("USB unknown state: %d", status);

View file

@ -1310,6 +1310,9 @@ static void rndis_status_cb(enum usb_dc_status_code status, const u8_t *param)
LOG_DBG("USB unhandlded state: %d", status);
break;
case USB_DC_SOF:
break;
case USB_DC_UNKNOWN:
default:
LOG_DBG("USB unknown state %d", status);

View file

@ -583,6 +583,8 @@ static void dfu_status_cb(enum usb_dc_status_code status, const u8_t *param)
case USB_DC_RESUME:
LOG_DBG("USB device resumed");
break;
case USB_DC_SOF:
break;
case USB_DC_UNKNOWN:
default:
LOG_DBG("USB unknown state");