diff options
Diffstat (limited to 'tmk_core/protocol/arm_atsam/usb/udd.h')
-rw-r--r-- | tmk_core/protocol/arm_atsam/usb/udd.h | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/tmk_core/protocol/arm_atsam/usb/udd.h b/tmk_core/protocol/arm_atsam/usb/udd.h index b580e5847..805b761a7 100644 --- a/tmk_core/protocol/arm_atsam/usb/udd.h +++ b/tmk_core/protocol/arm_atsam/usb/udd.h @@ -71,7 +71,7 @@ typedef uint8_t udd_ep_id_t; //! \brief Endpoint transfer status //! Returned in parameters of callback register via udd_ep_run routine. typedef enum { - UDD_EP_TRANSFER_OK = 0, + UDD_EP_TRANSFER_OK = 0, UDD_EP_TRANSFER_ABORT = 1, } udd_ep_status_t; @@ -94,36 +94,32 @@ typedef struct { uint16_t payload_size; //! Callback called after reception of ZLP from setup request - void (*callback) (void); + void (*callback)(void); //! 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. - bool(*over_under_run) (void); + bool (*over_under_run)(void); } udd_ctrl_request_t; extern udd_ctrl_request_t udd_g_ctrlreq; //! Return true if the setup request \a udd_g_ctrlreq indicates IN data transfer -#define Udd_setup_is_in() \ - (USB_REQ_DIR_IN == (udd_g_ctrlreq.req.bmRequestType & USB_REQ_DIR_MASK)) +#define Udd_setup_is_in() (USB_REQ_DIR_IN == (udd_g_ctrlreq.req.bmRequestType & USB_REQ_DIR_MASK)) //! Return true if the setup request \a udd_g_ctrlreq indicates OUT data transfer -#define Udd_setup_is_out() \ - (USB_REQ_DIR_OUT == (udd_g_ctrlreq.req.bmRequestType & USB_REQ_DIR_MASK)) +#define Udd_setup_is_out() (USB_REQ_DIR_OUT == (udd_g_ctrlreq.req.bmRequestType & USB_REQ_DIR_MASK)) //! Return the type of the SETUP request \a udd_g_ctrlreq. \see usb_reqtype. -#define Udd_setup_type() \ - (udd_g_ctrlreq.req.bmRequestType & USB_REQ_TYPE_MASK) +#define Udd_setup_type() (udd_g_ctrlreq.req.bmRequestType & USB_REQ_TYPE_MASK) //! Return the recipient of the SETUP request \a udd_g_ctrlreq. \see usb_recipient -#define Udd_setup_recipient() \ - (udd_g_ctrlreq.req.bmRequestType & USB_REQ_RECIP_MASK) +#define Udd_setup_recipient() (udd_g_ctrlreq.req.bmRequestType & USB_REQ_RECIP_MASK) /** * \brief End of halt callback function type. * Registered by routine udd_ep_wait_stall_clear() * Callback called when endpoint stall is cleared. */ -typedef void (*udd_callback_halt_cleared_t) (void); +typedef void (*udd_callback_halt_cleared_t)(void); /** * \brief End of transfer callback function type. @@ -134,8 +130,7 @@ typedef void (*udd_callback_halt_cleared_t) (void); * \param status UDD_EP_TRANSFER_ABORT, if transfer is aborted * \param n number of data transfered */ -typedef void (*udd_callback_trans_t) (udd_ep_status_t status, - iram_size_t nb_transfered, udd_ep_id_t ep); +typedef void (*udd_callback_trans_t)(udd_ep_status_t status, iram_size_t nb_transfered, udd_ep_id_t ep); /** * \brief Authorizes the VBUS event @@ -216,8 +211,7 @@ void udd_send_remotewakeup(void); * \param payload Pointer on payload * \param payload_size Size of payload */ -void udd_set_setup_payload( uint8_t *payload, uint16_t payload_size ); - +void udd_set_setup_payload(uint8_t *payload, uint16_t payload_size); /** * \name Endpoint Management @@ -239,8 +233,7 @@ void udd_set_setup_payload( uint8_t *payload, uint16_t payload_size ); * * \return \c 1 if the endpoint is enabled, otherwise \c 0. */ -bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes, - uint16_t MaxEndpointSize); +bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes, uint16_t MaxEndpointSize); /** * \brief Disables an endpoint @@ -294,8 +287,7 @@ bool udd_ep_clear_halt(udd_ep_id_t ep); * * \return \c 1 if the register is accepted, otherwise \c 0. */ -bool udd_ep_wait_stall_clear(udd_ep_id_t ep, - udd_callback_halt_cleared_t callback); +bool udd_ep_wait_stall_clear(udd_ep_id_t ep, udd_callback_halt_cleared_t callback); /** * \brief Allows to receive or send data on an endpoint @@ -321,9 +313,7 @@ bool udd_ep_wait_stall_clear(udd_ep_id_t ep, * * \return \c 1 if function was successfully done, otherwise \c 0. */ -bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket, - uint8_t *buf, iram_size_t buf_size, - udd_callback_trans_t callback); +bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket, uint8_t *buf, iram_size_t buf_size, udd_callback_trans_t callback); /** * \brief Aborts transfer on going on endpoint * @@ -339,7 +329,6 @@ void udd_ep_abort(udd_ep_id_t ep); //@} - /** * \name High speed test mode management * @@ -352,7 +341,6 @@ void udd_test_mode_se0_nak(void); void udd_test_mode_packet(void); //@} - /** * \name UDC callbacks to provide for UDD * @@ -393,4 +381,4 @@ extern void udc_sof_notify(void); #ifdef __cplusplus } #endif -#endif // _UDD_H_ +#endif // _UDD_H_ |