]> git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/ip/LwIPInterface.cpp
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[tmk_keyboard.git] / tool / mbed / mbed-sdk / libraries / net / cellular / CellularModem / ip / LwIPInterface.cpp
1 /* LwIPInterface.cpp */
2 /* Copyright (C) 2012 mbed.org, MIT License
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5 * and associated documentation files (the "Software"), to deal in the Software without restriction,
6 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
7 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in all copies or
11 * substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
14 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 */
19
20
21 #include "core/fwk.h"
22
23 #include "LwIPInterface.h"
24
25 extern "C" {
26 #include "lwip/init.h"
27 #include "lwip/tcpip.h"
28 }
29
30 LwIPInterface::LwIPInterface() : IPInterface(), m_rdySphre(1)
31 {
32 m_rdySphre.wait();
33 }
34
35 LwIPInterface::~LwIPInterface()
36 {
37
38 }
39
40 int LwIPInterface::init() //Init LwIP-specific stuff, create the right bindings, etc
41 {
42 //lwip_init(); //All LwIP initialisation functions called on a per-module basis (according to lwipopts.h)
43 tcpip_init(LwIPInterface::tcpipRdyCb, this); //Start TCP/IP processing thread
44 m_rdySphre.wait(); //Wait for callback to produce resource
45 return OK;
46 }
47
48 /*static*/ void LwIPInterface::tcpipRdyCb(void* ctx) //Result of TCP/IP thread launch
49 {
50 LwIPInterface* pIf = (LwIPInterface*) ctx;
51 pIf->m_rdySphre.release();
52 }
Imprint / Impressum