#include <assert.h>
#include <debug.h>
#include <irq_handler.h>
#include <physmem.h>
#include <stdbool.h>
#include <chip/clk.h>
#include <chip/memory-map.h>
#include <chip/irq-map.h>
#include <chip/portmux.h>
#include <chip/usbb.h>
#include <usb/udc.h>
#include <app/config_dmapool.h>
#include <app/config_usb.h>
#include "usbb_internal.h"
#include "usbb_regs.h"

Go to the source code of this file.
Functions | |
| static void | usbb_enter_device_mode (struct usbb_controller *usbb) |
| Enter USB device mode. | |
| static void | usbb_check_id (struct usbb_controller *usbb) |
| Check the state of the USB OTG ID pin. | |
| static void | usbb_interrupt (void *data) |
| USBB main interrupt handler. | |
| static struct usbb_controller * | usbb_init (void) |
| Initialize the USBB controller. | |
| struct udc * | udc_init (void) |
| Initialize the USB Device Controller. | |
This file implements a driver for the transceiver logic in the USBB hardware controller. It is responsible for enabling the host- and device parts of the driver depending on configuration options, transceiver states and USB On-The-Go events originating from HNP and SRP.
If the driver is configured as host-only or device-only, the OTG logic will be disabled. This file is still responsible for detecting connection/disconnection events, and generating/detecting Vbus.
Definition in file usbb_core.c.
| struct udc* udc_init | ( | void | ) | [read] |
Initialize the USB Device Controller.
This will initialize the USB Device Controller, making it ready to attach to the bus. The controller won't attach automatically until udc_attach() has been called as well.
If the UDC is part of a dual-role (OTG) controller, and dual-role configuration is enabled, this function will initialize the whole controller if it hasn't been initialized before.
Definition at line 342 of file usbb_core.c.
References usbb_init().

| static void usbb_check_id | ( | struct usbb_controller * | usbb | ) | [static] |
Check the state of the USB OTG ID pin.
Check the state of the USB OTG ID pin and enable host/device functionality as appropriate.
| usbb | The controller |
Definition at line 175 of file usbb_core.c.
References usbb_enter_device_mode(), and USBB_USBSTA_ID.
Referenced by usbb_init(), and usbb_interrupt().

| static void usbb_enter_device_mode | ( | struct usbb_controller * | usbb | ) | [static] |
Enter USB device mode.
Disable the host driver (if any), enable the UDC driver and start watching the state of the Vbus line.
Definition at line 132 of file usbb_core.c.
References dbg_printf, and USBB_VBUSTI.
Referenced by usbb_check_id(), and usbb_init().
| static struct usbb_controller* usbb_init | ( | void | ) | [static, read] |
Initialize the USBB controller.
For internal use only.
This function will initialize and enable the USBB controller. Depending on the configuration, this may involve one or more of the following steps:
Definition at line 262 of file usbb_core.c.
References clk_enable_usbb(), setup_irq_handler, usbb_check_id(), usbb_enter_device_mode(), USBB_IDTI, usbb_udc_init(), usbb_udc_shutdown(), USBB_USBCON_OTGPADE, USBB_USBCON_UIDE, USBB_USBCON_UIMOD_DEVICE, USBB_USBCON_UIMOD_HOST, and USBB_USBCON_USBE.
Referenced by udc_init().

| static void usbb_interrupt | ( | void * | data | ) | [static] |
USBB main interrupt handler.
This is the main interrupt handler for the USBB controller. It handles OTG and Vbus events, and calls the host- or device-specific interrupt handler, depending on the configuration and/or ID pin state.
| data | Data associated with this interrupt. |
Definition at line 193 of file usbb_core.c.
References usbb_check_id(), USBB_IDTI, usbb_udc_interrupt(), and USBB_VBUSTI.

1.5.8