2014-07-05 23:21:13 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* net/utils/net_dsec2tick.c
|
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2014-07-05 23:21:13 +02:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2014-07-05 23:21:13 +02:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2014-07-05 23:21:13 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <nuttx/clock.h>
|
|
|
|
|
2020-01-30 09:07:19 +01:00
|
|
|
#include "utils/utils.h"
|
|
|
|
|
2014-07-05 23:21:13 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: net_dsec2tick
|
2014-07-05 23:21:13 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Convert a decisecond value to a system clock ticks. Used by IGMP logic.
|
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2014-07-05 23:21:13 +02:00
|
|
|
* dsec The decisecond value to convert
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* The decisecond value expressed as system clock ticks
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-01-30 09:07:19 +01:00
|
|
|
unsigned int net_dsec2tick(int dsec)
|
2014-07-05 23:21:13 +02:00
|
|
|
{
|
|
|
|
/* Convert the deci-second comparison value to clock ticks. The CLK_TCK
|
|
|
|
* value is the number of clock ticks per second; decisecs argument is the
|
|
|
|
* maximum delay in 100's of milliseconds. CLK_TCK/10 is then the number
|
|
|
|
* of clock ticks in 100 milliseconds.
|
|
|
|
*/
|
|
|
|
|
|
|
|
return CLK_TCK * dsec / 10;
|
|
|
|
}
|