View previous topic :: View next topic |
Author |
Message |
SuperDave
Joined: 22 May 2008 Posts: 63 Location: Madison, TN
|
USB_Put_Packet length question |
Posted: Wed Jul 02, 2014 2:46 pm |
|
|
Given this line
usb_put_packet(endpoint,data,length,toggle)
and
data is a 32 word array of 16 BIT integers
and
the descriptor defines a 64 BYTE endpoint.
Is length 32 or 64? |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1353
|
|
Posted: Wed Jul 02, 2014 4:56 pm |
|
|
In the file where the function is defined, you should see what the parameter variable types are. If the parameter for data is int8*, then the length will be in reference to an 8bit value array. If the parameter for data is int16*, then the length will in reference to a 16 bit value array |
|
|
oxo
Joined: 13 Nov 2012 Posts: 219 Location: France
|
Re: USB_Put_Packet length question |
Posted: Thu Jul 03, 2014 2:47 am |
|
|
SuperDave wrote: | Given this line
usb_put_packet(endpoint,data,length,toggle)
and
data is a 32 word array of 16 BIT integers
and
the descriptor defines a 64 BYTE endpoint.
Is length 32 or 64? |
32 x 16 bit values == 64 bytes. Where is the confusion? |
|
|
SuperDave
Joined: 22 May 2008 Posts: 63 Location: Madison, TN
|
|
Posted: Thu Jul 03, 2014 5:14 am |
|
|
Thanks jeremiah.
The function in usb_hw_layer.h is Code: | int1 usb_put_packet(unsigned int8 endpoint, unsigned int8 * ptr, unsigned int16 len, USB_DTS_BIT tgl); | So the data is treated as a byte and the length becomes 64.
I was wondering if a 16 bit processor changed that but it doesn't. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Thu Jul 03, 2014 6:57 am |
|
|
USB, only transfers in bytes. Doesn't make any difference whether the processor is 8, 16, 32 or 64 bits.
The data being transferred is addressed by:
unsigned int8 * ptr
A pointer to a block of bytes. |
|
|
|