qmk_firmware/internals_udd_group.md

11 KiB

group udd_group

The UDD driver provides a low-level abstraction of the device controller hardware. Most events coming from the hardware such as interrupts, which may cause the UDD to call into the UDC and UDI.

Summary

Members Descriptions
define Udd_setup_is_in Return true if the setup request udd_g_ctrlreq indicates IN data transfer.
define Udd_setup_is_out Return true if the setup request udd_g_ctrlreq indicates OUT data transfer.
define Udd_setup_type Return the type of the SETUP request udd_g_ctrlreq.
define Udd_setup_recipient Return the recipient of the SETUP request udd_g_ctrlreq.
enum udd_ep_status_t Endpoint transfer status Returned in parameters of callback register via udd_ep_run routine.
public bool udd_include_vbus_monitoring(void) Authorizes the VBUS event.
public void udd_enable(void) Enables the USB Device mode.
public void udd_disable(void) Disables the USB Device mode.
public void udd_attach(void) Attach device to the bus when possible.
public void udd_detach(void) Detaches the device from the bus.
public bool udd_is_high_speed(void) Test whether the USB Device Controller is running at high speed or not.
public void udd_set_address(uint8_t address) Changes the USB address of device.
public uint8_t udd_getaddress(void) Returns the USB address of device.
public uint16_t udd_get_frame_number(void) Returns the current start of frame number.
public uint16_t udd_get_micro_frame_number(void) Returns the current micro start of frame number.
public void udd_send_remotewakeup(void) The USB driver sends a resume signal called Upstream Resume.
public void udd_set_setup_payload(uint8_t * payload,uint16_t payload_size) Load setup payload.
struct udd_ctrl_request_t Global variable to give and record information of the setup request management.

Members

define Udd_setup_is_in

Return true if the setup request udd_g_ctrlreq indicates IN data transfer.

define Udd_setup_is_out

Return true if the setup request udd_g_ctrlreq indicates OUT data transfer.

define Udd_setup_type

Return the type of the SETUP request udd_g_ctrlreq.

See also: usb_reqtype.

define Udd_setup_recipient

Return the recipient of the SETUP request udd_g_ctrlreq.

See also: usb_recipient

enum udd_ep_status_t

Values Descriptions
UDD_EP_TRANSFER_OK
UDD_EP_TRANSFER_ABORT

Endpoint transfer status Returned in parameters of callback register via udd_ep_run routine.

public bool udd_include_vbus_monitoring(void)

Authorizes the VBUS event.

Returns

true, if the VBUS monitoring is possible.

public void udd_enable(void)

Enables the USB Device mode.

public void udd_disable(void)

Disables the USB Device mode.

public void udd_attach(void)

Attach device to the bus when possible.

If a VBus control is included in driver, then it will attach device when an acceptable Vbus level from the host is detected.

public void udd_detach(void)

Detaches the device from the bus.

The driver must remove pull-up on USB line D- or D+.

public bool udd_is_high_speed(void)

Test whether the USB Device Controller is running at high speed or not.

Returns

true if the Device is running at high speed mode, otherwise false.

public void udd_set_address(uint8_t address)

Changes the USB address of device.

Parameters

  • address New USB address

public uint8_t udd_getaddress(void)

Returns the USB address of device.

Returns

USB address

public uint16_t udd_get_frame_number(void)

Returns the current start of frame number.

Returns

current start of frame number.

public uint16_t udd_get_micro_frame_number(void)

Returns the current micro start of frame number.

Returns

current micro start of frame number required in high speed mode.

public void udd_send_remotewakeup(void)

The USB driver sends a resume signal called Upstream Resume.

public void udd_set_setup_payload(uint8_t * payload,uint16_t payload_size)

Load setup payload.

Parameters

  • payload Pointer on payload

  • payload_size Size of payload

struct udd_ctrl_request_t

Global variable to give and record information of the setup request management.

This global variable allows to decode and response a setup request. It can be updated by udc_process_setup() from UDC or *setup() from UDIs.

Summary

Members Descriptions
public usb_setup_req_t req Data received in USB SETUP packet Note: The swap of "req.wValues" from uin16_t to le16_t is done by UDD.
public uint8_t * payload Point to buffer to send or fill with data following SETUP packet This buffer must be word align for DATA IN phase (use prefix COMPILER_WORD_ALIGNED for buffer)
public uint16_t payload_size Size of buffer to send or fill, and content the number of byte transfered.
public void(* callback Callback called after reception of ZLP from setup request.
public bool(* over_under_run Callback called when the buffer given (.payload) is full or empty. This one return false to abort data transfer, or true with a new buffer in .payload.

Members

public usb_setup_req_t req

Data received in USB SETUP packet Note: The swap of "req.wValues" from uin16_t to le16_t is done by UDD.

public uint8_t * payload

Point to buffer to send or fill with data following SETUP packet This buffer must be word align for DATA IN phase (use prefix COMPILER_WORD_ALIGNED for buffer)

public uint16_t payload_size

Size of buffer to send or fill, and content the number of byte transfered.

public void(* callback

Callback called after reception of ZLP from setup request.

public bool(* over_under_run

Callback called when the buffer given (.payload) is full or empty. This one return false to abort data transfer, or true with a new buffer in .payload.