#ifndef CORE_USB_USB #define CORE_USB_USB #include #include "usb_device_types.h" #include "usb_driver_common.h" // -------------- /** * Setup transfer state. */ typedef struct { USB_SetupRequest setup_req; ///< Setup request uint8_t next_stage; ///< Next expected stage bool out_complete; ///< Signals if transfer's OUT direction is complete, no later data reception is expected } Usb_SetupTransferState; // -------------- /** \cond 0 */ #ifndef USB_RX_BUF_SIZE #define USB_RX_BUF_SIZE (512) ///< Receive buffer size FIXME #endif /** \endcond */ // -------------- /** * Initialize USB core. * * @param drvIntf pointer to a mutable driver interface object */ void usbcore_init(UsbDrv_DrvIntf *drvIntf); /** * Reset USB core. */ void usbcore_reset(); /** * Write data to an IN Endpoint. * * @param ep index of the Endpoint * @param data pointer to data to be written * @param size data length * @return number of bytes written */ uint32_t usbcore_schedule_transmission(uint8_t ep, const uint8_t *data, uint16_t size); /** * Expect ingress data on an Endpoint. * * @param ep index of the Endpoint * @param size expected reception length * @return message length that the endpoint can support during next reception */ uint32_t usbcore_schedule_reception(uint8_t ep, uint16_t size); /** * Register a callback for IN transmission completion. * * @param ep index of the Endpoint * @param cb callback function */ void usbcore_register_IN_callback(uint8_t ep, UsbDrv_IN_cb cb); #endif /* CORE_USB_USB */