# drivers/usb/usbb_internal.h File Reference

USBB driver: Internal functions and definitions. More...

`#include <bitops.h>`
`#include <dmapool.h>`
`#include <slist.h>`
`#include <stdint.h>`
`#include <usb/request.h>`
`#include <usb/udc.h>`
`#include "usbb_regs.h"`

Include dependency graph for usbb_internal.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | usbb_sw_dma_desc
| USBB DMA descriptor. More...
## Enumerations
enum | ep0_state { EP0_STATE_SETUP = 0, EP0_STATE_DATA_IN, EP0_STATE_DATA_ZLP, EP0_STATE_DATA_OUT, EP0_STATE_STATUS_IN, EP0_STATE_STATUS_OUT, EP0_STATE_TEST_J, EP0_STATE_TEST_K, EP0_STATE_TEST_SE0_NAK, EP0_STATE_TEST_PACKET }
## Functions
void | usbb_udc_interrupt (struct usbb_udc *udcb)
| The USBB device-mode interrupt handler.
void | usbb_udc_vbus_off (struct usbb_udc *udcb)
| Signal that a low Vbus level has been detected.
void | usbb_udc_vbus_on (struct usbb_udc *udcb)
| Signal that a high Vbus level has been detected.
struct usbb_udc * | usbb_udc_init (void)
| Initialize the device part of the USBB controller.
void | usbb_udc_shutdown (struct usbb_udc *udcb)
| Shut down the device part of the USBB controller.

## Detailed Description

USBB driver: Internal functions and definitions.

This header is for internal use only. There is lots of ugly preprocessor stuff in here so that the rest of the code can be reasonably clean and efficient.

- Compiler: IAR EWAVR32 and GNU GCC for AVR32
- Supported devices: All AVR32 devices with a USBB module can be used.
- AppNote:

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file usbb_internal.h.

## Enumeration Type Documentation

enum ep0_state

Control endpoint state.

Enumerator:

  EP0_STATE_SETUP | Waiting for SETUP
  EP0_STATE_DATA_IN | IN data being sent
  EP0_STATE_DATA_ZLP | Zero-Length Packet being sent
  EP0_STATE_DATA_OUT | Waiting for OUT data
  EP0_STATE_STATUS_IN | IN status sent
  EP0_STATE_STATUS_OUT | Waiting for OUT status
  EP0_STATE_TEST_J | Test_J mode after status
  EP0_STATE_TEST_K | Test_K mode after status
  EP0_STATE_TEST_SE0_NAK | Test_SE0_NAK mode after status
  EP0_STATE_TEST_PACKET | Test_Packet mode after status

Definition at line 89 of file usbb_internal.h.

## Function Documentation

struct usbb_udc* usbb_udc_init | ( | void |  | ) | `[read]`

Initialize the device part of the USBB controller.

For internal use only.

This function does any device-side initialization necessary when the USBB controller as a whole is being initialized. It does not enable any device-side functionality.

Returns:
  A USBB device controller instance.

Definition at line 1802 of file usbb_udc.c.

References slist_init(), softirq_set_handler(), usbb_udc_softirq(), USBB_UDCON_LS, and USBB_UDCON_SPDCONF_FULL.

Referenced by usbb_init().

Here is the call graph for this function:

void usbb_udc_interrupt | ( | struct usbb_udc * | udcb | ) |

The USBB device-mode interrupt handler.

For internal use only.

Parameters:

  | udcb | The USBB Device Controller instance.

Definition at line 1661 of file usbb_udc.c.

References softirq_raise().

Referenced by usbb_interrupt().

Here is the call graph for this function:

void usbb_udc_shutdown | ( | struct usbb_udc * | udcb | ) |

Shut down the device part of the USBB controller.

For internal use only.

This function does any device-side cleanups necessary when the USBB controller as a whole is being shut down.

Parameters:

  | udcb | The USBB device controller instance.

Definition at line 1834 of file usbb_udc.c.

Referenced by usbb_init().

void usbb_udc_vbus_off | ( | struct usbb_udc * | udcb | ) |

Signal that a low Vbus level has been detected.

For internal use only.

This function is called by the USBB bus interface driver when Vbus power is no longer provided by the host.

Parameters:

  | udcb | The USBB Device Controller instance

Definition at line 1734 of file usbb_udc.c.

References clear_bit(), dbg_printf, udc::flags, test_bit(), and USB_DEV_HAS_POWER.

Here is the call graph for this function:

void usbb_udc_vbus_on | ( | struct usbb_udc * | udcb | ) |

Signal that a high Vbus level has been detected.

For internal use only.

This function is called by the USBB bus interface driver when Vbus power is provided by the host.

Parameters:

  | udcb | The USBB Device Controller instance

Definition at line 1714 of file usbb_udc.c.

References dbg_printf, udc::flags, set_bit(), test_bit(), and USB_DEV_HAS_POWER.

Here is the call graph for this function: