mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 03:05:40 +08:00
Update to use 64-bit timer when available
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* drivers/mmcsd/mmcsd_sdio.c
|
* drivers/mmcsd/mmcsd_sdio.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009-2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2009-2013, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -1120,10 +1120,10 @@ static int mmcsd_eventwait(FAR struct mmcsd_state_s *priv,
|
|||||||
|
|
||||||
static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
|
static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
|
||||||
{
|
{
|
||||||
uint32_t starttime;
|
systime_t starttime;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
uint32_t r1;
|
uint32_t r1;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* First, check if the card has been removed. */
|
/* First, check if the card has been removed. */
|
||||||
|
|
||||||
@@ -2714,9 +2714,9 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
|
|||||||
static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
|
static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
|
||||||
{
|
{
|
||||||
uint32_t response;
|
uint32_t response;
|
||||||
uint32_t start;
|
|
||||||
uint32_t elapsed;
|
|
||||||
uint32_t sdcapacity = MMCSD_ACMD41_STDCAPACITY;
|
uint32_t sdcapacity = MMCSD_ACMD41_STDCAPACITY;
|
||||||
|
systime_t start;
|
||||||
|
systime_t elapsed;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Assume failure to identify the card */
|
/* Assume failure to identify the card */
|
||||||
|
|||||||
@@ -443,8 +443,8 @@ static int mmcsd_waitready(FAR struct mmcsd_slot_s *slot)
|
|||||||
{
|
{
|
||||||
FAR struct spi_dev_s *spi = slot->spi;
|
FAR struct spi_dev_s *spi = slot->spi;
|
||||||
uint8_t response;
|
uint8_t response;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
|
|
||||||
/* Wait until the card is no longer busy (up to 500MS) */
|
/* Wait until the card is no longer busy (up to 500MS) */
|
||||||
|
|
||||||
@@ -548,8 +548,8 @@ static uint32_t mmcsd_sendcmd(FAR struct mmcsd_slot_s *slot,
|
|||||||
case MMCSD_CMDRESP_R1B:
|
case MMCSD_CMDRESP_R1B:
|
||||||
{
|
{
|
||||||
uint32_t busy = 0;
|
uint32_t busy = 0;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
|
|
||||||
start = START_TIME;
|
start = START_TIME;
|
||||||
do
|
do
|
||||||
@@ -963,9 +963,9 @@ static int mmcsd_recvblock(FAR struct mmcsd_slot_s *slot, uint8_t *buffer,
|
|||||||
int nbytes)
|
int nbytes)
|
||||||
{
|
{
|
||||||
FAR struct spi_dev_s *spi = slot->spi;
|
FAR struct spi_dev_s *spi = slot->spi;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
uint8_t token;
|
uint8_t token;
|
||||||
|
|
||||||
/* Wait up to the maximum to receive a valid data token. taccess is the
|
/* Wait up to the maximum to receive a valid data token. taccess is the
|
||||||
* time from when the command is sent until the first byte of data is
|
* time from when the command is sent until the first byte of data is
|
||||||
@@ -1579,8 +1579,8 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
|
|||||||
FAR struct spi_dev_s *spi = slot->spi;
|
FAR struct spi_dev_s *spi = slot->spi;
|
||||||
uint8_t csd[16];
|
uint8_t csd[16];
|
||||||
uint32_t result = MMCSD_SPIR1_IDLESTATE;
|
uint32_t result = MMCSD_SPIR1_IDLESTATE;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
|||||||
@@ -417,8 +417,8 @@ static int sst39vf_chiperase(FAR struct sst39vf_dev_s *priv)
|
|||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
struct sst39vf_wrinfo_s wrinfo;
|
struct sst39vf_wrinfo_s wrinfo;
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Send the sequence to erase the chip */
|
/* Send the sequence to erase the chip */
|
||||||
@@ -488,8 +488,8 @@ static int sst39vf_sectorerase(FAR struct sst39vf_dev_s *priv,
|
|||||||
{
|
{
|
||||||
struct sst39vf_wrinfo_s wrinfo;
|
struct sst39vf_wrinfo_s wrinfo;
|
||||||
#if 0
|
#if 0
|
||||||
uint32_t start;
|
systime_t start;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set up the sector address */
|
/* Set up the sector address */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* drivers/net/enc28j60.c
|
* drivers/net/enc28j60.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2012, 2014-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2010-2012, 2014-2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* References:
|
* References:
|
||||||
@@ -750,8 +750,8 @@ static void enc_wrbreg(FAR struct enc_driver_s *priv, uint8_t ctrlreg,
|
|||||||
static int enc_waitbreg(FAR struct enc_driver_s *priv, uint8_t ctrlreg,
|
static int enc_waitbreg(FAR struct enc_driver_s *priv, uint8_t ctrlreg,
|
||||||
uint8_t bits, uint8_t value)
|
uint8_t bits, uint8_t value)
|
||||||
{
|
{
|
||||||
uint32_t start = clock_systimer();
|
systime_t start = clock_systimer();
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
uint8_t rddata;
|
uint8_t rddata;
|
||||||
|
|
||||||
/* Loop until the exit condition is met */
|
/* Loop until the exit condition is met */
|
||||||
|
|||||||
@@ -679,8 +679,8 @@ static void enc_wrreg(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
|
|||||||
static int enc_waitreg(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
|
static int enc_waitreg(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
|
||||||
uint16_t bits, uint16_t value)
|
uint16_t bits, uint16_t value)
|
||||||
{
|
{
|
||||||
uint32_t start = clock_systimer();
|
systime_t start = clock_systimer();
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
uint16_t rddata;
|
uint16_t rddata;
|
||||||
|
|
||||||
/* Loop until the exit condition is met */
|
/* Loop until the exit condition is met */
|
||||||
@@ -1533,7 +1533,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
|
|||||||
arp_ipin(&priv->dev);
|
arp_ipin(&priv->dev);
|
||||||
ret = ipv4_input(&priv->dev);
|
ret = ipv4_input(&priv->dev);
|
||||||
|
|
||||||
if (ret == OK || (clock_systimer() - descr->ts) > ENC_RXTIMEOUT)
|
if (ret == OK || (clock_systimer() - (systime_t)descr->ts) > ENC_RXTIMEOUT)
|
||||||
{
|
{
|
||||||
/* If packet has been successfully processed or has timed out,
|
/* If packet has been successfully processed or has timed out,
|
||||||
* free it.
|
* free it.
|
||||||
@@ -1580,7 +1580,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
|
|||||||
|
|
||||||
ret = ipv6_input(&priv->dev);
|
ret = ipv6_input(&priv->dev);
|
||||||
|
|
||||||
if (ret == OK || (clock_systimer() - descr->ts) > ENC_RXTIMEOUT)
|
if (ret == OK || (clock_systimer() - (systime_t)descr->ts) > ENC_RXTIMEOUT)
|
||||||
{
|
{
|
||||||
/* If packet has been successfully processed or has timed out,
|
/* If packet has been successfully processed or has timed out,
|
||||||
* free it.
|
* free it.
|
||||||
@@ -1728,7 +1728,7 @@ static void enc_pktif(FAR struct enc_driver_s *priv)
|
|||||||
|
|
||||||
/* Set current timestamp */
|
/* Set current timestamp */
|
||||||
|
|
||||||
descr->ts = clock_systimer();
|
descr->ts = (uint32_t)clock_systimer();
|
||||||
|
|
||||||
/* Store the start address of the frame without the enc's header */
|
/* Store the start address of the frame without the enc's header */
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -434,8 +434,8 @@ static void slip_txtask(int argc, FAR char *argv[])
|
|||||||
FAR struct slip_driver_s *priv;
|
FAR struct slip_driver_s *priv;
|
||||||
unsigned int index = *(argv[1]) - '0';
|
unsigned int index = *(argv[1]) - '0';
|
||||||
net_lock_t flags;
|
net_lock_t flags;
|
||||||
unsigned int msec_start;
|
systime_t msec_start;
|
||||||
unsigned int msec_now;
|
systime_t msec_now;
|
||||||
unsigned int hsec;
|
unsigned int hsec;
|
||||||
|
|
||||||
ndbg("index: %d\n", index);
|
ndbg("index: %d\n", index);
|
||||||
|
|||||||
+3
-2
@@ -45,8 +45,9 @@
|
|||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include <queue.h>
|
#include <queue.h>
|
||||||
|
|
||||||
#include <nuttx/power/pm.h>
|
#include <nuttx/clock.h>
|
||||||
#include <nuttx/wqueue.h>
|
#include <nuttx/wqueue.h>
|
||||||
|
#include <nuttx/power/pm.h>
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
|
|
||||||
@@ -136,7 +137,7 @@ struct pm_global_s
|
|||||||
|
|
||||||
/* stime - The time (in ticks) at the start of the current time slice */
|
/* stime - The time (in ticks) at the start of the current time slice */
|
||||||
|
|
||||||
uint32_t stime;
|
systime_t stime;
|
||||||
|
|
||||||
/* This semaphore manages mutually exclusive access to the power management
|
/* This semaphore manages mutually exclusive access to the power management
|
||||||
* registry. It must be initialized to the value 1.
|
* registry. It must be initialized to the value 1.
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
|
|
||||||
void pm_activity(int priority)
|
void pm_activity(int priority)
|
||||||
{
|
{
|
||||||
uint32_t now;
|
systime_t now;
|
||||||
uint32_t accum;
|
uint32_t accum;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* drivers/power/pm_checkstate.c
|
* drivers/power/pm_checkstate.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011-2012, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -108,7 +108,7 @@
|
|||||||
|
|
||||||
enum pm_state_e pm_checkstate(void)
|
enum pm_state_e pm_checkstate(void)
|
||||||
{
|
{
|
||||||
uint32_t now;
|
systime_t now;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
/* Check for the end of the current time slice. This must be performed
|
/* Check for the end of the current time slice. This must be performed
|
||||||
|
|||||||
@@ -212,23 +212,16 @@ static ssize_t uptime_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
size_t linesize;
|
size_t linesize;
|
||||||
off_t offset;
|
off_t offset;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
systime ticktime;
|
||||||
#ifdef CONFIG_SYSTEM_TIME64
|
|
||||||
uint64_t ticktime;
|
|
||||||
#if !defined(CONFIG_HAVE_DOUBLE) || !defined(CONFIG_LIBC_FLOATINGPOINT)
|
|
||||||
uint64_t sec;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
uint32_t ticktime;
|
|
||||||
#if !defined(CONFIG_HAVE_DOUBLE) || !defined(CONFIG_LIBC_FLOATINGPOINT)
|
|
||||||
uint32_t sec;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CONFIG_HAVE_DOUBLE) && defined(CONFIG_LIBC_FLOATINGPOINT)
|
#if defined(CONFIG_HAVE_DOUBLE) && defined(CONFIG_LIBC_FLOATINGPOINT)
|
||||||
double now;
|
double now;
|
||||||
#else
|
#else
|
||||||
|
# if defined(CONFIG_SYSTEM_TIME64)
|
||||||
|
uint64_t sec;
|
||||||
|
# else
|
||||||
|
uint32_t sec;
|
||||||
|
# endif
|
||||||
unsigned int remainder;
|
unsigned int remainder;
|
||||||
unsigned int csec;
|
unsigned int csec;
|
||||||
#endif
|
#endif
|
||||||
@@ -249,15 +242,9 @@ static ssize_t uptime_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
|
|
||||||
if (filep->f_pos == 0)
|
if (filep->f_pos == 0)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SYSTEM_TIME64
|
/* System time */
|
||||||
/* 64-bit timer */
|
|
||||||
|
|
||||||
ticktime = clock_systimer64();
|
|
||||||
#else
|
|
||||||
/* 32-bit timer */
|
|
||||||
|
|
||||||
ticktime = clock_systimer();
|
ticktime = clock_systimer();
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CONFIG_HAVE_DOUBLE) && defined(CONFIG_LIBC_FLOATINGPOINT)
|
#if defined(CONFIG_HAVE_DOUBLE) && defined(CONFIG_LIBC_FLOATINGPOINT)
|
||||||
/* Convert the system up time to a seconds + hundredths of seconds string */
|
/* Convert the system up time to a seconds + hundredths of seconds string */
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* fs/vfs/fs_poll.c
|
* fs/vfs/fs_poll.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009, 2012-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009, 2012-2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
+33
-16
@@ -1,7 +1,8 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* include/nuttx/clock.h
|
* include/nuttx/clock.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011-2012, 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011-2012, 2014, 2016 Gregory Nutt.
|
||||||
|
All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -164,6 +165,14 @@
|
|||||||
#define TICK2DSEC(tick) (((tick)+(TICK_PER_DSEC/2))/TICK_PER_DSEC) /* Rounds */
|
#define TICK2DSEC(tick) (((tick)+(TICK_PER_DSEC/2))/TICK_PER_DSEC) /* Rounds */
|
||||||
#define TICK2SEC(tick) (((tick)+(TICK_PER_SEC/2))/TICK_PER_SEC) /* Rounds */
|
#define TICK2SEC(tick) (((tick)+(TICK_PER_SEC/2))/TICK_PER_SEC) /* Rounds */
|
||||||
|
|
||||||
|
/* Select the access to the system timer using its natural with */
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_TIME64
|
||||||
|
# define clock_systimer() clock_systimer64()
|
||||||
|
#else
|
||||||
|
# define clock_systimer() clock_systimer32()
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -177,10 +186,26 @@ struct cpuload_s
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* This type is the natural with of the system timer */
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_TIME64
|
||||||
|
typedef uint64_t systime_t;
|
||||||
|
#else
|
||||||
|
typedef uint32_t systime_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Access to raw system clock ***********************************************/
|
/* Access to raw system clock ***********************************************/
|
||||||
/* Direct access to the system timer/counter is supported only if (1) the
|
/* Direct access to the system timer/counter is supported only if (1) the
|
||||||
* system timer counter is available (i.e., we are not configured to use
|
* system timer counter is available (i.e., we are not configured to use
|
||||||
@@ -191,14 +216,14 @@ struct cpuload_s
|
|||||||
#ifdef __HAVE_KERNEL_GLOBALS
|
#ifdef __HAVE_KERNEL_GLOBALS
|
||||||
# ifdef CONFIG_SYSTEM_TIME64
|
# ifdef CONFIG_SYSTEM_TIME64
|
||||||
|
|
||||||
extern volatile uint64_t g_system_timer;
|
EXTERN volatile uint64_t g_system_timer;
|
||||||
#define clock_systimer() (uint32_t)(g_system_timer & 0x00000000ffffffff)
|
#define clock_systimer32() (uint32_t)(g_system_timer & 0x00000000ffffffff)
|
||||||
#define clock_systimer64() g_system_timer
|
#define clock_systimer64() g_system_timer
|
||||||
|
|
||||||
# else
|
# else
|
||||||
|
|
||||||
extern volatile uint32_t g_system_timer;
|
EXTERN volatile uint32_t g_system_timer;
|
||||||
#define clock_systimer() g_system_timer
|
#define clock_systimer32() g_system_timer
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@@ -207,14 +232,6 @@ extern volatile uint32_t g_system_timer;
|
|||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define EXTERN extern "C"
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#else
|
|
||||||
#define EXTERN extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: clock_synchronize
|
* Function: clock_synchronize
|
||||||
*
|
*
|
||||||
@@ -248,7 +265,7 @@ void clock_synchronize(void);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: clock_systimer
|
* Function: clock_systimer32
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return the current value of the 32-bit system timer counter. Indirect
|
* Return the current value of the 32-bit system timer counter. Indirect
|
||||||
@@ -268,9 +285,9 @@ void clock_synchronize(void);
|
|||||||
|
|
||||||
#ifndef __HAVE_KERNEL_GLOBALS
|
#ifndef __HAVE_KERNEL_GLOBALS
|
||||||
# ifdef CONFIG_SYSTEM_TIME64
|
# ifdef CONFIG_SYSTEM_TIME64
|
||||||
# define clock_systimer() (uint32_t)(clock_systimer64() & 0x00000000ffffffff)
|
# define clock_systimer32() (uint32_t)(clock_systimer64() & 0x00000000ffffffff)
|
||||||
# else
|
# else
|
||||||
uint32_t clock_systimer(void);
|
uint32_t clock_systimer32(void);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+10
-9
@@ -1,7 +1,7 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* include/nuttx/sched.h
|
* include/nuttx/sched.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -51,6 +51,7 @@
|
|||||||
#include <mqueue.h>
|
#include <mqueue.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <nuttx/clock.h>
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/wdog.h>
|
#include <nuttx/wdog.h>
|
||||||
#include <nuttx/mm/shm.h>
|
#include <nuttx/mm/shm.h>
|
||||||
@@ -273,14 +274,14 @@ struct replenishment_s
|
|||||||
|
|
||||||
struct sporadic_s
|
struct sporadic_s
|
||||||
{
|
{
|
||||||
bool suspended; /* Thread is currently suspended */
|
bool suspended; /* Thread is currently suspended */
|
||||||
uint8_t hi_priority; /* Sporadic high priority */
|
uint8_t hi_priority; /* Sporadic high priority */
|
||||||
uint8_t low_priority; /* Sporadic low priority */
|
uint8_t low_priority; /* Sporadic low priority */
|
||||||
uint8_t max_repl; /* Maximum number of replenishments */
|
uint8_t max_repl; /* Maximum number of replenishments */
|
||||||
uint8_t nrepls; /* Number of active replenishments */
|
uint8_t nrepls; /* Number of active replenishments */
|
||||||
uint32_t repl_period; /* Sporadic replenishment period */
|
uint32_t repl_period; /* Sporadic replenishment period */
|
||||||
uint32_t budget; /* Sporadic execution budget period */
|
uint32_t budget; /* Sporadic execution budget period */
|
||||||
uint32_t eventtime; /* Time thread suspended or [re-]started */
|
systime_t eventtime; /* Time thread suspended or [re-]started */
|
||||||
|
|
||||||
/* This is the last interval timer activated */
|
/* This is the last interval timer activated */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* include/nuttx/semaphore.h
|
* include/nuttx/semaphore.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
|
|
||||||
|
#include <nuttx/clock.h>
|
||||||
#include <nuttx/fs/fs.h>
|
#include <nuttx/fs/fs.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -110,7 +111,7 @@ extern "C"
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sem_tickwait(FAR sem_t *sem, uint32_t start, uint32_t delay);
|
int sem_tickwait(FAR sem_t *sem, systime_t start, uint32_t delay);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -47,6 +47,8 @@
|
|||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include <queue.h>
|
#include <queue.h>
|
||||||
|
|
||||||
|
#include <nuttx/clock.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -290,8 +292,8 @@ struct work_s
|
|||||||
struct dq_entry_s dq; /* Implements a doubly linked list */
|
struct dq_entry_s dq; /* Implements a doubly linked list */
|
||||||
worker_t worker; /* Work callback */
|
worker_t worker; /* Work callback */
|
||||||
FAR void *arg; /* Callback argument */
|
FAR void *arg; /* Callback argument */
|
||||||
uint32_t qtime; /* Time work queued */
|
systime_t qtime; /* Time work queued */
|
||||||
uint32_t delay; /* Delay until work performed */
|
systime_t delay; /* Delay until work performed */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -359,7 +361,7 @@ int work_usrstart(void);
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int work_queue(int qid, FAR struct work_s *work, worker_t worker,
|
int work_queue(int qid, FAR struct work_s *work, worker_t worker,
|
||||||
FAR void *arg, uint32_t delay);
|
FAR void *arg, systime_t delay);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: work_cancel
|
* Name: work_cancel
|
||||||
|
|||||||
@@ -211,7 +211,11 @@
|
|||||||
* NuttX configuration.
|
* NuttX configuration.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SYS_clock_systimer (__SYS_clock+0)
|
#ifdef CONFIG_SYSTEM_TIME64
|
||||||
|
# define SYS_clock_systimer64 (__SYS_clock+0)
|
||||||
|
#endif
|
||||||
|
# define SYS_clock_systimer32 (__SYS_clock+0)
|
||||||
|
#endif
|
||||||
#define SYS_clock_getres (__SYS_clock+1)
|
#define SYS_clock_getres (__SYS_clock+1)
|
||||||
#define SYS_clock_gettime (__SYS_clock+2)
|
#define SYS_clock_gettime (__SYS_clock+2)
|
||||||
#define SYS_clock_settime (__SYS_clock+3)
|
#define SYS_clock_settime (__SYS_clock+3)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/wqueue/work_usrthread.c
|
* libc/wqueue/work_usrthread.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2009-2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -122,11 +122,11 @@ void work_process(FAR struct usr_wqueue_s *wqueue)
|
|||||||
volatile FAR struct work_s *work;
|
volatile FAR struct work_s *work;
|
||||||
worker_t worker;
|
worker_t worker;
|
||||||
FAR void *arg;
|
FAR void *arg;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
uint32_t remaining;
|
systime_t remaining;
|
||||||
uint32_t stick;
|
systime_t stick;
|
||||||
uint32_t ctick;
|
systime_t ctick;
|
||||||
uint32_t next;
|
systime_t next;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Then process queued work. Lock the work queue while we process items
|
/* Then process queued work. Lock the work queue while we process items
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ struct icmp_ping_s
|
|||||||
FAR struct devif_callback_s *png_cb; /* Reference to callback instance */
|
FAR struct devif_callback_s *png_cb; /* Reference to callback instance */
|
||||||
|
|
||||||
sem_t png_sem; /* Use to manage the wait for the response */
|
sem_t png_sem; /* Use to manage the wait for the response */
|
||||||
uint32_t png_time; /* Start time for determining timeouts */
|
systime_t png_time; /* Start time for determining timeouts */
|
||||||
uint32_t png_ticks; /* System clock ticks to wait */
|
systime_t png_ticks; /* System clock ticks to wait */
|
||||||
int png_result; /* 0: success; <0:negated errno on fail */
|
int png_result; /* 0: success; <0:negated errno on fail */
|
||||||
in_addr_t png_addr; /* The peer to be ping'ed */
|
in_addr_t png_addr; /* The peer to be ping'ed */
|
||||||
uint16_t png_id; /* Used to match requests with replies */
|
uint16_t png_id; /* Used to match requests with replies */
|
||||||
@@ -124,7 +124,7 @@ struct icmp_ping_s
|
|||||||
|
|
||||||
static inline int ping_timeout(FAR struct icmp_ping_s *pstate)
|
static inline int ping_timeout(FAR struct icmp_ping_s *pstate)
|
||||||
{
|
{
|
||||||
uint32_t elapsed = clock_systimer() - pstate->png_time;
|
systime_t elapsed = clock_systimer() - pstate->png_time;
|
||||||
if (elapsed >= pstate->png_ticks)
|
if (elapsed >= pstate->png_ticks)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ struct icmpv6_ping_s
|
|||||||
FAR struct devif_callback_s *png_cb; /* Reference to callback instance */
|
FAR struct devif_callback_s *png_cb; /* Reference to callback instance */
|
||||||
|
|
||||||
sem_t png_sem; /* Use to manage the wait for the response */
|
sem_t png_sem; /* Use to manage the wait for the response */
|
||||||
uint32_t png_time; /* Start time for determining timeouts */
|
systime_t png_time; /* Start time for determining timeouts */
|
||||||
uint32_t png_ticks; /* System clock ticks to wait */
|
systime_t png_ticks; /* System clock ticks to wait */
|
||||||
int png_result; /* 0: success; <0:negated errno on fail */
|
int png_result; /* 0: success; <0:negated errno on fail */
|
||||||
net_ipv6addr_t png_addr; /* The peer to be ping'ed */
|
net_ipv6addr_t png_addr; /* The peer to be ping'ed */
|
||||||
uint16_t png_id; /* Used to match requests with replies */
|
uint16_t png_id; /* Used to match requests with replies */
|
||||||
@@ -127,7 +127,7 @@ struct icmpv6_ping_s
|
|||||||
|
|
||||||
static inline int ping_timeout(FAR struct icmpv6_ping_s *pstate)
|
static inline int ping_timeout(FAR struct icmpv6_ping_s *pstate)
|
||||||
{
|
{
|
||||||
uint32_t elapsed = clock_systimer() - pstate->png_time;
|
systime_t elapsed = clock_systimer() - pstate->png_time;
|
||||||
if (elapsed >= pstate->png_ticks)
|
if (elapsed >= pstate->png_ticks)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
|
|
||||||
#include <net/ethernet.h>
|
#include <net/ethernet.h>
|
||||||
|
|
||||||
|
#include <nuttx/clock.h>
|
||||||
#include <nuttx/net/ip.h>
|
#include <nuttx/net/ip.h>
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
@@ -100,7 +101,7 @@ extern struct neighbor_entry g_neighbors[CONFIG_NET_IPv6_NCONF_ENTRIES];
|
|||||||
|
|
||||||
/* This is the time, in clock ticks, of the last poll */
|
/* This is the time, in clock ticks, of the last poll */
|
||||||
|
|
||||||
extern uint32_t g_neighbor_polltime;
|
extern systime_t g_neighbor_polltime;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ struct neighbor_entry g_neighbors[CONFIG_NET_IPv6_NCONF_ENTRIES];
|
|||||||
|
|
||||||
/* This is the time, in clock ticks, of the last poll */
|
/* This is the time, in clock ticks, of the last poll */
|
||||||
|
|
||||||
uint32_t g_neighbor_polltime;
|
systime_t g_neighbor_polltime;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
|
|||||||
@@ -75,8 +75,8 @@
|
|||||||
|
|
||||||
void neighbor_periodic(void)
|
void neighbor_periodic(void)
|
||||||
{
|
{
|
||||||
uint32_t now;
|
systime_t now;
|
||||||
uint32_t ticks;
|
systime_t ticks;
|
||||||
uint32_t hsecs;
|
uint32_t hsecs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ void neighbor_periodic(void)
|
|||||||
|
|
||||||
now = clock_systimer();
|
now = clock_systimer();
|
||||||
ticks = now - g_neighbor_polltime;
|
ticks = now - g_neighbor_polltime;
|
||||||
hsecs = TICK2HSEC(ticks);
|
hsecs = (uint32_t)TICK2HSEC(ticks);
|
||||||
|
|
||||||
/* Reset the time of the last poll */
|
/* Reset the time of the last poll */
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ struct tcp_close_s
|
|||||||
FAR struct socket *cl_psock; /* Reference to the TCP socket */
|
FAR struct socket *cl_psock; /* Reference to the TCP socket */
|
||||||
sem_t cl_sem; /* Signals disconnect completion */
|
sem_t cl_sem; /* Signals disconnect completion */
|
||||||
int cl_result; /* The result of the close */
|
int cl_result; /* The result of the close */
|
||||||
uint32_t cl_start; /* Time close started (in ticks) */
|
systime_t cl_start; /* Time close started (in ticks) */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* net/socket/net_sendfile.c
|
* net/socket/net_sendfile.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 UVC Ingenieure. All rights reserved.
|
* Copyright (C) 2013 UVC Ingenieure. All rights reserved.
|
||||||
* Copyright (C) 2007-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2016 Gregory Nutt. All rights reserved.
|
||||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||||
* Max Holtzberg <mh@uvc.de>
|
* Max Holtzberg <mh@uvc.de>
|
||||||
*
|
*
|
||||||
@@ -103,7 +103,7 @@ struct sendfile_s
|
|||||||
uint32_t snd_isn; /* Initial sequence number */
|
uint32_t snd_isn; /* Initial sequence number */
|
||||||
uint32_t snd_acked; /* The number of bytes acked */
|
uint32_t snd_acked; /* The number of bytes acked */
|
||||||
#ifdef CONFIG_NET_SOCKOPTS
|
#ifdef CONFIG_NET_SOCKOPTS
|
||||||
uint32_t snd_time; /* Last send time for determining timeout */
|
systime_t snd_time; /* Last send time for determining timeout */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -69,10 +69,10 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int net_timeo(uint32_t start_time, socktimeo_t timeo)
|
int net_timeo(systime_t start_time, socktimeo_t timeo)
|
||||||
{
|
{
|
||||||
uint32_t timeo_ticks = DSEC2TICK(timeo);
|
systime_t timeo_ticks = DSEC2TICK(timeo);
|
||||||
uint32_t elapsed = clock_systimer() - start_time;
|
systime_t elapsed = clock_systimer() - start_time;
|
||||||
|
|
||||||
if (elapsed >= timeo_ticks)
|
if (elapsed >= timeo_ticks)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/socket/recvfrom.c
|
* net/socket/recvfrom.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011-2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -93,7 +93,7 @@ struct recvfrom_s
|
|||||||
{
|
{
|
||||||
FAR struct socket *rf_sock; /* The parent socket structure */
|
FAR struct socket *rf_sock; /* The parent socket structure */
|
||||||
#ifdef CONFIG_NET_SOCKOPTS
|
#ifdef CONFIG_NET_SOCKOPTS
|
||||||
uint32_t rf_starttime; /* rcv start time for determining timeout */
|
systime_t rf_starttime; /* rcv start time for determining timeout */
|
||||||
#endif
|
#endif
|
||||||
FAR struct devif_callback_s *rf_cb; /* Reference to callback instance */
|
FAR struct devif_callback_s *rf_cb; /* Reference to callback instance */
|
||||||
sem_t rf_sem; /* Semaphore signals recv completion */
|
sem_t rf_sem; /* Semaphore signals recv completion */
|
||||||
|
|||||||
+2
-1
@@ -47,6 +47,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <nuttx/clock.h>
|
||||||
#include <nuttx/net/net.h>
|
#include <nuttx/net/net.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -345,7 +346,7 @@ int net_close(int sockfd);
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_SOCKOPTS
|
#ifdef CONFIG_NET_SOCKOPTS
|
||||||
int net_timeo(uint32_t start_time, socktimeo_t timeo);
|
int net_timeo(systime_t start_time, socktimeo_t timeo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/tcp/tcp_send_unbuffered.c
|
* net/tcp/tcp_send_unbuffered.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2014, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -103,7 +103,7 @@ struct send_s
|
|||||||
uint32_t snd_isn; /* Initial sequence number */
|
uint32_t snd_isn; /* Initial sequence number */
|
||||||
uint32_t snd_acked; /* The number of bytes acked */
|
uint32_t snd_acked; /* The number of bytes acked */
|
||||||
#ifdef CONFIG_NET_SOCKOPTS
|
#ifdef CONFIG_NET_SOCKOPTS
|
||||||
uint32_t snd_time; /* Last send time for determining timeout */
|
systime_t snd_time; /* Last send time for determining timeout */
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_NET_TCP_SPLIT)
|
#if defined(CONFIG_NET_TCP_SPLIT)
|
||||||
bool snd_odd; /* True: Odd packet in pair transaction */
|
bool snd_odd; /* True: Odd packet in pair transaction */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/udp/udp_psock_sendto.c
|
* net/udp/udp_psock_sendto.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011-2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -99,7 +99,7 @@ struct sendto_s
|
|||||||
FAR struct socket *st_sock; /* Points to the parent socket structure */
|
FAR struct socket *st_sock; /* Points to the parent socket structure */
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_NET_SENDTO_TIMEOUT
|
#ifdef CONFIG_NET_SENDTO_TIMEOUT
|
||||||
uint32_t st_time; /* Last send time for determining timeout */
|
systime_t st_time; /* Last send time for determining timeout */
|
||||||
#endif
|
#endif
|
||||||
FAR struct devif_callback_s *st_cb; /* Reference to callback instance */
|
FAR struct devif_callback_s *st_cb; /* Reference to callback instance */
|
||||||
sem_t st_sem; /* Semaphore signals sendto completion */
|
sem_t st_sem; /* Semaphore signals sendto completion */
|
||||||
|
|||||||
+1
-1
@@ -147,7 +147,7 @@ config SYSTEM_TIME64
|
|||||||
USEC_PER_TICK, typically at 100Hz. The count at any given time is
|
USEC_PER_TICK, typically at 100Hz. The count at any given time is
|
||||||
then the "uptime" in units of system timer ticks. By default, the
|
then the "uptime" in units of system timer ticks. By default, the
|
||||||
system time is 32-bits wide. Those defaults provide a range of about
|
system time is 32-bits wide. Those defaults provide a range of about
|
||||||
13.6 years which is probably a sufficient range for "uptime".
|
497 days which is probably a sufficient range for "uptime".
|
||||||
|
|
||||||
However, if the system timer rate is significantly higher than 100Hz
|
However, if the system timer rate is significantly higher than 100Hz
|
||||||
and/or if a very long "uptime" is required, then this option can be
|
and/or if a very long "uptime" is required, then this option can be
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/clock/clock_systimer.c
|
* sched/clock/clock_systimer.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011, 2014-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011, 2014-2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* See nuttx/clock.h */
|
/* See nuttx/clock.h */
|
||||||
|
|
||||||
#undef clock_systimer
|
#undef cloc_systimer32
|
||||||
#undef clock_systimer64
|
#undef clock_systimer64
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: clock_systimer
|
* Name: cloc_systimer32
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return the current value of the 32-bit system timer counter
|
* Return the current value of the 32-bit system timer counter
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uint32_t clock_systimer(void)
|
uint32_t cloc_systimer32(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SCHED_TICKLESS
|
#ifdef CONFIG_SCHED_TICKLESS
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ static int g_fillresult;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_PAGING_TIMEOUT_TICKS
|
#ifdef CONFIG_PAGING_TIMEOUT_TICKS
|
||||||
status uint32_t g_starttime;
|
static systime_t g_starttime;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/sched/sched_sporadic.c
|
* sched/sched/sched_sporadic.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -975,9 +975,9 @@ int sched_sporadic_resume(FAR struct tcb_s *tcb)
|
|||||||
{
|
{
|
||||||
FAR struct sporadic_s *sporadic;
|
FAR struct sporadic_s *sporadic;
|
||||||
FAR struct replenishment_s *repl;
|
FAR struct replenishment_s *repl;
|
||||||
|
systime_t now;
|
||||||
uint32_t unrealized;
|
uint32_t unrealized;
|
||||||
uint32_t last;
|
uint32_t last;
|
||||||
uint32_t now;
|
|
||||||
|
|
||||||
DEBUGASSERT(tcb && tcb->sporadic);
|
DEBUGASSERT(tcb && tcb->sporadic);
|
||||||
sporadic = tcb->sporadic;
|
sporadic = tcb->sporadic;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/semaphore/sem_tickdwait.c
|
* sched/semaphore/sem_tickdwait.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -80,11 +80,11 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sem_tickwait(FAR sem_t *sem, uint32_t start, uint32_t delay)
|
int sem_tickwait(FAR sem_t *sem, systime_t start, uint32_t delay)
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
DEBUGASSERT(sem != NULL && up_interrupt_context() == false &&
|
DEBUGASSERT(sem != NULL && up_interrupt_context() == false &&
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/signal/sig/nanosleep.c
|
* sched/signal/sig/nanosleep.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
int nanosleep(FAR const struct timespec *rqtp, FAR struct timespec *rmtp)
|
int nanosleep(FAR const struct timespec *rqtp, FAR struct timespec *rmtp)
|
||||||
{
|
{
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
uint32_t starttick;
|
systime_t starttick;
|
||||||
sigset_t set;
|
sigset_t set;
|
||||||
struct siginfo value;
|
struct siginfo value;
|
||||||
int errval;
|
int errval;
|
||||||
@@ -183,8 +183,8 @@ int nanosleep(FAR const struct timespec *rqtp, FAR struct timespec *rmtp)
|
|||||||
|
|
||||||
if (rmtp)
|
if (rmtp)
|
||||||
{
|
{
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
uint32_t remaining;
|
systime_t remaining;
|
||||||
int ticks;
|
int ticks;
|
||||||
|
|
||||||
/* First get the number of clock ticks that we were requested to
|
/* First get the number of clock ticks that we were requested to
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/wqueue/work_process.c
|
* libc/wqueue/work_process.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009-2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2009-2014, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -72,22 +72,6 @@
|
|||||||
# define MIN(a,b) ((a) < (b) ? (a) : (b))
|
# define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Type Declarations
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -109,17 +93,17 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void work_process(FAR struct kwork_wqueue_s *wqueue, uint32_t period, int wndx)
|
void work_process(FAR struct kwork_wqueue_s *wqueue, systime_t period, int wndx)
|
||||||
{
|
{
|
||||||
volatile FAR struct work_s *work;
|
volatile FAR struct work_s *work;
|
||||||
worker_t worker;
|
worker_t worker;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
FAR void *arg;
|
FAR void *arg;
|
||||||
uint32_t elapsed;
|
systime_t elapsed;
|
||||||
uint32_t remaining;
|
systime_t remaining;
|
||||||
uint32_t stick;
|
systime_t stick;
|
||||||
uint32_t ctick;
|
systime_t ctick;
|
||||||
uint32_t next;
|
systime_t next;
|
||||||
|
|
||||||
/* Then process queued work. We need to keep interrupts disabled while
|
/* Then process queued work. We need to keep interrupts disabled while
|
||||||
* we process items in the work list.
|
* we process items in the work list.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/wqueue/wqueue.h
|
* sched/wqueue/wqueue.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -46,6 +46,8 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <queue.h>
|
#include <queue.h>
|
||||||
|
|
||||||
|
#include <nuttx/clock.h>
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_WORKQUEUE
|
#ifdef CONFIG_SCHED_WORKQUEUE
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -72,7 +74,7 @@ struct kworker_s
|
|||||||
|
|
||||||
struct kwork_wqueue_s
|
struct kwork_wqueue_s
|
||||||
{
|
{
|
||||||
uint32_t delay; /* Delay between polling cycles (ticks) */
|
systime_t delay; /* Delay between polling cycles (ticks) */
|
||||||
struct dq_queue_s q; /* The queue of pending work */
|
struct dq_queue_s q; /* The queue of pending work */
|
||||||
struct kworker_s worker[1]; /* Describes a worker thread */
|
struct kworker_s worker[1]; /* Describes a worker thread */
|
||||||
};
|
};
|
||||||
@@ -84,7 +86,7 @@ struct kwork_wqueue_s
|
|||||||
#ifdef CONFIG_SCHED_HPWORK
|
#ifdef CONFIG_SCHED_HPWORK
|
||||||
struct hp_wqueue_s
|
struct hp_wqueue_s
|
||||||
{
|
{
|
||||||
uint32_t delay; /* Delay between polling cycles (ticks) */
|
systime_t delay; /* Delay between polling cycles (ticks) */
|
||||||
struct dq_queue_s q; /* The queue of pending work */
|
struct dq_queue_s q; /* The queue of pending work */
|
||||||
struct kworker_s worker[1]; /* Describes the single high priority worker */
|
struct kworker_s worker[1]; /* Describes the single high priority worker */
|
||||||
};
|
};
|
||||||
@@ -97,7 +99,7 @@ struct hp_wqueue_s
|
|||||||
#ifdef CONFIG_SCHED_LPWORK
|
#ifdef CONFIG_SCHED_LPWORK
|
||||||
struct lp_wqueue_s
|
struct lp_wqueue_s
|
||||||
{
|
{
|
||||||
uint32_t delay; /* Delay between polling cycles (ticks) */
|
systime_t delay; /* Delay between polling cycles (ticks) */
|
||||||
struct dq_queue_s q; /* The queue of pending work */
|
struct dq_queue_s q; /* The queue of pending work */
|
||||||
|
|
||||||
/* Describes each thread in the low priority queue's thread pool */
|
/* Describes each thread in the low priority queue's thread pool */
|
||||||
@@ -183,7 +185,7 @@ int work_lpstart(void);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void work_process(FAR struct kwork_wqueue_s *wqueue, uint32_t period, int wndx);
|
void work_process(FAR struct kwork_wqueue_s *wqueue, systime_t period, int wndx);
|
||||||
|
|
||||||
#endif /* CONFIG_SCHED_WORKQUEUE */
|
#endif /* CONFIG_SCHED_WORKQUEUE */
|
||||||
#endif /* __SCHED_WQUEUE_WQUEUE_H */
|
#endif /* __SCHED_WQUEUE_WQUEUE_H */
|
||||||
|
|||||||
+2
-1
@@ -11,7 +11,8 @@
|
|||||||
"clock_getres","time.h","","int","clockid_t","struct timespec*"
|
"clock_getres","time.h","","int","clockid_t","struct timespec*"
|
||||||
"clock_gettime","time.h","","int","clockid_t","struct timespec*"
|
"clock_gettime","time.h","","int","clockid_t","struct timespec*"
|
||||||
"clock_settime","time.h","","int","clockid_t","const struct timespec*"
|
"clock_settime","time.h","","int","clockid_t","const struct timespec*"
|
||||||
"clock_systimer","nuttx/clock.h","!defined(__HAVE_KERNEL_GLOBALS)","uint32_t"
|
"clock_systimer32","nuttx/clock.h","!defined(__HAVE_KERNEL_GLOBALS) && !defined(CONFIG_SYSTEM_TIME64)","uint32_t"
|
||||||
|
"clock_systimer64","nuttx/clock.h","!defined(__HAVE_KERNEL_GLOBALS) && defined(CONFIG_SYSTEM_TIME64)","uint64_t"
|
||||||
"close","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","int","int"
|
"close","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","int","int"
|
||||||
"closedir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","int","FAR DIR*"
|
"closedir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","int","FAR DIR*"
|
||||||
"connect","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t"
|
"connect","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t"
|
||||||
|
|||||||
|
@@ -60,7 +60,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: syscall_clock_systimer
|
* Name: syscall_clock_systimer32/64
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* In the kernel build, proxying for clock_systimer() must be handled
|
* In the kernel build, proxying for clock_systimer() must be handled
|
||||||
@@ -74,7 +74,14 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uint32_t syscall_clock_systimer(void)
|
#ifdef CONFIG_SYSTEM_TIME64
|
||||||
|
uint64_t syscall_clock_systimer64(void)
|
||||||
{
|
{
|
||||||
return clock_systimer();
|
return clock_systimer64();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
uint32_t syscall_clock_systimer32(void)
|
||||||
|
{
|
||||||
|
return clock_systimer32();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -99,7 +99,11 @@
|
|||||||
* have an address that can be included in the g_funclookup[] table.
|
* have an address that can be included in the g_funclookup[] table.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint32_t syscall_clock_systimer(void);
|
#ifdef CONFIG_SYSTEM_TIME64
|
||||||
|
uint64_t syscall_clock_systimer64(void);
|
||||||
|
#else
|
||||||
|
uint32_t syscall_clock_systimer32(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
|
|||||||
@@ -148,7 +148,11 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert)
|
|||||||
* NuttX configuration.
|
* NuttX configuration.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SYSCALL_LOOKUP(syscall_clock_systimer, 0, STUB_clock_systimer)
|
#ifdef CONFIG_SYSTEM_TIME64
|
||||||
|
SYSCALL_LOOKUP(syscall_clock_systimer64, 0, STUB_clock_systimer64)
|
||||||
|
#endif
|
||||||
|
SYSCALL_LOOKUP(syscall_clock_systimer32, 0, STUB_clock_systimer32)
|
||||||
|
#endif
|
||||||
SYSCALL_LOOKUP(clock_getres, 2, STUB_clock_getres)
|
SYSCALL_LOOKUP(clock_getres, 2, STUB_clock_getres)
|
||||||
SYSCALL_LOOKUP(clock_gettime, 2, STUB_clock_gettime)
|
SYSCALL_LOOKUP(clock_gettime, 2, STUB_clock_gettime)
|
||||||
SYSCALL_LOOKUP(clock_settime, 2, STUB_clock_settime)
|
SYSCALL_LOOKUP(clock_settime, 2, STUB_clock_settime)
|
||||||
|
|||||||
Reference in New Issue
Block a user