File syn_port_usb.h¶
FileList > port > syn_port_usb.h
Go to the source code of this file
USB HAL hardware port interface contract.
#include "syntropic/common/syn_defs.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_port_usb_connect (void) Signal physical USB connection/attach (e.g. enable D+ pullup). |
| SYN_Status | syn_port_usb_disconnect (void) Signal physical USB disconnect/detach (e.g. disable D+ pullup). |
| SYN_Status | syn_port_usb_ep_close (uint8_t ep_addr) Close a hardware endpoint. |
| SYN_Status | syn_port_usb_ep_open (uint8_t ep_addr, uint8_t ep_type, uint16_t max_pkt) Open and configure a hardware endpoint. |
| SYN_Status | syn_port_usb_ep_read (uint8_t ep_addr, void * buf, uint16_t max_len, uint16_t * out_len) Read packet from an OUT endpoint FIFO/buffer. |
| SYN_Status | syn_port_usb_ep_stall (uint8_t ep_addr) Signal STALL condition on an endpoint. |
| SYN_Status | syn_port_usb_ep_write (uint8_t ep_addr, const void * data, uint16_t len) Write packet to an IN endpoint FIFO/buffer. |
| SYN_Status | syn_port_usb_init (void) Initialize low-level USB peripheral hardware. |
| SYN_Status | syn_port_usb_set_address (uint8_t addr) Assign USB device address in hardware controller. |
Macros¶
| Type | Name |
|---|---|
| define | SYN_USB_EP_TYPE_BULK 2U |
| define | SYN_USB_EP_TYPE_CONTROL 0U |
| define | SYN_USB_EP_TYPE_INTR 3U |
| define | SYN_USB_EP_TYPE_ISOC 1U |
Public Functions Documentation¶
function syn_port_usb_connect¶
Signal physical USB connection/attach (e.g. enable D+ pullup).
Returns:
SYN_OK on success.
function syn_port_usb_disconnect¶
Signal physical USB disconnect/detach (e.g. disable D+ pullup).
Returns:
SYN_OK on success.
function syn_port_usb_ep_close¶
Close a hardware endpoint.
Parameters:
ep_addrEndpoint address.
Returns:
SYN_OK on success.
function syn_port_usb_ep_open¶
Open and configure a hardware endpoint.
Parameters:
ep_addrBit 7: Direction (0=OUT, 1=IN), Bits 3:0: Endpoint number.ep_typeEndpoint type (SYN_USB_EP_TYPE_*).max_pktMaximum packet size in bytes.
Returns:
SYN_OK on success.
function syn_port_usb_ep_read¶
Read packet from an OUT endpoint FIFO/buffer.
SYN_Status syn_port_usb_ep_read (
uint8_t ep_addr,
void * buf,
uint16_t max_len,
uint16_t * out_len
)
Parameters:
ep_addrEndpoint address.bufDestination buffer.max_lenMax capacity.out_lenPointer to receive read byte count.
Returns:
SYN_OK on success, SYN_BUSY if no packet available.
function syn_port_usb_ep_stall¶
Signal STALL condition on an endpoint.
Parameters:
ep_addrEndpoint address.
Returns:
SYN_OK on success.
function syn_port_usb_ep_write¶
Write packet to an IN endpoint FIFO/buffer.
Parameters:
ep_addrEndpoint address.dataPointer to payload bytes.lenByte length.
Returns:
SYN_OK on success.
function syn_port_usb_init¶
Initialize low-level USB peripheral hardware.
Returns:
SYN_OK on success.
function syn_port_usb_set_address¶
Assign USB device address in hardware controller.
Parameters:
addrassigned address (1..127).
Returns:
SYN_OK on success.
Macro Definition Documentation¶
define SYN_USB_EP_TYPE_BULK¶
Bulk Endpoint (2)
define SYN_USB_EP_TYPE_CONTROL¶
USB Endpoint Types per USB Spec Control Endpoint (0)
define SYN_USB_EP_TYPE_INTR¶
Interrupt Endpoint (3)
define SYN_USB_EP_TYPE_ISOC¶
Isochronous Endpoint (1)
The documentation for this class was generated from the following file src/port/syn_port_usb.h