nuttx/sched/timer/timer.h
Gregory Nutt f824989acc sched/timer: Update most files to Apache 2.0
Update all files possible under sched/timer to Apache 2.0.  These excludes two files that have a Xiaomi copyright.  Also, run all modified files through nxstyle to assure that the conform to the coding standard.
2020-03-11 18:39:28 -03:00

89 lines
3.3 KiB
C

/****************************************************************************
* sched/timer/timer.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __SCHED_TIMER_TIMER_H
#define __SCHED_TIMER_TIMER_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <nuttx/compiler.h>
#include <nuttx/signal.h>
#include <nuttx/wdog.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define PT_FLAGS_PREALLOCATED 0x01 /* Timer comes from a pool of preallocated timers */
/****************************************************************************
* Public Types
****************************************************************************/
/* This structure represents one POSIX timer */
struct posix_timer_s
{
FAR struct posix_timer_s *flink;
uint8_t pt_flags; /* See PT_FLAGS_* definitions */
uint8_t pt_crefs; /* Reference count */
pid_t pt_owner; /* Creator of timer */
int pt_delay; /* If non-zero, used to reset repetitive timers */
int pt_last; /* Last value used to set watchdog */
WDOG_ID pt_wdog; /* The watchdog that provides the timing */
struct sigevent pt_event; /* Notification information */
struct sigwork_s pt_work;
};
/****************************************************************************
* Public Data
****************************************************************************/
#if CONFIG_PREALLOC_TIMERS > 0
/* This is a list of free, preallocated timer structures */
extern 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.
*/
extern volatile sq_queue_t g_alloctimers;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
void weak_function timer_initialize(void);
void weak_function timer_deleteall(pid_t pid);
int timer_release(FAR struct posix_timer_s *timer);
#endif /* __SCHED_TIMER_TIMER_H */