Commit Graph

254 Commits (4cdcdc10104995591f68d6623115d7eba3d10d20)

Author SHA1 Message Date
Marcus Chang abca2ca48b FlashIAP: Add explicit read function to flash_api.h
On some platforms, the in-application memory is not memory mapped
and therefore cannot be accessed using memcpy.

The flash_read function added to flash_api.h (with a weak
implementation using memcpy in mbed_flash_api.c) can be used for
reading data from areas that are not memory mapped.
2017-07-06 18:53:32 +01:00
Deepika 56f3868e48 Corrected typo 2017-06-29 09:09:53 -05:00
Deepika d22d8af2a2 Corrected handling of format/frequency 2017-06-26 14:34:13 -05:00
Deepika de89be35f8 _acquire() function added & no duplication in format/freq calls
1. Private _acquire() function is added to avoid multiple locking/unlocking
2. format and frequency functions updated to use appropriate function calls
instead of a aquire()
2017-06-26 14:06:16 -05:00
Jimmy Brisson f6d0c29b95 Merge pull request #4594 from pan-/non_copyable
Introduce mbed::NonCopyable traits
2017-06-26 10:29:35 -05:00
Rob Meades 89ddfc5beb Add set_baud() method to UARTSerial(). 2017-06-22 12:26:48 +01:00
Vincent Coubard 3f388ca2a8 drivers: Mark non identity types as non copyable with the NonCopyable traits.
Classes changed: CAN, Ethernet, FlashIAP, I2C, InterruptIn, LowPowerTicker, LowPowerTimeout, LowPowerTimer, RawSerial, Serial, SerialBase, SPI, SPISlave, Ticker, Timeout, Timer, TimerEvent and UARTSerial.
2017-06-20 16:23:46 +01:00
Vincent Coubard 7f5b992064 drivers: Replace private copy constructor and Copy assignement operator by NonCopyable traits.
Modified classes are: BusIn, BusOut, BusInOut and InterruptManager.
2017-06-20 16:23:46 +01:00
Deepika 1ece5ff8a8 Using size_t instead of integer type to resolve warning: comparison between signed and unsigned integer expressions 2017-06-15 14:59:24 -05:00
Hasnain Virk 64a92df455 Avoid lock collision b/w SerialBase & UARTSerial
Fixes issue #4537. SerialBase and UARTSerial happened to have same names
for the mutex locking that confused the system of holding a mutex in interrupt context.
UARTSerial has to change so as to provide empty implementations for lock() and unlock()
becuase it uses SerialBase from interrupt context only or from its own critical section,
so no extra locks required.
Private locks for UARTSerial itself are renamed to api_lock() and api_unlock().
2017-06-13 16:28:31 +03:00
deepikabhavnani c5ff982fc3 Enabled operator API documentation in drivers 2017-06-08 15:53:53 -05:00
Deepika 6478e88808 Fix doxygen warnings in 'drivers' 2017-06-08 15:53:53 -05:00
Sam Grove fa0cd205a2 Merge pull request #4094 from pan-/fix_hal_ticker
[HAL] Add support for 64 bit us timestamp
2017-06-01 23:25:26 -05:00
Martin Kojtal e229a49182 Merge pull request #4207 from geky/spi-remove-byte-locking
spi: Add SPI block-write to C++ and HAL for performance
2017-06-01 14:03:36 +02:00
Vincent Coubard f52da48d95 TimerEvent: Use ticker_insert_event_us instead of the old API in
insert_absolute.

With this patch, event insertion should be more precise.
2017-05-31 19:14:21 +01: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 09ae609d56 Stream class should use mbed::fdopen() to attach a stream
mbed::fdopen() is provided in mbed_retarget.cpp which will attach a stream to the
given FileHandle. Removing mbed_set_unbuffered_stream() from stream class as it
is defined in mbed_retarget.cpp. Stream class should not decide whether it wants
to detach buffers from c library or not. mbed::fdopen() will do that based upon
isatty() call. So if a FileHandle is not a tty, i.e., is not a device type, c library
buffering will not be turned off. For device type FileHandles, c library buffering
is turned off.
2017-05-31 15:02:11 +03:00
Hasnain Virk b2408d8a16 Extending FileHandle & introducing mbed_poll
This has been an attempt to extend existing FileHandle to behave like POSIX
file descriptor for input/output resources/devices too.
This will now provide an abstract indicator/handle any arbitrary file or device
type resource. May be in future, sockets too.

In order to correctly detect availability of read/write a FileHandle, we needed
a select or poll mechanisms. We opted for poll as POSIX defines in
http://pubs.opengroup.org/onlinepubs/009695399/functions/poll.html Currently,
mbed::poll() just spins and scans filehandles looking for any events we are
interested in. In future, his spinning behaviour will be replaced with
condition variables.

In retarget.cpp we have introduced an mbed::fdopen() function which is
equivalent to C fdopen(). It attaches a std stream to our FileHandle stream.
newlib-nano somehow does not seem to call isatty() so retarget doesn't work for
device type file handles. We handle this by checking ourselves in
mbed::fdopen() if we wish to attach our stream to std stream.  We also turn off
buffering by C library as our stuff will be buffered already.

sigio() is also provided, matching the API of the Socket class, with a view to
future unification. As well as unblocking poll(), _poll_change calls the user
sigio callback if an event happens, i.e., when FileHandle becomes
readable/writable.
2017-05-31 15:02:11 +03:00
Christopher Haster 31bf0d5099 spi: Added block-level SPI writes at the HAL level
Poking the block-level SPI writes through the HAL level gives more
freedom to targets to improve SPI transaction speed.
2017-05-25 12:04:58 -05:00
Christopher Haster 58491aa244 spi: Added block-level SPI writes to the C++ api
virtual int write(const char *tx_buffer, int tx_length,
            char *rx_buffer, int rx_length);

The main benefit of block-level SPI writes is the performance
improvement from not acquiring a mutex lock between each byte sent on
the SPI bus. The block write may also be poked through the hal level for
additional speed improvements.
2017-05-25 12:04:45 -05:00
Vincent Coubard 3b6c00b040 Timer: add a function to read the timer in a 64bit variable.
The Timer implementation has been refactored to take advantage of this
implementation as the base for all functions reading the time elapsed.
2017-05-16 10:37:34 +01:00
Vincent Coubard 15327ca607 [Driver] Improve timer precision for ms and seconds. 2017-05-16 10:37:34 +01:00
Vincent Coubard abb0a65ac5 [Drivers] Let ticker support long us timestamp. 2017-05-16 10:37:34 +01:00
Vincent Coubard c90a3a007a [Driver] Add API to support insertion of us_timestamp_t in TimerEvent. 2017-05-16 10:35:12 +01:00
adustm b6581d317c Rename the f parameter into hz to avoid confusion with a loopcounter 2017-05-16 10:37:50 +02:00
adustm f740d2f3bc Add an mbed API that allows the initialization of the CAN at the correct
CAN bus frequency
2017-05-15 14:14:26 +02:00
Anna Bridge 47b1a9eeec Merge pull request #4111 from sg-/fix-the-docs
[drivers] Update doxygen errors
2017-04-21 14:10:17 +01:00
Sam Grove 9dd24f92c2 Disallow doxygen to render protected and private members 2017-04-12 11:48:02 -05:00
Sam Grove 710af8f09b Add deprecation note to CAN attach
attach members not using Callback class are not compatible with
const and volatile types. This was missed when callback was initially
added
2017-04-12 10:30:33 -05:00
Sam Grove 26b9a1f6a3 Enable doxygen to use the pre-processor
Best way to enable MBED_DEPRICATED APIs to be properly rendered
requires using the doxygen preprocessor. This means all device_has
labels need to also be defined or the default DOXYGEN_ONLY label
applied to the API headers which this commit does. ASYNCH currently
exluded.
2017-04-12 09:01:29 -05:00
Sam Grove cba75f467d Fix typo in doxygen group 2017-04-12 08:56:36 -05:00
Neil Thiessen fd7ecda387 Updated CAN to new Callback API
Updated CAN to use new Callback assignment API in order to fix compiler warnings.
2017-04-05 21:07:55 -06:00
Jimmy Brisson f945d71319 Update class documentation tags
stop using scope for \addtogroup. It was placing class methods into the
group documentation instead of the class documentation. The new style is
to explicitly tag the class as @ingroup. This new method will allow the
class to be linked in the group page, and the class page will contain
the detailed documentation of the class methods.
2017-04-04 14:21:53 -05:00
Sam Grove b3ce99676b Updates doxygen errors in documentation for code in the drivers/ directory. 2017-04-04 12:40:09 -05:00
Christopher Haster 61c9683644 Filesystem: Moved retarget related file interfaces into platform 2017-03-14 11:02:34 -05:00
Christopher Haster 77243ef46b Filesystem: Revert deprecation of FileHandle
As identified by @hasnainvirk, @kjbracey-arm, the FileHandle and
FileBase serve two separate functions and their integration is
limiting for certain use cases.

FileLike is actually the redundant class here, but the multiple
inheritance it provides is used as a hack by the retargeting code
to get at the FileHandle implementation bound to the FileBase name.

It may make more sense for the FileBase to inherit from FileHandle,
(with perhaps a different name), but rather than explore the
possibility, this will just restore the previous hierarchy.
2017-03-14 11:02:34 -05:00
Anna Bridge 693f14ee97 Merge pull request #3827 from betzw/betzw_wb_i2c
Correct return values for `I2C::write(int, const char*, int, bool)`
2017-03-14 14:33:42 +00:00
Christopher Haster 51b58b1ad4 Filesystem: Restored LocalFileSystem tests for mbed 2 2017-03-10 11:04:05 -06:00
Christopher Haster 87c0b82230 Updated includes of renamed platform header files 2017-03-01 16:45:55 -06:00
Christopher Haster 7ca4eabf77 Filesystem: Fixed integration with mbed 2 builds 2017-02-24 12:03:14 -06:00
Christopher Haster eea5c9f08a Filesystem: Integration with retarget code 2017-02-24 11:55:37 -06:00
Christopher Haster ee3e920ed1 Filesystem: Moved toolchain-specific types into retarget.h 2017-02-24 11:42:32 -06:00
Christopher Haster cbcc445f54 Added d_type member of dirent struct to readdir 2017-02-23 16:39:25 +00:00
Christopher Haster 9299a88e8f Filesystem: Add support for stat
Provided through FileSystemLike::stat
2017-02-23 16:30:42 +00:00
Wolfgang Betz c7453b2452 Correct return values for `I2C::write(int, const char*, int, bool)` 2017-02-23 09:18:34 +01: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
0xc0170 87001589c1 flash: add FlashIAP class
Flash IAP that provides erase/read/program to an internal API. It
invokes flash HAL functions.

FlashIAP checks for alignments for erase and program. HAL functions
do not, to avoid duplication per target implementation.
2017-02-21 14:08:42 -06:00
Christopher Haster 417524f562 Callback: Adopt better use of assignment/call operators 2017-02-15 15:19:38 -06:00
0xc0170 11d6f388d2 I2C - correct return values for write functions
The correction was made based on the i2c hal, and some target implementations
(early implementations like nxp 1768, freescale KLXX).
2016-11-21 11:26:02 +00:00
Jimmy Brisson f1a78027d3 Add tags to our code 2016-10-04 15:02:44 -05:00
Bogdan Marinescu 8eb36e1164 Added a baud argument for (Raw)Serial objects
This commit adds a `baud` argument for Serial and RawSerial objects:

- there is a new `Serial` constructor with a mandatory baud rate
  argument. The old constructor also got a `baud` argument with a
  default value (to keep backward compatibility).
- the `RawSerial` constructor also got a `baud` argument with a default
  value.

There's also a new configuration parameter (`default-serial-baud-rate`)
that can be used to specify the default value of the above `baud`
arguments.
2016-10-03 20:12:24 +03:00
Sam Grove 301b77c4b2 For drivers, events, hal, platform, rtos and mbed.h add one level of path to make sure specific and unique includes files are found. 2016-10-01 02:11:36 -05:00
Christopher Haster c2d9fc29ff restructure - Fixed include paths damaged by the restructure 2016-09-30 19:18:09 -05:00
Christopher Haster 15904b7544 restructure - Split hal into drivers+platform+hal
hal/common/AnalogIn.cpp -> drivers/AnalogIn.cpp
hal/api/AnalogIn.h -> drivers/AnalogIn.h
hal/api/AnalogOut.h -> drivers/AnalogOut.h
hal/common/BusIn.cpp -> drivers/BusIn.cpp
hal/api/BusIn.h -> drivers/BusIn.h
hal/common/BusInOut.cpp -> drivers/BusInOut.cpp
hal/api/BusInOut.h -> drivers/BusInOut.h
hal/common/BusOut.cpp -> drivers/BusOut.cpp
hal/api/BusOut.h -> drivers/BusOut.h
hal/common/CAN.cpp -> drivers/CAN.cpp
hal/api/CAN.h -> drivers/CAN.h
hal/api/CircularBuffer.h -> drivers/CircularBuffer.h
hal/api/DigitalIn.h -> drivers/DigitalIn.h
hal/api/DigitalInOut.h -> drivers/DigitalInOut.h
hal/api/DigitalOut.h -> drivers/DigitalOut.h
hal/api/DirHandle.h -> drivers/DirHandle.h
hal/common/Ethernet.cpp -> drivers/Ethernet.cpp
hal/api/Ethernet.h -> drivers/Ethernet.h
hal/common/FileBase.cpp -> drivers/FileBase.cpp
hal/api/FileBase.h -> drivers/FileBase.h
hal/api/FileHandle.h -> drivers/FileHandle.h
hal/common/FileLike.cpp -> drivers/FileLike.cpp
hal/api/FileLike.h -> drivers/FileLike.h
hal/common/FilePath.cpp -> drivers/FilePath.cpp
hal/api/FilePath.h -> drivers/FilePath.h
hal/common/FileSystemLike.cpp -> drivers/FileSystemLike.cpp
hal/api/FileSystemLike.h -> drivers/FileSystemLike.h
hal/common/I2C.cpp -> drivers/I2C.cpp
hal/api/I2C.h -> drivers/I2C.h
hal/common/I2CSlave.cpp -> drivers/I2CSlave.cpp
hal/api/I2CSlave.h -> drivers/I2CSlave.h
hal/common/InterruptIn.cpp -> drivers/InterruptIn.cpp
hal/api/InterruptIn.h -> drivers/InterruptIn.h
hal/common/InterruptManager.cpp -> drivers/InterruptManager.cpp
hal/api/InterruptManager.h -> drivers/InterruptManager.h
hal/common/LocalFileSystem.cpp -> drivers/LocalFileSystem.cpp
hal/api/LocalFileSystem.h -> drivers/LocalFileSystem.h
hal/api/LowPowerTicker.h -> drivers/LowPowerTicker.h
hal/api/LowPowerTimeout.h -> drivers/LowPowerTimeout.h
hal/api/LowPowerTimer.h -> drivers/LowPowerTimer.h
hal/api/PortIn.h -> drivers/PortIn.h
hal/api/PortInOut.h -> drivers/PortInOut.h
hal/api/PortOut.h -> drivers/PortOut.h
hal/api/PwmOut.h -> drivers/PwmOut.h
hal/common/RawSerial.cpp -> drivers/RawSerial.cpp
hal/api/RawSerial.h -> drivers/RawSerial.h
hal/common/SPI.cpp -> drivers/SPI.cpp
hal/api/SPI.h -> drivers/SPI.h
hal/common/SPISlave.cpp -> drivers/SPISlave.cpp
hal/api/SPISlave.h -> drivers/SPISlave.h
hal/common/Serial.cpp -> drivers/Serial.cpp
hal/api/Serial.h -> drivers/Serial.h
hal/common/SerialBase.cpp -> drivers/SerialBase.cpp
hal/api/SerialBase.h -> drivers/SerialBase.h
hal/common/Stream.cpp -> drivers/Stream.cpp
hal/api/Stream.h -> drivers/Stream.h
hal/common/Ticker.cpp -> drivers/Ticker.cpp
hal/api/Ticker.h -> drivers/Ticker.h
hal/common/Timeout.cpp -> drivers/Timeout.cpp
hal/api/Timeout.h -> drivers/Timeout.h
hal/common/Timer.cpp -> drivers/Timer.cpp
hal/api/Timer.h -> drivers/Timer.h
hal/common/TimerEvent.cpp -> drivers/TimerEvent.cpp
hal/api/TimerEvent.h -> drivers/TimerEvent.h
hal/api/Transaction.h -> drivers/Transaction.h
hal/api/can_helper.h -> drivers/can_helper.h
hal/.yotta_ignore
hal/CMakeLists.txt
hal/hal/analogin_api.h -> hal/analogin_api.h
hal/hal/analogout_api.h -> hal/analogout_api.h
hal/hal/buffer.h -> hal/buffer.h
hal/hal/can_api.h -> hal/can_api.h
hal/hal/dma_api.h -> hal/dma_api.h
hal/hal/ethernet_api.h -> hal/ethernet_api.h
hal/hal/gpio_api.h -> hal/gpio_api.h
hal/hal/gpio_irq_api.h -> hal/gpio_irq_api.h
hal/hal/i2c_api.h -> hal/i2c_api.h
hal/hal/lp_ticker_api.h -> hal/lp_ticker_api.h
hal/common/mbed_gpio.c -> hal/mbed_gpio.c
hal/common/mbed_lp_ticker_api.c -> hal/mbed_lp_ticker_api.c
hal/common/mbed_pinmap_common.c -> hal/mbed_pinmap_common.c
hal/common/mbed_ticker_api.c -> hal/mbed_ticker_api.c
hal/common/mbed_us_ticker_api.c -> hal/mbed_us_ticker_api.c
hal/module.json
hal/hal/pinmap.h -> hal/pinmap.h
hal/hal/port_api.h -> hal/port_api.h
hal/hal/pwmout_api.h -> hal/pwmout_api.h
hal/hal/rtc_api.h -> hal/rtc_api.h
hal/hal/serial_api.h -> hal/serial_api.h
hal/hal/sleep_api.h -> hal/sleep_api.h
hal/hal/spi_api.h -> hal/spi_api.h
hal/hal/storage_abstraction/Driver_Common.h -> hal/storage_abstraction/Driver_Common.h
hal/hal/storage_abstraction/Driver_Storage.h -> hal/storage_abstraction/Driver_Storage.h
hal/hal/ticker_api.h -> hal/ticker_api.h
hal/hal/trng_api.h -> hal/trng_api.h
hal/hal/us_ticker_api.h -> hal/us_ticker_api.h
hal/api/mbed.h -> mbed.h
hal/api/CThunk.h -> platform/CThunk.h
hal/common/CallChain.cpp -> platform/CallChain.cpp
hal/api/CallChain.h -> platform/CallChain.h
hal/api/Callback.h -> platform/Callback.h
hal/api/FunctionPointer.h -> platform/FunctionPointer.h
hal/api/PlatformMutex.h -> platform/PlatformMutex.h
hal/api/SingletonPtr.h -> platform/SingletonPtr.h
hal/api/critical.h -> platform/critical.h
hal/common/mbed_alloc_wrappers.cpp -> platform/mbed_alloc_wrappers.cpp
hal/common/mbed_assert.c -> platform/mbed_assert.c
hal/api/mbed_assert.h -> platform/mbed_assert.h
hal/common/mbed_board.c -> platform/mbed_board.c
hal/common/mbed_critical.c -> platform/mbed_critical.c
hal/api/mbed_debug.h -> platform/mbed_debug.h
hal/common/mbed_error.c -> platform/mbed_error.c
hal/api/mbed_error.h -> platform/mbed_error.h
hal/common/mbed_interface.c -> platform/mbed_interface.c
hal/api/mbed_interface.h -> platform/mbed_interface.h
hal/common/mbed_mem_trace.c -> platform/mbed_mem_trace.c
hal/api/mbed_mem_trace.h -> platform/mbed_mem_trace.h
hal/common/mbed_rtc_time.cpp -> platform/mbed_rtc_time.cpp
hal/common/mbed_semihost_api.c -> platform/mbed_semihost_api.c
hal/api/mbed_stats.h -> platform/mbed_stats.h
hal/common/mbed_wait_api_no_rtos.c -> platform/mbed_wait_api_no_rtos.c
hal/common/mbed_wait_api_rtos.cpp -> platform/mbed_wait_api_rtos.cpp
hal/api/platform.h -> platform/platform.h
hal/common/retarget.cpp -> platform/retarget.cpp
hal/api/rtc_time.h -> platform/rtc_time.h
hal/api/semihost_api.h -> platform/semihost_api.h
hal/api/toolchain.h -> platform/toolchain.h
hal/api/wait_api.h -> platform/wait_api.h
2016-09-30 19:18:09 -05:00