Commit Graph

482 Commits (aad53c237725c30bb68e8acee8f4e8d07a486e96)

Author SHA1 Message Date
Kevin Bracey 649856f3ff Implement enable calls in UARTSerial
Implement enable calls so that reception can be shut down to save
power without closing the device.
2019-02-22 11:01:01 +02:00
Leszek Rusinowicz 8586528ff6 Asynchronous Serial API fixes and refactoring, part 3
Updated API documentation to better explain API operation and to explicitly
point out that any event ends the operation.
2019-02-12 17:13:02 +01:00
Leszek Rusinowicz cbb84d8ad3 Asynchronous Serial API fixes and refactoring, part 2
Aborting of asynchronous operation is necessarily hazardous, as
operation can end in interrupt anywhere from the point of decision
until it is actually aborted down the abort_...() method.
Proper deep sleep unlocking requires then use of the critical
section and should be contained completely within API implementation.
2019-02-12 17:09:48 +01:00
Leszek Rusinowicz 6d648092e1 Asynchronous Serial API fixes and refactoring, part 1
1. As RX and TX flows are separate on Serial device, read and write
   functionalities should be completely separate, including any deep
   sleep locking etc.
2. User may want to use asynchronous API without a callback (especially
   for write operations), for example in a command-response scheme
   end of write operation is usually meaningless. The intuitive
   method is to submit NULL pointer for a callback. For this reason
   depending on the _callback field in determining whether the
   operation is in progress seems to be uncertain, so introduced
   additional flags for this purpose.
2019-02-12 17:04:19 +01:00
David Saada 48a3ae9636 FlashIAP driver: Add retries to erase and program operations.
Few boards may fail the write actions due to HW limitations (like critical
drivers that disable flash operations). Just retry a few times until success.
In addition, remove the redundant retries in NVStore (not needed now).
2019-01-30 16:05:27 +02:00
Przemyslaw Stekiel af02b23bf7 Fix for Issue #7308 (Deep_sleep_lock Ticker.h Issue) 2019-01-24 08:22:24 +01:00
kegilbert 70b9b753db Add doxygen spellcheck jobs to Travis
Currently tests
    - drivers
    - platform
    - rtos
    - events
    - features/netsocket
2019-01-11 10:22:15 -06:00
Martin Kojtal ab1c2be997
Merge pull request #8957 from InfernoEmbedded/fix-8913
Fix incorrect #ifdefs on DEVICE_FOO macros
2018-12-20 10:52:06 +00:00
Alastair D'Silva 2617c5d55b Don't use define checks on DEVICE_FOO macros (mbed code)
The DEVICE_FOO macros are always defined (either 0 or 1).

This patch replaces any instances of a define check on a DEVICE_FOO
macro with value test instead.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
2018-12-20 10:16:42 +11:00
Alastair D'Silva 24dbfb6b09 Remove #ifdefs for DEVICE_SERIAL & friends
DEVICE_SERIAL is always defined (either 0 or 1).
Remove the faulty checks introduces in commit
26b9a1f6a3 and replace them with
value checks as originally implemented.

Fixes #8913

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
2018-12-20 09:42:02 +11:00
David Saada f3bac3451c Fix FLASHIAP_ROM_END macro for GCC_ARM & IAR toolchains
- Consider data section in GCC_ARM toolchain
- Consider init_array section in IAR toolchain
- Rename macro to FLASHIAP_APP_ROM_END_ADDR for clarity sake
2018-12-19 12:05:08 +02:00
embeddedteam103 0210cefa9e Add unsigned everywhere in the driver for
compatibility with the CAN HAL
2018-12-17 16:49:17 +02:00
Martin Kojtal aec8bb6046 drivers: add spdx license 2018-11-28 10:39:50 +00:00
Russ Butler caa7b93921 Rename lock functions and classes
Invert the name of the lock functions and classes so you are not
locking a negative.
2018-11-27 09:29:32 +00:00
Russ Butler 58ed5c2f7d Change MPU lock name for readability in FlashIAP
Change the variable names in FlashIAP from
'xn' to 'make_ram_executable' and from 'wn' to 'make_rom_writable' to
make the code more readable.
2018-11-27 09:29:32 +00:00
Russ Butler 1821d37621 Overhaul MPU for new requirements
Make the following changes:
-Allow a vector specific ARM MPU driver by defining MBED_MPU_CUSTOM
-Allow ROM address to be configured for ARMv7-M devices by
    setting the define MBED_MPU_ROM_END
-Add ROM write protection
    -Add new functions and lock
    -enable at boot
    -disable during flash programming
2018-11-27 09:29:32 +00:00
Russ Butler d27566c955 Rename MpuXnLock
Rename MpuXnLock  to ScopedMpuXnLock so it has the same naming
convention as ScopedMutexLock. Also make this class inherit from
NonCopyable to prevent misuse.
2018-11-27 09:29:32 +00:00
Russ Butler c0ff98614a Disable the MPU when flashing
When programming flash using the FlashIAP API allow execution from
ram. Many devices require flashing to be done from RAM.

Also allow execution from ram when running the low level flash tests.
2018-11-27 09:29:31 +00:00
Martin Kojtal 9aef9d3661
Merge pull request #8671 from mray19027/uart_break
Feature: Add non-blocking serial break/unbreak functions
2018-11-19 13:14:55 +00:00
Martin Kojtal fbdbffffb9 drivers: fix coding style for doxygen 2018-11-15 07:20:11 +00:00
Michael Ray b7559e315c Feature: Added non-blocking serial break/unbreak functions
Current serial implementation has a send_break() command which
sends a break command on the UART for a fixed amount of time.

Added functions to allow users to send a break in a non-blocking
fashion, as well as for a user-specified amount of time.
2018-11-13 12:46:05 -06:00
Deepika a21a4224c5 Docs update in platform folder
1. Remove protected member functions and protected attributes from rendering
   on docs site
2. Update BusInOut doxygen
2018-11-08 17:31:11 -06:00
David Saada 542744d03c Support erase value in Flash HAL drivers, FlashIAP and block devices 2018-11-07 14:23:07 +02:00
Cruz Monrreal 5549c52da2
Merge pull request #8606 from pea-pod/fix-bus-oboe
Fix off-by-one-error in BusIn/Out
2018-11-06 13:43:27 -06:00
William Kelly III 74f72597a8 Fix off-by-one-error in BusIn/Out 2018-10-31 12:28:53 -05:00
Kevin Bracey 3da44f67ce Add format checking to RawSerial::printf 2018-10-31 15:36:32 +02:00
kegilbert e8e9076662 Fix typos in Drivers doxygen 2018-10-30 15:04:54 -05:00
Russ Butler 3b970c179f Move #endif to fix PwmOut.h doxygen
Move the #endif up so it does not include the closing bracket of
PwmOut. This allows the doxygen for PwmOut, classmbed_1_1_pwm_out.html,
to build.
2018-10-29 10:52:30 -05:00
Cruz Monrreal II b364dcb48e Merge branch 'doc-fix-spi' of ssh://github.com/paul-szczepanek-arm/mbed-os into rollup 2018-10-26 11:43:01 -05:00
Mel W fae81b698b
One more missing period. 2018-10-26 10:45:38 +03:00
Mel W 782251a089
Adding periods 2018-10-26 10:45:05 +03:00
Cruz Monrreal II ec9404a32e Merge branch 'fix_doxygen_MBedCRC' of ssh://github.com/maciejbocianski/mbed-os into rollup 2018-10-25 21:49:45 -05:00
Christopher Haster fa09fff283 Fix interleaved ifdefs with DEVICE_SPI_ASYNCH + DOXYGEN_ONLY 2018-10-25 11:33:17 -05:00
Paul Szczepanek 889a98e4f5
Update SPI.h 2018-10-25 11:34:30 +01:00
Martin Kojtal e9f98906d7 crc: fix crc mode coding style 2018-10-25 09:58:17 +01:00
paul-szczepanek-arm efdcdd5450 active voice 2018-10-24 09:56:53 +01:00
paul-szczepanek-arm d4b6fdc1ec SPI capitalisation 2018-10-24 09:26:10 +01:00
paul-szczepanek-arm 68628c1178 fix syntax err from misplaced ifdef 2018-10-24 08:49:07 +01:00
Maciej Bocianski 394df128fb MbedCRC doxygen fix 2018-10-24 09:33:37 +02:00
Cruz Monrreal II 0e2983e539 Merge branch 'doc-fix-i2c_slave' of ssh://github.com/paul-szczepanek-arm/mbed-os into rollup 2018-10-23 22:38:33 -05:00
Cruz Monrreal II 2274fc8bc1 Merge branch 'doc-fix-spi_slave' of ssh://github.com/paul-szczepanek-arm/mbed-os into rollup 2018-10-23 22:38:32 -05:00
paul-szczepanek-arm 263f067da4 imperative 2018-10-23 17:32:03 +01:00
paul-szczepanek-arm 482f2b6d07 spi doxygen fixes 2018-10-23 17:26:38 +01:00
Amanda Butler 7637c61d9d
Edit SPISlave.h
Make minor edits to existing text.
2018-10-23 09:20:22 -05:00
Amanda Butler 7fa3a44cc3
Copy edit I2CSlave.h
Make minor copy edits.
2018-10-23 09:13:52 -05:00
paul-szczepanek-arm f9ae6a37b1 hide protected 2018-10-23 14:49:37 +01:00
paul-szczepanek-arm 68929ce94b doxygen cleanup 2018-10-23 14:47:25 +01:00
paul-szczepanek-arm 52a0b649bc fix documentation and example 2018-10-23 12:03:59 +01:00
Thomas Kemmer fdc675441a Clean up UARTSerial.cpp includes. 2018-10-21 15:35:40 +02:00
Cruz Monrreal II 660bc2d446 Merge branch 'doc_fix_pwm' of ssh://github.com/TacoGrandeTX/mbed-os into rollup 2018-10-18 20:01:39 -05:00
Cruz Monrreal II 9cd5cbdb15 Merge branch 'writeathon' of ssh://github.com/yennster/mbed-os into rollup 2018-10-18 20:01:37 -05:00
Cruz Monrreal 6ce8f2fce8
Merge pull request #8421 from TacoGrandeTX/doc_fix_portout
PortOut.h: Documentation improvements only
2018-10-18 12:28:18 -05:00
Cruz Monrreal e698f0b29f
Merge pull request #8076 from kjbracey-arm/error_stderr
Error output improvements
2018-10-18 08:39:17 -05:00
Cruz Monrreal 4600c85611
Merge pull request #8442 from evva-sfw/bug/missing-define
Add missing define in drivers/SerialWireOutput.h
2018-10-17 09:33:18 -05:00
Kevin Bracey c989845d5a mbed_error_vfprintf -> mbed_error_vprintf
Name vfprintf doesn't make sense - if we have mbed_error_printf, this is
vprintf.
2018-10-17 12:55:20 +03:00
Kevin Bracey 1094c08129 Add support for UARTSerial::write from critical section 2018-10-17 12:55:20 +03:00
Cruz Monrreal 996a31f9d8
Merge pull request #8419 from TacoGrandeTX/doc_fix_portin
PortIn.h: Documentation improvements only
2018-10-16 16:18:50 -05:00
welaZat 88f30ccbbb Added missing define in drivers/SerialWireOutput.h 2018-10-16 14:11:15 +02:00
Jenny Plunkett 383798b525 Revert "Remove note about Stream/Serial deprecation"
This reverts commit 5ee5b071ab.
2018-10-15 14:42:45 -05:00
Cruz Monrreal ec03df4823
Merge pull request #7980 from kjbracey-arm/thread_deprecations
Clean up rtos::Thread deprecation warnings
2018-10-15 10:09:55 -05:00
Cruz Monrreal e0e915f5db
Merge pull request #8423 from cmonr/rollup2
Rollup PR: Additional doc PRs + lingering need:CI PRs
2018-10-15 10:04:04 -05:00
Cruz Monrreal II 46e4cb2b9d Merge branch 'doxy-rm-protected' of ssh://github.com/ARMmbed/mbed-os into ARMmbed-doxy-rm-protected 2018-10-12 21:46:57 -05:00
RFulchiero 7ea75edc7c PortOut.h: Documentation improvements only
* Improve function and parameter descriptions
2018-10-12 17:11:06 -05:00
RFulchiero bdcf24b82f PortIn.h: Documentation improvements only
* Improve function and parameter descriptions
* Improve clarity of the example
2018-10-12 16:14:32 -05:00
kegilbert e51169e3c8 Remove protected members from doxy in Analog/Digital classes
- Add example snippets to Analog/Digital read/write overrides
2018-10-12 15:08:51 -05:00
Amanda Butler 19472ff154
Copy edit I2C.h
Edit existing text.
2018-10-12 14:56:01 -05:00
Naveen Kaje 19c91081c6 I2C.h: Update documentation, example and formatting
Change the example to a more elaborate implementation.
Fix formatting and update documentation.
2018-10-12 13:50:53 -05:00
Jenny Plunkett b31bc766e6
Add note about default baud rate is 9600 2018-10-12 13:40:23 -05:00
Jenny Plunkett 5ee5b071ab Remove note about Stream/Serial deprecation 2018-10-12 13:22:49 -05:00
Jenny Plunkett 9a7f359ab5 Add (Not Connected) 2018-10-12 13:22:14 -05:00
RFulchiero a6a2852f13 Documentation improvements only
- Prevent protected attributes from appearing on docs site.
- Standardize units of time (microsecond, millisecond).
- Improve example description.
2018-10-12 13:21:18 -05:00
Jenny Plunkett 20f913a06e Remove Serial protected member functions and attributes 2018-10-12 13:20:02 -05:00
Jenny Plunkett 84dad6ce53 Remove RawSerial protected member functions 2018-10-12 13:18:11 -05:00
Naveen Kaje acabbebdb4 I2C.h: Remove protected attributes from appearing on docs site 2018-10-12 12:08:09 -05:00
Cruz Monrreal II 9489972a3e Merge branch 'timer_doc_update' of ssh://github.com/naveenkaje/mbed-os into naveenkaje-timer_doc_update 2018-10-12 12:07:25 -05:00
Cruz Monrreal II bfc3c95905 Merge branch 'ticker_doc' of ssh://github.com/aashishc1988/mbed-os into aashishc1988-ticker_doc 2018-10-12 12:07:19 -05:00
Cruz Monrreal II 8ebfafe60d Merge branch 'interruptin_doc_update' of ssh://github.com/naveenkaje/mbed-os into naveenkaje-interruptin_doc_update 2018-10-12 12:07:17 -05:00
Cruz Monrreal II b7e022d659 Merge branch 'kegilbert-patch-1' of ssh://github.com/ARMmbed/mbed-os into ARMmbed-kegilbert-patch-1 2018-10-12 12:07:14 -05:00
Cruz Monrreal II b480a892b0 Merge branch 'doc_updates' of ssh://github.com/deepikabhavnani/mbed-os into deepikabhavnani-doc_updates 2018-10-12 12:07:12 -05:00
Amanda Butler 985cd70243
Edit InterruptIn.h
Make minor grammar edits.
2018-10-12 11:19:34 -05:00
Amanda Butler be4985e87e
Edit Ticker.h
Make minor copy edits to existing text.
2018-10-12 11:16:32 -05:00
Amanda Butler 648eb39f74
Copy edit Timer.h
Copy edit existing text for minor grammar issues.
2018-10-12 11:01:11 -05:00
Aashish chaddha a9ce00bb4d fixed a mistake where I was adding "can not supprted" error at wrong place 2018-10-12 10:16:32 -05:00
Naveen Kaje 615ae0b2ec Timer.h: Update comments 2018-10-12 10:09:36 -05:00
Aashish chaddha f0a4451054 fix critical bug where I was hiding a lot more class members than i should. Add "CAN_NOT_SUPPORTED" guard to header instead of example 2018-10-12 10:01:38 -05:00
Naveen Kaje feb3833e4b Timer.h: Remove protected attributes from rendering on docs site 2018-10-12 09:51:53 -05:00
Kevin Bracey 1ef213ec89 Clean up Thread deprecation warnings
Static Thread methods and signal methods have been deprecated. Remove
all references in the main code, and most of the tests. Some tests of
the deprecated APIs themselves remain.
2018-10-12 14:57:13 +03:00
Aashish chaddha a92066858b improve ticker doc 2018-10-11 17:05:35 -05:00
Naveen Kaje 3ab4f76d4c InterruptIn.h: Update comments 2018-10-11 16:40:18 -05:00
Naveen Kaje 0235838be8 InterruptIn: Remove protected attributes from rendering on docs site 2018-10-11 16:18:09 -05:00
Kevin Gilbert a28d1c0cfc
Fix minor typo 2018-10-11 15:17:27 -05:00
deepikabhavnani 7b7576feb2 Correct the param descritions of QSPI 2018-10-11 14:41:18 -05:00
Aashish chaddha 21136cafcc improve can documentation 2018-10-11 12:39:46 -05:00
deepikabhavnani 1918904e91 QSPI: Remove protected member functions from rendering on docs site, but keep them in the code. 2018-10-11 10:12:39 -05:00
Cruz Monrreal fd4f47d18f
Merge pull request #8109 from deepikabhavnani/i2c_recovery
Add reset recovery for I2C bus
2018-10-08 10:27:04 -05:00
Martin Kojtal ea2dec01be
Merge pull request #8090 from deepikabhavnani/spi_4969
Cleanup SPI constructor and destructor
2018-10-05 11:17:56 +02:00
Martin Kojtal 9b0e5346cc
Merge pull request #7975 from tkem/fix/timer-read-range
Use high resolution time for Timer::read().
2018-10-01 11:46:18 +02:00
Martin Kojtal 3d94fb889b
Merge pull request #7903 from tkem/fix/cleanup-include-paths
Clean up include paths.
2018-09-19 12:16:09 +02:00
deepikabhavnani 0ef5d92d92 Addressed review comments 2018-09-14 10:26:03 -05:00
deepikabhavnani 0a9ff20658 Cleanup SPI constructor and add destructor
_acquire() is not required in constructor, since we are not performing
any operation on SPI bus yet. Just initialize the pins/hw

Destructor is required to clear _owner else SPI format/frequency will not be
set if object is recreated. We do not free SPI bus, but init again in hardware
may or may not change frequency/format.

```
{
    SPI spi1(...);
    spi1.transfer(...);
}
{
    SPI spi1(...);
    spi1.transfer(...);
}
```
2018-09-12 17:22:30 -05:00
Deepika ccb08a3fa1 Added reset recovery for I2C
Hardware Reset API should do the recovery of I2C bus,
but in absence of reset pin connected to slave device we need
software recovery of I2C bus.
2018-09-12 16:36:12 -05:00
Martin Kojtal acb59c4538
Merge pull request #7991 from maciejbocianski/qspi_driver_docs_fix
fix example code in QSPI.h
2018-09-07 10:47:42 +02:00
Cruz Monrreal 2ec889f580
Merge pull request #8015 from maciejbocianski/qspi_driver_fixes
QSPI driver: API parameters fix
2018-09-06 17:07:34 -05:00
Maciej Bocianski 99be98c8d0 QSPI driver: API parameters fix 2018-09-06 09:00:09 +02:00
Maciej Bocianski ff9ef2bbb9 fix example code in QSPI.h 2018-09-05 15:43:29 +02:00
Thomas Kemmer 9c4ec9cfae Use high resolution time for Timer::read(). 2018-09-03 20:54:27 +02:00
Christopher Haster 43651dfcdf
CRC: Removed assertion on NULL buffer
When length is zero, the buffer is not accessed. The CRC functions are used
inside several other layers where a 0-length buffer may have meanings in
different contexts and being able to pass 0-length NULL buffers to CRC as a
noop simplifies the code.
2018-09-03 09:20:47 -05:00
Deepika 4d7fdfc2a9 Use MbedCRC for LittleFS (0xEDB88320)
CRC used in LittleFS is Reversed ANSI, hence new polynomial added.
Reversed polynomials perform shift in reverse direction of standard
polynomial, and we do not have option to notify reverse shift to hardware.
Hence this option is available in software only.
2018-09-02 15:25:40 -05:00
Cruz Monrreal 1e3e69463f
Merge pull request #7781 from deepikabhavnani/crc_safety
Add thread safety to CRC class
2018-08-29 15:42:23 -05:00
Cruz Monrreal 3f5cd54948
Merge pull request #7891 from tkem/fix/remove-unnnecessary-includes
Remove unused cmsis includes.
2018-08-28 09:09:15 -05:00
Thomas Kemmer a16c374725 Clean up include paths. 2018-08-27 20:47:19 +02:00
Cruz Monrreal e2409bfdfe
Merge pull request #7848 from aashishc1988/CanMessengerBug
Message ID in CAN constructor needs to be unsigned
2018-08-27 10:29:15 -05:00
Thomas Kemmer 59ce33f7e8 Remove unused cmsis includes. 2018-08-25 23:57:16 +02:00
Maciej Bocianski 883ea2f1d1 astyle fixes on QSPI API/driver/tests 2018-08-22 15:02:15 +02:00
Maciej Bocianski ad49388888 QSPI driver: fixes after PR 7783 review
- make QSPI::lock and QSPI::unlock protected
- fix QSPI::_initialize return value
- add assert on QSPI::_initialize failure
- minor comments fixes
2018-08-22 15:02:14 +02:00
adustm 0714ac350f Revert "Dummy cycles count is not an init parameter, but a command parameter."
This reverts commit f1ad089660.
2018-08-22 15:00:21 +02:00
adustm 2b234c2902 Move _mode from QSPI::configure_format to QSPI::QSPI
QSPI::configure_format shall not call initialize function.
This way, QSPI::configure_format can be called any time,
only to change the format of commands.
It must contain only parameters for the commands, not for the Init function
2018-08-22 15:00:20 +02:00
adustm 8d2f426d97 Dummy cycles count is not an init parameter, but a command parameter.
It can change depending on the chosen command, not only at start.
This way we avoid to launch init function and break the internal status variables.
2018-08-22 15:00:19 +02:00
Martin Kojtal d54bac2207 QSPI: add address to command transfer 2018-08-22 15:00:18 +02:00
Martin Kojtal 41453169a0 QSPI: fix memset header file missing 2018-08-22 15:00:17 +02:00
Martin Kojtal 784c473f63 QSPI HAL: add disabled flag to format phase
If phase is being skipped, set disabled to true, otherwise false.
2018-08-22 15:00:08 +02:00
Martin Kojtal b71f2a15ea QSPI: fix alt size NONE instead 0 2018-08-22 15:00:07 +02:00
Martin Kojtal 910f1a8884 QSPI: fix driver style issues 2018-08-22 15:00:07 +02:00
Martin Kojtal 3db3364821 QSPI: fix arguments for write/read when alt is defined
Should be: instr, alt, address or inst, addr or just addr
2018-08-22 15:00:06 +02:00
Martin Kojtal 1557ce37f1 QSPI: remove spaces on empty lines 2018-08-22 15:00:05 +02:00
Martin Kojtal 0612ab2292 QSPI: remove initialize method
Not used anymore, not defined. ctor default initializes the object
2018-08-22 15:00:05 +02:00
Martin Kojtal 6274cd4597 QSPI: fix address size for build qspi command
if address is skipped, used size NONE
2018-08-22 15:00:04 +02:00
Senthil Ramakrishnan 894f8bdf9f Review fixes 2018-08-22 15:00:04 +02:00
Senthil Ramakrishnan 273cf05d92 Minor optimizations and code style fixes 2018-08-22 15:00:04 +02:00
Senthil Ramakrishnan 04ec07c017 Fix bracket placements 2018-08-22 15:00:03 +02:00
Senthil Ramakrishnan d9036865d8 Remove explicit initialize API and coding style fixes 2018-08-22 15:00:02 +02:00
Senthil Ramakrishnan 0f7cc36f69 Changing config and return definitions to adhere to HAL defs 2018-08-22 15:00:02 +02:00
Senthil Ramakrishnan 9deecacc9b Fix code style issues 2018-08-22 15:00:01 +02:00
Senthil Ramakrishnan 16d121c5d2 Review fixes and doxygen changes 2018-08-22 15:00:00 +02:00
Senthil Ramakrishnan 219d0c6e70 QSPI driver implementation 2018-08-22 15:00:00 +02:00
deepikabhavnani 986411ccb0 Add thread safety to CRC class
Thread safety is added to serialize the hardware CRC and will not
impact the software CRC.
2018-08-21 15:26:05 -05:00
Aashish chaddha c07e29bd2a The messageID for CAN constructor needs to be unsigned to avoid unnecessary implicit casting 2018-08-21 12:32:22 -05:00
deepikabhavnani 7885edb671 Template specialization didnt work after addition of default constructor
Template specialization didn't work after addition of default constructor
for unsupported polynomials. Since the argument type and count are same,
compiler always selects the default constructor.
2018-08-14 15:47:44 -05:00
Nir Sonnenschein ec4c33ca80
Merge pull request #7735 from deepikabhavnani/crc_lfs
Optimized CRC implementation - (32-bit ANSI polynomial)
2018-08-14 19:45:03 +03:00
deepikabhavnani f593555cbb Guard hardware related implementation into DEVICE_CRC 2018-08-09 17:28:19 -05:00
deepikabhavnani 531a83ebd2 Add optimized implementation of 32-bit ANSI CRC 2018-08-09 17:27:07 -05:00
David Saada 535b196ab2 FlashIAP: Add a ROM end macro 2018-08-06 15:54:10 +03:00
Kevin Bracey 0f98338153 Improve efficiency and formatting of ITM output
SerialWireOutput was outputting 1 character per 32-bit write to the
ITM stimulus port. This is inefficient, and causes processing problems
with some viewers due to them receiving 3 NUL bytes between each
desired character.

Rework to allow us to be more efficient, and eliminate those NUL bytes:

* Retain existing mbed_itm_send() and clarify it's a single 32-bit write.
* Add new mbed_itm_send_block() that is appropriate for sending
  character data, and modify SerialWireOutput to use it.
* Move "wait for FIFO ready" check to before the write, rather than
  after.

One minor correction - FIFOREADY is a single bit of the register read.
Don't interpret reserved bits.
2018-07-04 10:16:28 +03:00
Martin Kojtal 700e6df834 drivers: astyle update 2018-06-29 10:36:36 +01:00
deepikabhavnani e19f6ac4dd Suppress warning for IAR compiler as well 2018-06-19 11:36:42 -05:00
ccli8 f51d036ecd Fix mbed_crc_ctor is missing in some MbedCRC constructor
This error leaves MbedCRC/_mode uninitialized and may cause mbed-os-tests-mbed_drivers-crc/
Test SD CRC polynomials failed.
2018-06-01 09:49:33 +08:00
Bartek Szatkowski 6e9f04bf2f Rename DEVICE_LOWPOWERTIMER to DEVICE_LPTICKER
That's to match DEVICE_USTICKER.
2018-05-25 12:20:09 -05:00
Steven Cartmell d53ffb7022 HAL CRC: Fix inverted CRC mode selection 2018-05-24 17:51:49 +01:00
Steven Cartmell 8e14b5977b HAL CRC: Add bit width parameter to crc_config_t 2018-05-24 17:51:49 +01:00
Steven Cartmell e1ca2b32fc Add CRC configuration options to HAL API 2018-05-24 17:51:49 +01:00
Steven Cartmell 5847f0c975 Fix CRC class coding conventions 2018-05-24 17:51:48 +01:00
Steven Cartmell e0d98bfe2c Adapt MbedCRC class to support Hardware CRC
- Move CRC polynomial enum into HAL layer, so it's accessible from platform
  implementations

- Add enum to CRC class to indicate which mode the CRC class should use:
  HARDWARE, TABLE, or BITWISE

- Add calls to HAL Hardware CRC API to each of the compute functions when the
  class is in HARDWARE mode.

- Add missing constructor call to template constructor, and remove const from
  delegating constructor.
2018-05-24 17:50:12 +01:00
Cruz Monrreal a301db5d43
Merge pull request #6791 from kjbracey-arm/fcntl
Add POSIX fcntl flag support
2018-05-21 17:17:02 -05:00
David Saada 9cdecf4d5a FlashIAP: Fix problem of programming source buffer not aligned to uint32_t 2018-05-10 12:00:29 +03:00
Kevin Bracey 59f49e2b96 Add `is_blocking()` method to FileHandle
There was no way to check current blocking state, so no way to modify
and restore status.

Also have default FileHandle::set_blocking() used by real files return a
correct error code when asked for non-blocking, and success when asked
for blocking.

These were minor omissions that are required to implement POSIX fcntl
properly.

fixup! Add `is_blocking()` method to FileHandle
2018-05-03 15:38:33 +03:00
Paul Thompson d6c5f16fd3 Eliminate complier warning and remove superfluous call to empty()
Appears when complied with -O3 optimization level

Compile: UARTSerial.cpp
../drivers/UARTSerial.cpp: In member function 'void mbed::UARTSerial::tx_irq()':
../drivers/UARTSerial.cpp:314:31: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized]
         SerialBase::_base_putc(data);
2018-04-16 07:23:47 -07:00
Martin Kojtal 501953b1a4
Merge pull request #6442 from deepikabhavnani/crc_test
Add test for MbedCRC.h
2018-04-06 10:46:52 +02:00
Martin Kojtal 3328ecd92a
Merge pull request #6531 from SenRamakri/sen_DeprecatedFixes
Fix doxygen comments to reflect the deprecated functions
2018-04-06 10:06:31 +02:00
Russ Butler 1b58e58e1a Fix deep sleep locking for Timeout class
Detach in the Timeout::handler so deep sleep is properly unlocked.
2018-04-03 15:46:10 -05:00
Senthil Ramakrishnan 194b89cce6 Fix doxygen comments to reflect the deprecated functions 2018-04-03 14:10:39 -05:00
Deepika 331620e1d0 Default constructor for template class should be part of header file 2018-03-23 14:55:07 -05:00
Cruz Monrreal 801f27efcf
Merge pull request #6239 from bmcdonnell-ionx/interrupt-in-pin-mode
Interrupt in pin mode
2018-03-23 12:00:36 -05:00
George Beckstein d3ab5c7e59
Added SerialWireOutput to mbed namespace 2018-03-22 12:35:54 -04:00
Brendan McDonnell 8d2214fa6e linebreaks 2018-03-21 11:18:54 -04:00
Brendan McDonnell 895e19ae0f Restore single-param InterruptIn ctor, to maintain binary compatibility (for Wi-Fi drivers).
Revert "simplify InterruptIn - default parameter instead of multiple constructors"; add comment.

This reverts commit d28dbf6702.
2018-03-21 11:18:42 -04: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
Cruz Monrreal 9ddb092d43
Merge pull request #6230 from bulislaw/system_reset
Add system_reset call
2018-03-01 10:31:07 -06:00
Brendan McDonnell 087b4281f6 linebreak 2018-03-01 11:13:22 -05:00
Brendan McDonnell e4bf6c47ff add doxygen param info 2018-03-01 11:13:19 -05:00
Brendan McDonnell d28dbf6702 simplify InterruptIn - default parameter instead of multiple constructors 2018-02-28 14:42:43 -05:00
Brendan McDonnell dfa6a7aa97 factor out common function 2018-02-28 14:02:05 -05:00
Brendan McDonnell 35308c1937 overload InterruptIn constructor to allow PinMode control 2018-02-28 14:00:50 -05:00
Cruz Monrreal 3d1174a215
Merge pull request #5911 from deepikabhavnani/common_crc
CRC class implementation
2018-02-28 11:53:54 -06:00
Bartek Szatkowski 4cb47df40a Add system_reset() function to Mbed OS 2018-02-28 16:42:34 +00:00
deepikabhavnani b60eb1d001 Updated table to be const and small fixes 2018-02-27 09:35:55 -06:00
Cruz Monrreal 3d37d819e9
Merge pull request #5046 from fkjagodzinski/timerevent_tests
TimerEvent tests
2018-02-26 15:02:52 -06:00
Filip Jagodzinski 7f73785b9a Drivers: TimerEvent: Update API docs 2018-02-23 09:13:35 +01:00
David Saada 0aeeece97d FlashIAP driver modifications:
- Support programming across sectors.
- Support program size not aligned to page size.
- Fix validations on sector erase.
2018-02-22 22:48:29 +02:00
Brendan McDonnell c4f10aafee typos 2018-02-20 20:11:19 -05:00
Cruz Monrreal cd7595e5a7
Merge pull request #6076 from mprse/remove_ticker_interface_init_while_Ticker_creation
Remove ticker interface initialization while Ticker creation.
2018-02-20 13:21:20 -06:00
deepikabhavnani af0982295f Moved specialized functions to CPP file
Template specialized functions are moved to cpp file, to add MbedCRC.h
in mbed.h. Else linker shall multiple definition error.
2018-02-20 08:12:44 -06:00
Marcus Chang bbf92fdf0d Instrumented Trace Macrocell (ITM) HAL API
HAL API for initializing the ITM and setting SWO debug output.
Actual debug output implemented as SWO FileHandle.
2018-02-16 08:24:31 -08:00
Przemyslaw Stekiel 17dece407a Remove ticker interface initialization while Ticker creation.
Ticker constructor calls directly target specific ticker init function. Currently there is no problem, since ticker interface initialization functions are protected against multi-calls and simply returns if not called for the first time (interface initialization can be performed only once). According to the new Thicker HAL API requirements:
The function ticker_init allows the ticker to keep counting and disables the ticker interrupt.

Disabling interrupts while some Ticker interrupts are already scheduled for sure will destroy the schedule. Ticker interface should be initialized only once and it is already done by: static void initialize(const ticker_data_t *ticker) function in /m-bed/hal/mbed_ticker_api.c file.
2018-02-13 09:11:16 +00:00
deepikabhavnani 8e537115c5 Removed init/deinit and added cpp file for tables 2018-02-02 09:43:06 -06:00
deepikabhavnani afe8834bb8 CRC class implementation
CRC class `MbedCRC.h` is templated class created to support hardware/software
CRCs. Default CRC will be hardware CRC when support for HAL is available.

Polynomial tables are available for 8/16 bit CCITT, 7/16 bit for SD card and
32-bit ANSI. Polynomial table implementation will be used if Hardware CRC is
not available.

In case device does not have hardware CRC and polynomial table is not supported,
CRC is still available and is computed runtime bit by bit for all data input.
2018-01-24 13:26:41 -06:00
Cruz Monrreal 31f59b9fb4
Merge pull request #5721 from scartmell-arm/bug-i2c-abort-deep-sleep
Fix bug allowing I2C::abort_transfer to incorrectly unlock deep sleep mode
2018-01-11 10:30:53 -06:00
Steven Cartmell c2670870dc Fix bug allowing SPI::abort_transfer to incorrectly unlock deep sleep mode
- Add flag to SPI class to track if the SPI instance has locked deep sleep mode.
- Wrap call to sleep_manager_lock_deep_sleep to only be called if SPI instance
  hasn't already locked deep sleep.
- Wrap call to sleep_manager_unlock_deep_sleep to only be called if SPI has
  currently locked deep sleep mode.
2018-01-04 09:39:39 +00:00
Steven Cartmell 26f01d6c25 Fix bug allowing I2C::abort_transfer to incorrectly unlock deep sleep mode
- Add flag to I2C class to track if the I2C instance has locked deep sleep mode.
- Wrap call to sleep_manager_lock_deep_sleep to only be called if I2C instance
  hasn't already locked deep sleep.
- Wrap call to sleep_manager_unlock_deep_sleep to only be called if I2C has
  currently locked deep sleep mode.
2018-01-04 09:37:44 +00:00
Kevin Bracey 9678c8052e Make UARTSerial send all data when blocking
Previously, write() was somewhat soft - it only ever made one attempt to
wait for buffer space, so it would take as much data as would fit in the
buffer in one call.

This is not the intent of a POSIX 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 write to write everything, we can make applications' lives
easier - they can just do "write(large amount)" confident that it will
all go in one call (if no errors).

So, rework to make multiple writes to the buffer, blocking as necessary,
until all data is written.

This change does not apply to read(), 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
Martin Kojtal fbd9e7eaf2
Merge pull request #5372 from SenRamakri/sen_PlatformDoxygenUpdates
Doxygen comments fixes
2017-11-09 16:38:45 +00:00
Jimmy Brisson 6912a9dc0d
Merge pull request #5393 from c1728p9/call_chain_deprecation
Deprecate CallChain and InterruptManager
2017-11-02 11:10:52 -05:00
Jimmy Brisson 5768693e0d
Merge pull request #5088 from kjbracey-arm/uartserial_flow
UARTSerial: add flow control and format APIs
2017-11-02 10:37:40 -05:00
Russ Butler 8deef6a699 Deprecate InterruptManager
This patch deprecates the InterruptManager class since it is an
internal API (not in mbed.h) which is not being used anywhere in
the codebase.
2017-10-27 14:47:55 -05:00
Senthil Ramakrishnan 3ad298488c Doxygen comment updates and fixes 2017-10-26 15:36:26 -05:00
Jimmy Brisson 493e3788e3 Merge pull request #5216 from kjbracey-arm/UARTSerial_wait
Avoid wait_ms() spin
2017-10-13 09:20:41 -05:00
Jimmy Brisson 4dff32ab5a Merge pull request #5220 from c1728p9/sleep_lock_fixes
Fix deep sleep lock bugs
2017-10-05 10:03:44 -05:00
Russ Butler 32303a9130 Fix sleep lock underflow in LowPowerTimer
If a LowPowerTimer is started and then goes out of scope then a
deep sleep lock underflow can occur. This is because the
the variable '_lock_deepsleep' is checked when starting the timer
but is not checked in the destructor, which unconditionally releases
the deep sleep lock.
2017-10-02 19:32:20 -05:00
Russ Butler f854f3e6db Properly unlock sleep in destructor of drivers
Unlock sleep in CAN and SerialBase. This prevents deep sleep from
staying locked if these objects are destroyed without first clearing
the callbacks.
2017-10-02 11:35:08 -05:00
Russ Butler 87b151c8a0 Protect Ticker attach with a critical section
Add a critical section to attach_us so setting _function and
locking deep sleep are done atomically.
2017-10-02 11:35:05 -05:00
Jimmy Brisson bb61b42fba Merge pull request #5148 from mprse/fix_enable_deepsleep_for_lp_timer
Enable deepsleep for LowPowerXXX objects
2017-09-28 14:11:40 -05:00
Jimmy Brisson f7cca5b023 Merge pull request #5066 from kjbracey-arm/uartserial_readable
UARTSerial: Avoid readable() ambiguity
2017-09-28 14:08:43 -05:00
Jimmy Brisson 6177c01c92 Merge pull request #5062 from 0xc0170/fix_interruptin_callback
InterruptIn: Use NULL callback by default
2017-09-28 14:04:28 -05:00
Jimmy Brisson f57f0d4631 Merge pull request #5045 from maciejbocianski/ticker_fix
Ticker class description update - small interval warning
2017-09-28 14:01:36 -05:00
Kevin Bracey b18332cb4d Avoid wait_ms() spin
System's wait_ms() spins to achieve a precise delay - we don't want this.
Call Thread::wait directly.
2017-09-28 10:45:57 +03:00
Jimmy Brisson ddb6b66674 Merge pull request #5177 from 0xc0170/fix_pwmout_sleep
PWMOut: lock deesleep addition
2017-09-27 09:09:36 -05:00
Jimmy Brisson 8508d26ea2 Merge pull request #5095 from c1728p9/timer_sleep_lock_fix
Release deep sleep lock in destructor of Timer class
2017-09-27 09:09:07 -05:00
Martin Kojtal 5a6aee43eb PWMOut: lock deesleep addition
As PWMOut in most cases depend on high speed freq clock, it should lock deepsleep while active.
2017-09-22 15:08:02 +01:00
Martin Kojtal 26f9144c45 Merge pull request #5000 from 0xc0170/fix_flash_page_doc
flash: add note about program size
2017-09-22 11:28:54 +01:00
Przemyslaw Stekiel 10ee2fa935 Enable deepsleep for low power Ticker and low power Timer.
Fix for issue #5076.
2017-09-22 08:30:17 +02:00
Maciej Bocianski 19ee9c1b43 Ticker class description update - small interval warning 2017-09-18 11:39:06 +02:00
Russ Butler f766f7d421 Release deep sleep lock in destructor of Timer class
Release the deep sleep lock when running instances of the Timer class
are deleted. This ensures that deep sleep locks are properly released
by the Timer class.
2017-09-13 20:10:06 -05:00
Kevin Bracey c262a035f6 UARTSerial: add flow control and format APIs
Add passthrough APIs to enable the flow control and format methods from
SerialBase to be accessed.

Modify the RX data pump so it stops reading data and disables the IRQ
when the buffer is full, to allow UART automatic flow control to work.

In principle it would also be possible as a future enhancement to
provide XON/XOFF flow control, or manual RTS/CTS control using GPIO, but
this commit at least restores the functionality present in Serial,
SerialBase and RawSerial that was missing in UARTSerial.
2017-09-13 15:27:13 +03:00
Kevin Bracey 3b9f9bb564 UARTSerial: Avoid readable() ambiguity
UARTSerial inherits both FileHandle::readable() [public] and
SerialBase::readable() [private], so calling readable() on a UARTSerial
object produces an ambiguous member error.

Add using declarations to direct towards the FileHandle versions of
readable and writable.

There's currently no ambiguity for writable, as SerialBase uses the
spelling 'writeable', but add a using directive for that anyway, in case
SerialBase gains 'writable' later.
2017-09-12 11:36:57 +03:00
Martin Kojtal 78718910d3 Ticker: invoke _function only if attached 2017-09-09 20:42:57 -05:00
Martin Kojtal d3cc0038d3 InterruptIn: callback to NULL clean-up
As we can check if callback was attached, we use NULL assigment.
2017-09-09 09:48:10 +02:00
Martin Kojtal f6c34a2303 SerialBase and CAN: fix Callbacks comparision
As Callback currently does not have fully functional comparision (see #5017),
we workaround by doing null check.
2017-09-07 15:35:08 +01:00
Martin Kojtal 5b33d2583d drivers: fix attach sleep locking
attach/detach can be multiple invoked. Therefore lock/unlock deep sleep
only for the very first time it is invoked (when callbacks
are actually changed).
2017-09-07 15:35:06 +01:00
Martin Kojtal e57f0bcd26 Drivers: locking sleep fix for attach/detach
As attach provides API to change a callback, lock/unlock should
only happen if we are doing the first/last callback (start-stop).
2017-09-07 15:35:05 +01:00
Martin Kojtal e6d8a9a8a4 Drivers with interrupts: adding sleep deep locking
Any driver with attach or async API should be considered for deep sleep.

Add locking to those that require in most cases
high-frequency clocks:

- CAN
- I2C
- SPI
- Serial
- Ticker/Timeout/Timer
2017-09-07 15:35:05 +01:00
Martin Kojtal 3f58d3ef48 flash: add note about program size
Program size - the writable page size that flash controller supports.
Plus fix program page description - multiple pages program
2017-09-06 07:54:18 +01:00
Steve Cartmell cdca13798b Fix compiler warning for deprecated function call
Replaced the deprecated function call .attach() with an assignment
2017-08-14 12:10:31 +01:00
Jimmy Brisson 1f94ede86c Merge pull request #4744 from deepikabhavnani/spi_issue_4743
Allow user to set default transfer byte for block read
2017-07-24 14:45:30 -05:00
Jimmy Brisson c1e455c594 Merge pull request #4615 from u-blox/uart_serial_set_baud
Add set_baud() method to UARTSerial().
2017-07-24 10:50:43 -05:00
Deepika 1b797e9081 Closed review comments
1. Doxygen and Grammar related
2. Change dummy to spi_fill
3. Remove NXP driver and add default loop in spi block read (same as all
other drivers)
2017-07-21 09:46:22 -05:00
Deepika fd43405ffe Allow user to set dummy tranfer byte for block read 2017-07-11 15:46:32 -05:00
Jimmy Brisson efc5c47e55 Merge pull request #4720 from marcuschangarm/flashiap_read
FlashIAP: Add explicit read function to flash_api.h
2017-07-07 17:47:49 -05:00
Anna Bridge 4890261c98 Merge pull request #4548 from deepikabhavnani/os_warn
Resolve Warnings for mbed-os-examples
2017-07-07 12:43:27 +01:00
Anna Bridge 28df3aeb87 Merge pull request #4635 from deepikabhavnani/spi_acquire
_acquire() function added & removed duplication in format/freq calls
2017-07-07 12:41:34 +01:00
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