PER Firmware
Loading...
Searching...
No Matches
usb_priv.h File Reference

Register-level interface used by the STM32G4 USB public layer. More...

#include <stdint.h>
#include "common/phal_G4/usb/usb.h"
Include dependency graph for usb_priv.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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.
 
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.
 

Detailed Description

Register-level interface used by the STM32G4 USB public layer.

Author
Ronak Jain (jain7.nosp@m.17@p.nosp@m.urdue.nosp@m..edu)

These functions assume that the public layer has validated endpoint numbers, directions, pointers, packet lengths, and peripheral lifecycle state.

Function Documentation

◆ USB_PRIV_connect()

void USB_PRIV_connect ( void )

Attach to the bus by enabling the internal D+ pull-up.

Here is the caller graph for this function:

◆ USB_PRIV_deinit()

void USB_PRIV_deinit ( void )

Detach, disable interrupts, and power down the USB peripheral.

Here is the caller graph for this function:

◆ USB_PRIV_enableInterrupts()

void USB_PRIV_enableInterrupts ( void )

Enable USB event interrupts and endpoint operation.

Here is the caller graph for this function:

◆ USB_PRIV_getFrameNumber()

uint16_t USB_PRIV_getFrameNumber ( void )

Read the USB peripheral's current 11-bit frame number.

Returns
The frame number maintained from Start-of-Frame packets.
Here is the caller graph for this function:

◆ USB_PRIV_handleInterrupt()

void USB_PRIV_handleInterrupt ( void )

Decode one pending USB interrupt and notify the application.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ USB_PRIV_init()

bool USB_PRIV_init ( void )

Enable and reset the USB hardware, configure pins and packet memory.

Returns
true once HSI48 is ready and initialization completes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ USB_PRIV_read()

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.

Returns
true when a complete packet fit in the destination and was consumed.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ USB_PRIV_setAddress()

void USB_PRIV_setAddress ( uint8_t address)

Write the seven-bit device address while keeping the device enabled.

Here is the caller graph for this function:

◆ USB_PRIV_stall()

void USB_PRIV_stall ( uint8_t endpoint,
PHAL_USB_EndpointDirection_t direction )

Set one endpoint direction to the USB STALL handshake state.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ USB_PRIV_write()

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.

Returns
true when the endpoint was idle and accepted the packet.
Here is the call graph for this function:
Here is the caller graph for this function: