#ifndef USB_TRANSFER_FLAGS_H #define USB_TRANSFER_FLAGS_H #include "app/usb/usb_transfers.h" // @USB_TRANSFER_FLAG_SHORTPACKET // The bitwise flag used to indicate weither the short packet has received at last OUT transaction or not. #define USB_TRANSFER_FLAG_SHORTPACKET (1ul << 0) // Short packet flag static inline bool usb_transfer_check_shortpacket( sUSBTransfer_t * transf ) { // check if the last transaction was a Short-packet transaction return usb_transfer_check_flags_fast( transf, USB_TRANSFER_FLAG_SHORTPACKET, USB_TRANSFER_FLAG_SHORTPACKET, eUSBTransferFlagMode_Or ); } static inline void usb_transfer_set_shortpacket( sUSBTransfer_t * transf ) { // set the Short-packet signature for transaction usb_transfer_modify_flags( transf, USB_TRANSFER_FLAG_SHORTPACKET, USB_TRANSFER_FLAG_SHORTPACKET ); // protect the flag from clearing usb_transfer_modify_flags_locks( transf, USB_TRANSFER_FLAG_SHORTPACKET, USB_TRANSFER_FLAG_SHORTPACKET ); } static inline void usb_transfer_clear_shortpacket( sUSBTransfer_t * transf ) { // un-protect the flag from clearing usb_transfer_modify_flags_locks( transf, USB_TRANSFER_FLAG_SHORTPACKET, 0 ); // reset the Short-packet signature for transaction usb_transfer_modify_flags( transf, USB_TRANSFER_FLAG_SHORTPACKET, 0 ); } #endif