[Bugfix rtems-lwip 1/4] Fix definition of portTICK_RATE_MS

Chris Johns chrisj at rtems.org
Tue Apr 2 23:58:57 UTC 2024


On 1/4/2024 9:49 am, Bernd Moessner wrote:
> The FreeRTOS define portTICK_RATE_MS must represent the time in ms
> between two system ticks.
> ---
>  rtemslwip/xilinx/xlwipopts.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rtemslwip/xilinx/xlwipopts.h b/rtemslwip/xilinx/xlwipopts.h
> index d915c3c..23b942f 100644
> --- a/rtemslwip/xilinx/xlwipopts.h
> +++ b/rtemslwip/xilinx/xlwipopts.h
> @@ -29,7 +29,7 @@
>  
>  /* These macros allow RTEMS to pretend to be FreeRTOS for Xilinx drivers */
>  #define tskIDLE_PRIORITY RTEMS_MAXIMUM_PRIORITY
> -#define portTICK_RATE_MS (rtems_clock_get_ticks_per_second() * 1000)
> +#define portTICK_RATE_MS (1000 / rtems_clock_get_ticks_per_second())

I do not know lwip but this macro is computing a constant at every location it
is used so I wonder if this could be a global value, eg:

--
extern const size_t rtems_portTICK_RATE_MS;
#define portTICK_RATE_MS rtems_portTICK_RATE_MS
--
const size_t rtems_portTICK_RATE_MS =
               (1000 / rtems_clock_get_ticks_per_second()) + 1;
--

?

Should the value be `+ 1` in case the tick is greater than 1msec?

Chris


More information about the devel mailing list