2.2 Core Layer

The core layer responds to the enumeration requests issued by the USB host. It has exclusive access to the HAL and the control endpoint (Endpoint 0). When the host issues a class-specific control transfer request, the core layer analyzes the setup packet of the control transfer and routes it to the appropriate class layer.

The core layer must be initialized with the following data:
  • Pointers to configuration descriptors and string descriptors
  • Information about the class components in the application
  • The USB peripheral interrupt, the USB peripheral instance, and sleep mode operation options

The core layer enables all registered classes with it when it receives a Set Configuration Request (for a supported configuration) from the host. It reinitializes the classes in the class layer when a USB reset event occurs. It opens the HAL and registers an event handler to receive USB events. The application can also open the core component (the application becomes a client to the core layer). Then, the application can receive bus and device events and respond to control transfer requests. The core layer provides events to the application, such as device configured or reset. Some of these events are notification-only events, while others require the application to take action.