Commit Graph

8 Commits

Author SHA1 Message Date
Christian Mauderer
5115e6524f bsps/shared: Fix Coverity warning in MCP7940M
Fixes the following Coverity warning:

** CID 1539495:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/bsps/shared/dev/rtc/mcp7940m.c: 317 in mcp7940m_set_time()

Basically coverity warns that (buf[...] & 0x7) can't be bigger than 7.
Just remove the unnecessary comparison.
2023-08-03 07:18:37 +02:00
Christian Mauderer
38dd86355d bsps/shared: Add MCP7940M RTC driver
The MCP7940M is a I2C RTC chip. The new driver uses the dev/i2c API to
support the RTC. It is written with the intention, that the driver can
be adapted to other RTCs with a similar register layout by just
replacing the initialization function.
2023-08-01 09:24:33 +02:00
Joel Sherrill
d6ebf4067e bsps/shared/*: Change license to BSD-2
Updates #3053.
2022-06-15 12:35:18 -05:00
Sebastian Huber
523867de9d rtems: Constify rtems_task_wake_when()
Add a parameter to _TOD_Validate() to disable the validation of the
ticks member.

There are two reasons for this change.  Firstly, in
rtems_task_wake_when() was a double check for time_buffer == NULL (one
in rtems_task_wake_when() and one in _TOD_Validate()).  Secondly, the
ticks member is ignored by rtems_task_wake_when().  This was done with a
write of zero to the ticks member and thus a modification of the
user-provided structure.  Now the structure is no longer modified.
Using a mask parameter is quite efficient. You just have to load an
immediate value and there are no additional branches in _TOD_Validate().

Close #4406.
2021-05-12 21:25:37 +02:00
Frank Kühndel
3af2dc7802 _TOD_Validate(): Fix incorrect return code
This patch fixes bug #4403. Directives

* rtems_timer_fire_when()
* rtems_timer_server_fire_when()
* rtems_task_wake_when()

are documented to return RTEMS_INVALID_ADDRESS when their time-of-day
argument is NULL. But actually they return RTEMS_INVALID_CLOCK. To fix
the issue this patch changes _TOD_Validate() to return a
status code instead of just true/false.

Close #4403
2021-05-12 06:41:10 +02:00
Sebastian Huber
9c20b987cd rtems: Add <rtems/rtems/clockimpl.h> 2020-12-02 07:45:53 +01:00
Sebastian Huber
90013f59bd bsps: Move tod.c to bsps and rename
This patch is a part of the BSP source reorganization.

Update #3285.
2018-04-16 14:56:05 +02:00
Sebastian Huber
27de4e1fb8 bsps: Move libchip to bsps
This patch is a part of the BSP source reorganization.

Update #3285.
2018-04-04 10:13:28 +02:00