|
PER Firmware
|
STM32G4 USB register and packet-memory implementation. More...
Functions | |
| static volatile uint16_t * | usb_endpoint_register (uint8_t endpoint) |
| static volatile uint16_t * | usb_descriptor_word (uint8_t endpoint, uint8_t word) |
| static volatile uint16_t * | usb_pma (uint16_t address) |
| static uint16_t | usb_transmit_address (uint8_t endpoint) |
| static uint16_t | usb_receive_address (uint8_t endpoint) |
| static void | usb_delay (uint32_t iterations) |
| static bool | usb_enable_clock (void) |
| static void | usb_configure_pins (void) |
| static void | usb_configure_type_c_sink (void) |
| static void | usb_reset_peripheral (void) |
| static void | usb_set_status (uint8_t endpoint, PHAL_USB_EndpointDirection_t direction, uint8_t status) |
| static void | usb_clear_transfer (uint8_t endpoint, PHAL_USB_EndpointDirection_t direction) |
| static void | usb_configure_endpoint (uint8_t endpoint, uint16_t type_bits) |
| static void | usb_configure_endpoints (void) |
| static void | usb_copy_to_pma (uint16_t address, const void *source, uint16_t length_bytes) |
| static void | usb_copy_from_pma (uint16_t address, void *destination, uint16_t length_bytes) |
| bool | USB_PRIV_init (void) |
| Enable and reset the USB hardware, configure pins and packet memory. | |
| void | USB_PRIV_deinit (void) |
| Detach, disable interrupts, and power down the USB peripheral. | |
| void | USB_PRIV_enableInterrupts (void) |
| Enable USB event interrupts and endpoint operation. | |
| void | USB_PRIV_connect (void) |
| Attach to the bus by enabling the internal D+ pull-up. | |
| void | USB_PRIV_setAddress (uint8_t address) |
| Write the seven-bit device address while keeping the device enabled. | |
| void | USB_PRIV_stall (uint8_t endpoint, PHAL_USB_EndpointDirection_t direction) |
| Set one endpoint direction to the USB STALL handshake state. | |
| bool | USB_PRIV_write (uint8_t endpoint, const void *source, uint16_t length_bytes) |
| Copy one IN packet to packet memory and make it available to the host. | |
| bool | USB_PRIV_read (uint8_t endpoint, void *destination, uint16_t destination_capacity, uint16_t *received_length) |
| Copy one completed OUT packet from packet memory and rearm reception. | |
| static void | usb_clear_interrupt_flags (uint16_t interrupt_status) |
| void | USB_PRIV_handleInterrupt (void) |
| Decode one pending USB interrupt and notify the application. | |
| uint16_t | USB_PRIV_getFrameNumber (void) |
| Read the USB peripheral's current 11-bit frame number. | |
Variables | |
| static constexpr uint16_t | USB_PRIV_BTABLE_OFFSET = 0U |
| static constexpr uint16_t | USB_PRIV_BUFFER_START = 64U |
| static constexpr uint32_t | USB_PRIV_CLOCK_TIMEOUT = 1'000'000U |
| static constexpr uint32_t | USB_PRIV_STARTUP_DELAY = 1'000U |
| static constexpr uint8_t | USB_PRIV_STATUS_STALL = 1U |
| static constexpr uint8_t | USB_PRIV_STATUS_NAK = 2U |
| static constexpr uint8_t | USB_PRIV_STATUS_VALID = 3U |
| static constexpr uint8_t | USB_PRIV_DM_PIN = 11U |
| static constexpr uint8_t | USB_PRIV_DP_PIN = 12U |
| static constexpr uint8_t | USB_PRIV_CC1_PIN = 8U |
| static constexpr uint8_t | USB_PRIV_CC2_PIN = 9U |
| static constexpr uint8_t | USB_PRIV_GPIO_MODE_BITS = 0b11U |
| static constexpr uint8_t | USB_PRIV_GPIO_MODE_BIT_WIDTH = 2U |
| static constexpr uint8_t | USB_PRIV_ENDPOINT_REGISTER_STRIDE = 2U |
| static constexpr uint8_t | USB_PRIV_BTABLE_ENTRY_SIZE_BYTES = 8U |
| static constexpr uint8_t | USB_PRIV_BTABLE_WORD_SIZE_BYTES = 2U |
| static constexpr uint8_t | USB_PRIV_BUFFERS_PER_ENDPOINT = 2U |
| static constexpr uint8_t | USB_PRIV_ENDPOINT_COUNT = 8U |
| static constexpr uint8_t | USB_PRIV_STATUS_TX_SHIFT = 4U |
| static constexpr uint8_t | USB_PRIV_STATUS_RX_SHIFT = 12U |
| static constexpr uint8_t | USB_PRIV_RX_BLOCK_COUNT = 1U |
| static constexpr uint8_t | USB_PRIV_RX_BLOCK_COUNT_SHIFT = 10U |
STM32G4 USB register and packet-memory implementation.
|
static |
Acknowledge non-endpoint flags present in an ISTR snapshot.
|
static |
Acknowledge one endpoint transfer without clearing the opposite direction.
|
static |
Populate one BTABLE entry and enable its IN and OUT directions.
|
static |
Restore the fixed control and bulk endpoint configuration.
|
static |
Release the USB-C CC and USB data pins from their GPIO digital paths.
|
static |
Configure UCPD1 to advertise this board as a USB-C power sink.
|
static |
Copy a packet from STM32 packet memory into application memory.
|
static |
Copy an application packet into the STM32's 16-bit packet memory.
|
static |
Provide the minimum peripheral power-up delay without requiring a timer.
|
static |
Return one 16-bit field from an endpoint's four-word BTABLE entry.
|
static |
Enable HSI48 and wait a bounded period for clock-ready acknowledgement.
|
static |
Return the register that controls both directions of one endpoint.
|
static |
Convert a USB byte address to its memory-mapped packet-memory address.
| void USB_PRIV_connect | ( | void | ) |
Attach to the bus by enabling the internal D+ pull-up.
| void USB_PRIV_deinit | ( | void | ) |
Detach, disable interrupts, and power down the USB peripheral.
| void USB_PRIV_enableInterrupts | ( | void | ) |
Enable USB event interrupts and endpoint operation.
| uint16_t USB_PRIV_getFrameNumber | ( | void | ) |
Read the USB peripheral's current 11-bit frame number.
| void USB_PRIV_handleInterrupt | ( | void | ) |
Decode one pending USB interrupt and notify the application.
| bool USB_PRIV_init | ( | void | ) |
Enable and reset the USB hardware, configure pins and packet memory.
| bool USB_PRIV_read | ( | uint8_t | endpoint, |
| void * | destination, | ||
| uint16_t | destination_capacity, | ||
| uint16_t * | received_length ) |
Copy one completed OUT packet from packet memory and rearm reception.
The received length is reported even when the destination is too small; in that case the packet remains pending and the OUT endpoint is not rearmed.
| void USB_PRIV_setAddress | ( | uint8_t | address | ) |
Write the seven-bit device address while keeping the device enabled.
| void USB_PRIV_stall | ( | uint8_t | endpoint, |
| PHAL_USB_EndpointDirection_t | direction ) |
Set one endpoint direction to the USB STALL handshake state.
| bool USB_PRIV_write | ( | uint8_t | endpoint, |
| const void * | source, | ||
| uint16_t | length_bytes ) |
Copy one IN packet to packet memory and make it available to the host.
|
static |
Calculate the packet-memory byte address of an endpoint's OUT buffer.
|
static |
Reset and power up USB into a detached, interrupt-disabled state.
|
static |
Change the hardware handshake state for one endpoint direction.
|
static |
Calculate the packet-memory byte address of an endpoint's IN buffer.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |