2010-08-14 09:56:13 +08:00
|
|
|
/****************************************************************************
|
2014-08-09 05:08:07 +08:00
|
|
|
* sched/paging/paging.h
|
2010-08-14 09:56:13 +08:00
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
2012-07-15 03:30:31 +08:00
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
2010-08-14 09:56:13 +08:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
|
|
* used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
|
|
|
|
* COPYRIGHT OWNER 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.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-08-09 05:08:07 +08:00
|
|
|
#ifndef __SCHED_PAGING_PAGING_H
|
|
|
|
#define __SCHED_PAGING_PAGING_H
|
2010-08-14 09:56:13 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
2014-04-14 04:32:20 +08:00
|
|
|
|
2010-08-14 09:56:13 +08:00
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <queue.h>
|
|
|
|
|
|
|
|
#ifdef CONFIG_PAGING
|
|
|
|
|
|
|
|
/****************************************************************************
|
2015-04-08 20:47:36 +08:00
|
|
|
* Pre-processor Definitions
|
2010-08-14 09:56:13 +08:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Configuration ************************************************************/
|
|
|
|
|
2010-08-15 23:02:45 +08:00
|
|
|
/* Supply reasonable (but probably non-optimal) default settings if
|
|
|
|
* configuration items are omitted.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CONFIG_PAGING_DEFPRIO
|
|
|
|
# define CONFIG_PAGING_DEFPRIO 50
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CONFIG_PAGING_WORKPERIOD
|
|
|
|
# define CONFIG_PAGING_WORKPERIOD (500*1000) /* 1/2 second */
|
2010-08-14 09:56:13 +08:00
|
|
|
#endif
|
|
|
|
|
2010-08-15 23:02:45 +08:00
|
|
|
#ifndef CONFIG_PAGING_STACKSIZE
|
|
|
|
# define CONFIG_PAGING_STACKSIZE CONFIG_IDLETHREAD_STACKSIZE
|
2010-08-14 09:56:13 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_DISABLE_SIGNALS
|
|
|
|
# warning "Page fill support requires signals"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY
|
|
|
|
|
2010-08-15 23:02:45 +08:00
|
|
|
/* This is the task IDof the page fill worker thread. This value was set in
|
|
|
|
* os_start when the page fill worker thread was started.
|
|
|
|
*/
|
2010-08-14 09:56:13 +08:00
|
|
|
|
|
|
|
extern pid_t g_pgworker;
|
|
|
|
|
2010-08-16 00:50:25 +08:00
|
|
|
/* The page fill worker thread maintains a static variable called g_pftcb.
|
|
|
|
* If no page fill is in progress, g_pftcb will be NULL. Otherwise, g_pftcb
|
|
|
|
* will point to the TCB of the task which is receiving the fill that is
|
|
|
|
* in progess.
|
2010-08-15 23:02:45 +08:00
|
|
|
*
|
|
|
|
* NOTE: I think that this is the only state in which a TCB does not reside
|
|
|
|
* in some list. Here is it in limbo, outside of the normally queuing while
|
|
|
|
* the page file is in progress. Where here, it will be marked with
|
|
|
|
* TSTATE_TASK_INVALID.
|
|
|
|
*/
|
2010-08-14 09:56:13 +08:00
|
|
|
|
2013-02-05 02:46:28 +08:00
|
|
|
extern FAR struct tcb_s *g_pftcb;
|
2010-08-14 09:56:13 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: pg_worker
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* This is the entry point of the worker thread that performs the actual
|
|
|
|
* page file.
|
|
|
|
*
|
|
|
|
* Input parameters:
|
|
|
|
* argc, argv (not used)
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Does not return
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2012-07-15 03:30:31 +08:00
|
|
|
int pg_worker(int argc, char *argv[]);
|
2010-08-14 09:56:13 +08:00
|
|
|
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
#endif /* CONFIG_PAGING */
|
2014-08-09 05:08:07 +08:00
|
|
|
#endif /* __SCHED_PAGING_PAGING_H */
|