diff options
Diffstat (limited to 'rtemsbsd/src/rtems-bsd-timeout.c')
-rw-r--r-- | rtemsbsd/src/rtems-bsd-timeout.c | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/rtemsbsd/src/rtems-bsd-timeout.c b/rtemsbsd/src/rtems-bsd-timeout.c deleted file mode 100644 index 0055c42e..00000000 --- a/rtemsbsd/src/rtems-bsd-timeout.c +++ /dev/null @@ -1,129 +0,0 @@ -/** - * @file - * - * @ingroup rtems_bsd_rtems - * - * @brief TODO. - */ - -/* - * COPYRIGHT (c) 2012. - * On-Line Applications Research Corporation (OAR). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <freebsd/machine/rtems-bsd-config.h> -#include <freebsd/sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <freebsd/sys/param.h> -#include <freebsd/sys/systm.h> -#include <freebsd/sys/bus.h> -#include <freebsd/sys/callout.h> -#include <freebsd/sys/condvar.h> -#include <freebsd/sys/interrupt.h> -#include <freebsd/sys/kernel.h> -#include <freebsd/sys/ktr.h> -#include <freebsd/sys/lock.h> -#include <freebsd/sys/malloc.h> -#include <freebsd/sys/mutex.h> -#include <freebsd/sys/proc.h> -#include <freebsd/sys/sdt.h> - -static int timeout_cpu; -/* - * There is one struct callout_cpu per cpu, holding all relevant - * state for the callout processing thread on the individual CPU. - * In particular: - * cc_ticks is incremented once per tick in callout_cpu(). - * It tracks the global 'ticks' but in a way that the individual - * threads should not worry about races in the order in which - * hardclock() and hardclock_cpu() run on the various CPUs. - * cc_softclock is advanced in callout_cpu() to point to the - * first entry in cc_callwheel that may need handling. In turn, - * a softclock() is scheduled so it can serve the various entries i - * such that cc_softclock <= i <= cc_ticks . - * XXX maybe cc_softclock and cc_ticks should be volatile ? - * - * cc_ticks is also used in callout_reset_cpu() to determine - * when the callout should be served. - */ -struct callout_cpu { - struct mtx cc_lock; - struct callout *cc_callout; - struct callout_tailq *cc_callwheel; - struct callout_list cc_callfree; - struct callout *cc_next; - struct callout *cc_curr; - void *cc_cookie; - int cc_ticks; - int cc_softticks; - int cc_cancel; - int cc_waiting; -}; - -/* - * timeout -- - * Execute a function after a specified length of time. - * - * untimeout -- - * Cancel previous timeout function call. - * - * callout_handle_init -- - * Initialize a handle so that using it with untimeout is benign. - * - * See AT&T BCI Driver Reference Manual for specification. This - * implementation differs from that one in that although an - * identification value is returned from timeout, the original - * arguments to timeout as well as the identifier are used to - * identify entries for untimeout. - */ - -struct callout_handle -timeout(ftn, arg, to_ticks) - timeout_t *ftn; - void *arg; - int to_ticks; -{ - struct callout_cpu *cc; - struct callout *new; - struct callout_handle handle; - -#if 0 - cc = CC_CPU(timeout_cpu); - CC_LOCK(cc); - /* Fill in the next free callout structure. */ - new = SLIST_FIRST(&cc->cc_callfree); - if (new == NULL) - /* XXX Attempt to malloc first */ - panic("timeout table full"); - SLIST_REMOVE_HEAD(&cc->cc_callfree, c_links.sle); - callout_reset(new, to_ticks, ftn, arg); - handle.callout = new; - CC_UNLOCK(cc); -#endif - return (handle); -} - - |