local fork
Dependencies: Socket USBHostWANDongle_bleedingedge lwip-sys lwip
Fork of VodafoneUSBModem_bleedingedge by
ip/LwIPInterface.cpp@62:d0b6bccbd613, 2012-12-10 (annotated)
- Committer:
- donatien
- Date:
- Mon Dec 10 17:07:08 2012 +0000
- Revision:
- 62:d0b6bccbd613
- Parent:
- 16:02db4f537955
Separate Voda and USBHostWANDongle libs developments flows: do not use bleeding edge lib for usb lib, which now points to https://mbed.org/users/mbed_official/code/USBHostWANDongle
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 16:02db4f537955 | 1 | /* LwIPInterface.cpp */ |
donatien | 16:02db4f537955 | 2 | /* Copyright (C) 2012 mbed.org, MIT License |
donatien | 16:02db4f537955 | 3 | * |
donatien | 16:02db4f537955 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
donatien | 16:02db4f537955 | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
donatien | 16:02db4f537955 | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
donatien | 16:02db4f537955 | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
donatien | 16:02db4f537955 | 8 | * furnished to do so, subject to the following conditions: |
donatien | 16:02db4f537955 | 9 | * |
donatien | 16:02db4f537955 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
donatien | 16:02db4f537955 | 11 | * substantial portions of the Software. |
donatien | 16:02db4f537955 | 12 | * |
donatien | 16:02db4f537955 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
donatien | 16:02db4f537955 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
donatien | 16:02db4f537955 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
donatien | 16:02db4f537955 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 16:02db4f537955 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
donatien | 16:02db4f537955 | 18 | */ |
donatien | 16:02db4f537955 | 19 | |
donatien | 16:02db4f537955 | 20 | |
donatien | 16:02db4f537955 | 21 | #include "core/fwk.h" |
donatien | 16:02db4f537955 | 22 | |
donatien | 16:02db4f537955 | 23 | #include "LwIPInterface.h" |
donatien | 16:02db4f537955 | 24 | |
donatien | 16:02db4f537955 | 25 | extern "C" { |
donatien | 16:02db4f537955 | 26 | #include "lwip/init.h" |
donatien | 16:02db4f537955 | 27 | #include "lwip/tcpip.h" |
donatien | 16:02db4f537955 | 28 | } |
donatien | 16:02db4f537955 | 29 | |
donatien | 16:02db4f537955 | 30 | LwIPInterface::LwIPInterface() : IPInterface(), m_rdySphre(1) |
donatien | 16:02db4f537955 | 31 | { |
donatien | 16:02db4f537955 | 32 | m_rdySphre.wait(); |
donatien | 16:02db4f537955 | 33 | } |
donatien | 16:02db4f537955 | 34 | |
donatien | 16:02db4f537955 | 35 | LwIPInterface::~LwIPInterface() |
donatien | 16:02db4f537955 | 36 | { |
donatien | 16:02db4f537955 | 37 | |
donatien | 16:02db4f537955 | 38 | } |
donatien | 16:02db4f537955 | 39 | |
donatien | 16:02db4f537955 | 40 | int LwIPInterface::init() //Init LwIP-specific stuff, create the right bindings, etc |
donatien | 16:02db4f537955 | 41 | { |
donatien | 16:02db4f537955 | 42 | //lwip_init(); //All LwIP initialisation functions called on a per-module basis (according to lwipopts.h) |
donatien | 16:02db4f537955 | 43 | tcpip_init(LwIPInterface::tcpipRdyCb, this); //Start TCP/IP processing thread |
donatien | 16:02db4f537955 | 44 | m_rdySphre.wait(); //Wait for callback to produce resource |
donatien | 16:02db4f537955 | 45 | return OK; |
donatien | 16:02db4f537955 | 46 | } |
donatien | 16:02db4f537955 | 47 | |
donatien | 16:02db4f537955 | 48 | /*static*/ void LwIPInterface::tcpipRdyCb(void* ctx) //Result of TCP/IP thread launch |
donatien | 16:02db4f537955 | 49 | { |
donatien | 16:02db4f537955 | 50 | LwIPInterface* pIf = (LwIPInterface*) ctx; |
donatien | 16:02db4f537955 | 51 | pIf->m_rdySphre.release(); |
donatien | 16:02db4f537955 | 52 | } |