On some targets with very fast counters used for us ticker (e.g. 26 MHz) tested interrupt delays provided in the ticker_timeout array may be too short (execution of the set_interrupt() function takes longer than the tested delay).
We will skip tested ticker delay if the delay is less than assumed max set_interrupt() function execution time (20 us).
Also, the test array will be extended.
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;
CRC tests failed to exercise handling of the initial and final-xor
values with respect to reflection parameters. Add tests covering this.
Expected behaviour is that the initial value is always non-reflected and
the final-xor happens after the optional output reflection.
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.
GCC 9 and sufficiently-new Clang (including ARM Compiler 6.13) give us
access to the C++20 (draft) `is_constant_evaluated` test. Allows us to
restrict code to compile-time only.
This is particularly useful when using assembler intrinsics, which the
compiler cannot optimise or compile-time evaluate. It allows us to write
something like
constexpr uint32_t reverse_bits(uint32_t x)
{
if (is_constant_evaluated(x)) {
// C code to do calculation here
return x;
} else {
// an assembler intrinsic that cannot be optimised
return __RBIT(x);
}
}
This can then be totally compile-time given a constant input.
(In this example, ultimately it would be a good idea to include this
functionality in CMSIS's GCC `__RBIT`, which needs it because GCC
requires use of assembler. Clang implements `__RBIT` as a built-in,
meaning it can already compute it at compile-time, so does not benefit.).
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.
string_to_pdp_type is only used in CellularContext classes and by having
the conversion method in CellularContext it can be used to check also
the non-standard Non-IP PDP type string.
This will optimize down the time it takes to restore the clock
settings when getting out of deep sleep.
If 48MHz is available let's use it, otherwise at least 4MHz should be
available for any MCU with MSI.
ATHandler is part of our API so header file was moved under API folder and .cpp file was moved under device/ folder
ATHandler is used in both AT and PPP mode so it has been in slightly wrong place at the beginning.
Some parts of PPP debug traces were enabled also on non-debug builds.
Now they are correctly disabled. Corrected also compiler warnings
that became visible when trace macros were flagged (if clauses without
brackets).