From 0e436b1cb6c0dea2280b09208a43af636a29ce64 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 11 Sep 2013 12:00:01 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6291 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/nil/NIL-STM32F051-DISCOVERY/nilconf.h | 70 +++++++++++++++---- demos/nil/NIL-STM32F303-DISCOVERY/nilconf.h | 70 +++++++++++++++---- .../NIL-STM32F373-STM32373C_EVAL/nilconf.h | 70 +++++++++++++++---- demos/nil/NIL-STM32L152-DISCOVERY/nilconf.h | 70 +++++++++++++++---- os/nil/include/nil.h | 14 ++-- os/nil/osal/osal.h | 2 +- os/nil/ports/ARMCMx/nilcore.h | 2 +- os/nil/src/nil.c | 8 +-- 8 files changed, 237 insertions(+), 69 deletions(-) diff --git a/demos/nil/NIL-STM32F051-DISCOVERY/nilconf.h b/demos/nil/NIL-STM32F051-DISCOVERY/nilconf.h index 5276a3f2a..220ce8b37 100644 --- a/demos/nil/NIL-STM32F051-DISCOVERY/nilconf.h +++ b/demos/nil/NIL-STM32F051-DISCOVERY/nilconf.h @@ -1,20 +1,17 @@ /* - Nil RTOS - Copyright (C) 2012 Giovanni Di Sirio. + ChibiOS/NIL - Copyright (C) 2013 Giovanni Di Sirio - This file is part of Nil RTOS. + Licensed 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 - Nil RTOS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - Nil RTOS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + 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. */ /** @@ -31,6 +28,13 @@ #ifndef _NILCONF_H_ #define _NILCONF_H_ +/*===========================================================================*/ +/** + * @name Kernel parameters and options + * @{ + */ +/*===========================================================================*/ + /** * @brief Number of user threads in the application. * @note This number is not inclusive of the idle thread which is @@ -38,6 +42,15 @@ */ #define NIL_CFG_NUM_THREADS 3 +/** @} */ + +/*===========================================================================*/ +/** + * @name System timer settings + * @{ + */ +/*===========================================================================*/ + /** * @brief System tick frequency. */ @@ -51,7 +64,16 @@ * The value one is not valid, timeouts are rounded up to * this value. */ -#define NIL_CFG_TIMEDELTA 2 +#define NIL_CFG_ST_TIMEDELTA 2 + +/** @} */ + +/*===========================================================================*/ +/** + * @name Subsystem options + * @{ + */ +/*===========================================================================*/ /** * @brief Events Flags APIs. @@ -61,6 +83,15 @@ */ #define NIL_CFG_USE_EVENTS TRUE +/** @} */ + +/*===========================================================================*/ +/** + * @name Debug options + * @{ + */ +/*===========================================================================*/ + /** * @brief System assertions. */ @@ -71,6 +102,15 @@ */ #define NIL_CFG_ENABLE_STACK_CHECK FALSE +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel hooks + * @{ + */ +/*===========================================================================*/ + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -103,6 +143,8 @@ #define NIL_CFG_IDLE_LEAVE_HOOK() { \ } +/** @} */ + /*===========================================================================*/ /* Port-specific settings (override port settings defaulted in nilcore.h). */ /*===========================================================================*/ diff --git a/demos/nil/NIL-STM32F303-DISCOVERY/nilconf.h b/demos/nil/NIL-STM32F303-DISCOVERY/nilconf.h index 5276a3f2a..220ce8b37 100644 --- a/demos/nil/NIL-STM32F303-DISCOVERY/nilconf.h +++ b/demos/nil/NIL-STM32F303-DISCOVERY/nilconf.h @@ -1,20 +1,17 @@ /* - Nil RTOS - Copyright (C) 2012 Giovanni Di Sirio. + ChibiOS/NIL - Copyright (C) 2013 Giovanni Di Sirio - This file is part of Nil RTOS. + Licensed 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 - Nil RTOS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - Nil RTOS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + 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. */ /** @@ -31,6 +28,13 @@ #ifndef _NILCONF_H_ #define _NILCONF_H_ +/*===========================================================================*/ +/** + * @name Kernel parameters and options + * @{ + */ +/*===========================================================================*/ + /** * @brief Number of user threads in the application. * @note This number is not inclusive of the idle thread which is @@ -38,6 +42,15 @@ */ #define NIL_CFG_NUM_THREADS 3 +/** @} */ + +/*===========================================================================*/ +/** + * @name System timer settings + * @{ + */ +/*===========================================================================*/ + /** * @brief System tick frequency. */ @@ -51,7 +64,16 @@ * The value one is not valid, timeouts are rounded up to * this value. */ -#define NIL_CFG_TIMEDELTA 2 +#define NIL_CFG_ST_TIMEDELTA 2 + +/** @} */ + +/*===========================================================================*/ +/** + * @name Subsystem options + * @{ + */ +/*===========================================================================*/ /** * @brief Events Flags APIs. @@ -61,6 +83,15 @@ */ #define NIL_CFG_USE_EVENTS TRUE +/** @} */ + +/*===========================================================================*/ +/** + * @name Debug options + * @{ + */ +/*===========================================================================*/ + /** * @brief System assertions. */ @@ -71,6 +102,15 @@ */ #define NIL_CFG_ENABLE_STACK_CHECK FALSE +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel hooks + * @{ + */ +/*===========================================================================*/ + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -103,6 +143,8 @@ #define NIL_CFG_IDLE_LEAVE_HOOK() { \ } +/** @} */ + /*===========================================================================*/ /* Port-specific settings (override port settings defaulted in nilcore.h). */ /*===========================================================================*/ diff --git a/demos/nil/NIL-STM32F373-STM32373C_EVAL/nilconf.h b/demos/nil/NIL-STM32F373-STM32373C_EVAL/nilconf.h index 5276a3f2a..220ce8b37 100644 --- a/demos/nil/NIL-STM32F373-STM32373C_EVAL/nilconf.h +++ b/demos/nil/NIL-STM32F373-STM32373C_EVAL/nilconf.h @@ -1,20 +1,17 @@ /* - Nil RTOS - Copyright (C) 2012 Giovanni Di Sirio. + ChibiOS/NIL - Copyright (C) 2013 Giovanni Di Sirio - This file is part of Nil RTOS. + Licensed 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 - Nil RTOS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - Nil RTOS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + 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. */ /** @@ -31,6 +28,13 @@ #ifndef _NILCONF_H_ #define _NILCONF_H_ +/*===========================================================================*/ +/** + * @name Kernel parameters and options + * @{ + */ +/*===========================================================================*/ + /** * @brief Number of user threads in the application. * @note This number is not inclusive of the idle thread which is @@ -38,6 +42,15 @@ */ #define NIL_CFG_NUM_THREADS 3 +/** @} */ + +/*===========================================================================*/ +/** + * @name System timer settings + * @{ + */ +/*===========================================================================*/ + /** * @brief System tick frequency. */ @@ -51,7 +64,16 @@ * The value one is not valid, timeouts are rounded up to * this value. */ -#define NIL_CFG_TIMEDELTA 2 +#define NIL_CFG_ST_TIMEDELTA 2 + +/** @} */ + +/*===========================================================================*/ +/** + * @name Subsystem options + * @{ + */ +/*===========================================================================*/ /** * @brief Events Flags APIs. @@ -61,6 +83,15 @@ */ #define NIL_CFG_USE_EVENTS TRUE +/** @} */ + +/*===========================================================================*/ +/** + * @name Debug options + * @{ + */ +/*===========================================================================*/ + /** * @brief System assertions. */ @@ -71,6 +102,15 @@ */ #define NIL_CFG_ENABLE_STACK_CHECK FALSE +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel hooks + * @{ + */ +/*===========================================================================*/ + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -103,6 +143,8 @@ #define NIL_CFG_IDLE_LEAVE_HOOK() { \ } +/** @} */ + /*===========================================================================*/ /* Port-specific settings (override port settings defaulted in nilcore.h). */ /*===========================================================================*/ diff --git a/demos/nil/NIL-STM32L152-DISCOVERY/nilconf.h b/demos/nil/NIL-STM32L152-DISCOVERY/nilconf.h index 7cdcfbf02..c43879adb 100644 --- a/demos/nil/NIL-STM32L152-DISCOVERY/nilconf.h +++ b/demos/nil/NIL-STM32L152-DISCOVERY/nilconf.h @@ -1,20 +1,17 @@ /* - Nil RTOS - Copyright (C) 2012 Giovanni Di Sirio. + ChibiOS/NIL - Copyright (C) 2013 Giovanni Di Sirio - This file is part of Nil RTOS. + Licensed 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 - Nil RTOS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - Nil RTOS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + 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. */ /** @@ -31,6 +28,13 @@ #ifndef _NILCONF_H_ #define _NILCONF_H_ +/*===========================================================================*/ +/** + * @name Kernel parameters and options + * @{ + */ +/*===========================================================================*/ + /** * @brief Number of user threads in the application. * @note This number is not inclusive of the idle thread which is @@ -38,6 +42,15 @@ */ #define NIL_CFG_NUM_THREADS 3 +/** @} */ + +/*===========================================================================*/ +/** + * @name System timer settings + * @{ + */ +/*===========================================================================*/ + /** * @brief System tick frequency. */ @@ -51,7 +64,16 @@ * The value one is not valid, timeouts are rounded up to * this value. */ -#define NIL_CFG_TIMEDELTA 0 +#define NIL_CFG_ST_TIMEDELTA 0 + +/** @} */ + +/*===========================================================================*/ +/** + * @name Subsystem options + * @{ + */ +/*===========================================================================*/ /** * @brief Events Flags APIs. @@ -61,6 +83,15 @@ */ #define NIL_CFG_USE_EVENTS TRUE +/** @} */ + +/*===========================================================================*/ +/** + * @name Debug options + * @{ + */ +/*===========================================================================*/ + /** * @brief System assertions. */ @@ -71,6 +102,15 @@ */ #define NIL_CFG_ENABLE_STACK_CHECK FALSE +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel hooks + * @{ + */ +/*===========================================================================*/ + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -103,6 +143,8 @@ #define NIL_CFG_IDLE_LEAVE_HOOK() { \ } +/** @} */ + /*===========================================================================*/ /* Port-specific settings (override port settings defaulted in nilcore.h). */ /*===========================================================================*/ diff --git a/os/nil/include/nil.h b/os/nil/include/nil.h index 1c8aaf359..98dd2c04e 100644 --- a/os/nil/include/nil.h +++ b/os/nil/include/nil.h @@ -142,8 +142,8 @@ typedef struct nil_thread thread_t; * The value one is not valid, timeouts are rounded up to * this value. */ -#if !defined(NIL_CFG_TIMEDELTA) || defined(__DOXYGEN__) -#define NIL_CFG_TIMEDELTA 0 +#if !defined(NIL_CFG_ST_TIMEDELTA) || defined(__DOXYGEN__) +#define NIL_CFG_ST_TIMEDELTA 0 #endif /** @@ -195,8 +195,8 @@ typedef struct nil_thread thread_t; #error "invalid NIL_CFG_ST_FREQUENCY specified" #endif -#if (NIL_CFG_TIMEDELTA < 0) || (NIL_CFG_TIMEDELTA == 1) -#error "invalid NIL_CFG_TIMEDELTA specified" +#if (NIL_CFG_ST_TIMEDELTA < 0) || (NIL_CFG_ST_TIMEDELTA == 1) +#error "invalid NIL_CFG_ST_TIMEDELTA specified" #endif #if NIL_CFG_ENABLE_ASSERTS @@ -309,13 +309,13 @@ typedef struct { * or to an higher priority thread if a switch is required. */ thread_t *next; -#if NIL_CFG_TIMEDELTA == 0 || defined(__DOXYGEN__) +#if NIL_CFG_ST_TIMEDELTA == 0 || defined(__DOXYGEN__) /** * @brief System time. */ systime_t systime; #endif -#if NIL_CFG_TIMEDELTA > 0 || defined(__DOXYGEN__) +#if NIL_CFG_ST_TIMEDELTA > 0 || defined(__DOXYGEN__) /** * @brief System time of the last tick event. */ @@ -702,7 +702,7 @@ typedef struct { * * @xclass */ -#if NIL_CFG_TIMEDELTA == 0 || defined(__DOXYGEN__) +#if NIL_CFG_ST_TIMEDELTA == 0 || defined(__DOXYGEN__) #define chVTGetSystemTimeX() (nil.systime) #else #define chVTGetSystemTimeX() port_timer_get_time() diff --git a/os/nil/osal/osal.h b/os/nil/osal/osal.h index d4394687e..71d47894f 100644 --- a/os/nil/osal/osal.h +++ b/os/nil/osal/osal.h @@ -88,7 +88,7 @@ /** * @brief Systick mode required by the underlying OS. */ -#if (NIL_CFG_TIMEDELTA == 0) || defined(__DOXYGEN__) +#if (NIL_CFG_ST_TIMEDELTA == 0) || defined(__DOXYGEN__) #define OSAL_ST_MODE OSAL_ST_MODE_PERIODIC #else #define OSAL_ST_MODE OSAL_ST_MODE_FREERUNNING diff --git a/os/nil/ports/ARMCMx/nilcore.h b/os/nil/ports/ARMCMx/nilcore.h index a4d032b95..85e004dca 100644 --- a/os/nil/ports/ARMCMx/nilcore.h +++ b/os/nil/ports/ARMCMx/nilcore.h @@ -197,7 +197,7 @@ struct port_intctx {}; #endif #if !defined(_FROM_ASM_) -#if NIL_CFG_TIMEDELTA > 0 +#if NIL_CFG_ST_TIMEDELTA > 0 #include "nilcore_timer.h" #endif #endif /* !defined(_FROM_ASM_) */ diff --git a/os/nil/src/nil.c b/os/nil/src/nil.c index aefe4ccb2..4d84d654c 100644 --- a/os/nil/src/nil.c +++ b/os/nil/src/nil.c @@ -147,7 +147,7 @@ void chSysHalt(const char *reason) { */ void chSysTimerHandlerI(void) { -#if NIL_CFG_TIMEDELTA == 0 +#if NIL_CFG_ST_TIMEDELTA == 0 thread_t *tp = &nil.threads[0]; nil.systime++; do { @@ -335,14 +335,14 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t timeout) { /* Storing the wait object for the current thread.*/ otp->state = newstate; -#if NIL_CFG_TIMEDELTA > 0 +#if NIL_CFG_ST_TIMEDELTA > 0 if (timeout != TIME_INFINITE) { systime_t time = chVTGetSystemTimeX() + timeout; /* TIMEDELTA makes sure to have enough time to reprogram the timer before the free-running timer counter reaches the selected timeout.*/ - if (timeout < NIL_CFG_TIMEDELTA) - timeout = NIL_CFG_TIMEDELTA; + if (timeout < NIL_CFG_ST_TIMEDELTA) + timeout = NIL_CFG_ST_TIMEDELTA; if (nil.lasttime == nil.nexttime) { /* Special case, first thread asking for a timeout.*/