Commit Graph

495 Commits (ec839f0931a69bb22566188f9477cfc3f6adb97e)

Author SHA1 Message Date
Veijo Pesonen 399aabad2e USBMSD: Fixes compiler warnings 2020-01-31 10:37:18 +02:00
Anna Bridge cb53825874
Merge pull request #12282 from mprse/fix_for_issue_12268
Fix for issue #12268 (SerialBase.cpp: fix initialization list)
2020-01-23 11:48:58 +00:00
Anna Bridge 80fe861f1d
Merge pull request #12035 from kjbracey-arm/callback_prep
Preparation for Callback changes
2020-01-21 11:50:43 +00:00
Przemyslaw Stekiel f4af0516f4 SerialBase.cpp: fix compiler warnings by updating the initialization list 2020-01-20 11:03:51 +01:00
Martin Kojtal 18c941cc84
Merge pull request #12207 from hugueskamba/hk-add-buffered_serial
Add BufferedSerial class to replace UARTSerial
2020-01-16 10:06:22 +00:00
Hugues Kamba a74ffacf81 Remove usage of UARTSerial in Mbed OS Core diretories
Replace with BufferedSerial as UARTSerial has been deprecated.
2020-01-13 13:20:57 +00:00
Hugues Kamba 5fa76279ef Mark `UARTSerial` as deprecated 2020-01-13 13:20:57 +00:00
Hugues Kamba 18f677e91c Implement the BufferedSerial class to replace UARTSerial
`BufferedSerial` is `UARTSerial` renamed to convey the original purpose
of the class.
2020-01-13 13:20:57 +00:00
Kevin Bracey 8b02c4ed1c Add missing <string.h> includes 2020-01-09 14:52:54 +02:00
Kevin Bracey d6a48b5124 Turn NULLs into nullptr
Avoids overload problems with Callback(nullptr) versus Callback(fnptr).
2020-01-09 14:52:54 +02:00
Kevin Bracey ccd2a32ad1 MbedCRC: improve default constructors
Original default constructor implementation wasn't quite working
properly; it didn't cope with the new "mode_limit" parameter.

Change mechanism so that this now works:

    MbedCRC<POLY32_BIT_ANSI_CRC, 32, CrcMode::TABLE> crc;
2020-01-08 13:36:17 +02:00
Kevin Bracey 094f22901f MbedCRC: handle init values better
Init values often need reflection, and use of `__RBIT` prevents constant
init being done at compile time (unless `__RBIT` uses a compiler
intrinsic, which it doesn't for GCC).

Rather than try to handle constants 0U and -1U with a special case to
avoid the RBIT, which can in turn lead to runtime bloat for nonconstant
inits, use a C++20 style is_constant_evaluated() check to switch between
C and assembly forms.

This reduces code-size for non-constant init, by eliminating a runtime
condition, and allows the bit-reversal of any constant init to happen at
compile time.
2020-01-08 13:36:17 +02:00
Kevin Bracey 04f929e85f MbedCRC.h: declare table specialisations
Clang emits warnings if it can see a declaration when it needs a
templated variable. Add declarations for the specialisations in
MbedCRC.cpp to MbedCRC.h keep it quiet.

Tighten up a little by making all `_crc_table` references conditional
on tables being configured on.
2020-01-08 13:36:17 +02:00
Martin Kojtal fab9e3b6c7
Merge pull request #12176 from OpenNuvoton/nuvoton_usbd
Nuvoton: Support usbd
2020-01-07 16:38:39 +01:00
Hugues Kamba dbaeeaf758 Replace RawSerial instances as it has been deprecated 2020-01-06 15:48:49 +00:00
cyliangtw dc55d741c0 Adjust _rx_in_progress=true in USBCDC.cpp for USB DMA auto-receive chip 2020-01-03 20:40:39 +08:00
Anna Bridge bad7baf4de
Merge pull request #12121 from hugueskamba/hk-deprecate-serial-class
Serial: Deprecate the class and promote UnbufferedSerial instead
2019-12-19 16:34:01 +00:00
Anna Bridge fb8bbb83e4
Merge pull request #11997 from kjbracey-arm/rm_fp
Remove deprecated FunctionPointer class
2019-12-19 16:32:46 +00:00
Hugues Kamba 79054f154a Serial: Deprecate the class and promote UnbufferedSerial instead 2019-12-18 10:59:26 +00:00
Przemysław Gąsior eee46665d2 Fixed Serial ambiguity for enable_input and output 2019-12-16 15:01:28 +01:00
Anna Bridge d128ff4882
Merge pull request #11961 from hugueskamba/hk-add-unbuffered-serial-class
UnbufferedSerial: Introduce the class to replace RawSerial
2019-12-13 15:54:40 +00:00
Hugues Kamba 7b845409a0 UnbufferedSerial: Introduce the class to replace RawSerial
* Deprecate RawSerial.
* Introduce UnbufferedSerial to provide unbuffered I/O by implementing
  with a FileHandle interface for I/O	streams.
* Add Greentea test for the UnbufferedSerial class.
2019-12-12 08:44:09 +00:00
Przemyslaw Stekiel b6c25b1421 Remove serial flow control functions from image if flow control is not used 2019-12-09 08:28:14 +01:00
Przemyslaw Stekiel 160342b2d0 static pin-map - patch for SerialBase class
Related PR:

https://github.com/ARMmbed/mbed-os/pull/10924

The above PR adds functions to disable/enable serial input/output. If both serial input and serial output are disabled, the peripheral is freed. If either serial input or serial output is re-enabled, the peripheral is reinitialized.

I missed this change while working on the static pinmap and unfortunately it has an impact on it. The reinitialization is a problem for static pinmap. Now the HAL init()/init_direct() function is called not only in the constructor (but also when re-enabling the peripheral). In the current version, even if static pinmap constructor was used to create an object (and init_direct() HAL API), when reinitialization is done it uses init() HAL API. This must be split.

If static pinmap constructor is used, then the peripheral must be always initialized using HAL init_direct() function. If regular the constructor is used, then the peripheral must be initialized using HAL init() function. The same split also must be done while setting flow control during reinitialization.
2019-12-09 08:28:13 +01:00
Kevin Bracey 60e07ef8d6 Remove deprecated FunctionPointer class 2019-12-02 15:53:47 +02:00
Kevin Bracey c67816b5ff Adjust code for MbedCRC changes
* Make mbed_error use bitwise MbedCRC call rather than local
  implementation.
* Remove use of POLY_32BIT_REV_ANSI from LittleFS.
* Move some MbedCRC instances closer to use - construction cost is
  trivial, and visibility aids compiler optimisation.
2019-12-02 14:45:37 +02:00
Kevin Bracey a995c162ac Revise MbedCRC template
* Use compile-time detection of hardware CRC capability, so unneeded
  code and tables do not go into the image.
* Add global JSON config option to allow choice between no tables,
  16-entry tables or 256-entry tables for software CRC. Default set
  to 16-entry, reducing ROM size from previous 256-entry.
* Allow manual override in template parameter to force software or
  bitwise CRC for a particular instance.
* Micro-optimisations, particularly use of `RBIT` instruction and
  optimising bitwise computation using inline assembler.

Incompatible changes:

* Remove special-case "POLY_32BIT_REV_ANSI" - users can use standard
  POLY_32BIT_ANSI, which now uses the same 16-entry tables by default,
  or can use hardware acceleration, which was disabled for
  POLY_32BIT_REV_ANSI. MbedCRC<POLY_32BIT_ANSI, 32, CrcMode::TABLE> can
  be used to force software like POLY_32BIT_REV_ANSI.
* The precomputed table for POLY_16BIT_IBM had errors - this has been
  corrected, but software CRC results will be different from the previous
  software calculation.
* < 8-bit CRC results are no longer are shifted up in the output value,
  but placed in the lowest bits, like other sizes. This means that code
  performing the SD command CRC will now need to use `(crc << 1) | 1`,
  rather than `crc | 1`.
2019-12-02 14:45:37 +02:00
Przemyslaw Stekiel b2dad08387 Change explicit pinmap to static pinmap 2019-11-28 08:32:12 +01:00
Przemyslaw Stekiel 7db99341fa Serial, QSPI: Fix style 2019-11-28 08:32:08 +01:00
Przemyslaw Stekiel 933e77414d prevent passing of temporary pinmap objects 2019-11-28 08:32:07 +01:00
Przemyslaw Stekiel 0147af8418 CAN: remove redundant loop 2019-11-28 08:32:07 +01:00
Przemyslaw Stekiel ef8a99472a QSPI: Add pointer to HAL init function 2019-11-28 08:32:07 +01:00
Przemyslaw Stekiel 0cf9b1ef75 QSPI: Add explicit pinmap support 2019-11-28 08:32:04 +01:00
Przemyslaw Stekiel 655a6b896f CAN: Add explicit pinmap support 2019-11-28 08:32:03 +01:00
Przemyslaw Stekiel d75cc97d80 Explicit pinmap - fix style 2019-11-28 08:32:02 +01:00
Przemyslaw Stekiel 17c1b9a860 Fix spelling error 2019-11-28 08:32:02 +01:00
Przemyslaw Stekiel bef6854a47 Serial, SerialBase, UARTSerial: Add explicit pinmap support 2019-11-28 08:32:00 +01:00
Przemyslaw Stekiel 80b46769aa I2C: Add explicit pinmap support 2019-11-28 08:31:59 +01:00
Przemyslaw Stekiel bbd90b604b AnalogOut: Add explicit pinmap support 2019-11-28 08:31:58 +01:00
Przemyslaw Stekiel bfe19ad170 AnalogIn: Add explicit pinmap support 2019-11-28 08:31:57 +01:00
Przemyslaw Stekiel db5c5b5fb0 PwmOut: Add explicit pinmap support 2019-11-28 08:31:57 +01:00
Przemyslaw Stekiel 3a38c6bae0 SPISlave: Add explicit pinmap support 2019-11-28 08:31:56 +01:00
Przemyslaw Stekiel beec0f1e84 SPI: Add explicit pinmap support 2019-11-28 08:31:56 +01:00
Martin Kojtal 5f7ecea00b
Revert "MbedCRC and CRC HAL revisions" 2019-11-26 13:45:37 +00:00
Kevin Bracey 8811972201 Adjust code for MbedCRC changes
* Make mbed_error use bitwise MbedCRC call rather than local
  implementation.
* Remove use of POLY_32BIT_REV_ANSI from LittleFS.
* Move some MbedCRC instances closer to use - construction cost is
  trivial, and visibility aids compiler optimisation.
2019-11-13 14:31:49 +02:00
Kevin Bracey 3939c992d4 Revise MbedCRC template
* Use compile-time detection of hardware CRC capability, so unneeded
  code and tables do not go into the image.
* Add global JSON config option to allow choice between no tables,
  16-entry tables or 256-entry tables for software CRC. Default set
  to 16-entry, reducing ROM size from previous 256-entry.
* Allow manual override in template parameter to force software or
  bitwise CRC for a particular instance.
* Micro-optimisations, particularly use of `RBIT` instruction and
  optimising bitwise computation using inline assembler.

Incompatible changes:

* Remove special-case "POLY_32BIT_REV_ANSI" - users can use standard
  POLY_32BIT_ANSI, which now uses the same 16-entry tables by default,
  or can use hardware acceleration, which was disabled for
  POLY_32BIT_REV_ANSI. MbedCRC<POLY_32BIT_ANSI, 32, CrcMode::TABLE> can
  be used to force software like POLY_32BIT_REV_ANSI.
* The precomputed table for POLY_16BIT_IBM had errors - this has been
  corrected, but software CRC results will be different from the previous
  software calculation.
* < 8-bit CRC results are no longer are shifted up in the output value,
  but placed in the lowest bits, like other sizes. This means that code
  performing the SD command CRC will now need to use `(crc << 1) | 1`,
  rather than `crc | 1`.
2019-11-13 14:31:49 +02:00
Martin Kojtal a73c2b1429
Merge pull request #11814 from sandeepmistry/usb-msd-mode-sense-10
USBMSD: implement MODE SENSE (10) command
2019-11-11 15:51:51 +01:00
Janne Kiiskila 916b91f13e SerialBase.h|cpp [-Wreorder] compiler warning fix
This fixes:

```
[Warning] SerialBase.h@351,22: 'mbed::SerialBase::_flow2' will be initialized after [-Wreorder]
[Warning] SerialBase.h@343,22:   'bool mbed::SerialBase::_rx_enabled' [-Wreorder]
[Warning] SerialBase.cpp@26,1:   when initialized here [-Wreorder]

```

by using C++11 style initializer for SerialBase

Kudos to Kevin Bracey, as her his suggestion - we can drop the initializer
list if we just set the values directly in the SerialBase.h. No need to
worry about the "right order" after that.
2019-11-08 11:20:47 +02:00
Sandeep Mistry c7d9d0af46 USBMSD: implement MODE SENSE (10) command 2019-11-05 11:17:40 -05:00
Martin Kojtal f560e7960a
Merge pull request #11641 from hugueskamba/hk-fix-deepsleep-pwmout
PmwOut: Add method to enable/disable PWM
2019-11-04 14:28:50 +01:00