CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

USB_Put_Packet length question

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
SuperDave



Joined: 22 May 2008
Posts: 63
Location: Madison, TN

View user's profile Send private message Visit poster's website

USB_Put_Packet length question
PostPosted: Wed Jul 02, 2014 2:46 pm     Reply with quote

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: 1358

View user's profile Send private message

PostPosted: Wed Jul 02, 2014 4:56 pm     Reply with quote

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

View user's profile Send private message

Re: USB_Put_Packet length question
PostPosted: Thu Jul 03, 2014 2:47 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Thu Jul 03, 2014 5:14 am     Reply with quote

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: 19556

View user's profile Send private message

PostPosted: Thu Jul 03, 2014 6:57 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group