PebbleOS v4.47.0-757-g12b6c531f
Loading...
Searching...
No Matches
udc.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <pbl/device.h>

Data Structures

struct  pbl_udc_callbacks
 What the stack does with what a controller reports, from its interrupt. More...
 
struct  pbl_udc_ops
 Driver operations. More...
 
struct  pbl_udc
 USB device controller. More...
 

Macros

#define PBL_UDC_EP_IN   0x80U
 Direction bit of an IN endpoint address.
 
#define PBL_UDC_STATE_DEFINE(sym)
 Define the runtime state of a controller.
 
#define PBL_UDC_INIT(sym, _name, _parent, _ops, _num_eps, _max_speed)
 Initializer of a controller.
 

Enumerations

enum  pbl_udc_ep_type { PBL_UDC_EP_CONTROL = 0 , PBL_UDC_EP_ISOCHRONOUS = 1 , PBL_UDC_EP_BULK = 2 , PBL_UDC_EP_INTERRUPT = 3 }
 Endpoint transfer types, as the endpoint descriptor gives them. More...
 
enum  pbl_udc_speed { PBL_UDC_SPEED_FULL , PBL_UDC_SPEED_HIGH }
 Bus speeds. More...
 
enum  pbl_udc_event {
  PBL_UDC_EVENT_RESET , PBL_UDC_EVENT_ENUMERATED , PBL_UDC_EVENT_SUSPEND , PBL_UDC_EVENT_RESUME ,
  PBL_UDC_EVENT_SETUP
}
 Bus events. More...
 

Functions

void pbl_udc_register (const struct pbl_udc *udc, const struct pbl_udc_callbacks *cb, void *arg)
 Take what the controller reports.
 
int pbl_udc_enable (const struct pbl_udc *udc)
 Connect to the bus.
 
int pbl_udc_disable (const struct pbl_udc *udc)
 Disconnect from the bus.
 
enum pbl_udc_speed pbl_udc_speed (const struct pbl_udc *udc)
 The speed the bus runs at, once enumerated.
 
int pbl_udc_set_address (const struct pbl_udc *udc, uint8_t addr)
 Take the address the host gave, before the status stage of its request.
 
int pbl_udc_ep_enable (const struct pbl_udc *udc, uint8_t ep, enum pbl_udc_ep_type type, uint16_t mps)
 Set an endpoint up.
 
int pbl_udc_ep_disable (const struct pbl_udc *udc, uint8_t ep)
 Shut an endpoint down.
 
int pbl_udc_ep_set_halt (const struct pbl_udc *udc, uint8_t ep, bool halt)
 Stall an endpoint, or clear its stall.
 
int pbl_udc_ep_queue (const struct pbl_udc *udc, uint8_t ep, void *buf, size_t len)
 Start a transfer.
 
void pbl_udc_event (const struct pbl_udc *udc, enum pbl_udc_event evt, const uint8_t *setup)
 Report a bus event, from the controller's interrupt.
 
void pbl_udc_xfer_done (const struct pbl_udc *udc, uint8_t ep, int ret)
 Report the end of a transfer, from the controller's interrupt.
 

Variables

const struct pbl_udc *const UDC
 The device controller of the board, for the USB device stack.