Thejus.. wrote:
> Hi
>
> I have a as example
> #define PROT_EN_DATA_REG 320
>
> Its loaded into 64 bit value register whose 32 bits is (ex
> setup_data[39:8]=PROT_EN_DATA).Its programmed in hardware as
> setup_data[39:8]= PROT_EN_DAT_REG.
So, you are reading a register? It wants the register number in the
body of the control request, and it will return the value in the data
field? If so, be sure to pass an output buffer and set the wLength
appropriately.
> First 8 bits are taken care of.
> bmRequestType=
> LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_DEVICE
Are you sure you want "class" type? The valid "class" requests are all
dictated by the USB class specifications. If this is a vendor-specific
request, you are violating the protocol, because the bRequest value is
not a legal request type. You should use "vendor" requests.
> Now i want to put this value 320(or 0x140 ) into fields of
> libusb_control_transfer
> uint8_t bRequest
> uint16_t wValue
> uint16_t wIndex
>
> How can i make the entry into these three fields in C as i want to do
> control transfers.
The fields are transmitted in that order, little endian. This is really
not that hard to figure, is it? On a little endian machine:
uint32_t fullValue = PROT_EN2_DATA;
t.bRequest = fullValue & 0xff;
t.wValue = (fullValue >> 8) & 0xffff;
t.wIndex = fullValue >> 24;
--
Tim Roberts, timr@...
Providenza & Boekelheide, Inc.
|