1 uint8_t TEMPLATE_FUNC_NAME (void* Buffer
, uint16_t Length
)
3 uint8_t* DataStream
= (uint8_t*)(Buffer
+ TEMPLATE_BUFFER_OFFSET(Length
));
4 bool LastPacketFull
= false;
6 if (Length
> USB_ControlRequest
.wLength
)
7 Length
= USB_ControlRequest
.wLength
;
9 while (Length
&& !(Endpoint_IsOUTReceived()))
11 while (!(Endpoint_IsINReady()));
13 while (Length
&& (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize
))
15 TEMPLATE_TRANSFER_BYTE(DataStream
);
19 LastPacketFull
= (Endpoint_BytesInEndpoint() == USB_ControlEndpointSize
);
23 if (Endpoint_IsOUTReceived())
24 return ENDPOINT_RWCSTREAM_HostAborted
;
28 while (!(Endpoint_IsINReady()));
32 while (!(Endpoint_IsOUTReceived()));
34 return ENDPOINT_RWCSTREAM_NoError
;
37 #undef TEMPLATE_BUFFER_OFFSET
38 #undef TEMPLATE_FUNC_NAME
39 #undef TEMPLATE_TRANSFER_BYTE