HTTPClient using static IP

Dependencies:   mbed

Committer:
mr_q
Date:
Mon May 30 11:53:37 2011 +0000
Revision:
0:d8f2f7d5f31b
v0.01 Draft

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mr_q 0:d8f2f7d5f31b 1
mr_q 0:d8f2f7d5f31b 2 /*
mr_q 0:d8f2f7d5f31b 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
mr_q 0:d8f2f7d5f31b 4
mr_q 0:d8f2f7d5f31b 5 Permission is hereby granted, free of charge, to any person obtaining a copy
mr_q 0:d8f2f7d5f31b 6 of this software and associated documentation files (the "Software"), to deal
mr_q 0:d8f2f7d5f31b 7 in the Software without restriction, including without limitation the rights
mr_q 0:d8f2f7d5f31b 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
mr_q 0:d8f2f7d5f31b 9 copies of the Software, and to permit persons to whom the Software is
mr_q 0:d8f2f7d5f31b 10 furnished to do so, subject to the following conditions:
mr_q 0:d8f2f7d5f31b 11
mr_q 0:d8f2f7d5f31b 12 The above copyright notice and this permission notice shall be included in
mr_q 0:d8f2f7d5f31b 13 all copies or substantial portions of the Software.
mr_q 0:d8f2f7d5f31b 14
mr_q 0:d8f2f7d5f31b 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
mr_q 0:d8f2f7d5f31b 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
mr_q 0:d8f2f7d5f31b 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
mr_q 0:d8f2f7d5f31b 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
mr_q 0:d8f2f7d5f31b 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
mr_q 0:d8f2f7d5f31b 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
mr_q 0:d8f2f7d5f31b 21 THE SOFTWARE.
mr_q 0:d8f2f7d5f31b 22 */
mr_q 0:d8f2f7d5f31b 23
mr_q 0:d8f2f7d5f31b 24 #include "UsbDevice.h"
mr_q 0:d8f2f7d5f31b 25
mr_q 0:d8f2f7d5f31b 26 #include "netCfg.h"
mr_q 0:d8f2f7d5f31b 27 #if NET_USB
mr_q 0:d8f2f7d5f31b 28
mr_q 0:d8f2f7d5f31b 29 //#define __DEBUG
mr_q 0:d8f2f7d5f31b 30 #include "dbg/dbg.h"
mr_q 0:d8f2f7d5f31b 31
mr_q 0:d8f2f7d5f31b 32 UsbDevice::UsbDevice( UsbHostMgr* pMgr, int hub, int port, int addr ) : m_pControlEp(NULL), /*m_controlEp( this, 0x00, false, USB_CONTROL, 8 ),*/
mr_q 0:d8f2f7d5f31b 33 m_pMgr(pMgr), m_connected(false), m_enumerated(false), m_hub(hub), m_port(port), m_addr(addr), m_refs(0),
mr_q 0:d8f2f7d5f31b 34 m_vid(0), m_pid(0)
mr_q 0:d8f2f7d5f31b 35 {
mr_q 0:d8f2f7d5f31b 36
mr_q 0:d8f2f7d5f31b 37 }
mr_q 0:d8f2f7d5f31b 38
mr_q 0:d8f2f7d5f31b 39 UsbDevice::~UsbDevice()
mr_q 0:d8f2f7d5f31b 40 {
mr_q 0:d8f2f7d5f31b 41 if(m_pControlEp)
mr_q 0:d8f2f7d5f31b 42 delete m_pControlEp;
mr_q 0:d8f2f7d5f31b 43 }
mr_q 0:d8f2f7d5f31b 44
mr_q 0:d8f2f7d5f31b 45 UsbErr UsbDevice::enumerate()
mr_q 0:d8f2f7d5f31b 46 {
mr_q 0:d8f2f7d5f31b 47 // USB_INT32S rc;
mr_q 0:d8f2f7d5f31b 48
mr_q 0:d8f2f7d5f31b 49 UsbErr rc;
mr_q 0:d8f2f7d5f31b 50
mr_q 0:d8f2f7d5f31b 51 DBG("Starting enumeration (m_pMgr = %p)\n", m_pMgr);
mr_q 0:d8f2f7d5f31b 52
mr_q 0:d8f2f7d5f31b 53 #if 1
mr_q 0:d8f2f7d5f31b 54 m_pMgr->resetPort(m_hub, m_port);
mr_q 0:d8f2f7d5f31b 55 #else
mr_q 0:d8f2f7d5f31b 56 wait_ms(100); /* USB 2.0 spec says atleast 50ms delay beore port reset */
mr_q 0:d8f2f7d5f31b 57 LPC_USB->HcRhPortStatus1 = OR_RH_PORT_PRS; // Initiate port reset
mr_q 0:d8f2f7d5f31b 58 while (LPC_USB->HcRhPortStatus1 & OR_RH_PORT_PRS)
mr_q 0:d8f2f7d5f31b 59 __WFI(); // Wait for port reset to complete...
mr_q 0:d8f2f7d5f31b 60 LPC_USB->HcRhPortStatus1 = OR_RH_PORT_PRSC; // ...and clear port reset signal
mr_q 0:d8f2f7d5f31b 61 wait_ms(200); /* Wait for 100 MS after port reset */
mr_q 0:d8f2f7d5f31b 62 #endif
mr_q 0:d8f2f7d5f31b 63
mr_q 0:d8f2f7d5f31b 64 DBG("Port reset\n");
mr_q 0:d8f2f7d5f31b 65
mr_q 0:d8f2f7d5f31b 66 wait_ms(200);
mr_q 0:d8f2f7d5f31b 67
mr_q 0:d8f2f7d5f31b 68 m_pControlEp = new UsbEndpoint( this, 0x00, false, USB_CONTROL, 8, 0 );
mr_q 0:d8f2f7d5f31b 69
mr_q 0:d8f2f7d5f31b 70 //EDCtrl->Control = 8 << 16;/* Put max pkt size = 8 */
mr_q 0:d8f2f7d5f31b 71 /* Read first 8 bytes of device desc */
mr_q 0:d8f2f7d5f31b 72 rc = controlReceive(USB_DEVICE_TO_HOST | USB_RECIPIENT_DEVICE, GET_DESCRIPTOR, (USB_DESCRIPTOR_TYPE_DEVICE << 8)|(0), 0, m_controlDataBuf, 8);
mr_q 0:d8f2f7d5f31b 73 if (rc)
mr_q 0:d8f2f7d5f31b 74 {
mr_q 0:d8f2f7d5f31b 75 DBG("RC=%d",rc);
mr_q 0:d8f2f7d5f31b 76 return (rc);
mr_q 0:d8f2f7d5f31b 77 }
mr_q 0:d8f2f7d5f31b 78
mr_q 0:d8f2f7d5f31b 79 DBG("Got descriptor, max ep size is %d\n", m_controlDataBuf[7]);
mr_q 0:d8f2f7d5f31b 80
mr_q 0:d8f2f7d5f31b 81 m_pControlEp->updateSize(m_controlDataBuf[7]); /* Get max pkt size of endpoint 0 */
mr_q 0:d8f2f7d5f31b 82 rc = controlSend(USB_HOST_TO_DEVICE | USB_RECIPIENT_DEVICE, SET_ADDRESS, m_addr, 0, NULL, 0); /* Set the device address to m_addr */
mr_q 0:d8f2f7d5f31b 83 if (rc)
mr_q 0:d8f2f7d5f31b 84 {
mr_q 0:d8f2f7d5f31b 85 // PRINT_Err(rc);
mr_q 0:d8f2f7d5f31b 86 return (rc);
mr_q 0:d8f2f7d5f31b 87 }
mr_q 0:d8f2f7d5f31b 88 wait_ms(2);
mr_q 0:d8f2f7d5f31b 89 //EDCtrl->Control = (EDCtrl->Control) | 1; /* Modify control pipe with address 1 */
mr_q 0:d8f2f7d5f31b 90
mr_q 0:d8f2f7d5f31b 91 //Update address
mr_q 0:d8f2f7d5f31b 92 m_pControlEp->updateAddr(m_addr);
mr_q 0:d8f2f7d5f31b 93 DBG("Ep addr is now %d", m_addr);
mr_q 0:d8f2f7d5f31b 94 /**/
mr_q 0:d8f2f7d5f31b 95
mr_q 0:d8f2f7d5f31b 96 //rc = HOST_GET_DESCRIPTOR(USB_DESCRIPTOR_TYPE_DEVICE, 0, TDBuffer, 17); //Read full device descriptor
mr_q 0:d8f2f7d5f31b 97 rc = controlReceive(USB_DEVICE_TO_HOST | USB_RECIPIENT_DEVICE, GET_DESCRIPTOR, (USB_DESCRIPTOR_TYPE_DEVICE << 8)|(0), 0, m_controlDataBuf, 17);
mr_q 0:d8f2f7d5f31b 98 if (rc)
mr_q 0:d8f2f7d5f31b 99 {
mr_q 0:d8f2f7d5f31b 100 //PRINT_Err(rc);
mr_q 0:d8f2f7d5f31b 101 return (rc);
mr_q 0:d8f2f7d5f31b 102 }
mr_q 0:d8f2f7d5f31b 103 /*
mr_q 0:d8f2f7d5f31b 104 rc = SerialCheckVidPid();
mr_q 0:d8f2f7d5f31b 105 if (rc != OK) {
mr_q 0:d8f2f7d5f31b 106 PRINT_Err(rc);
mr_q 0:d8f2f7d5f31b 107 return (rc);
mr_q 0:d8f2f7d5f31b 108 }
mr_q 0:d8f2f7d5f31b 109 */
mr_q 0:d8f2f7d5f31b 110 /**/
mr_q 0:d8f2f7d5f31b 111
mr_q 0:d8f2f7d5f31b 112 m_vid = *((uint16_t*)&m_controlDataBuf[8]);
mr_q 0:d8f2f7d5f31b 113 m_pid = *((uint16_t*)&m_controlDataBuf[10]);
mr_q 0:d8f2f7d5f31b 114
mr_q 0:d8f2f7d5f31b 115 DBG("VID: %02x, PID: %02x\n", m_vid, m_pid);
mr_q 0:d8f2f7d5f31b 116 /* Get the configuration descriptor */
mr_q 0:d8f2f7d5f31b 117 //rc = HOST_GET_DESCRIPTOR(USB_DESCRIPTOR_TYPE_CONFIGURATION, 0, TDBuffer, 9);
mr_q 0:d8f2f7d5f31b 118 rc = controlReceive(USB_DEVICE_TO_HOST | USB_RECIPIENT_DEVICE, GET_DESCRIPTOR, (USB_DESCRIPTOR_TYPE_CONFIGURATION << 8)|(0), 0, m_controlDataBuf, 9);
mr_q 0:d8f2f7d5f31b 119 if (rc)
mr_q 0:d8f2f7d5f31b 120 {
mr_q 0:d8f2f7d5f31b 121 //PRINT_Err(rc);
mr_q 0:d8f2f7d5f31b 122 return (rc);
mr_q 0:d8f2f7d5f31b 123 }
mr_q 0:d8f2f7d5f31b 124 /* Get the first configuration data */
mr_q 0:d8f2f7d5f31b 125 //rc = HOST_GET_DESCRIPTOR(USB_DESCRIPTOR_TYPE_CONFIGURATION, 0, TDBuffer, *((uint16_t*)&TDBuffer[2]));
mr_q 0:d8f2f7d5f31b 126 rc = controlReceive(USB_DEVICE_TO_HOST | USB_RECIPIENT_DEVICE, GET_DESCRIPTOR, (USB_DESCRIPTOR_TYPE_CONFIGURATION << 8)|(0), 0, m_controlDataBuf, *((uint16_t*)&m_controlDataBuf[2]));
mr_q 0:d8f2f7d5f31b 127 if (rc)
mr_q 0:d8f2f7d5f31b 128 {
mr_q 0:d8f2f7d5f31b 129 //PRINT_Err(rc);
mr_q 0:d8f2f7d5f31b 130 return (rc);
mr_q 0:d8f2f7d5f31b 131 }
mr_q 0:d8f2f7d5f31b 132
mr_q 0:d8f2f7d5f31b 133 DBG("Desc len is %d\n", *((uint16_t*)&m_controlDataBuf[2]));
mr_q 0:d8f2f7d5f31b 134
mr_q 0:d8f2f7d5f31b 135 DBG("Set configuration\n");
mr_q 0:d8f2f7d5f31b 136
mr_q 0:d8f2f7d5f31b 137 //rc = USBH_SET_CONFIGURATION(1);/* Select device configuration 1 */
mr_q 0:d8f2f7d5f31b 138 rc = controlSend(USB_HOST_TO_DEVICE | USB_RECIPIENT_DEVICE, SET_CONFIGURATION, 1, 0, NULL, 0);
mr_q 0:d8f2f7d5f31b 139 if (rc)
mr_q 0:d8f2f7d5f31b 140 {
mr_q 0:d8f2f7d5f31b 141 // PRINT_Err(rc);
mr_q 0:d8f2f7d5f31b 142 return rc;
mr_q 0:d8f2f7d5f31b 143 }
mr_q 0:d8f2f7d5f31b 144 wait_ms(100);/* Some devices may require this delay */
mr_q 0:d8f2f7d5f31b 145
mr_q 0:d8f2f7d5f31b 146 m_enumerated = true;
mr_q 0:d8f2f7d5f31b 147 return USBERR_OK;
mr_q 0:d8f2f7d5f31b 148 }
mr_q 0:d8f2f7d5f31b 149
mr_q 0:d8f2f7d5f31b 150 bool UsbDevice::connected()
mr_q 0:d8f2f7d5f31b 151 {
mr_q 0:d8f2f7d5f31b 152 return m_connected;
mr_q 0:d8f2f7d5f31b 153 }
mr_q 0:d8f2f7d5f31b 154
mr_q 0:d8f2f7d5f31b 155 bool UsbDevice::enumerated()
mr_q 0:d8f2f7d5f31b 156 {
mr_q 0:d8f2f7d5f31b 157 return m_enumerated;
mr_q 0:d8f2f7d5f31b 158 }
mr_q 0:d8f2f7d5f31b 159
mr_q 0:d8f2f7d5f31b 160 int UsbDevice::getPid()
mr_q 0:d8f2f7d5f31b 161 {
mr_q 0:d8f2f7d5f31b 162 return m_pid;
mr_q 0:d8f2f7d5f31b 163 }
mr_q 0:d8f2f7d5f31b 164
mr_q 0:d8f2f7d5f31b 165 int UsbDevice::getVid()
mr_q 0:d8f2f7d5f31b 166 {
mr_q 0:d8f2f7d5f31b 167 return m_vid;
mr_q 0:d8f2f7d5f31b 168 }
mr_q 0:d8f2f7d5f31b 169
mr_q 0:d8f2f7d5f31b 170 UsbErr UsbDevice::getConfigurationDescriptor(int config, uint8_t** pBuf)
mr_q 0:d8f2f7d5f31b 171 {
mr_q 0:d8f2f7d5f31b 172 //For now olny one config
mr_q 0:d8f2f7d5f31b 173 *pBuf = m_controlDataBuf;
mr_q 0:d8f2f7d5f31b 174 return USBERR_OK;
mr_q 0:d8f2f7d5f31b 175 }
mr_q 0:d8f2f7d5f31b 176
mr_q 0:d8f2f7d5f31b 177 UsbErr UsbDevice::getInterfaceDescriptor(int config, int item, uint8_t** pBuf)
mr_q 0:d8f2f7d5f31b 178 {
mr_q 0:d8f2f7d5f31b 179 byte* desc_ptr = m_controlDataBuf;
mr_q 0:d8f2f7d5f31b 180
mr_q 0:d8f2f7d5f31b 181 /* if (desc_ptr[1] != USB_DESCRIPTOR_TYPE_CONFIGURATION)
mr_q 0:d8f2f7d5f31b 182 {
mr_q 0:d8f2f7d5f31b 183 return USBERR_BADCONFIG;
mr_q 0:d8f2f7d5f31b 184 }*/
mr_q 0:d8f2f7d5f31b 185
mr_q 0:d8f2f7d5f31b 186 if(item>=m_controlDataBuf[4])//Interfaces count
mr_q 0:d8f2f7d5f31b 187 return USBERR_NOTFOUND;
mr_q 0:d8f2f7d5f31b 188
mr_q 0:d8f2f7d5f31b 189 desc_ptr += desc_ptr[0];
mr_q 0:d8f2f7d5f31b 190
mr_q 0:d8f2f7d5f31b 191 *pBuf = NULL;
mr_q 0:d8f2f7d5f31b 192
mr_q 0:d8f2f7d5f31b 193 while (desc_ptr < m_controlDataBuf + *((uint16_t*)&m_controlDataBuf[2]))
mr_q 0:d8f2f7d5f31b 194 {
mr_q 0:d8f2f7d5f31b 195
mr_q 0:d8f2f7d5f31b 196 switch (desc_ptr[1]) {
mr_q 0:d8f2f7d5f31b 197 case USB_DESCRIPTOR_TYPE_INTERFACE:
mr_q 0:d8f2f7d5f31b 198 if(desc_ptr[2] == item)
mr_q 0:d8f2f7d5f31b 199 {
mr_q 0:d8f2f7d5f31b 200 *pBuf = desc_ptr;
mr_q 0:d8f2f7d5f31b 201 return USBERR_OK;
mr_q 0:d8f2f7d5f31b 202 }
mr_q 0:d8f2f7d5f31b 203 desc_ptr += desc_ptr[0]; // Move to next descriptor start
mr_q 0:d8f2f7d5f31b 204 break;
mr_q 0:d8f2f7d5f31b 205 }
mr_q 0:d8f2f7d5f31b 206
mr_q 0:d8f2f7d5f31b 207 }
mr_q 0:d8f2f7d5f31b 208
mr_q 0:d8f2f7d5f31b 209 if(*pBuf == NULL)
mr_q 0:d8f2f7d5f31b 210 return USBERR_NOTFOUND;
mr_q 0:d8f2f7d5f31b 211
mr_q 0:d8f2f7d5f31b 212 return USBERR_OK;
mr_q 0:d8f2f7d5f31b 213 }
mr_q 0:d8f2f7d5f31b 214
mr_q 0:d8f2f7d5f31b 215
mr_q 0:d8f2f7d5f31b 216 UsbErr UsbDevice::setConfiguration(int config)
mr_q 0:d8f2f7d5f31b 217 {
mr_q 0:d8f2f7d5f31b 218 return USBERR_OK;
mr_q 0:d8f2f7d5f31b 219 }
mr_q 0:d8f2f7d5f31b 220
mr_q 0:d8f2f7d5f31b 221 UsbErr UsbDevice::controlSend(byte requestType, byte request, word value, word index, const byte* buf, int len)
mr_q 0:d8f2f7d5f31b 222 {
mr_q 0:d8f2f7d5f31b 223 UsbErr rc;
mr_q 0:d8f2f7d5f31b 224 fillControlBuf(requestType, request, value, index, len);
mr_q 0:d8f2f7d5f31b 225 m_pControlEp->setNextToken(TD_SETUP);
mr_q 0:d8f2f7d5f31b 226 rc = m_pControlEp->transfer(m_controlBuf, 8);
mr_q 0:d8f2f7d5f31b 227 while(m_pControlEp->status() == USBERR_PROCESSING);
mr_q 0:d8f2f7d5f31b 228 rc = (UsbErr) MIN(0, m_pControlEp->status());
mr_q 0:d8f2f7d5f31b 229 if(rc)
mr_q 0:d8f2f7d5f31b 230 return rc;
mr_q 0:d8f2f7d5f31b 231 if(len)
mr_q 0:d8f2f7d5f31b 232 {
mr_q 0:d8f2f7d5f31b 233 m_pControlEp->setNextToken(TD_OUT);
mr_q 0:d8f2f7d5f31b 234 rc = m_pControlEp->transfer((byte*)buf, len);
mr_q 0:d8f2f7d5f31b 235 while(m_pControlEp->status() == USBERR_PROCESSING);
mr_q 0:d8f2f7d5f31b 236 rc = (UsbErr) MIN(0, m_pControlEp->status());
mr_q 0:d8f2f7d5f31b 237 if(rc)
mr_q 0:d8f2f7d5f31b 238 return rc;
mr_q 0:d8f2f7d5f31b 239 }
mr_q 0:d8f2f7d5f31b 240 m_pControlEp->setNextToken(TD_IN);
mr_q 0:d8f2f7d5f31b 241 rc = m_pControlEp->transfer(NULL, 0);
mr_q 0:d8f2f7d5f31b 242 while(m_pControlEp->status() == USBERR_PROCESSING);
mr_q 0:d8f2f7d5f31b 243 rc = (UsbErr) MIN(0, m_pControlEp->status());
mr_q 0:d8f2f7d5f31b 244 if(rc)
mr_q 0:d8f2f7d5f31b 245 return rc;
mr_q 0:d8f2f7d5f31b 246 return USBERR_OK;
mr_q 0:d8f2f7d5f31b 247 }
mr_q 0:d8f2f7d5f31b 248
mr_q 0:d8f2f7d5f31b 249 UsbErr UsbDevice::controlReceive(byte requestType, byte request, word value, word index, const byte* buf, int len)
mr_q 0:d8f2f7d5f31b 250 {
mr_q 0:d8f2f7d5f31b 251 UsbErr rc;
mr_q 0:d8f2f7d5f31b 252 fillControlBuf(requestType, request, value, index, len);
mr_q 0:d8f2f7d5f31b 253 m_pControlEp->setNextToken(TD_SETUP);
mr_q 0:d8f2f7d5f31b 254 rc = m_pControlEp->transfer(m_controlBuf, 8);
mr_q 0:d8f2f7d5f31b 255 while(m_pControlEp->status() == USBERR_PROCESSING);
mr_q 0:d8f2f7d5f31b 256 rc = (UsbErr) MIN(0, m_pControlEp->status());
mr_q 0:d8f2f7d5f31b 257 if(rc)
mr_q 0:d8f2f7d5f31b 258 return rc;
mr_q 0:d8f2f7d5f31b 259 if(len)
mr_q 0:d8f2f7d5f31b 260 {
mr_q 0:d8f2f7d5f31b 261 m_pControlEp->setNextToken(TD_IN);
mr_q 0:d8f2f7d5f31b 262 rc = m_pControlEp->transfer( (byte*) buf, len);
mr_q 0:d8f2f7d5f31b 263 while(m_pControlEp->status() == USBERR_PROCESSING);
mr_q 0:d8f2f7d5f31b 264 rc = (UsbErr) MIN(0, m_pControlEp->status());
mr_q 0:d8f2f7d5f31b 265 if(rc)
mr_q 0:d8f2f7d5f31b 266 return rc;
mr_q 0:d8f2f7d5f31b 267 }
mr_q 0:d8f2f7d5f31b 268 m_pControlEp->setNextToken(TD_OUT);
mr_q 0:d8f2f7d5f31b 269 rc = m_pControlEp->transfer(NULL, 0);
mr_q 0:d8f2f7d5f31b 270 while(m_pControlEp->status() == USBERR_PROCESSING);
mr_q 0:d8f2f7d5f31b 271 rc = (UsbErr) MIN(0, m_pControlEp->status());
mr_q 0:d8f2f7d5f31b 272 if(rc)
mr_q 0:d8f2f7d5f31b 273 return rc;
mr_q 0:d8f2f7d5f31b 274 return USBERR_OK;
mr_q 0:d8f2f7d5f31b 275 }
mr_q 0:d8f2f7d5f31b 276
mr_q 0:d8f2f7d5f31b 277 void UsbDevice::fillControlBuf(byte requestType, byte request, word value, word index, int len)
mr_q 0:d8f2f7d5f31b 278 {
mr_q 0:d8f2f7d5f31b 279 #ifdef __BIG_ENDIAN
mr_q 0:d8f2f7d5f31b 280 #error "Must implement BE to LE conv here"
mr_q 0:d8f2f7d5f31b 281 #endif
mr_q 0:d8f2f7d5f31b 282 m_controlBuf[0] = requestType;
mr_q 0:d8f2f7d5f31b 283 m_controlBuf[1] = request;
mr_q 0:d8f2f7d5f31b 284 //We are in LE so it's fine
mr_q 0:d8f2f7d5f31b 285 *((word*)&m_controlBuf[2]) = value;
mr_q 0:d8f2f7d5f31b 286 *((word*)&m_controlBuf[4]) = index;
mr_q 0:d8f2f7d5f31b 287 *((word*)&m_controlBuf[6]) = (word) len;
mr_q 0:d8f2f7d5f31b 288 }
mr_q 0:d8f2f7d5f31b 289
mr_q 0:d8f2f7d5f31b 290
mr_q 0:d8f2f7d5f31b 291 #endif