Polling support – Comtrol eCos User Manual
Page 708

Control Endpoints
4. When
buffer_size
is 0 and
fill_buffer_fn
is NULL, no more data is available and the transfer has
completed.
5. Optionally a completion function can be installed. This will be invoked with 0 if the transfer completes suc-
cessfully, or with an error code if the transfer is cancelled because of another control messsage.
If the requested data is contiguous then the only fields that need to be manipulated are
buffer
and
buffer_size
, and optionally
complete_fn
. If the requested data is not contiguous then the initial control
message handler should update
fill_buffer_fn
and some or all of the other fields, as required. An example
of this is the handling of the standard get-descriptor control message by
usbs_handle_standard_control
.
Polling Support
typedef struct usbs_control_endpoint {
void
(*poll_fn)(struct usbs_control_endpoint*);
int
interrupt_vector;
...
} usbs_control_endpoint;
In nearly all circumstances USB I/O should be interrupt-driven. However, there are special environments such as
RedBoot where polled operation may be appropriate. If the device driver can operate in polled mode then it will
provide a suitable function via the
poll_fn
field, and higher-level code can invoke this regularly. This polling
function will take care of all endpoints associated with the device, not just the control endpoint. If the USB hardware
involves a single interrupt vector then this will be identified in the data structure as well.
604