2014-07-06 05:21:13 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* net/utils/net_dsec2tick.c
|
|
|
|
*
|
2021-02-19 19:45:37 +08: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-06 05:21:13 +08:00
|
|
|
*
|
2021-02-19 19:45:37 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2014-07-06 05:21:13 +08:00
|
|
|
*
|
2021-02-19 19:45:37 +08: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-06 05:21:13 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <nuttx/clock.h>
|
|
|
|
|
2020-01-30 16:07:19 +08:00
|
|
|
#include "utils/utils.h"
|
|
|
|
|
2014-07-06 05:21:13 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2017-04-22 06:33:14 +08:00
|
|
|
* Name: net_dsec2tick
|
2014-07-06 05:21:13 +08:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Convert a decisecond value to a system clock ticks. Used by IGMP logic.
|
|
|
|
*
|
2018-03-13 23:52:27 +08:00
|
|
|
* Input Parameters:
|
2014-07-06 05:21:13 +08:00
|
|
|
* dsec The decisecond value to convert
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* The decisecond value expressed as system clock ticks
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-01-30 16:07:19 +08:00
|
|
|
unsigned int net_dsec2tick(int dsec)
|
2014-07-06 05:21:13 +08: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;
|
|
|
|
}
|