Hardware Reference
In-Depth Information
/******************************************************************************
* Function:
void USBStallHandler(void)
*
* PreCondition:
A STALL packet is sent to the host by the SIE.
*
* Input:
None
*
* Output:
None
*
* Side Effects:
None
*
* Overview:
The STALLIF is set anytime the SIE sends out a STALL
*
packet regardless of which endpoint causes it.
*
A Setup transaction overrides the STALL function. A stalled
*
endpoint stops stalling once it receives a setup packet.
*
In this case, the SIE will accepts the Setup packet and
*
set the TRNIF flag to notify the firmware. STALL function
*
for that particular endpoint pipe will be automatically
*
disabled (direction specific).
*
*
There are a few reasons for an endpoint to be stalled.
*
1. When a non-supported USB request is received.
*
Example: GET_DESCRIPTOR(DEVICE_QUALIFIER)
*
2. When an endpoint is currently halted.
*
3. When the device class specifies that an endpoint must
*
stall in response to a specific event.
*
Example: Mass Storage Device Class
*
If the CBW is not valid, the device shall
*
STALL the Bulk-In pipe.
*
See USB Mass Storage Class Bulk-only Transport
*
Specification for more details.
*
* Note: UEPn.EPSTALL can be scanned to see which endpoint causes
* the stall event.
* If
*****************************************************************************/
void USBStallHandler(void)
{
/*
* Does not really have to do anything here,
* even for the control endpoint.
* All BDs of Endpoint 0 are owned by SIE right now,
* but once a Setup Transaction is received, the ownership
* for EP0_OUT will be returned to CPU.
* When the Setup Transaction is serviced, the ownership
* for EP0_IN will then be forced back to CPU by firmware.
*
* NOTE: Above description is not quite true at this point.
*
It seems the SIE never returns the UOWN bit to CPU,
*
and a TRNIF is never generated upon successful
Search WWH ::




Custom Search