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 "rpc.h"
mr_q 0:d8f2f7d5f31b 25
mr_q 0:d8f2f7d5f31b 26 #include "UsbSerial.h"
mr_q 0:d8f2f7d5f31b 27
mr_q 0:d8f2f7d5f31b 28 //#define __DEBUG
mr_q 0:d8f2f7d5f31b 29 #include "dbg/dbg.h"
mr_q 0:d8f2f7d5f31b 30
mr_q 0:d8f2f7d5f31b 31 #include "netCfg.h"
mr_q 0:d8f2f7d5f31b 32 #if NET_USB_SERIAL
mr_q 0:d8f2f7d5f31b 33
mr_q 0:d8f2f7d5f31b 34 namespace mbed {
mr_q 0:d8f2f7d5f31b 35
mr_q 0:d8f2f7d5f31b 36 #define BUF_LEN 64
mr_q 0:d8f2f7d5f31b 37 #define FLUSH_TMOUT 100000 //US
mr_q 0:d8f2f7d5f31b 38
mr_q 0:d8f2f7d5f31b 39 UsbSerial::UsbSerial(UsbDevice* pDevice, int epIn, int epOut, const char* name /*= NULL*/) : Stream(name), m_epIn(pDevice, epIn, true, USB_BULK, BUF_LEN), m_epOut(pDevice, epOut, false, USB_BULK, BUF_LEN),
mr_q 0:d8f2f7d5f31b 40 m_pInCbItem(NULL), m_pInCbMeth(NULL), m_pOutCbItem(NULL), m_pOutCbMeth(NULL)
mr_q 0:d8f2f7d5f31b 41 {
mr_q 0:d8f2f7d5f31b 42 m_inBufEven = new char[BUF_LEN];
mr_q 0:d8f2f7d5f31b 43 m_inBufOdd = new char[BUF_LEN];
mr_q 0:d8f2f7d5f31b 44 m_pInBufPos = m_inBufUsr = m_inBufEven;
mr_q 0:d8f2f7d5f31b 45 m_inBufTrmt = m_inBufOdd;
mr_q 0:d8f2f7d5f31b 46
mr_q 0:d8f2f7d5f31b 47 m_outBufEven = new char[BUF_LEN];
mr_q 0:d8f2f7d5f31b 48 m_outBufOdd = new char[BUF_LEN];
mr_q 0:d8f2f7d5f31b 49 m_pOutBufPos = m_outBufUsr = m_outBufEven;
mr_q 0:d8f2f7d5f31b 50 m_outBufTrmt = m_outBufOdd;
mr_q 0:d8f2f7d5f31b 51
mr_q 0:d8f2f7d5f31b 52 m_inBufLen = m_outBufLen = 0;
mr_q 0:d8f2f7d5f31b 53
mr_q 0:d8f2f7d5f31b 54 DBG("Starting RX'ing on in ep\n");
mr_q 0:d8f2f7d5f31b 55
mr_q 0:d8f2f7d5f31b 56 m_timeout = false;
mr_q 0:d8f2f7d5f31b 57
mr_q 0:d8f2f7d5f31b 58 m_epIn.setOnCompletion(this, &UsbSerial::onEpInTransfer);
mr_q 0:d8f2f7d5f31b 59 m_epOut.setOnCompletion(this, &UsbSerial::onEpOutTransfer);
mr_q 0:d8f2f7d5f31b 60
mr_q 0:d8f2f7d5f31b 61 startRx();
mr_q 0:d8f2f7d5f31b 62 }
mr_q 0:d8f2f7d5f31b 63
mr_q 0:d8f2f7d5f31b 64 UsbSerial::~UsbSerial()
mr_q 0:d8f2f7d5f31b 65 {
mr_q 0:d8f2f7d5f31b 66 delete[] m_inBufEven;
mr_q 0:d8f2f7d5f31b 67 delete[] m_inBufOdd;
mr_q 0:d8f2f7d5f31b 68 delete[] m_outBufEven;
mr_q 0:d8f2f7d5f31b 69 delete[] m_outBufOdd;
mr_q 0:d8f2f7d5f31b 70 }
mr_q 0:d8f2f7d5f31b 71
mr_q 0:d8f2f7d5f31b 72 void UsbSerial::baud(int baudrate) {
mr_q 0:d8f2f7d5f31b 73 //
mr_q 0:d8f2f7d5f31b 74 }
mr_q 0:d8f2f7d5f31b 75
mr_q 0:d8f2f7d5f31b 76 void UsbSerial::format(int bits, int parity, int stop) {
mr_q 0:d8f2f7d5f31b 77 //
mr_q 0:d8f2f7d5f31b 78 }
mr_q 0:d8f2f7d5f31b 79
mr_q 0:d8f2f7d5f31b 80 #if 0 //For doc only
mr_q 0:d8f2f7d5f31b 81 template <class T>
mr_q 0:d8f2f7d5f31b 82 void attach(T* pCbItem, void (T::*pCbMeth)())
mr_q 0:d8f2f7d5f31b 83 {
mr_q 0:d8f2f7d5f31b 84 m_pCbItem = (CDummy*) pCbItem;
mr_q 0:d8f2f7d5f31b 85 m_pCbMeth = (void (CDummy::*)()) pCbMeth;
mr_q 0:d8f2f7d5f31b 86 }
mr_q 0:d8f2f7d5f31b 87 #endif
mr_q 0:d8f2f7d5f31b 88
mr_q 0:d8f2f7d5f31b 89 int UsbSerial::_getc() {
mr_q 0:d8f2f7d5f31b 90 NVIC_DisableIRQ(US_TICKER_TIMER_IRQn);
mr_q 0:d8f2f7d5f31b 91 NVIC_DisableIRQ(USB_IRQn);
mr_q 0:d8f2f7d5f31b 92 char c;
mr_q 0:d8f2f7d5f31b 93 c = *m_pInBufPos;
mr_q 0:d8f2f7d5f31b 94 m_pInBufPos++;
mr_q 0:d8f2f7d5f31b 95 NVIC_EnableIRQ(USB_IRQn);
mr_q 0:d8f2f7d5f31b 96 NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
mr_q 0:d8f2f7d5f31b 97 return c;
mr_q 0:d8f2f7d5f31b 98 }
mr_q 0:d8f2f7d5f31b 99
mr_q 0:d8f2f7d5f31b 100 int UsbSerial::_putc(int c) {
mr_q 0:d8f2f7d5f31b 101 NVIC_DisableIRQ(US_TICKER_TIMER_IRQn);
mr_q 0:d8f2f7d5f31b 102 NVIC_DisableIRQ(USB_IRQn);
mr_q 0:d8f2f7d5f31b 103 if( (m_pOutBufPos - m_outBufUsr) < BUF_LEN )
mr_q 0:d8f2f7d5f31b 104 {
mr_q 0:d8f2f7d5f31b 105 *m_pOutBufPos = (char) c;
mr_q 0:d8f2f7d5f31b 106 m_pOutBufPos++;
mr_q 0:d8f2f7d5f31b 107 }
mr_q 0:d8f2f7d5f31b 108 else
mr_q 0:d8f2f7d5f31b 109 {
mr_q 0:d8f2f7d5f31b 110 DBG("NO WAY!!!\n");
mr_q 0:d8f2f7d5f31b 111 }
mr_q 0:d8f2f7d5f31b 112 #if 1
mr_q 0:d8f2f7d5f31b 113 if( (m_pOutBufPos - m_outBufUsr) >= BUF_LEN ) //Must flush
mr_q 0:d8f2f7d5f31b 114 {
mr_q 0:d8f2f7d5f31b 115 if(m_timeout)
mr_q 0:d8f2f7d5f31b 116 m_txTimeout.detach();
mr_q 0:d8f2f7d5f31b 117 startTx();
mr_q 0:d8f2f7d5f31b 118 }
mr_q 0:d8f2f7d5f31b 119 else
mr_q 0:d8f2f7d5f31b 120 {
mr_q 0:d8f2f7d5f31b 121 /*if(m_timeout)
mr_q 0:d8f2f7d5f31b 122 m_txTimeout.detach();
mr_q 0:d8f2f7d5f31b 123 m_timeout = true;
mr_q 0:d8f2f7d5f31b 124 m_txTimeout.attach_us(this, &UsbSerial::startTx, FLUSH_TMOUT);*/
mr_q 0:d8f2f7d5f31b 125 if(!m_timeout)
mr_q 0:d8f2f7d5f31b 126 {
mr_q 0:d8f2f7d5f31b 127 m_timeout = true;
mr_q 0:d8f2f7d5f31b 128 m_txTimeout.attach_us(this, &UsbSerial::startTx, FLUSH_TMOUT);
mr_q 0:d8f2f7d5f31b 129 }
mr_q 0:d8f2f7d5f31b 130 }
mr_q 0:d8f2f7d5f31b 131 #endif
mr_q 0:d8f2f7d5f31b 132 //startTx();
mr_q 0:d8f2f7d5f31b 133 NVIC_EnableIRQ(USB_IRQn);
mr_q 0:d8f2f7d5f31b 134 NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
mr_q 0:d8f2f7d5f31b 135 return c;
mr_q 0:d8f2f7d5f31b 136 }
mr_q 0:d8f2f7d5f31b 137
mr_q 0:d8f2f7d5f31b 138 int UsbSerial::readable() {
mr_q 0:d8f2f7d5f31b 139 NVIC_DisableIRQ(US_TICKER_TIMER_IRQn);
mr_q 0:d8f2f7d5f31b 140 NVIC_DisableIRQ(USB_IRQn);
mr_q 0:d8f2f7d5f31b 141 int res;
mr_q 0:d8f2f7d5f31b 142 if( (m_pInBufPos - m_inBufUsr) < m_inBufLen )
mr_q 0:d8f2f7d5f31b 143 {
mr_q 0:d8f2f7d5f31b 144 //DBG("\r\nREADABLE\r\n");
mr_q 0:d8f2f7d5f31b 145 res = true;
mr_q 0:d8f2f7d5f31b 146 }
mr_q 0:d8f2f7d5f31b 147 else
mr_q 0:d8f2f7d5f31b 148 {
mr_q 0:d8f2f7d5f31b 149 //DBG("\r\nNOT READABLE\r\n");
mr_q 0:d8f2f7d5f31b 150 startRx(); //Try to swap packets & start another transmission
mr_q 0:d8f2f7d5f31b 151 res = ((m_pInBufPos - m_inBufUsr) < m_inBufLen )?true:false;
mr_q 0:d8f2f7d5f31b 152 }
mr_q 0:d8f2f7d5f31b 153 NVIC_EnableIRQ(USB_IRQn);
mr_q 0:d8f2f7d5f31b 154 NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
mr_q 0:d8f2f7d5f31b 155 return (bool)res;
mr_q 0:d8f2f7d5f31b 156 }
mr_q 0:d8f2f7d5f31b 157
mr_q 0:d8f2f7d5f31b 158 int UsbSerial::writeable() {
mr_q 0:d8f2f7d5f31b 159 NVIC_DisableIRQ(US_TICKER_TIMER_IRQn);
mr_q 0:d8f2f7d5f31b 160 NVIC_DisableIRQ(USB_IRQn);
mr_q 0:d8f2f7d5f31b 161 // DBG("\r\nWRITEABLE???\r\n");
mr_q 0:d8f2f7d5f31b 162 int res = (bool)( (m_pOutBufPos - m_outBufUsr) < BUF_LEN);
mr_q 0:d8f2f7d5f31b 163 NVIC_EnableIRQ(USB_IRQn);
mr_q 0:d8f2f7d5f31b 164 NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
mr_q 0:d8f2f7d5f31b 165 return res;
mr_q 0:d8f2f7d5f31b 166 }
mr_q 0:d8f2f7d5f31b 167
mr_q 0:d8f2f7d5f31b 168 void UsbSerial::onReadable()
mr_q 0:d8f2f7d5f31b 169 {
mr_q 0:d8f2f7d5f31b 170 if(m_pInCbItem && m_pInCbMeth)
mr_q 0:d8f2f7d5f31b 171 (m_pInCbItem->*m_pInCbMeth)();
mr_q 0:d8f2f7d5f31b 172 }
mr_q 0:d8f2f7d5f31b 173
mr_q 0:d8f2f7d5f31b 174 void UsbSerial::onWriteable()
mr_q 0:d8f2f7d5f31b 175 {
mr_q 0:d8f2f7d5f31b 176 if(m_pOutCbItem && m_pOutCbMeth)
mr_q 0:d8f2f7d5f31b 177 (m_pOutCbItem->*m_pOutCbMeth)();
mr_q 0:d8f2f7d5f31b 178 }
mr_q 0:d8f2f7d5f31b 179
mr_q 0:d8f2f7d5f31b 180 void UsbSerial::onEpInTransfer()
mr_q 0:d8f2f7d5f31b 181 {
mr_q 0:d8f2f7d5f31b 182 int len = m_epIn.status();
mr_q 0:d8f2f7d5f31b 183 DBG("RX transfer completed w len=%d\n",len);
mr_q 0:d8f2f7d5f31b 184 startRx();
mr_q 0:d8f2f7d5f31b 185 if(len > 0)
mr_q 0:d8f2f7d5f31b 186 onReadable();
mr_q 0:d8f2f7d5f31b 187 }
mr_q 0:d8f2f7d5f31b 188
mr_q 0:d8f2f7d5f31b 189 void UsbSerial::onEpOutTransfer()
mr_q 0:d8f2f7d5f31b 190 {
mr_q 0:d8f2f7d5f31b 191 int len = m_epOut.status();
mr_q 0:d8f2f7d5f31b 192 DBG("TX transfer completed w len=%d\n",len);
mr_q 0:d8f2f7d5f31b 193 if(m_timeout)
mr_q 0:d8f2f7d5f31b 194 m_txTimeout.detach();
mr_q 0:d8f2f7d5f31b 195 startTx();
mr_q 0:d8f2f7d5f31b 196 if(len > 0)
mr_q 0:d8f2f7d5f31b 197 onWriteable();
mr_q 0:d8f2f7d5f31b 198 }
mr_q 0:d8f2f7d5f31b 199
mr_q 0:d8f2f7d5f31b 200 void UsbSerial::startTx()
mr_q 0:d8f2f7d5f31b 201 {
mr_q 0:d8f2f7d5f31b 202
mr_q 0:d8f2f7d5f31b 203 DBG("Transfer>\n");
mr_q 0:d8f2f7d5f31b 204
mr_q 0:d8f2f7d5f31b 205 m_timeout = false;
mr_q 0:d8f2f7d5f31b 206
mr_q 0:d8f2f7d5f31b 207 // m_txTimeout.detach();
mr_q 0:d8f2f7d5f31b 208
mr_q 0:d8f2f7d5f31b 209 if(!(m_pOutBufPos - m_outBufUsr))
mr_q 0:d8f2f7d5f31b 210 {
mr_q 0:d8f2f7d5f31b 211 DBG("?!?!?\n");
mr_q 0:d8f2f7d5f31b 212 return;
mr_q 0:d8f2f7d5f31b 213 }
mr_q 0:d8f2f7d5f31b 214
mr_q 0:d8f2f7d5f31b 215 if( m_epOut.status() == USBERR_PROCESSING )
mr_q 0:d8f2f7d5f31b 216 {
mr_q 0:d8f2f7d5f31b 217 //Wait & retry
mr_q 0:d8f2f7d5f31b 218 //m_timeout = true;
mr_q 0:d8f2f7d5f31b 219 //m_txTimeout.attach_us(this, &UsbSerial::startTx, FLUSH_TMOUT);
mr_q 0:d8f2f7d5f31b 220 DBG("Ep is busy...\n");
mr_q 0:d8f2f7d5f31b 221 return;
mr_q 0:d8f2f7d5f31b 222 }
mr_q 0:d8f2f7d5f31b 223
mr_q 0:d8f2f7d5f31b 224 if( m_epOut.status() < 0 )
mr_q 0:d8f2f7d5f31b 225 {
mr_q 0:d8f2f7d5f31b 226 DBG("Tx trying again...\n");
mr_q 0:d8f2f7d5f31b 227 m_epOut.transfer((volatile uint8_t*)m_outBufTrmt, m_outBufLen);
mr_q 0:d8f2f7d5f31b 228 return;
mr_q 0:d8f2f7d5f31b 229 }
mr_q 0:d8f2f7d5f31b 230
mr_q 0:d8f2f7d5f31b 231 m_outBufLen = m_pOutBufPos - m_outBufUsr;
mr_q 0:d8f2f7d5f31b 232
mr_q 0:d8f2f7d5f31b 233 //Swap buffers
mr_q 0:d8f2f7d5f31b 234 volatile char* swapBuf = m_outBufUsr;
mr_q 0:d8f2f7d5f31b 235 m_outBufUsr = m_outBufTrmt;
mr_q 0:d8f2f7d5f31b 236 m_outBufTrmt = swapBuf;
mr_q 0:d8f2f7d5f31b 237
mr_q 0:d8f2f7d5f31b 238 m_epOut.transfer((volatile uint8_t*)m_outBufTrmt, m_outBufLen);
mr_q 0:d8f2f7d5f31b 239
mr_q 0:d8f2f7d5f31b 240 m_pOutBufPos = m_outBufUsr;
mr_q 0:d8f2f7d5f31b 241
mr_q 0:d8f2f7d5f31b 242 }
mr_q 0:d8f2f7d5f31b 243
mr_q 0:d8f2f7d5f31b 244 void UsbSerial::startRx()
mr_q 0:d8f2f7d5f31b 245 {
mr_q 0:d8f2f7d5f31b 246 if( (m_pInBufPos - m_inBufUsr) < m_inBufLen )
mr_q 0:d8f2f7d5f31b 247 {
mr_q 0:d8f2f7d5f31b 248 //User buf is not empty, cannot swap now...
mr_q 0:d8f2f7d5f31b 249 return;
mr_q 0:d8f2f7d5f31b 250 }
mr_q 0:d8f2f7d5f31b 251 int len = m_epIn.status();
mr_q 0:d8f2f7d5f31b 252 if( len == USBERR_PROCESSING )
mr_q 0:d8f2f7d5f31b 253 {
mr_q 0:d8f2f7d5f31b 254 //Previous transmission not completed
mr_q 0:d8f2f7d5f31b 255 return;
mr_q 0:d8f2f7d5f31b 256 }
mr_q 0:d8f2f7d5f31b 257 if( len < 0 )
mr_q 0:d8f2f7d5f31b 258 {
mr_q 0:d8f2f7d5f31b 259 DBG("Rx trying again...\n");
mr_q 0:d8f2f7d5f31b 260 m_epIn.transfer((volatile uint8_t*)m_inBufTrmt, BUF_LEN); //Start another transmission
mr_q 0:d8f2f7d5f31b 261 return;
mr_q 0:d8f2f7d5f31b 262 }
mr_q 0:d8f2f7d5f31b 263
mr_q 0:d8f2f7d5f31b 264 m_inBufLen = len;
mr_q 0:d8f2f7d5f31b 265
mr_q 0:d8f2f7d5f31b 266 //Swap buffers
mr_q 0:d8f2f7d5f31b 267 volatile char* swapBuf = m_inBufUsr;
mr_q 0:d8f2f7d5f31b 268 m_inBufUsr = m_inBufTrmt;
mr_q 0:d8f2f7d5f31b 269 m_inBufTrmt = swapBuf;
mr_q 0:d8f2f7d5f31b 270 m_pInBufPos = m_inBufUsr;
mr_q 0:d8f2f7d5f31b 271
mr_q 0:d8f2f7d5f31b 272 DBG("Starting new transfer\n");
mr_q 0:d8f2f7d5f31b 273 m_epIn.transfer((volatile uint8_t*)m_inBufTrmt, BUF_LEN); //Start another transmission
mr_q 0:d8f2f7d5f31b 274
mr_q 0:d8f2f7d5f31b 275 }
mr_q 0:d8f2f7d5f31b 276
mr_q 0:d8f2f7d5f31b 277 #ifdef MBED_RPC
mr_q 0:d8f2f7d5f31b 278 const struct rpc_method *UsbSerial::get_rpc_methods() {
mr_q 0:d8f2f7d5f31b 279 static const rpc_method methods[] = {
mr_q 0:d8f2f7d5f31b 280 { "readable", rpc_method_caller<int, UsbSerial, &UsbSerial::readable> },
mr_q 0:d8f2f7d5f31b 281 { "writeable", rpc_method_caller<int, UsbSerial, &UsbSerial::writeable> },
mr_q 0:d8f2f7d5f31b 282 RPC_METHOD_SUPER(Stream)
mr_q 0:d8f2f7d5f31b 283 };
mr_q 0:d8f2f7d5f31b 284 return methods;
mr_q 0:d8f2f7d5f31b 285 }
mr_q 0:d8f2f7d5f31b 286
mr_q 0:d8f2f7d5f31b 287 struct rpc_class *UsbSerial::get_rpc_class() {
mr_q 0:d8f2f7d5f31b 288 static const rpc_function funcs[] = {
mr_q 0:d8f2f7d5f31b 289 /*{ "new", rpc_function_caller<const char*, UsbDevice*, int, int, const char*, Base::construct<UsbSerial,UsbDevice*,int,int,const char*> > },*/ //RPC is buggy
mr_q 0:d8f2f7d5f31b 290 RPC_METHOD_END
mr_q 0:d8f2f7d5f31b 291 };
mr_q 0:d8f2f7d5f31b 292 static rpc_class c = { "UsbSerial", funcs, NULL };
mr_q 0:d8f2f7d5f31b 293 return &c;
mr_q 0:d8f2f7d5f31b 294 }
mr_q 0:d8f2f7d5f31b 295 #endif
mr_q 0:d8f2f7d5f31b 296
mr_q 0:d8f2f7d5f31b 297 } // namespace mbed
mr_q 0:d8f2f7d5f31b 298
mr_q 0:d8f2f7d5f31b 299 #endif
mr_q 0:d8f2f7d5f31b 300