RTEMS | aarch64/raspberrypi: Add Watchdog Timer driver (!120)
Kinsey Moore (@opticron)
gitlab at rtems.org
Tue Aug 6 20:04:54 UTC 2024
Kinsey Moore started a new discussion on bsps/aarch64/raspberrypi/start/watchdog.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/120#note_110576
> +int raspberrypi_watchdog_timeout;
> +
> +void raspberrypi_watchdog_init()
> +{
> + raspberrypi_watchdog_timeout = 0;
> +}
> +
> +void raspberrypi_watchdog_start(unsigned int timeout_ms)
> +{
> + double timeout_sec;
> + raspberrypi_watchdog_timeout = timeout_ms;
> +
> + timeout_sec = timeout_ms / 1000;
> +
> + PM_WDOG = BCM2711_PM_PASSWD_MAGIC |
> + ((int)(timeout_sec * 65536) & BCM2711_PM_WDOG_MASK);
I would recommend against using floating point math here since it's not necessary. Instead, you can use a uint32_t and reorder the operations such that the multiplication occurs first followed by the division. The get_remaining_time() function should also return a uint32_t utilizing similar principles.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/120#note_110576
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20240806/8ace1a98/attachment-0001.htm>
More information about the bugs
mailing list