Commit Graph

192 Commits (25b23a9286262ee3778cd48b57f2926d85473750)

Author SHA1 Message Date
Mika Leppänen a5a8b350ce Ported NXP LPCxx ethernet driver to unified EMAC 2018-06-06 14:29:49 +03:00
Kevin Bracey a8e8775aa9 Kinetis EMAC: Correct TX ring pointer array size
TX pointer array was using RX ring length in its declaration.
Wasted memory if RX ring > TX ring, as is the default, but would
be broken if RX ring < TX ring.
2018-06-06 13:30:01 +03:00
Kevin Bracey 30e68f3201 Kinetis EMAC: Make number of buffers configurable
16 RX buffers and 8 TX buffers is probably excessive. Nanostack
version of driver successfully used 4+4, and data pump should be
broadly equivalent.

This means that switching K64F devices from Nanostack to EMAC increases
base heap usage by 18K - observed in Nanostack border router builds.

Add a config option to make it possible to lower the number of buffers.
Defer consideration of lowering the default to later.
2018-06-06 13:30:01 +03:00
Kevin Bracey 6c6bcc3575 NSAPI: Use IPv6 conversion routines from frameworks
Share IPv6 conversion code with mbed_trace, Nanostack and
mbed client.

Output formatting is better, being conformant to RFC 5952.
2018-06-05 15:31:18 +03:00
Mika Leppänen 9ec1ec90d9 Fixed DNS resolution in case all sendto operations fail
DNS resolver now counts how many sendto operations are successful
during one DNS server attempt cycle (attempting to contact DNS
servers from 0 to last index, including stack specific ones). If all
socket sendto operations fail, DNS resolution is aborted.

If one or more are successful, DNS resolution is continued until
total network attempts count is reached or all sendto operations
fails during a cycle.
2018-06-05 14:29:48 +03:00
Veijo Pesonen aafeef7401 gethostbyname won't accept empty name
Considers both versions - synchronous and asynchronous. Earlier the
underlying stack was trusted to do this check.
2018-05-30 12:07:07 +03:00
Cruz Monrreal 24cebbaec3
Merge pull request #7016 from mikaleppanen/async_dns_corr
Corrected asynchronous DNS functionality
2018-05-29 10:48:17 -05:00
Cruz Monrreal 7418260b78
Merge pull request #7014 from KariHaapalehto/interface_check
Add check for _interface
2018-05-29 10:42:19 -05:00
Kari Haapalehto 8540b1ea23 Add check for _interface 2018-05-25 12:16:00 +03:00
Mika Leppänen d648bf8477 Corrected asynchronous DNS functionality
- Set network stack to store event queue so that mbed::mbed_event_queue() call
  is not needed every time call_in() is called
- Added dns state variables and enum (states are: created, initiated and cancelled)
- Corrected DNS response handling so that if DNS server returns that host name is
  unknown the DNS query is not tried again
- Reorder mutexes in nsapi_dns_query_multiple_async()
- Created nsapi_dns_query_async_initiate_next() function to initiate the next
  DNS query from the queue after delete of previous query
- Added dsn_timer_running variable to supervise DNS timer start/stop
- Changed cancel function to only mark query as deleted and moved deletion
  to timer function. This allows to run socket close on DNS thread
- Added new nsapi error NSAPI_ERROR_TIMEOUT for DNS (and other) timeouts
2018-05-25 11:21:52 +03:00
Seppo Takalo f989f6838b Fix build for MBT_ODIN_W2 and MBED_CONNECT_ODIN when using WiFi
Odin WiFi driver was only supplied for EVK board.
These all are just the same module, so using the main target name
that all inherit.
2018-05-25 10:54:09 +03:00
Asif Rizwan 657ac3f643 WIFI_EMAC class renamed to OdinWiFiEMAC, Formatting
Revert "in ODIN emac initialization required before connection"
2018-05-23 12:25:21 +03:00
Kevin Bracey 7e4eb5c24b LPC546XX: Correct Ethernet length calculations
Subtract 4 from the received packet length - the buffer contains the
CRC, which we shouldn't pass up.

Ensure we allocate receive buffers of a size corresponding to the
rounded-up size we tell the hardware - the hardware was overrunning the
allocation by a couple of bytes.
2018-05-23 12:25:21 +03:00
Mahesh Mahadevan 91ac8356ba LPC546XX: Add ENET support
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-05-23 12:25:20 +03:00
Asif Rizwan 0b14f1277e EMAC adaption added, updated ODIN drivers to v2.5.0 RC1 2018-05-23 12:25:18 +03:00
Kevin Bracey f3ec0dacd5 Add NetworkInterface::get_default_instance()
Provide an initial framework to make it easier to find a default network
interface.
2018-05-23 12:25:17 +03:00
Mika Leppänen e481c5ef75 Added memory manager set to add_ethernet_interface() of test stack
This allows that EMAC memory manager can be used to allocate EMAC driver
memory already after the add_ethernet_interface() call.
2018-05-23 12:24:11 +03:00
Mika Leppänen 31b8f73de7 Changed mutexes, delete and DNS call in callback set
- Changed mutexes to platform mutexes
- Removed not needed null check from delete
- Changed nsapi_dns_call_in_set() to use call_in_callback_cb_t and
added prototype to header
2018-05-23 12:24:10 +03:00
Mika Leppänen c4424ff0a1 Corrected more defects
- Serialized the sending of multiple async DNS queries since limits on event
message box sizes
- Added timer function that supervises the total time used to make DNS query
and triggers socket timeouts
- Changed nsapi_error_t to new nsapi_value_or_error_t on interface headers
- Corrected wording of gethostbyname_async return values
- Clarified .json options
- Added a new data type for socket callback that can be used from interrupts
- Corrected variable limits to use INT32_MAX etc. defines
- Changed mallocs to new
- Optimized variable sizes on DNS_QUERY definition
2018-05-23 12:24:10 +03:00
Mika Leppänen 1c01f5dda4 Corrected defects
- Changed call_in/call methods of the stack to callback provided by the stack
- Specified what are limitations for operations that are made in callback
- Added pure virtual class DNS that defines DNS operations
- Added cancel operation and unique ID to DNS request used in cancel
- Added DNS configuration options to netsocket/mbed_lib.json for retries,
  response wait time and cache size
- Changed host name to use dynamic memory in DNS query list and cache,
  set maximum length for the name to 255 bytes.
- Added mutex to asynchronous DNS
- Reworked retries: there is now total retry count and a server specific count
- Ignores invalid incoming UDP socket messages (DNS header is not valid), and retries DNS query
- Reworked DNS module asynchronous operation functions
- Corrected other review issues (nothrow new, missing free, missing mutex unlock etc.)
2018-05-23 12:24:10 +03:00
Mika Leppänen b7e8400c2c Added non-blocking DNS functionality to network interface
- Added non-blocking DNS interface to network interface and
  network stack.
- Added caching of DNS replies.
- Added a network stack function to get DNS addresses from stack.
- Added call and call_in hooks to onboard network stack to
  allow calling functions from onboard stack context.
- Added support to call and call_in functions to LWIP and
  Nanostack.
- Disabled LWIP DNS translator with the exception of DNS
  address storage used in DNS address get.
2018-05-23 12:24:10 +03:00
TomoYamanaka bad530ab0d Implementation of unified EMAC driver for Renesas mbed boards
Implementation of unified EMAC driver for Renesas mbed boards

Based on the driver so far, Renesas implemented the emac driver for GR-PEACH and VK-RZ/A1H.
The mainly changes is below.
- Add the connection part with LWIP according to the unified emac specification.
- Add three new multicast functions(add, remove, set_all).

The Greentea test netsocket and emac test passed.
2018-05-23 12:24:09 +03:00
cyliangtw 7bfa362492 [M487/NUC472] Fix tx frame length and remove GPL license 2018-05-23 12:24:09 +03:00
cyliangtw 401f09c479 [M487/NUC472] Support DHCP & TCP sample, also remove legacy emac 2018-05-23 12:24:09 +03:00
cyliangtw 89209b6cd5 [M487/NUC472] Support new EMAC feature, built OK 2018-05-23 12:24:08 +03:00
Mahesh Mahadevan 82b2a27a1c Kinetis EMAC: Renamed K64F files to Kinetis
This driver is used by more SoC's than K64F

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-05-23 12:24:07 +03:00
Mahesh Mahadevan 7bc4c0ec21 K64F, K66F: Update the SYSMPU implementation
Do not disable SYSMPU, instead add access for ENET bus master

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2018-05-23 12:24:07 +03:00
Mika Leppänen de72090d26 Changed STM emac driver to loop RX frame reading 2018-05-23 12:24:06 +03:00
Kevin Bracey 953f1b615a Add EMAC driver README.md with porting guide 2018-05-23 12:24:06 +03:00
Kevin Bracey fbd920777b Add extra labels for Freescale & STM EMAC drivers
Just checking "does the chip have an EMAC" doesn't work - there are
targets using those chips which do not have an Ethernet connector and
don't provide the necessary surrounding infrastructure (eg DISCO_F429ZI,
not providing the board emac config call, and HEXIWEAR not providing PHY
info).

Make the targets that actually do want EMAC define their own local
Freescale_EMAC and STM_EMAC labels, and move the drivers into
the corresponding TARGET_ directories, removing the #ifdefs.
2018-05-23 12:24:06 +03:00
Kevin Bracey d83dec9ea4 Stop drivers checking DEVICE_EMAC
Checking DEVICE_EMAC is problematic - particularly for the Odin W2 where
apps have been shutting this off to disable the Wi-fi interface.

Make drivers check a locally-relevant flag instead, pending new
thoughts on how to achieve application/test-relevant flagging for
XXX:get_default_instance() being provided by a system.

However that is achieved, drivers do require a flag set purely by the
target - they mustn't be tripped up by an add-on module providing itself
as the system's default EMAC.
2018-05-23 12:24:05 +03:00
Mika Leppänen 01b4d97cb4 Corrected STM eth driver flagging, memory allocation and thread init 2018-05-23 12:24:05 +03:00
Kevin Bracey 3c83c62ff7 Nanostack EMAC implementation
Make Nanostack an OnboardNetworkInterface, implementing
add_ethernet_interface so it can use EMAC drivers.

Can now be used via EthernetInterface, and be the system's default
network stack.

Legacy support for NanostackEthernetInterface retained. Some
restructuring of mesh interface code to fit into the
OnboardNetworkStack:::Interface system.
2018-05-23 12:24:04 +03:00
Kevin Bracey a0d374ef00 Extend EMAC multicast APIs 2018-05-23 12:24:02 +03:00
Kevin Bracey 5472a9703f EMAC: check link status callback is set
Nanostack doesn't set the link status callback. Make sure the two
example drivers don't crash if it isn't set.
2018-05-23 12:24:02 +03:00
Kevin Bracey 7ce098acb4 K64F EMAC: Fix TX error path leaks 2018-05-23 12:24:02 +03:00
Mika Leppänen 5da3cd9cce Added preferred alignment to emac and copy to/from to memory manager 2018-05-23 12:24:01 +03:00
Kevin Bracey 4950a993fd Move STM EMAC driver out out lwIP 2018-05-23 12:24:01 +03:00
Mika Leppänen 668e0821a1 Updated K64F ethernet driver to use memory manager 2018-05-23 12:24:00 +03:00
Mika Leppänen bc5d4d1c0d Created memory manager class to netsocket and updated lwip to use it
instead of old memory interface.
2018-05-23 12:24:00 +03:00
Kevin Bracey b222c25435 Work around Nuvoton #define EMAC 2018-05-23 12:23:58 +03:00
Kevin Bracey 0ecf4e4695 Move Freescale EMAC driver out of lwIP 2018-05-23 12:23:58 +03:00
Kevin Bracey 74dfe3423a Add downcast methods to NetworkInterface
As we've introduced virtual inheritance to support EMACInterface, we can
no longer use C-style casts or static_cast to downcast from
NetworkInterface to more specific types. RTTI is disabled in the
toolchains, so dynamic_cast is unavailables.

Add virtual downcast methods to permit conversions to the 6 derived
classes. Probably only needed for EMACInterface, WiFiInterface and
EthInterface, but handles the set.
2018-05-23 12:23:55 +03:00
Kevin Bracey 6dffe6e4e7 Remove CellularInterface
This has been superceded by CellularBase. Name change occurred late
in review of https://github.com/ARMmbed/mbed-os/pull/4119 and
original unused CellularInterface was left behind.
2018-05-22 11:44:46 +03:00
Kevin Bracey 1c5bbaf4d8 Insert EMACInterface class
Rather than let "EthernetInterface" be the base EMAC NetworkInterface,
insert an "EMACInterface" class.

EthernetInterface then derives from EMACInterface and EthInterface.

A Wi-Fi driver can derive from EMACInterface and WiFiInterface - this
will be more logical than deriving from EthernetInterface and
WiFiInterface.

This does mean adding a couple of virtual inheritances to avoid
duplicate NetworkInterfaces:

                   NetworkInterface
                     /           \
            virtual /             \ virtual
                   /               \
             EMACInterface     WiFiInterface
                   \               /
                    \             /
                     \           /
                  MyCustomWiFiInterface
2018-05-22 11:44:45 +03:00
Kevin Bracey 0386f73719 Networking update: general refactoring, unifying EMAC
Initial work by Bartek Szatkowski in https://github.com/ARMmbed/mbed-os/pull/4079,
reworked following review of https://github.com/ARMmbed/mbed-os/pull/5202 to
transform the entire system into C++, retaining the basic functionality.

Bartek's summary:

* Porting ethernet to EMAC
* Updating EMAC to enable multiple interfaces
* Untangling networking classes, making the abstractions a bit clearer to follow, etc
* General refactoring
* Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI

Revisions since initial branch:

* Remove lwip depencies
* Correct doxygen warnings
* Remove emac_api.h, replace with C++ EMAC abstract class.
* Create OnboardNetworkInterface, and LWIP implementation.
* Mappings since #4079
     lwip-interface/nsapi_stack_lwip.c -> LWIPStack.cpp
     lwip-interface/ipstack_lwip.c -> LWIPInterface.cpp
     netsocket/mbed_ipstack.h -> OnboardNetworkStack.h
     hal/emac_api.h -> EMAC.h
* Reinstate use of EthInterface abstraction
* Correct and clarify HW address EMAC ops
* Restore MBED_MAC_ADDR implementation
* Integrate PPP support with LWIP::Interface.
* Convert K64F lwIP driver to K64F_EMAC.

To do:

* Convert emac_stack_mem.h to follow this pattern.
* Figure out DEVICE_ETH/EMAC
* Update all drivers to use EMAC
2018-05-22 11:44:45 +03:00
Amanda Butler a83745bcdd
Copy edit UARTCellularInterface.h
Copy edit file for grammar.
2018-04-17 11:51:24 -05:00
Amanda Butler 8389bbfc61
Copy edit PPPCellularInterface.h
Copy edit file for grammar.
2018-04-17 11:49:20 -05:00
Amanda Butler 0f8a2c75e7
Copy edit OnboardCellularInterface.h
Copy edit file for grammar.
2018-04-17 11:44:28 -05:00
Amanda Butler 5835d83efa
Copy edit CellularInterface.h
Copy edit for grammar.
2018-04-17 11:41:59 -05:00
Teppo Järvelin 3b1c8c0a94 Cellular: Updated doxygen for deprecated API's. 2018-04-17 12:30:16 +03:00
Teppo Järvelin 89843246ac Separated context activation from connect, increased stack size to 2048 to avoid stack underflows and changed connection callback call. 2018-04-11 09:31:44 +03:00
Teppo Järvelin 83ea9be5f5 temp commit while changing work... 2018-04-11 09:31:44 +03:00
Teppo Järvelin 1661fc2744 Modified state machine, added cellular state and callback. 2018-04-11 09:31:44 +03:00
Max Payne bd47110554 Fix IPv4 address parsing due to not-so-portable scanf modifier
Bug is raised when using newlib-based toolchains.
%hh format is only avaliable in scanf if newlib is compiled
with _WANT_IO_C99_FORMATS option.
2018-04-02 23:33:21 +03:00
Cruz Monrreal 7c30faf69d
Merge pull request #6264 from jarvte/master
Deprecated warnings for feature/netsocket/cellular
2018-03-16 13:32:09 -05:00
Cruz Monrreal 9cac3b2f6b
Merge pull request #6149 from bmcdonnell-ionx/typos
Fix typos in the files
2018-03-15 10:53:03 -05:00
Teppo Järvelin 53455c5528 Fixed correct includes so that compile log is not polluted. 2018-03-13 16:23:15 +02:00
Teppo Järvelin 16e8b77474 PR review findings, updated deprecated comments. 2018-03-13 13:15:29 +02:00
Antti Kauppila 783d0c58f5 MBED_DEPRECATED_SINCE taken into use 2018-03-13 13:15:29 +02:00
Teppo Järvelin 7fd6b71337 Moved APN_db.h under new cellular. 2018-03-13 13:15:29 +02:00
Teppo Järvelin bee31ad1b3 Added deprecation notes to old cellular interfaces. 2018-03-13 13:15:29 +02:00
Amanda Butler a302a4be6d Copy edit OnboardCellularInterface.h
Copy edit file for active voice and removal of Latin abbreviations.
2018-03-02 14:38:08 +02:00
Ari Parkkila e53b93114e Typedef OnboardCellularInterface to EasyCellularConnection 2018-03-02 14:38:07 +02:00
Rob Meades 2fe3223612 Make MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP default in mbed_lib.json while
ensuring that, if there is a user-specified APN, it is still used.
2018-02-26 11:33:40 +00:00
Teemu Kultala 34ef11630c fix issue 6150 by always setting net interface UP in mbed_set_dhcp 2018-02-22 13:00:46 +02:00
Brendan McDonnell c4f10aafee typos 2018-02-20 20:11:19 -05:00
Jarno Lamsa 8bea5ef438 Add some documentation for the callback 2018-02-12 11:02:07 +02:00
Teemu Kultala 5a7482667e NSAPI status callback changes
This is the original content of feature-status-callbacks, reviewed in
https://github.com/ARMmbed/mbed-os/pull/5457
2018-02-09 12:44:31 +02:00
Kevin Bracey 15a3922f58 Correct return value of nsapi_dns_query_multiple
Documentation states that nsapi_dns_query_multiple returns the number of
addresses found on success - it was returning 0.

Overloads using SocketAddress are relying on the return value, meaning
those calls didn't work at all.

Fixes #5921.
2018-01-26 14:08:29 +02:00
Seppo Takalo 6bf0611748 Clarify TCPSocket::recv() and UDPSocket::recvfrom() documentation. 2018-01-12 12:03:56 +02:00
Kevin Bracey 67b97d39c4 Make TCPSocket send all data when blocking
Previously, send() was somewhat soft - it only ever made one send
call to the underlying stack, so it would typically take as much data
as would fit in the buffer, and only block if it was unable to write
anything.

This is not the intent of a POSIX socket/filehandle write. It should try
to send everything if blocking, and only send less if interrupted by a
signal:

 - If the O_NONBLOCK flag is clear, write() shall block the calling
   thread until the data can be accepted.

 - If the O_NONBLOCK flag is set, write() shall not block the thread.
   If some data can be written without blocking the thread, write()
   shall write what it can and return the number of bytes written.
   Otherwise, it shall return -1 and set errno to [EAGAIN].

This "send all" behaviour is of slightly limited usefulness in POSIX, as
you still usually have to worry about the interruption possibility:

  - If write() is interrupted by a signal before it writes any data, it
    shall return -1 with errno set to [EINTR].

  - If write() is interrupted by a signal after it successfully writes
    some data, it shall return the number of bytes written.

But as mbed OS does not have the possibility of signal interruption, if we
strengthen send to write everything, we can make applications' lives
easier - they can just do "send(large amount)" confident that it will
all go in one call (if no errors).

So, rework to make multiple sends to the underlying stack, blocking as
necessary, until all data is written.

This change does not apply to recv(), which is correct in only blocking until
some data is available:

 - If O_NONBLOCK is set, read() shall return -1 and set errno to [EAGAIN].

 - If O_NONBLOCK is clear, read() shall block the calling thread until some
   data becomes available.

 - The use of the O_NONBLOCK flag has no effect if there is some data
   available.
2017-11-21 09:51:36 +02:00
Kevin Gilbert b56ced249a Add multicast implementation for UDPSocket. IPv4 and IPv6 both supported. 2017-10-10 18:21:18 -05:00
Jimmy Brisson 908a05b231 Merge pull request #5016 from u-blox/apndb_fix
Fix cellular APN_db.h lookup.
2017-09-27 09:06:46 -05:00
Hasnain Virk 8c9a0b3aa5 Seperatig string literal from macro
From C++11 and beyond string literals must be seperated by space
so that they are recongizable as seperate tokens.

Context macro in PPPCellularInterface (CTX) has been causing issues
as it was not augmented with a space from a nearby string literal.
2017-09-15 17:39:46 +03:00
adbridge 6bd28ecb68 Remove string literal values and revert back to using CTX macro .
The previous fix to replace CTX with string literals was the wrong
solution. All that was actually required was to insert a space before
the macro.
2017-09-11 11:13:54 +01:00
Deepika 0132d31124 Fix IAR8 : user-defined literal operator not found
Cellular example had build issues with IAR8, combination of define and string
as argument to send function resulted in above error. Typecasting to const char *
didn't help, hence replacing the define explicitly.
2017-09-10 09:58:34 -05:00
Rob Meades bce900d8f7 Fix cellular APN_db.h lookup. 2017-09-05 11:50:51 +01:00
Martin Kojtal abafc6e7df Merge pull request #4580 from deepikabhavnani/wifi_34
Use EventFlags instead of Semaphores
2017-09-04 16:54:55 +01:00
Deepika beb5aac640 RTOS: Add EventFlags class
EventFlags class is a wrapper for Event Flag functionality introduced in
RTOS2/RTX5.
2017-08-29 14:07:44 -05:00
Mika Leppänen dd346ec5a8 Either ipv4 or ipv4v6 PPP and IP stacks are enabled based on 3GPP context 2017-08-22 13:14:41 +03:00
Russ Butler 026df0b7cd Turn on doxygen for DEVICE_* features
Enable doxygen for all device features. Also fix the warnings that
showed up once this was enabled.
2017-08-11 15:47:44 -05:00
Martin Kojtal 334c02f7d4 Cellular: not-supported error if MODEM_ON_BOARD not defined
If a test is empty, it leads to undef. Therefore if a test requires additional
details, it should print an error [NOT SUPPORTED].
2017-06-30 10:01:46 +01:00
Jimmy Brisson 8f42c87ab7 Merge pull request #4446 from hasnainvirk/add_cellular_unit_tests
Customer port verification tests for cellular
2017-06-29 11:04:56 -05:00
Hasnain Virk 09b07a49a6 Customer port verification tests for cellular
Basic TCP/UDP tests for PPP based onboard cellular modems.
Tests basic public APIs defined in CellularBase.h
A customer port must pass this test set, hence verifying their
particular implementation.
2017-06-07 14:57:48 +03:00
Jimmy Brisson aabecf633b Remove doxygen warnings in nsapi 2017-06-05 17:32:46 -05:00
Sam Grove 5f138810a9 Merge pull request #4294 from ARMmbed/feature_cmsis5
Update CMSIS-Core and RTX to version 5
2017-06-02 23:44:32 -05:00
Hasnain Virk 24de27c989 Major Refactoring & extensions
For keep supporting external APIs with the same name (supposedly there are a larger
number of users of those APIs), BufferedSerial and ATParser are being renamed.
BufferedSerial becomes UARTSerial, will complement a  future USBSerial etc.
ATParser becomes ATCmdParser.

* UARTSerial moves to /drivers

* APN_db.h is moved from platform to cellular/util/.

* Original CellularInterface is restored for backward compatability (again, supposedly there
  are users of that).

* A new file, CellularBase is added which will now servce as the base class for all
  upcoming drivers.

* Special restructuring for the driver has been undertaken. This makes a clear cut distinction
  between an on-board or an off-board implementation.
  	- PPPCellularInterface is a generic network interface that works with a generic FileHandle
          and PPP. A derived class is needed to pass that FileHandle.
        - PPPCellularInterface provides some base functionality like network registration, AT setup,
          PPP connection etc. Lower level job is delegated to the derived classes and various modem
          specific APIs are provided which are supposed to be overridden.
        - UARTCellularInterface is derived from PPPCellularInterface. It constructs a FileHandle and
          passes it back to PPPCellularInterface as well as provides modem hangupf functionality.
          In future we could proive a USBInterface that would derive from PPPCellularInterface and could
          pass the FileHandle back.
	- OnboardCellularInterface is derived from UARTCellularInterfae and provides hooks to
          the target provided implementation of onbard_modem_api.h. An off-board modem, i.e, a modem on
          a shield has to override the modem_init(), modem_power_up() etc as it cannot use
          onboard_modem_api.h.
2017-05-31 15:02:11 +03:00
Hasnain Virk 658ddf7c30 ARMCC link errors fixed, nsapi_ppp glue layer changed
GCC have not been capable enough to catch some linker errors which arose when
ethernet support for LWIP was disabled. Checks have been added to make sure that
unrefrenced code is not linked in.

nsapi_ppp glue layer is made more transparent to public cellular API. Storage of IP
addresses is removed. PPP layer already stores the addresses, so we pass the pointer back
to the upper layers.

If PPP is not used, we provide dummy functions.
2017-05-31 15:02:11 +03:00
Hasnain Virk 01088647b9 Finalizing the public API for Cellular
* state machine corrections
* adding various standard API methods
* Addition/revision/enhancement of the nsapi_ppp glue layer
* Turning off debug by default
2017-05-31 15:02:11 +03:00
Hasnain Virk 3b44f4758d Adding support for APN lookup
Mainly reutilizing code from ublox C027 support lib.
As we are using external PDP context, i.e., an external IP stack,
we will pass username and password to underlying stack running PPP.
We only support CHAP as the authentication protocol.
2017-05-31 15:02:11 +03:00
Hasnain Virk 87a4580e5f Bug fixes & state machine corrections
In case of carrier lost, we would like to inform PPP data pump.
That involved setting up link status flag down semaphores.
mbed_lwip_bringup() and mbed_lwip_bringdown() had been Ethernet specific only.
We extend these routines to support PPP as well. Currently we support only one interface
at a time. However, future enhancement to multi interface support should be trivial.
2017-05-31 15:02:11 +03:00
Kevin Bracey 7e3c529d21 Unify LWIP Ethernet and PPP initialisation 2017-05-31 15:02:11 +03:00
Bartek Szatkowski b793a3fb89 Update codebase for CMSIS5/RTX5
Update all of mbed-os to use RTX5.
2017-05-30 18:55:52 +01:00
Kevin Bracey 984e87d8e9 NSAPI - Don't send trailing garbage in DNS queries
Observed during investigation of
https://github.com/ARMmbed/mbed-os/issues/4246 - DNS queries sent
the entire buffer, not just the bit filled in.

Inefficient, especially for 6LoWPAN, and a security hole - the trailing
data could be previously-used heap.
2017-05-05 11:35:48 +03:00
Christopher Haster aff49d8d1e Renamed files in platform to match source names
critical.h     -> mbed_critical.h
sleep.h        -> mbed_sleep.h
toolchain.h    -> mbed_toolchain.h
rtc_time.h     -> mbed_rtc_time.h
semihost_api.h -> mbed_semihost_api.h
wait_api.h     -> mbed_wait_api.h
2017-02-22 18:17:54 -06:00
Sam Grove 6f6e5c478f Merge pull request #3784 from geky/nsapi-sigio
nsapi: Rename attach -> sigio to decrease confusion on its behaviour
2017-02-21 10:56:40 -06:00
Christopher Haster d4e686be63 nsapi: Renamed attach -> sigio to decrease confusion on its behaviour 2017-02-16 10:47:06 -06:00
Christopher Haster 417524f562 Callback: Adopt better use of assignment/call operators 2017-02-15 15:19:38 -06:00
Christopher Haster d741c135f4 nsapi: Changed initial state of sockets to allow events
Note, the registered callback is still disabled by a call to
socket_attach. This will avoid being called after the socket is closed
unless close is called from the attached callback, which is in irq
context.

As pointed out by kjbracey-arm, the previous behaviour was broken
for sockets that started out listening.
2017-01-20 07:58:34 -06:00