4.6.40.1 Functions

  • RETURN_CODE_t USB_EndpointConfigure (USB_PIPE_t pipe, uint16_t endpointSize, USB_ENDPOINT_t endpointType)

    Configures the endpoint with the desired settings using the Control and Status Register. Used to set up an endpoint before using it in an application. Sets up all the control register settings by looking up the usb_config.h file and clears the count registers.

  • RETURN_CODE_t USB_EndpointDisable (USB_PIPE_t pipe)

    Disables the endpoint by setting the endpoint type to 0x00.

  • uint16_t USB_EndpointSizeGet (USB_PIPE_t pipe)

    Helper function to return the endpoint size.

  • USB_ENDPOINT_t USB_EndpointTypeGet (USB_PIPE_t pipe)

    Helper function to return the endpoint type.

  • RETURN_CODE_t USB_EndpointStall (USB_PIPE_t pipe)

    Helps stall an endpoint when a command received from the host is invalid or unrecognizable. Used if the host sends data that is not supported by the device.

  • RETURN_CODE_t USB_EndpointStallClear (USB_PIPE_t pipe)

    Helps clear the Stall condition after the device has recovered from an unsupported command from the host. Used to reset stall before the next USB transfer. Used when the host issues a clear HALT/Feature request to reset stall.

  • bool USB_EndpointIsStalled (USB_PIPE_t pipe)

    Helper function to return the endpoint Stall condition.

  • RETURN_CODE_t USB_EndpointStalledConditionAck (USB_PIPE_t pipe)

    Acknowledges the stall status condition by clearing the Stall Status bit. Used to clear the Stall Status bit after a stall has been detected.

  • RETURN_CODE_t USB_DataToggleSet (USB_PIPE_t pipe)

    Sets the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

  • RETURN_CODE_t USB_DataToggleClear (USB_PIPE_t pipe)

    Clears the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

  • RETURN_CODE_t USB_DataToggle (USB_PIPE_t pipe)

    Toggles the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

  • RETURN_CODE_t ConvertEndpointSizeToMask (uint16_t endpointSize, USB_ENDPOINT_t endpointType, uint8_t *endpointMaskPtr)

    Converts an endpoint size in number of bytes into a register setting. Converts the endpoint size bit mask based on the EP_BUFSIZE setting of the endpoint control register.

  • RETURN_CODE_t EndpointBufferSet (USB_PIPE_t pipe, uint8_t *bufAddress)

    Configures the endpoint data buffer to a location in RAM for the next transaction.