Move work queue logic from sched/ to libc/wqueue. It is not core logic and will be extended to support user-space work queues

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5711 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2013-03-05 18:57:51 +00:00
parent 75e9291077
commit 4134862fb2
49 changed files with 230 additions and 201 deletions
+7 -1
View File
@@ -4246,8 +4246,14 @@
file (2013-03-04).
* configs/open1788: Enable LED support in all configurations.
(2013-03-04)
* configs/open1788/nsh: NSH configuration verified function. By Rommel
Marcelo (2013-03-05).
* configs/open1788/src/lpc17_nsh.c: Use the SD card interface, not SPI
to interface with SD cards.
to interface with SD cards (2013-03-05.
* arch/arm/src/lpc17xx/lpc17_sdcard.c and header files: Clone the STM32
SD card interface to the LPC1788. It appears to be the same IP.
(2013-03-05)
* libc/wqueue: Work queue logic moved from sched/ to libc/wqueue. It
is not really core OS functionality and this move helps prepare for
user-space work queues.
+39 -2
View File
@@ -150,6 +150,11 @@ config LPC17_ETHERNET
select ARCH_HAVE_PHY
default n
config LPC17_LCD
bool "LCD controller"
default n
depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X
config LPC17_USBHOST
bool "USB host"
select USBHOST
@@ -190,6 +195,11 @@ config LPC17_UART3
select ARCH_HAVE_UART3
default n
config LPC17_UART4
bool "UART4"
select ARCH_HAVE_UART4
default n
config LPC17_CAN1
bool "CAN1"
select ARCH_HAVE_UART4
@@ -202,6 +212,7 @@ config LPC17_CAN2
config LPC17_SPI
bool "SPI"
default n
depends on ARCH_FAMILY_LPC175X || ARCH_FAMILY_LPC176X
config LPC17_SSP0
bool "SSP0"
@@ -211,6 +222,11 @@ config LPC17_SSP1
bool "SSP1"
default n
config LPC17_SSP2
bool "SSP1"
default n
depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X
config LPC17_SPIFI
bool "SPIFI Interface"
depends on ARCH_HAVE_SPIFI
@@ -252,13 +268,19 @@ config LPC17_RIT
bool "RIT"
default n
config LPC17_PWM
bool "PWM"
config LPC17_PWM0
bool "PWM0"
default n
config LPC17_PWM1
bool "PWM1"
default n
depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X
config LPC17_MCPWM
bool "MCPWM"
default n
depends on ARCH_FAMILY_LPC175X || ARCH_FAMILY_LPC176X
config LPC17_QEI
bool "QEI"
@@ -268,6 +290,11 @@ config LPC17_RTC
bool "RTC"
default n
config LPC17_RTCEV
bool "RTC event monitor"
default n
depends on LPC17_RTC
config LPC17_WDT
bool "WDT"
default n
@@ -284,10 +311,20 @@ config LPC17_GPDMA
bool "GPDMA"
default n
config LPC17_CRC
bool "CRC engine"
default n
depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X
config LPC17_FLASH
bool "FLASH"
default n
config LPC17_EEPROM
bool "EEPROM"
default n
depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X
endmenu
menu "Serial driver options"
+1 -1
View File
@@ -338,7 +338,7 @@ Lincoln 60 Configuration Options
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -634,7 +634,7 @@ LPCXpresso Configuration Options
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -89,7 +89,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -89,7 +89,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -89,7 +89,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -89,7 +89,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -89,7 +89,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
@@ -89,7 +89,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -308,7 +308,7 @@ mbed Configuration Options
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -420,7 +420,7 @@ Nucleus 2G Configuration Options
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -717,7 +717,7 @@ Olimex LPC1766-STK Configuration Options
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -141,7 +141,7 @@ CONFIG_LPC17_UART0=y
# CONFIG_LPC17_TMR2 is not set
# CONFIG_LPC17_TMR3 is not set
# CONFIG_LPC17_RIT is not set
# CONFIG_LPC17_PWM is not set
# CONFIG_LPC17_PWM0 is not set
# CONFIG_LPC17_MCPWM is not set
# CONFIG_LPC17_QEI is not set
# CONFIG_LPC17_RTC is not set
+1 -1
View File
@@ -145,7 +145,7 @@ CONFIG_LPC17_UART0=y
# CONFIG_LPC17_TMR2 is not set
# CONFIG_LPC17_TMR3 is not set
# CONFIG_LPC17_RIT is not set
# CONFIG_LPC17_PWM is not set
# CONFIG_LPC17_PWM0 is not set
# CONFIG_LPC17_MCPWM is not set
# CONFIG_LPC17_QEI is not set
# CONFIG_LPC17_RTC is not set
+1 -1
View File
@@ -147,7 +147,7 @@ CONFIG_LPC17_SSP1=y
# CONFIG_LPC17_TMR2 is not set
# CONFIG_LPC17_TMR3 is not set
# CONFIG_LPC17_RIT is not set
# CONFIG_LPC17_PWM is not set
# CONFIG_LPC17_PWM0 is not set
# CONFIG_LPC17_MCPWM is not set
# CONFIG_LPC17_QEI is not set
# CONFIG_LPC17_RTC is not set
+1 -1
View File
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
@@ -87,7 +87,7 @@ CONFIG_LPC17_TMR1=n
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+7 -3
View File
@@ -128,6 +128,7 @@ CONFIG_LPC17_PLL0=y
CONFIG_LPC17_PLL1=y
# CONFIG_LPC17_EMC is not set
# CONFIG_LPC17_ETHERNET is not set
# CONFIG_LPC17_LCD is not set
# CONFIG_LPC17_USBHOST is not set
# CONFIG_LPC17_USBDEV is not set
# CONFIG_LPC17_SDCARD=y
@@ -135,11 +136,12 @@ CONFIG_LPC17_UART0=y
# CONFIG_LPC17_UART1 is not set
# CONFIG_LPC17_UART2 is not set
# CONFIG_LPC17_UART3 is not set
# CONFIG_LPC17_UART4 is not set
# CONFIG_LPC17_CAN1 is not set
# CONFIG_LPC17_CAN2 is not set
# CONFIG_LPC17_SPI is not set
# CONFIG_LPC17_SSP0 is not set
# CONFIG_LPC17_SSP1 is not set
# CONFIG_LPC17_SSP2 is not set
# CONFIG_LPC17_I2C0 is not set
# CONFIG_LPC17_I2C1 is not set
# CONFIG_LPC17_I2C2 is not set
@@ -149,15 +151,17 @@ CONFIG_LPC17_UART0=y
# CONFIG_LPC17_TMR2 is not set
# CONFIG_LPC17_TMR3 is not set
# CONFIG_LPC17_RIT is not set
# CONFIG_LPC17_PWM is not set
# CONFIG_LPC17_MCPWM is not set
# CONFIG_LPC17_PWM0 is not set
# CONFIG_LPC17_PWM1 is not set
# CONFIG_LPC17_QEI is not set
# CONFIG_LPC17_RTC is not set
# CONFIG_LPC17_WDT is not set
# CONFIG_LPC17_ADC is not set
# CONFIG_LPC17_DAC is not set
CONFIG_LPC17_GPDMA=y
# CONFIG_LPC17_CRC is not set
# CONFIG_LPC17_FLASH is not set
# CONFIG_LPC17_EEPROM is not set
#
# Serial driver options
+1 -1
View File
@@ -147,7 +147,7 @@ CONFIG_LPC17_UART0=y
# CONFIG_LPC17_TMR2 is not set
# CONFIG_LPC17_TMR3 is not set
# CONFIG_LPC17_RIT is not set
# CONFIG_LPC17_PWM is not set
# CONFIG_LPC17_PWM0 is not set
# CONFIG_LPC17_MCPWM is not set
# CONFIG_LPC17_QEI is not set
# CONFIG_LPC17_RTC is not set
+1 -1
View File
@@ -434,7 +434,7 @@ ZKit-ARM Configuration Options
CONFIG_LPC17_TMR2=n
CONFIG_LPC17_TMR3=n
CONFIG_LPC17_RIT=n
CONFIG_LPC17_PWM=n
CONFIG_LPC17_PWM0=n
CONFIG_LPC17_MCPWM=n
CONFIG_LPC17_QEI=n
CONFIG_LPC17_RTC=n
+1 -1
View File
@@ -148,7 +148,7 @@ CONFIG_LPC17_UART0=y
# CONFIG_LPC17_TMR2 is not set
# CONFIG_LPC17_TMR3 is not set
# CONFIG_LPC17_RIT is not set
# CONFIG_LPC17_PWM is not set
# CONFIG_LPC17_PWM0 is not set
# CONFIG_LPC17_MCPWM is not set
# CONFIG_LPC17_QEI is not set
# CONFIG_LPC17_RTC is not set
+1 -1
View File
@@ -146,7 +146,7 @@ CONFIG_LPC17_SSP0=y
# CONFIG_LPC17_TMR2 is not set
# CONFIG_LPC17_TMR3 is not set
# CONFIG_LPC17_RIT is not set
# CONFIG_LPC17_PWM is not set
# CONFIG_LPC17_PWM0 is not set
# CONFIG_LPC17_MCPWM is not set
# CONFIG_LPC17_QEI is not set
# CONFIG_LPC17_RTC is not set
+1 -1
View File
@@ -148,7 +148,7 @@ CONFIG_LPC17_UART0=y
# CONFIG_LPC17_TMR2 is not set
# CONFIG_LPC17_TMR3 is not set
# CONFIG_LPC17_RIT is not set
# CONFIG_LPC17_PWM is not set
# CONFIG_LPC17_PWM0 is not set
# CONFIG_LPC17_MCPWM is not set
# CONFIG_LPC17_QEI is not set
# CONFIG_LPC17_RTC is not set
+17 -9
View File
@@ -88,15 +88,15 @@ extern "C" {
#else
KMALLOC_EXTERN void kmm_initialize(FAR void *heap_start, size_t heap_size);
KMALLOC_EXTERN void kmm_addregion(FAR void *heapstart, size_t heapsize);
KMALLOC_EXTERN int kmm_trysemaphore(void);
KMALLOC_EXTERN void kmm_givesemaphore(void);
void kmm_initialize(FAR void *heap_start, size_t heap_size);
void kmm_addregion(FAR void *heapstart, size_t heapsize);
int kmm_trysemaphore(void);
void kmm_givesemaphore(void);
KMALLOC_EXTERN FAR void *kmalloc(size_t);
KMALLOC_EXTERN FAR void *kzalloc(size_t);
KMALLOC_EXTERN FAR void *krealloc(FAR void*, size_t);
KMALLOC_EXTERN void kfree(FAR void*);
FAR void *kmalloc(size_t);
FAR void *kzalloc(size_t);
FAR void *krealloc(FAR void*, size_t);
void kfree(FAR void*);
#endif
@@ -104,7 +104,15 @@ KMALLOC_EXTERN void kfree(FAR void*);
/* Handles memory freed from an interrupt handler */
KMALLOC_EXTERN void sched_free(FAR void *address);
void sched_free(FAR void *address);
/* Functions defined in os_list.c *******************************************/
/* Must be called periodically to clean up deallocations delayed by
* sched_free()
*/
void sched_garbagecollection(void);
#undef KMALLOC_EXTERN
#if defined(__cplusplus)
+67 -11
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/wqueue.h
*
* Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -83,6 +83,10 @@
* priority worker thread. Default: CONFIG_IDLETHREAD_STACKSIZE.
*/
#if defined(CONFIG_SCHED_WORKQUEUE) && defined(CONFIG_DISABLE_SIGNALS)
# warning "Worker thread support requires signals"
#endif
#ifndef CONFIG_SCHED_WORKPRIORITY
# define CONFIG_SCHED_WORKPRIORITY 192
#endif
@@ -109,6 +113,14 @@
# endif
#endif
/* How many worker threads are there? */
#ifdef CONFIG_SCHED_LPWORK
# define NWORKERS 2
#else
# define NWORKERS 1
#endif
/* Work queue IDs (indices):
*
* Kernel Work Queues:
@@ -144,6 +156,17 @@
#ifndef __ASSEMBLY__
/* This structure defines the state on one work queue. This structure is
* used internally by the OS and worker queue logic and should not be
* accessed by application logic.
*/
struct wqueue_s
{
pid_t pid; /* The task ID of the worker thread */
struct dq_queue_s q; /* The queue of pending work */
};
/* Defines the work callback */
typedef void (*worker_t)(FAR void *arg);
@@ -155,11 +178,11 @@ typedef void (*worker_t)(FAR void *arg);
struct work_s
{
struct dq_entry_s dq; /* Implements a doubly linked list */
worker_t worker; /* Work callback */
FAR void *arg; /* Callback argument */
uint32_t qtime; /* Time work queued */
uint32_t delay; /* Delay until work performed */
struct dq_entry_s dq; /* Implements a doubly linked list */
worker_t worker; /* Work callback */
FAR void *arg; /* Callback argument */
uint32_t qtime; /* Time work queued */
uint32_t delay; /* Delay until work performed */
};
/****************************************************************************
@@ -168,15 +191,48 @@ struct work_s
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
extern "C"
{
#else
#define EXTERN extern
#endif
/* The state of each work queue. This data structure is used internally by
* the OS and worker queue logic and should not be accessed by application
* logic.
*/
EXTERN struct wqueue_s g_work[NWORKERS];
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: work_hpthread and work_lpthread
*
* Description:
* These are the main worker threads that performs actions placed on the
* work lists. One thread also performs periodic garbage collection (that
* is performed by the idle thread if CONFIG_SCHED_WORKQUEUE is not defined).
*
* These entrypoints are referenced by OS internally and should not be
* accessed by application logic.
*
* Input parameters:
* argc, argv (not used)
*
* Returned Value:
* Does not return
*
****************************************************************************/
int work_hpthread(int argc, char *argv[]);
#ifdef CONFIG_SCHED_LPWORK
int work_lpthread(int argc, char *argv[]);
#endif
/****************************************************************************
* Name: work_queue
*
@@ -206,8 +262,8 @@ extern "C" {
*
****************************************************************************/
EXTERN int work_queue(int qid, FAR struct work_s *work, worker_t worker,
FAR void *arg, uint32_t delay);
int work_queue(int qid, FAR struct work_s *work, worker_t worker,
FAR void *arg, uint32_t delay);
/****************************************************************************
* Name: work_cancel
@@ -226,7 +282,7 @@ EXTERN int work_queue(int qid, FAR struct work_s *work, worker_t worker,
*
****************************************************************************/
EXTERN int work_cancel(int qid, FAR struct work_s *work);
int work_cancel(int qid, FAR struct work_s *work);
/****************************************************************************
* Name: work_signal
@@ -244,7 +300,7 @@ EXTERN int work_cancel(int qid, FAR struct work_s *work);
*
****************************************************************************/
EXTERN int work_signal(int qid);
int work_signal(int qid);
/****************************************************************************
* Name: work_available
+2 -1
View File
@@ -1,7 +1,7 @@
############################################################################
# libc/Makefile
#
# Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
# Copyright (C) 2007-2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -59,6 +59,7 @@ include dirent/Make.defs
include termios/Make.defs
include spawn/Make.defs
include queue/Make.defs
include wqueue/Make.defs
include misc/Make.defs
AOBJS = $(ASRCS:.S=$(OBJEXT))
+47
View File
@@ -0,0 +1,47 @@
############################################################################
# libc/wqueue/Make.defs
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# 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.
#
############################################################################
ifeq ($(CONFIG_SCHED_WORKQUEUE),y)
# Add the work queue C files to the build
CSRCS += work_thread.c work_queue.c work_cancel.c work_signal.c
# Add the wqueue directory to the build
DEPPATH += --dep-path wqueue
VPATH += :wqueue
endif
@@ -1,7 +1,7 @@
/****************************************************************************
* sched/work_cancel.c
* libc/wqueue/work_cancel.c
*
* Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2009-2010, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -47,8 +47,6 @@
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
#include "work_internal.h"
#ifdef CONFIG_SCHED_WORKQUEUE
/****************************************************************************
@@ -1,7 +1,7 @@
/****************************************************************************
* sched/work_queue.c
* libc/wqueue/work_queue.c
*
* Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -49,8 +49,6 @@
#include <nuttx/clock.h>
#include <nuttx/wqueue.h>
#include "work_internal.h"
#ifdef CONFIG_SCHED_WORKQUEUE
/****************************************************************************
@@ -1,7 +1,7 @@
/****************************************************************************
* sched/work_signal.c
* libc/wqueue/work_signal.c
*
* Copyright (C) 2009-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2009-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -44,8 +44,6 @@
#include <nuttx/wqueue.h>
#include "work_internal.h"
#ifdef CONFIG_SCHED_WORKQUEUE
/****************************************************************************
@@ -1,7 +1,7 @@
/****************************************************************************
* sched/work_thread.c
* libc/wqueue/work_thread.c
*
* Copyright (C) 2009-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2009-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -49,9 +49,7 @@
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
#include <nuttx/clock.h>
#include "os_internal.h"
#include "work_internal.h"
#include <nuttx/kmalloc.h>
#ifdef CONFIG_SCHED_WORKQUEUE
+1 -5
View File
@@ -175,10 +175,6 @@ TIMER_SRCS += timer_initialize.c timer_create.c timer_delete.c timer_getoverrun.
TIMER_SRCS += timer_gettime.c timer_settime.c timer_release.c
endif
ifeq ($(CONFIG_SCHED_WORKQUEUE),y)
WORK_SRCS = work_thread.c work_queue.c work_cancel.c work_signal.c
endif
ifeq ($(CONFIG_PAGING),y)
PGFILL_SRCS = pg_miss.c pg_worker.c
endif
@@ -189,7 +185,7 @@ KMM_SRCS = kmm_initialize.c kmm_addregion.c kmm_semaphore.c
KMM_SRCS = kmm_kmalloc.c kmm_kzalloc.c kmm_krealloc.c kmm_kfree.c
CSRCS = $(MISC_SRCS) $(TSK_SRCS) $(GRP_SRCS) $(SCHED_SRCS) $(WDOG_SRCS)
CSRCS += $(TIME_SRCS) $(SEM_SRCS) $(TIMER_SRCS) $(WORK_SRCS) $(PGFILL_SRCS)
CSRCS += $(TIME_SRCS) $(SEM_SRCS) $(TIMER_SRCS) $(PGFILL_SRCS)
CSRCS += $(IRQ_SRCS)
ifneq ($(CONFIG_DISABLE_CLOCK),y)
-3
View File
@@ -54,9 +54,6 @@
#ifdef CONFIG_PAGING
# include "pg_internal.h"
#endif
#ifdef CONFIG_SCHED_WORKQUEUE
# include "work_internal.h"
#endif
#ifdef CONFIG_NUTTX_KERNEL
# include "arch/board/user_map.h"
#endif
-1
View File
@@ -287,6 +287,5 @@ FAR struct tcb_s *sched_gettcb(pid_t pid);
bool sched_verifytcb(FAR struct tcb_s *tcb);
int sched_releasetcb(FAR struct tcb_s *tcb);
void sched_garbagecollection(void);
#endif /* __SCHED_OS_INTERNAL_H */
-114
View File
@@ -1,114 +0,0 @@
/****************************************************************************
* sched/work_internal.h
*
* Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
*
****************************************************************************/
#ifndef __SCHED_WORK_INTERNAL_H
#define __SCHED_WORK_INTERNAL_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <queue.h>
#ifdef CONFIG_SCHED_WORKQUEUE
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifdef CONFIG_DISABLE_SIGNALS
# warning "Worker thread support requires signals"
#endif
#ifdef CONFIG_SCHED_LPWORK
# define NWORKERS 2
#else
# define NWORKERS 1
#endif
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/* This structure defines the state on one work queue */
struct wqueue_s
{
pid_t pid; /* The task ID of the worker thread */
struct dq_queue_s q; /* The queue of pending work */
};
/****************************************************************************
* Public Data
****************************************************************************/
/* The state of each work queue */
extern struct wqueue_s g_work[NWORKERS];
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: work_hpthread and work_lpthread
*
* Description:
* These are the main worker threads that performs actions placed on the
* work lists. One thread also performs periodic garbage collection (that
* is performed by the idle thread if CONFIG_SCHED_WORKQUEUE is not defined).
*
* Input parameters:
* argc, argv (not used)
*
* Returned Value:
* Does not return
*
****************************************************************************/
int work_hpthread(int argc, char *argv[]);
#ifdef CONFIG_SCHED_LPWORK
int work_lpthread(int argc, char *argv[]);
#endif
#endif /* __ASSEMBLY__ */
#endif /* CONFIG_SCHED_WORKQUEUE */
#endif /* __SCHED_WORK_INTERNAL_H */