Endpoint_Read_Stream_LE question

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Endpoint_Read_Stream_LE question

631 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mozmck on Fri Feb 17 16:02:45 MST 2012
I'm having problems understanding the Endpoint_Read_Stream_LE() function.  The documentation in EndpointStream_LPC.h makes sense, but it does not seem to match the actual function.  The BytesProcessed variable is simply not used in the function in spite of the documentation, and there seem to be no checks that the data being read out of usb_data_buffer in Endpoint_Read_8() is actually data that was received from the host.

How do I know that if I call Endpoint_Read_Stream_LE() to read 128 bytes for instance, that I'm actually reading data sent from the host?  In addition, is there any way to find out how many un-read bytes are in the buffer?

Thanks in advance for any help!
Labels (1)
0 Kudos
2 Replies

579 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mozmck on Thu Apr 12 08:15:44 MST 2012
Thanks for the note.  I completely missed the Endpoint_BytesInEndpoint() function when looking before.
0 Kudos

579 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tuong on Mon Mar 26 19:45:09 MST 2012
Dear mozmck,

You can search Endpoint_Read_Stream_LE() in the tree, then you can see that before Endpoint_Read_Stream_LE() there is always a checking for Endpoint_IsOUTReceived(), this makes sure that the host sent data.

In addition, whenever the host sends data to device, interrupts help put these data into the share buffer, then Endpoint_Read_Stream_LE() will read them out from this share buffer. So there is no feature that tells how many unread data left, but there is Endpoint_BytesInEndpoint() that can help you know how many data are there.

With best regards,
Tuong Nguyen
0 Kudos