diff --git a/sched/clock/clock_abstime2ticks.c b/sched/clock/clock_abstime2ticks.c index 24213dd07b2..d21e706e393 100644 --- a/sched/clock/clock_abstime2ticks.c +++ b/sched/clock/clock_abstime2ticks.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/clock/clock_abstime2ticks.c * * Copyright (C) 2007, 2008, 2013-2014, 2016 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -44,11 +44,11 @@ #include #include "clock/clock.h" -/******************************************************************************** +/**************************************************************************** * Private Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: compare_timespec * * Description: @@ -56,7 +56,7 @@ * Return > 0 if time b is before time a * Return 0 if time a is the same as time b * - ********************************************************************************/ + ****************************************************************************/ static long compare_timespec(FAR const struct timespec *a, FAR const struct timespec *b) @@ -74,11 +74,11 @@ static long compare_timespec(FAR const struct timespec *a, return (long)a->tv_nsec -(long)b->tv_nsec; } -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: clock_abstime2ticks * * Description: @@ -93,10 +93,10 @@ static long compare_timespec(FAR const struct timespec *a, * OK on success; A non-zero error number on failure; * * Assumptions: - * Interrupts should be disabled so that the time is not changing during the - * calculation + * Interrupts should be disabled so that the time is not changing during + * the calculation * - ********************************************************************************/ + ****************************************************************************/ int clock_abstime2ticks(clockid_t clockid, FAR const struct timespec *abstime, FAR int *ticks) diff --git a/sched/clock/clock_ticks2time.c b/sched/clock/clock_ticks2time.c index b69379d8275..33353193a82 100644 --- a/sched/clock/clock_ticks2time.c +++ b/sched/clock/clock_ticks2time.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/clock/clock_ticks2time.c * * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. @@ -31,22 +31,22 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include #include #include "clock/clock.h" -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: clock_ticks2time * * Description: @@ -61,7 +61,7 @@ * * Assumptions: * - ********************************************************************************/ + ****************************************************************************/ int clock_ticks2time(int ticks, FAR struct timespec *reltime) { diff --git a/sched/clock/clock_time2ticks.c b/sched/clock/clock_time2ticks.c index 8667e6bcd9d..5bb613b61de 100644 --- a/sched/clock/clock_time2ticks.c +++ b/sched/clock/clock_time2ticks.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/clock/clock_time2ticks.c * * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -44,17 +44,17 @@ #include "clock/clock.h" -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: clock_time2ticks * * Description: - * Convert a timespec delay to system timer ticks. This function is suitable - * for calculating relative time delays and does not depend on the other - * clock_* logic. + * Convert a timespec delay to system timer ticks. This function is + * suitable for calculating relative time delays and does not depend on + * the other clock_* logic. * * Parameters: * reltime - Convert this relative time to system clock ticks. @@ -65,15 +65,15 @@ * * Assumptions: * - ********************************************************************************/ + ****************************************************************************/ int clock_time2ticks(FAR const struct timespec *reltime, FAR int *ticks) { #ifdef CONFIG_HAVE_LONG_LONG int64_t relnsec; - /* Convert the relative time into nanoseconds. The range of the int64_t is - * sufficiently large that there is no real need for range checking. + /* Convert the relative time into nanoseconds. The range of the int64_t + * is sufficiently large that there is no real need for range checking. */ relnsec = (int64_t)reltime->tv_sec * NSEC_PER_SEC + diff --git a/sched/clock/clock_timekeeping.c b/sched/clock/clock_timekeeping.c index c8fb361c6fe..be83688f015 100644 --- a/sched/clock/clock_timekeeping.c +++ b/sched/clock/clock_timekeeping.c @@ -1,4 +1,4 @@ -/************************************************************************ +/**************************************************************************** * sched/clock/clock_timekeeping.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************/ + ****************************************************************************/ -/************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************/ + ****************************************************************************/ #include @@ -52,9 +52,9 @@ #include "clock/clock.h" -/************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************/ + ****************************************************************************/ #define NTP_MAX_ADJUST 500 @@ -68,13 +68,13 @@ static uint64_t g_clock_last_counter; static uint64_t g_clock_mask; static long g_clock_adjust; -/************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************/ + ****************************************************************************/ -/************************************************************************ +/**************************************************************************** * Name: clock_get_current_time - ************************************************************************/ + ****************************************************************************/ static int clock_get_current_time(FAR struct timespec *ts, FAR struct timespec *base) @@ -114,31 +114,31 @@ errout_in_critical_section: return ret; } -/************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************/ + ****************************************************************************/ -/************************************************************************ +/**************************************************************************** * Name: clock_timekeeping_get_monotonic_time - ************************************************************************/ + ****************************************************************************/ int clock_timekeeping_get_monotonic_time(FAR struct timespec *ts) { return clock_get_current_time(ts, &g_clock_monotonic_time); } -/************************************************************************ +/**************************************************************************** * Name: clock_timekeeping_get_wall_time - ************************************************************************/ + ****************************************************************************/ int clock_timekeeping_get_wall_time(FAR struct timespec *ts) { return clock_get_current_time(ts, &g_clock_wall_time); } -/************************************************************************ +/**************************************************************************** * Name: clock_timekeeping_set_wall_time - ************************************************************************/ + ****************************************************************************/ int clock_timekeeping_set_wall_time(FAR struct timespec *ts) { @@ -163,7 +163,7 @@ errout_in_critical_section: return ret; } -/**************************************************************************** +/******************************************************************************** * Name: adjtime * * Description: @@ -226,9 +226,9 @@ int adjtime(FAR const struct timeval *delta, FAR struct timeval *olddelta) return OK; } -/************************************************************************ +/**************************************************************************** * Name: clock_update_wall_time - ************************************************************************/ + ****************************************************************************/ void clock_update_wall_time(void) { @@ -304,9 +304,9 @@ errout_in_critical_section: leave_critical_section(flags); } -/************************************************************************ +/**************************************************************************** * Name: clock_inittimekeeping - ************************************************************************/ + ****************************************************************************/ void clock_inittimekeeping(void) { @@ -318,7 +318,9 @@ void clock_inittimekeeping(void) (void)up_rtc_getdatetime(&rtctime); - /* And use the broken-errout_in_critical_section time to initialize the system time */ + /* And use the broken-errout_in_critical_section time to initialize the + * system time. + */ g_clock_wall_time.tv_sec = mktime(&rtctime); g_clock_wall_time.tv_nsec = 0; diff --git a/sched/clock/clock_timespec_add.c b/sched/clock/clock_timespec_add.c index f2eae0dac26..0e0fb931dbb 100644 --- a/sched/clock/clock_timespec_add.c +++ b/sched/clock/clock_timespec_add.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/clock/clock_timespec_add.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -44,9 +44,9 @@ #include "clock/clock.h" -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Name: clock_timespec_add diff --git a/sched/clock/clock_timespec_subtract.c b/sched/clock/clock_timespec_subtract.c index c02dc35538e..754c84d1cb5 100644 --- a/sched/clock/clock_timespec_subtract.c +++ b/sched/clock/clock_timespec_subtract.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/clock/clock_timespec_subtract.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -44,9 +44,9 @@ #include "clock/clock.h" -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Name: clock_timespec_subtract diff --git a/sched/environ/env_getenv.c b/sched/environ/env_getenv.c index e5309be325a..6e92f90d3f1 100644 --- a/sched/environ/env_getenv.c +++ b/sched/environ/env_getenv.c @@ -1,5 +1,5 @@ /**************************************************************************** - * env_getenv.c + * sched/environ/env_getenv.c * * Copyright (C) 2007, 2008, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/sched/environ/env_getenvironptr.c b/sched/environ/env_getenvironptr.c index d392777392a..11c4f5368e1 100644 --- a/sched/environ/env_getenvironptr.c +++ b/sched/environ/env_getenvironptr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * env_getenvironptr.c + * sched/environ/env_getenvironptr.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/sched/group/group_setupstreams.c b/sched/group/group_setupstreams.c index 63929de8e6f..996b9cec7bf 100644 --- a/sched/group/group_setupstreams.c +++ b/sched/group/group_setupstreams.c @@ -1,5 +1,5 @@ /**************************************************************************** - * group_setupstreams.c + * sched/group/group_setupstreams.c * * Copyright (C) 2007-2008, 2010-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/sched/pthread/pthread_barrierdestroy.c b/sched/pthread/pthread_barrierdestroy.c index dbad57947a0..6bf0270b13f 100644 --- a/sched/pthread/pthread_barrierdestroy.c +++ b/sched/pthread/pthread_barrierdestroy.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/pthread/pthread_barriedestroy.c * * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -44,20 +44,21 @@ #include #include -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: pthread_barrier_destroy * * Description: - * The pthread_barrier_destroy() function destroys the barrier referenced by - * 'barrier' and releases any resources used by the barrier. The effect of - * subsequent use of the barrier is undefined until the barrier is - * reinitialized by another call to pthread_barrier_init(). The results are - * undefined if pthread_barrier_destroy() is called when any thread is blocked - * on the barrier, or if this function is called with an uninitialized barrier. + * The pthread_barrier_destroy() function destroys the barrier referenced + * by 'barrier' and releases any resources used by the barrier. The effect + * of subsequent use of the barrier is undefined until the barrier is + * reinitialized by another call to pthread_barrier_init(). The result + * are undefined if pthread_barrier_destroy() is called when any thread is + * blocked on the barrier, or if this function is called with an + * uninitialized barrier. * * Parameters: * barrier - barrier to be destroyed. @@ -65,13 +66,13 @@ * Return Value: * 0 (OK) on success or on of the following error numbers: * - * EBUSY The implementation has detected an attempt to destroy a barrier while - * it is in use. + * EBUSY The implementation has detected an attempt to destroy a barrier + * while it is in use. * EINVAL The value specified by barrier is invalid. * * Assumptions: * - ********************************************************************************/ + ****************************************************************************/ int pthread_barrier_destroy(FAR pthread_barrier_t *barrier) { diff --git a/sched/pthread/pthread_barrierinit.c b/sched/pthread/pthread_barrierinit.c index adaca2876c2..5051601417f 100644 --- a/sched/pthread/pthread_barrierinit.c +++ b/sched/pthread/pthread_barrierinit.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/pthread/pthread_barrieinit.c * * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -44,44 +44,45 @@ #include #include -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: pthread_barrier_init * * Description: - * The pthread_barrier_init() function allocates any resources required to use - * the barrier referenced by 'barrier' and initialized the barrier with the - * attributes referenced by attr. If attr is NULL, the default barrier - * attributes will be used. The results are undefined if pthread_barrier_init() - * is called when any thread is blocked on the barrier. The results are - * undefined if a barrier is used without first being initialized. The results - * are undefined if pthread_barrier_init() is called specifying an already - * initialized barrier. + * The pthread_barrier_init() function allocates any resources required to + * use the barrier referenced by 'barrier' and initialized the barrier + * with the attributes referenced by attr. If attr is NULL, the default + * barrier attributes will be used. The results are undefined if + * pthread_barrier_init() is called when any thread is blocked on the + * barrier. The results are undefined if a barrier is used without first + * being initialized. The results are undefined if pthread_barrier_init() + * is called specifying an already initialized barrier. * * Parameters: * barrier - the barrier to be initialized * attr - barrier attributes to be used in the initialization. - * count - the count to be associated with the barrier. The count argument - * specifies the number of threads that must call pthread_barrier_wait() before - * any of them successfully return from the call. The value specified by - * count must be greater than zero. + * count - the count to be associated with the barrier. The count + * argument specifies the number of threads that must call + * pthread_barrier_wait() before any of them successfully return from + * the call. The value specified by count must be greater than zero. * * Return Value: * 0 (OK) on success or on of the following error numbers: * - * EAGAIN The system lacks the necessary resources to initialize another barrier. - * EINVAL The barrier reference is invalid, or the values specified by attr are - * invalid, or the value specified by count is equal to zero. + * EAGAIN The system lacks the necessary resources to initialize another + * barrier. EINVAL The barrier reference is invalid, or the values + * specified by attr are invalid, or the value specified by count + * is equal to zero. * ENOMEM Insufficient memory exists to initialize the barrier. - * EBUSY The implementation has detected an attempt to reinitialize a barrier - * while it is in use. + * EBUSY The implementation has detected an attempt to reinitialize a + * barrier while it is in use. * * Assumptions: * - ********************************************************************************/ + ****************************************************************************/ int pthread_barrier_init(FAR pthread_barrier_t *barrier, FAR const pthread_barrierattr_t *attr, unsigned int count) diff --git a/sched/pthread/pthread_barrierwait.c b/sched/pthread/pthread_barrierwait.c index 2d5a306df0a..cf2f959c4e5 100644 --- a/sched/pthread/pthread_barrierwait.c +++ b/sched/pthread/pthread_barrierwait.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/pthread/pthread_barrierwait.c * * Copyright (C) 2007, 2009, 2014 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -45,41 +45,43 @@ #include #include -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: pthread_barrier_wait * * Description: - * The pthread_barrier_wait() function synchronizse participating threads at - * the barrier referenced by 'barrier'. The calling thread is blocked until - * the required number of threads have called pthread_barrier_wait() specifying - * the same 'barrier'. When the required number of threads have called - * pthread_barrier_wait() specifying the 'barrier', the constant - * PTHREAD_BARRIER_SERIAL_THREAD will be returned to one unspecified thread - * and zero will be returned to each of the remaining threads. At this point, - * the barrier will be reset to the state it had as a result of the most recent - * pthread_barrier_init() function that referenced it. + * The pthread_barrier_wait() function synchronizse participating threads + * at the barrier referenced by 'barrier'. The calling thread is blocked + * until the required number of threads have called pthread_barrier_wait() + * specifying the same 'barrier'. When the required number of threads + * have called pthread_barrier_wait() specifying the 'barrier', the + * constant PTHREAD_BARRIER_SERIAL_THREAD will be returned to one + * unspecified thread and zero will be returned to each of the remaining + * threads. At this point, the barrier will be reset to the state it had + * as a result of the most recent pthread_barrier_init() function that + * referenced it. * - * The constant PTHREAD_BARRIER_SERIAL_THREAD is defined in pthread.h and its - * value must be distinct from any other value returned by pthread_barrier_wait(). + * The constant PTHREAD_BARRIER_SERIAL_THREAD is defined in pthread.h and + * its value must be distinct from any other value returned by + * pthread_barrier_wait(). * - * The results are undefined if this function is called with an uninitialized - * barrier. + * The results are undefined if this function is called with an + * uninitialized barrier. * - * If a signal is delivered to a thread blocked on a barrier, upon return from - * the signal handler the thread will resume waiting at the barrier if the barrier - * wait has not completed; otherwise, the thread will continue as normal from - * the completed barrier wait. Until the thread in the signal handler returns - * from it, it is unspecified whether other threads may proceed past the barrier - * once they have all reached it. + * If a signal is delivered to a thread blocked on a barrier, upon return + * from the signal handler the thread will resume waiting at the barrier + * if the barrier wait has not completed; otherwise, the thread will + * continue as normal from the completed barrier wait. Until the thread in + * the signal handler returns from it, it is unspecified whether other + * threads may proceed past the barrier once they have all reached it. * - * A thread that has blocked on a barrier will not prevent any unblocked thread - * that is eligible to use the same processing resources from eventually making - * forward progress in its execution. Eligibility for processing resources will - * be determined by the scheduling policy. + * A thread that has blocked on a barrier will not prevent any unblocked + * thread that is eligible to use the same processing resources from + * eventually making forward progress in its execution. Eligibility for + * processing resources will be determined by the scheduling policy. * * Parameters: * barrier - the barrier to wait on @@ -89,7 +91,7 @@ * * Assumptions: * - ********************************************************************************/ + ****************************************************************************/ int pthread_barrier_wait(FAR pthread_barrier_t *barrier) { diff --git a/sched/pthread/pthread_findjoininfo.c b/sched/pthread/pthread_findjoininfo.c index 60769bc16dd..23fcc6a46d7 100644 --- a/sched/pthread/pthread_findjoininfo.c +++ b/sched/pthread/pthread_findjoininfo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * pthread_findjoininfo.c + * sched/pthread/pthread_findjoininfo.c * * Copyright (C) 2007, 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/sched/pthread/pthread_getaffinity.c b/sched/pthread/pthread_getaffinity.c index 817aa11a206..f4d46f1976a 100644 --- a/sched/pthread/pthread_getaffinity.c +++ b/sched/pthread/pthread_getaffinity.c @@ -1,5 +1,5 @@ /**************************************************************************** - * pthread_getaffinity.c + * sched/pthread/pthread_getaffinity.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/sched/pthread/pthread_getschedparam.c b/sched/pthread/pthread_getschedparam.c index a3fe352c0cf..a71bc488cdb 100644 --- a/sched/pthread/pthread_getschedparam.c +++ b/sched/pthread/pthread_getschedparam.c @@ -1,5 +1,5 @@ /**************************************************************************** - * pthread_getschedparam.c + * sched/pthread/pthread_getschedparam.c * * Copyright (C) 2007, 2008, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/sched/pthread/pthread_join.c b/sched/pthread/pthread_join.c index 90628bb4445..9b73fd4268f 100644 --- a/sched/pthread/pthread_join.c +++ b/sched/pthread/pthread_join.c @@ -1,5 +1,5 @@ /**************************************************************************** - * pthread_join.c + * sched/pthread/pthread_join.c * * Copyright (C) 2007, 2008, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/sched/pthread/pthread_once.c b/sched/pthread/pthread_once.c index b8afe81112a..cd778a02d23 100644 --- a/sched/pthread/pthread_once.c +++ b/sched/pthread/pthread_once.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/pthread/pthread_once.c * * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -45,26 +45,26 @@ #include #include -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: pthread_once * * Description: - * The first call to pthread_once() by any thread with a given once_control, - * will call the init_routine with no arguments. Subsequent calls to - * pthread_once() with the same once_control will have no effect. On return - * from pthread_once(), init_routine will have completed. + * The first call to pthread_once() by any thread with a given + * once_control, will call the init_routine with no arguments. Subsequent + * calls to pthread_once() with the same once_control will have no effect. + * On return from pthread_once(), init_routine will have completed. * * Parameters: - * once_control - Determines if init_routine should be called. once_control - * should be declared and initializeed as follows: + * once_control - Determines if init_routine should be called. + * once_control should be declared and initializeed as follows: * * pthread_once_t once_control = PTHREAD_ONCE_INIT; * - * PTHREAD_ONCE_INIT is defined in pthread.h + * PTHREAD_ONCE_INIT is defined in pthread.h * init_routine - The initialization routine that will be called once. * * Return Value: @@ -73,7 +73,7 @@ * * Assumptions: * - ********************************************************************************/ + ****************************************************************************/ int pthread_once(FAR pthread_once_t *once_control, CODE void (*init_routine)(void)) diff --git a/sched/pthread/pthread_setcancelstate.c b/sched/pthread/pthread_setcancelstate.c index a17560224e9..b9aab9a7d12 100644 --- a/sched/pthread/pthread_setcancelstate.c +++ b/sched/pthread/pthread_setcancelstate.c @@ -1,4 +1,4 @@ -/****************************************************************************************** +/**************************************************************************** * sched/pthread/pthread_setcancelstate.c * * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. @@ -31,23 +31,23 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ******************************************************************************************/ + ****************************************************************************/ -/****************************************************************************************** +/**************************************************************************** * Included Files - ******************************************************************************************/ + ****************************************************************************/ #include #include #include "sched/sched.h" -/****************************************************************************************** +/**************************************************************************** * Public Functions - ******************************************************************************************/ + ****************************************************************************/ -/****************************************************************************************** +/**************************************************************************** * Name: pthread_setcancelstate - ******************************************************************************************/ + ****************************************************************************/ int pthread_setcancelstate(int state, FAR int *oldstate) { diff --git a/sched/sched/sched_removereadytorun.c b/sched/sched/sched_removereadytorun.c index 354bbc20e49..35543037ef4 100644 --- a/sched/sched/sched_removereadytorun.c +++ b/sched/sched/sched_removereadytorun.c @@ -1,5 +1,5 @@ /**************************************************************************** - * shced/sched_removereadytorun.c + * sched/sched_removereadytorun.c * * Copyright (C) 2007-2009, 2012, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/sched/timer/timer_create.c b/sched/timer/timer_create.c index a573ff38ba2..cff93c0a4bb 100644 --- a/sched/timer/timer_create.c +++ b/sched/timer/timer_create.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/timer/timer_create.c * * Copyright (C) 2007-2009, 2011, 2014-2016 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -53,17 +53,17 @@ #ifndef CONFIG_DISABLE_POSIX_TIMERS -/******************************************************************************** +/**************************************************************************** * Private Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: timer_allocate * * Description: * Allocate one POSIX timer and place it into the allocated timer list. * - ********************************************************************************/ + ****************************************************************************/ static FAR struct posix_timer_s *timer_allocate(void) { @@ -112,32 +112,33 @@ static FAR struct posix_timer_s *timer_allocate(void) return ret; } -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: timer_create * * Description: - * The timer_create() function creates per-thread timer using the specified - * clock, clock_id, as the timing base. The timer_create() function returns, in - * the location referenced by timerid, a timer ID of type timer_t used to identify - * the timer in timer requests. This timer ID is unique until the timer is - * deleted. The particular clock, clock_id, is defined in . The timer - * whose ID is returned will be in a disarmed state upon return from - * timer_create(). + * The timer_create() function creates per-thread timer using the + * specified clock, clock_id, as the timing base. The timer_create() + * function returns, in the location referenced by timerid, a timer ID of + * type timer_t used to identify the timer in timer requests. This timer + * ID is unique until the timer is deleted. The particular clock, clock_id, + * is defined in . The timer whose ID is returned will be in a + * disarmed state upon return from timer_create(). * - * The evp argument, if non-NULL, points to a sigevent structure. This structure - * is allocated by the called and defines the asynchronous notification to occur. - * If the evp argument is NULL, the effect is as if the evp argument pointed to - * a sigevent structure with the sigev_notify member having the value SIGEV_SIGNAL, - * the sigev_signo having a default signal number, and the sigev_value member - * having the value of the timer ID. + * The evp argument, if non-NULL, points to a sigevent structure. This + * structure is allocated by the called and defines the asynchronous + * notification to occur. If the evp argument is NULL, the effect is as + * if the evp argument pointed to a sigevent structure with the + * sigev_notify member having the value SIGEV_SIGNAL, the sigev_signo + * having a default signal number, and the sigev_value member having the + * value of the timer ID. * - * Each implementation defines a set of clocks that can be used as timing bases - * for per-thread timers. All implementations shall support a clock_id of - * CLOCK_REALTIME. + * Each implementation defines a set of clocks that can be used as timing + * bases for per-thread timers. All implementations shall support a + * clock_id of CLOCK_REALTIME. * * Parameters: * clockid - Specifies the clock to use as the timing base. @@ -148,30 +149,31 @@ static FAR struct posix_timer_s *timer_allocate(void) * Return Value: * If the call succeeds, timer_create() will return 0 (OK) and update the * location referenced by timerid to a timer_t, which can be passed to the - * other per-thread timer calls. If an error occurs, the function will return - * a value of -1 (ERROR) and set errno to indicate the error. + * other per-thread timer calls. If an error occurs, the function will + * return a value of -1 (ERROR) and set errno to indicate the error. * - * EAGAIN - The system lacks sufficient signal queuing resources to honor the - * request. - * EAGAIN - The calling process has already created all of the timers it is - * allowed by this implementation. + * EAGAIN - The system lacks sufficient signal queuing resources to honor + * the request. + * EAGAIN - The calling process has already created all of the timers it + * is allowed by this implementation. * EINVAL - The specified clock ID is not defined. - * ENOTSUP - The implementation does not support the creation of a timer attached - * to the CPU-time clock that is specified by clock_id and associated with a - * thread different thread invoking timer_create(). + * ENOTSUP - The implementation does not support the creation of a timer + * attached to the CPU-time clock that is specified by clock_id and + * associated with a thread different thread invoking timer_create(). * * Assumptions: * - ********************************************************************************/ + ****************************************************************************/ -int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timerid) +int timer_create(clockid_t clockid, FAR struct sigevent *evp, + FAR timer_t *timerid) { FAR struct posix_timer_s *ret; WDOG_ID wdog; /* Sanity checks. Also, we support only CLOCK_REALTIME */ - if (!timerid || clockid != CLOCK_REALTIME) + if (timerid == NULL || clockid != CLOCK_REALTIME) { set_errno(EINVAL); return ERROR; diff --git a/sched/timer/timer_delete.c b/sched/timer/timer_delete.c index 495db81dc1d..6d6e5bebc12 100644 --- a/sched/timer/timer_delete.c +++ b/sched/timer/timer_delete.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/timer/timer_delete.c * * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -46,34 +46,34 @@ #ifndef CONFIG_DISABLE_POSIX_TIMERS -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: timer_delete * * Description: - * The timer_delete() function deletes the specified timer, timerid, previously - * created by the timer_create() function. If the timer is armed when - * timer_delete() is called, the timer will be automatically disarmed before - * removal. The disposition of pending signals for the deleted timer is - * unspecified. + * The timer_delete() function deletes the specified timer, timerid, + * previously created by the timer_create() function. If the timer is + * armed when timer_delete() is called, the timer will be automatically + * disarmed before removal. The disposition of pending signals for the + * deleted timer is unspecified. * * Parameters: * timerid - The per-thread timer, previously created by the call to * timer_create(), to be deleted. * * Return Value: - * If the call succeeds, timer_create() will return 0 (OK). Otherwise, the - * function will return a value of -1 (ERROR) and set errno to indicate the - * error. + * If the call succeeds, timer_create() will return 0 (OK). Otherwise, + * the function will return a value of -1 (ERROR) and set errno to + * indicate the error. * * EINVAL - The timer specified timerid is not valid. * * Assumptions: * - ********************************************************************************/ + ****************************************************************************/ int timer_delete(timer_t timerid) { diff --git a/sched/timer/timer_getoverrun.c b/sched/timer/timer_getoverrun.c index e92a81bef9b..da07dcedcac 100644 --- a/sched/timer/timer_getoverrun.c +++ b/sched/timer/timer_getoverrun.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/timer/timer_getoverrun.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -46,30 +46,31 @@ #ifndef CONFIG_DISABLE_POSIX_TIMERS -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: timer_getoverrun * * Description: - * Only a single signal will be queued to the process for a given timer at any - * point in time. When a timer for which a signal is still pending expires, no - * signal will be queued, and a timer overrun will occur. When a timer - * expiration signal is delivered to or accepted by a process, if the - * implementation supports the Realtime Signals Extension, the - * timer_getoverrun() function will return the timer expiration overrun count for - * the specified timer. The overrun count returned contains the number of extra - * timer expirations that occurred between the time the signal was generated - * (queued) and when it was delivered or accepted, up to but not including an - * implementation-defined maximum of DELAYTIMER_MAX. If the number of such - * extra expirations is greater than or equal to DELAYTIMER_MAX, then the - * overrun count will be set to DELAYTIMER_MAX. The value returned by - * timer_getoverrun() will apply to the most recent expiration signal delivery - * or acceptance for the timer. If no expiration signal has been delivered - * for the timer, or if the Realtime Signals Extension is not supported, the - * return value of timer_getoverrun() is unspecified. + * Only a single signal will be queued to the process for a given timer at + * any point in time. When a timer for which a signal is still pending + * expires, no signal will be queued, and a timer overrun will occur. When + * a timer expiration signal is delivered to or accepted by a process, if + * the implementation supports the Realtime Signals Extension, the + * timer_getoverrun() function will return the timer expiration overrun + * count for the specified timer. The overrun count returned contains the + * number of extra timer expirations that occurred between the time the + * signal was generated (queued) and when it was delivered or accepted, up + * to but not including an implementation-defined maximum of + * DELAYTIMER_MAX. If the number of such extra expirations is greater than + * or equal to DELAYTIMER_MAX, then the overrun count will be set to + * DELAYTIMER_MAX. The value returned by timer_getoverrun() will apply to + * the most recent expiration signal delivery or acceptance for the timer. + * If no expiration signal has been delivered for the timer, or if the + * Realtime Signals Extension is not supported, the return value of + * timer_getoverrun() is unspecified. * * Parameters: * timerid - The pre-thread timer, previously created by the call to @@ -77,14 +78,15 @@ * * Return Value: * If the timer_getoverrun() function succeeds, it will return the timer - * expiration overrun count as explained above. timer_getoverrun() will fail if: + * expiration overrun count as explained above. timer_getoverrun() will + * fail if: * * EINVAL - The timerid argument does not correspond to an ID returned by * timer_create() but not yet deleted by timer_delete(). * * Assumptions: * - ********************************************************************************/ + ****************************************************************************/ int timer_getoverrun(timer_t timerid) { diff --git a/sched/timer/timer_gettime.c b/sched/timer/timer_gettime.c index 44bf877c9f3..c1e58899b45 100644 --- a/sched/timer/timer_gettime.c +++ b/sched/timer/timer_gettime.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/timer/timer_gettime.c * * Copyright (C) 2007 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -47,21 +47,22 @@ #ifndef CONFIG_DISABLE_POSIX_TIMERS -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: timer_gettime * * Description: - * The timer_gettime() function will store the amount of time until the - * specified timer, timerid, expires and the reload value of the timer into the - * space pointed to by the value argument. The it_value member of this structure - * will contain the amount of time before the timer expires, or zero if the timer - * is disarmed. This value is returned as the interval until timer expiration, - * even if the timer was armed with absolute time. The it_interval member of - * value will contain the reload value last set by timer_settime(). + * The timer_gettime() function will store the amount of time until the + * specified timer, timerid, expires and the reload value of the timer + * into the space pointed to by the value argument. The it_value member + * of this structure will contain the amount of time before the timer + * expires, or zero if the timer is disarmed. This value is returned as + * the interval until timer expiration, even if the timer was armed with + * absolute time. The it_interval member of value will contain the reload + * value last set by timer_settime(). * * Parameters: * timerid - The pre-thread timer, previously created by the call to @@ -69,8 +70,8 @@ * * Return Value: * If the timer_gettime() succeeds, a value of 0 (OK) will be returned. - * If an error occurs, the value -1 (ERROR) will be returned, and errno set to - * indicate the error. + * If an error occurs, the value -1 (ERROR) will be returned, and errno + * set to indicate the error. * * EINVAL - The timerid argument does not correspond to an ID returned by * timer_create() but not yet deleted by timer_delete(). @@ -80,7 +81,7 @@ * by this function could be significantly more than that actual time * remaining on the timer at any time. * - ********************************************************************************/ + ****************************************************************************/ int timer_gettime(timer_t timerid, FAR struct itimerspec *value) { diff --git a/sched/timer/timer_initialize.c b/sched/timer/timer_initialize.c index 2a215c605cf..25a64b1a51a 100644 --- a/sched/timer/timer_initialize.c +++ b/sched/timer/timer_initialize.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/timer/timer_initialize.c * * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include #include @@ -51,9 +51,9 @@ #ifndef CONFIG_DISABLE_POSIX_TIMERS -/******************************************************************************** +/**************************************************************************** * Private Data - ********************************************************************************/ + ****************************************************************************/ /* These are the preallocated times */ @@ -61,28 +61,28 @@ static struct posix_timer_s g_prealloctimers[CONFIG_PREALLOC_TIMERS]; #endif -/******************************************************************************** +/**************************************************************************** * Public Data - ********************************************************************************/ - -/* This is a list of free, preallocated timer structures */ + ****************************************************************************/ #if CONFIG_PREALLOC_TIMERS > 0 +/* This is a list of free, preallocated timer structures */ + volatile sq_queue_t g_freetimers; #endif -/* This is a list of instantiated timer structures -- active and inactive. The - * timers are place on this list by timer_create() and removed from the list by - * timer_delete() or when the owning thread exits. +/* This is a list of instantiated timer structures -- active and inactive. + * The timers are place on this list by timer_create() and removed from the + * list by timer_delete() or when the owning thread exits. */ volatile sq_queue_t g_alloctimers; -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: timer_initialize * * Description: @@ -94,9 +94,7 @@ volatile sq_queue_t g_alloctimers; * Return Value: * None * - * Assumptions: - * - ********************************************************************************/ + ****************************************************************************/ void weak_function timer_initialize(void) { @@ -120,12 +118,12 @@ void weak_function timer_initialize(void) sq_init((FAR sq_queue_t *)&g_alloctimers); } -/******************************************************************************** +/**************************************************************************** * Name: timer_deleteall * * Description: - * This function is called whenever a thread exits. Any timers owned by that - * thread are deleted as though called by timer_delete(). + * This function is called whenever a thread exits. Any timers owned by + * that thread are deleted as though called by timer_delete(). * * It is provided in this file so that it can be weakly defined but also, * like timer_intitialize(), be brought into the link whenever the timer @@ -137,9 +135,7 @@ void weak_function timer_initialize(void) * Return Value: * None * - * Assumptions: - * - ********************************************************************************/ + ****************************************************************************/ void weak_function timer_deleteall(pid_t pid) { @@ -148,7 +144,9 @@ void weak_function timer_deleteall(pid_t pid) irqstate_t flags; flags = enter_critical_section(); - for (timer = (FAR struct posix_timer_s *)g_alloctimers.head; timer; timer = next) + for (timer = (FAR struct posix_timer_s *)g_alloctimers.head; + timer != NULL; + timer = next) { next = timer->flink; if (timer->pt_owner == pid) diff --git a/sched/timer/timer_release.c b/sched/timer/timer_release.c index 3ad62febbc1..2608092a16f 100644 --- a/sched/timer/timer_release.c +++ b/sched/timer/timer_release.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/timer/timer_release.c * * Copyright (C) 2008 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -49,19 +49,19 @@ #ifndef CONFIG_DISABLE_POSIX_TIMERS -/******************************************************************************** +/**************************************************************************** * Private Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: timer_free * * Description: - * Remove the timer from the allocated timer list and free it or return it to - * the free list (depending on whether or not the timer is one of the + * Remove the timer from the allocated timer list and free it or return it + * to the free list (depending on whether or not the timer is one of the * preallocated timers) * - ********************************************************************************/ + ****************************************************************************/ static inline void timer_free(struct posix_timer_s *timer) { @@ -90,29 +90,30 @@ static inline void timer_free(struct posix_timer_s *timer) } } -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: timer_release * * Description: - * timer_release implements the heart of timer_delete. It is private to the - * the OS internals and differs only in that return value of 1 means that the - * timer was not actually deleted. + * timer_release implements the heart of timer_delete. It is private to + * the OS internals and differs only in that return value of 1 means that + * the timer was not actually deleted. * * Parameters: * timer - The per-thread timer, previously created by the call to * timer_create(), to be deleted. * * Return Value: - * If the call succeeds, timer_release() will return 0 (OK) or 1 (meaning that - * the timer is still valid). Otherwise, the function will return a negated errno: + * If the call succeeds, timer_release() will return 0 (OK) or 1 (meaning + * that the timer is still valid). Otherwise, the function will return a + * negated errno value: * * -EINVAL - The timer specified timerid is not valid. * - ********************************************************************************/ + ****************************************************************************/ int timer_release(FAR struct posix_timer_s *timer) { diff --git a/sched/timer/timer_settime.c b/sched/timer/timer_settime.c index d134441e3e8..aa6007f95aa 100644 --- a/sched/timer/timer_settime.c +++ b/sched/timer/timer_settime.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/timer/timer_settime.c * * Copyright (C) 2007-2010, 2013-2016 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -53,19 +53,20 @@ #ifndef CONFIG_DISABLE_POSIX_TIMERS -/******************************************************************************** +/**************************************************************************** * Private Function Prototypes - ********************************************************************************/ + ****************************************************************************/ static inline void timer_signotify(FAR struct posix_timer_s *timer); -static inline void timer_restart(FAR struct posix_timer_s *timer, wdparm_t itimer); +static inline void timer_restart(FAR struct posix_timer_s *timer, + wdparm_t itimer); static void timer_timeout(int argc, wdparm_t itimer); -/******************************************************************************** +/**************************************************************************** * Private Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: timer_signotify * * Description: @@ -81,7 +82,7 @@ static void timer_timeout(int argc, wdparm_t itimer); * Assumptions: * This function executes in the context of the watchod timer interrupt. * - ********************************************************************************/ + ****************************************************************************/ static inline void timer_signotify(FAR struct posix_timer_s *timer) { @@ -121,7 +122,7 @@ static inline void timer_signotify(FAR struct posix_timer_s *timer) #endif } -/******************************************************************************** +/**************************************************************************** * Name: timer_restart * * Description: @@ -136,7 +137,7 @@ static inline void timer_signotify(FAR struct posix_timer_s *timer) * Assumptions: * This function executes in the context of the watchdog timer interrupt. * - ********************************************************************************/ + ****************************************************************************/ static inline void timer_restart(FAR struct posix_timer_s *timer, wdparm_t itimer) @@ -146,12 +147,12 @@ static inline void timer_restart(FAR struct posix_timer_s *timer, if (timer->pt_delay) { timer->pt_last = timer->pt_delay; - (void)wd_start(timer->pt_wdog, timer->pt_delay, (wdentry_t)timer_timeout, - 1, itimer); + (void)wd_start(timer->pt_wdog, timer->pt_delay, + (wdentry_t)timer_timeout, 1, itimer); } } -/******************************************************************************** +/**************************************************************************** * Name: timer_timeout * * Description: @@ -169,13 +170,14 @@ static inline void timer_restart(FAR struct posix_timer_s *timer, * Assumptions: * This function executes in the context of the watchod timer interrupt. * - ********************************************************************************/ + ****************************************************************************/ static void timer_timeout(int argc, wdparm_t itimer) { #ifndef CONFIG_CAN_PASS_STRUCTS - /* On many small machines, pointers are encoded and cannot be simply cast from - * wdparm_t to struct tcb_s *. The following union works around this (see wdogparm_t). + /* On many small machines, pointers are encoded and cannot be simply cast + * from wdparm_t to struct tcb_s *. The following union works around this + * (see wdogparm_t). */ union @@ -186,9 +188,9 @@ static void timer_timeout(int argc, wdparm_t itimer) u.itimer = itimer; - /* Send the specified signal to the specified task. Increment the reference - * count on the timer first so that will not be deleted until after the - * signal handler returns. + /* Send the specified signal to the specified task. Increment the + * reference count on the timer first so that will not be deleted until + * after the signal handler returns. */ u.timer->pt_crefs++; @@ -207,9 +209,9 @@ static void timer_timeout(int argc, wdparm_t itimer) #else FAR struct posix_timer_s *timer = (FAR struct posix_timer_s *)itimer; - /* Send the specified signal to the specified task. Increment the reference - * count on the timer first so that will not be deleted until after the - * signal handler returns. + /* Send the specified signal to the specified task. Increment the + * reference count on the timer first so that will not be deleted until + * after the signal handler returns. */ timer->pt_crefs++; @@ -228,62 +230,63 @@ static void timer_timeout(int argc, wdparm_t itimer) #endif } -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: timer_settime * * Description: - * The timer_settime() function sets the time until the next expiration of the - * timer specified by timerid from the it_value member of the value argument - * and arm the timer if the it_value member of value is non-zero. If the - * specified timer was already armed when timer_settime() is called, this call - * will reset the time until next expiration to the value specified. If the - * it_value member of value is zero, the timer will be disarmed. The effect - * of disarming or resetting a timer with pending expiration notifications is - * unspecified. + * The timer_settime() function sets the time until the next expiration of + * the timer specified by timerid from the it_value member of the value + * argument and arm the timer if the it_value member of value is non-zero. + * If the specified timer was already armed when timer_settime() is + * called, this call will reset the time until next expiration to the + * value specified. If the it_value member of value is zero, the timer + * will be disarmed. The effect of disarming or resetting a timer with + * pending expiration notifications is unspecified. * - * If the flag TIMER_ABSTIME is not set in the argument flags, timer_settime() - * will behave as if the time until next expiration is set to be equal to the - * interval specified by the it_value member of value. That is, the timer will - * expire in it_value nanoseconds from when the call is made. If the flag - * TIMER_ABSTIME is set in the argument flags, timer_settime() will behave as - * if the time until next expiration is set to be equal to the difference between - * the absolute time specified by the it_value member of value and the current - * value of the clock associated with timerid. That is, the timer will expire - * when the clock reaches the value specified by the it_value member of value. - * If the specified time has already passed, the function will succeed and the + * If the flag TIMER_ABSTIME is not set in the argument flags, + * timer_settime() will behave as if the time until next expiration is set + * to be equal to the interval specified by the it_value member of value. + * That is, the timer will expire in it_value nanoseconds from when the + * call is made. If the flag TIMER_ABSTIME is set in the argument flags, + * timer_settime() will behave as if the time until next expiration is set + * to be equal to the difference between the absolute time specified by + * the it_value member of value and the current value of the clock + * associated with timerid. That is, the timer will expire when the clock + * reaches the value specified by the it_value member of value. If the + * specified time has already passed, the function will succeed and the * expiration notification will be made. * * The reload value of the timer will be set to the value specified by the * it_interval member of value. When a timer is armed with a non-zero * it_interval, a periodic (or repetitive) timer is specified. * - * Time values that are between two consecutive non-negative integer multiples - * of the resolution of the specified timer will be rounded up to the larger - * multiple of the resolution. Quantization error will not cause the timer to - * expire earlier than the rounded time value. + * Time values that are between two consecutive non-negative integer + * multiples of the resolution of the specified timer will be rounded up + * to the larger multiple of the resolution. Quantization error will not + * cause the timer to expire earlier than the rounded time value. * - * If the argument ovalue is not NULL, the timer_settime() function will store, - * in the location referenced by ovalue, a value representing the previous - * amount of time before the timer would have expired, or zero if the timer was - * disarmed, together with the previous timer reload value. Timers will not - * expire before their scheduled time. + * If the argument ovalue is not NULL, the timer_settime() function will + * store, in the location referenced by ovalue, a value representing the + * previous amount of time before the timer would have expired, or zero if + * the timer was disarmed, together with the previous timer reload value. + * Timers will not expire before their scheduled time. * * Parameters: * timerid - The pre-thread timer, previously created by the call to * timer_create(), to be be set. * flags - Specifie characteristics of the timer (see above) * value - Specifies the timer value to set - * ovalue - A location in which to return the time remaining from the previous - * timer setting. (ignored) + * ovalue - A location in which to return the time remaining from the + * previous timer setting. (ignored) * * Return Value: * If the timer_settime() succeeds, a value of 0 (OK) will be returned. - * If an error occurs, the value -1 (ERROR) will be returned, and errno set to - * indicate the error. + * If an error occurs, the value -1 (ERROR) will be returned, and errno set + * to indicate the error. * * EINVAL - The timerid argument does not correspond to an ID returned by * timer_create() but not yet deleted by timer_delete(). @@ -293,9 +296,10 @@ static void timer_timeout(int argc, wdparm_t itimer) * * Assumptions: * - ********************************************************************************/ + ****************************************************************************/ -int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value, +int timer_settime(timer_t timerid, int flags, + FAR const struct itimerspec *value, FAR struct itimerspec *ovalue) { FAR struct posix_timer_s *timer = (FAR struct posix_timer_s *)timerid; @@ -373,7 +377,6 @@ int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value /* Then start the watchdog */ - if (delay > 0) { timer->pt_last = delay; diff --git a/sched/wdog/wd_gettime.c b/sched/wdog/wd_gettime.c index f533f42f1ec..3027b29636e 100644 --- a/sched/wdog/wd_gettime.c +++ b/sched/wdog/wd_gettime.c @@ -1,4 +1,4 @@ -/******************************************************************************** +/**************************************************************************** * sched/wdog/wd_gettime.c * * Copyright (C) 2007, 2009, 2014-2016 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************/ + ****************************************************************************/ #include @@ -44,11 +44,11 @@ #include "wdog/wdog.h" -/******************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************/ + ****************************************************************************/ -/******************************************************************************** +/**************************************************************************** * Name: wd_gettime * * Description: @@ -59,12 +59,11 @@ * wdog = watchdog ID * * Return Value: - * The time in system ticks remaining until the watchdog time expires. Zero - * means either that wdog is not valid or that the wdog has already expired. + * The time in system ticks remaining until the watchdog time expires. + * Zero means either that wdog is not valid or that the wdog has already + * expired. * - * Assumptions: - * - ********************************************************************************/ + ****************************************************************************/ int wd_gettime(WDOG_ID wdog) { @@ -75,14 +74,16 @@ int wd_gettime(WDOG_ID wdog) flags = enter_critical_section(); if (wdog && WDOG_ISACTIVE(wdog)) { - /* Traverse the watchdog list accumulating lag times until we find the wdog - * that we are looking for + /* Traverse the watchdog list accumulating lag times until we find the + * wdog that we are looking for */ FAR struct wdog_s *curr; int delay = 0; - for (curr = (FAR struct wdog_s *)g_wdactivelist.head; curr; curr = curr->next) + for (curr = (FAR struct wdog_s *)g_wdactivelist.head; + curr != NULL; + curr = curr->next) { delay += curr->lag; if (curr == wdog) diff --git a/sched/wqueue/kwork_process.c b/sched/wqueue/kwork_process.c index f09735fd665..8354a81fca1 100644 --- a/sched/wqueue/kwork_process.c +++ b/sched/wqueue/kwork_process.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/wqueue/work_process.c + * sched/wqueue/work_process.c * * Copyright (C) 2009-2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt