This is meant as a substitute for sys_clock_timeout_end_calc()
Current sys_clock_timeout_end_calc() usage opens up many bug
possibilities due to the actual timeout evaluation's open-coded nature.
Issue ##50611 is one example.
- Some users store the returned value in a signed variable, others in
an unsigned one, making the comparison with UINT64_MAX (corresponding
to K_FOREVER) wrong in the signed case.
- Some users compute the difference and store that in a signed variable
to compare against 0 which still doesn't work with K_FOREVER. And when
this difference is used as a timeout argument then the K_FOREVER
nature of the timeout is lost.
- Some users complexify their code by special-casing K_NO_WAIT and
K_FOREVER inline which is bad for both code readability and binary
size.
Let's introduce a better abstraction to deal with absolute timepoints
with an opaque type to be used with a well-defined API.
The word "timeout" was avoided in the naming on purpose as the timeout
namespace is quite crowded already and it is preferable to make a
distinction between relative time periods (timeouts) and absolute time
values (timepoints).
A few stacks are also adjusted as they were too tight on X86.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Add Atmel Pwm typedef so that when doing `Pwm * const pwm` definition
checkpatch doesn't complain about the position of the '*'. If not added,
we must define `Pwm *const pwm` to make checkpatch happy, but,
clang-format results in `Pwm * const pwm` (correct).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Add a derogation to checkpatch's 'SPACING' rule, which randomly returns
the following type of issue when STM32Cube HAL *_TypeDef are used:
-:10: ERROR:SPACING: need consistent spacing around '*' (ctx:WxV)
#10: FILE: drivers/adc/adc_stm32.c:806:
+ ADC_TypeDef *adc = config->base;
This derogation applies to all _TypDef structures defined in STM32Cube
CMSIS descriptions:
FMC_Bank1E_6_TypeDef
DMA_Channel_TypeDef
ADC_TypeDef
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
The pinctrl_soc_pin_t is used as an opaque type in pinctrl to store pin
configurations which are SoC dependent.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Add the ability to define architecture specific structures, notably
the ability to extend struct _cpu with per-CPU arch-specific stuff that
can be accessed with _current_cpu->arch.* similarly to _current->arch.*
for per-thead architecture data.
This is opt-in for architectures that want to benefit from this,
otherwise empty defaults are provided. A placeholder for ARM64 is
included to show the pattern.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This is now called z_arch_esf_t, conforming to our naming
convention.
This needs to remain a typedef due to how our offset generation
header mechanism works.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
checkpatch expects typedefs to be suffixed with _t and has different
rules when typedefs are being used as arguments of a function. This
seems to be a known issue and defining typedefs in a file resolves this
issue.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>