From 95b238fc867da32f28c74b98b793fbd40345b595 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 25 Sep 2007 18:41:39 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@23 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/LPC214x-GCC/chconf.h | 8 ++-- demos/LPC214x-GCC/chtypes.h | 2 +- demos/Win32-MSVS/chtypes.h | 2 +- demos/Win32-MinGW/chtypes.h | 2 +- docs/Doxyfile | 72 ++++++++++++++++----------------- ports/ARM7-LPC214x/GCC/lpc214x_serial.h | 6 +-- readme.txt | 17 ++++++-- src/chschd.c | 12 +----- src/chsem.c | 28 +++++-------- src/chthreads.c | 1 - src/include/delta.h | 14 +++++++ src/include/threads.h | 5 +-- src/templates/chtypes.h | 2 +- 13 files changed, 87 insertions(+), 84 deletions(-) diff --git a/demos/LPC214x-GCC/chconf.h b/demos/LPC214x-GCC/chconf.h index bb03058c8..30670c8fd 100644 --- a/demos/LPC214x-GCC/chconf.h +++ b/demos/LPC214x-GCC/chconf.h @@ -72,7 +72,7 @@ /** Configuration option: if specified then the Semaphores APIs with priority * shift are included in the kernel. * @note requires \p CH_USE_SEMAPHORES.*/ -//#define CH_USE_RT_SEMAPHORES +#define CH_USE_RT_SEMAPHORES /** Configuration option: if specified then the Events APIs are included in * the kernel.*/ @@ -82,7 +82,7 @@ * function is included in the kernel. * @note requires \p CH_USE_EVENTS. * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ -//#define CH_USE_EVENTS_TIMEOUT +#define CH_USE_EVENTS_TIMEOUT /** Configuration option: if specified then the Synchronous Messages APIs are * included in the kernel.*/ @@ -92,13 +92,13 @@ * function is included in the kernel. * @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ -//#define CH_USE_MESSAGES_TIMEOUT +#define CH_USE_MESSAGES_TIMEOUT /** Configuration option: if specified then the \p chMsgSendWithEvent() * function is included in the kernel. * @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ -//#define CH_USE_MESSAGES_EVENT +#define CH_USE_MESSAGES_EVENT /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. diff --git a/demos/LPC214x-GCC/chtypes.h b/demos/LPC214x-GCC/chtypes.h index 48bf7a7d9..49c7c6c38 100644 --- a/demos/LPC214x-GCC/chtypes.h +++ b/demos/LPC214x-GCC/chtypes.h @@ -33,7 +33,7 @@ typedef BYTE8 t_tmode; typedef BYTE8 t_tstate; -typedef WORD16 t_prio; +typedef LONG32 t_prio; typedef PTR_EQ t_msg; typedef LONG32 t_eventid; typedef ULONG32 t_eventmask; diff --git a/demos/Win32-MSVS/chtypes.h b/demos/Win32-MSVS/chtypes.h index 33eb4b963..f7d05b855 100644 --- a/demos/Win32-MSVS/chtypes.h +++ b/demos/Win32-MSVS/chtypes.h @@ -33,7 +33,7 @@ typedef BYTE8 t_tmode; typedef BYTE8 t_tstate; -typedef WORD16 t_prio; +typedef LONG32 t_prio; typedef PTR_EQ t_msg; typedef LONG32 t_eventid; typedef ULONG32 t_eventmask; diff --git a/demos/Win32-MinGW/chtypes.h b/demos/Win32-MinGW/chtypes.h index 48bf7a7d9..49c7c6c38 100644 --- a/demos/Win32-MinGW/chtypes.h +++ b/demos/Win32-MinGW/chtypes.h @@ -33,7 +33,7 @@ typedef BYTE8 t_tmode; typedef BYTE8 t_tstate; -typedef WORD16 t_prio; +typedef LONG32 t_prio; typedef PTR_EQ t_msg; typedef LONG32 t_eventid; typedef ULONG32 t_eventmask; diff --git a/docs/Doxyfile b/docs/Doxyfile index d3b18072b..6cc09c5d9 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -4,7 +4,7 @@ # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = ChibiOS/RT -PROJECT_NUMBER = "0.2.0 alpha" +PROJECT_NUMBER = "0.2.1 alpha" OUTPUT_DIRECTORY = . CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English @@ -26,7 +26,7 @@ ALWAYS_DETAILED_SEC = NO INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO STRIP_FROM_PATH = "C:/Documents and Settings/Administrator/" -STRIP_FROM_INC_PATH = +STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = YES MULTILINE_CPP_IS_BRIEF = NO @@ -34,7 +34,7 @@ DETAILS_AT_TOP = YES INHERIT_DOCS = NO SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 2 -ALIASES = +ALIASES = OPTIMIZE_OUTPUT_FOR_C = YES OPTIMIZE_OUTPUT_JAVA = NO BUILTIN_STL_SUPPORT = NO @@ -64,11 +64,11 @@ GENERATE_TODOLIST = YES GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = +ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = NO SHOW_DIRECTORIES = NO -FILE_VERSION_FILTER = +FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- @@ -78,7 +78,7 @@ WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = NO WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = +WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- @@ -115,15 +115,15 @@ FILE_PATTERNS = *.c \ *.py \ *.ddf RECURSIVE = YES -EXCLUDE = +EXCLUDE = EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = EXAMPLE_PATTERNS = * EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing @@ -141,20 +141,20 @@ VERBATIM_HEADERS = NO #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = +IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = html HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = +CHM_FILE = +HHC_LOCATION = GENERATE_CHI = NO BINARY_TOC = NO TOC_EXPAND = NO @@ -171,8 +171,8 @@ LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex COMPACT_LATEX = NO PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = +EXTRA_PACKAGES = +LATEX_HEADER = PDF_HYPERLINKS = NO USE_PDFLATEX = NO LATEX_BATCHMODE = NO @@ -184,8 +184,8 @@ GENERATE_RTF = NO RTF_OUTPUT = rtf COMPACT_RTF = NO RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- @@ -198,8 +198,8 @@ MAN_LINKS = NO #--------------------------------------------------------------------------- GENERATE_XML = NO XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = +XML_SCHEMA = +XML_DTD = XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output @@ -211,16 +211,16 @@ GENERATE_AUTOGEN_DEF = NO GENERATE_PERLMOD = NO PERLMOD_LATEX = NO PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = +PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- -# Configuration options related to the preprocessor +# Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = PREDEFINED = __JUST_STUBS__ \ __DOXIGEN__ \ CH_USE_VIRTUAL_TIMERS \ @@ -242,18 +242,18 @@ PREDEFINED = __JUST_STUBS__ \ CH_USE_MESSAGES \ CH_USE_MESSAGES_TIMEOUT \ CH_USE_MESSAGES_EVENT -EXPAND_AS_DEFINED = +EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- -# Configuration::additions related to external references +# Configuration::additions related to external references #--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = +TAGFILES = +GENERATE_TAGFILE = ALLEXTERNALS = NO EXTERNAL_GROUPS = YES PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = NO HIDE_UNDOC_RELATIONS = YES @@ -270,8 +270,8 @@ CALLER_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = +DOT_PATH = +DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_HEIGHT = 1024 MAX_DOT_GRAPH_DEPTH = 1000 @@ -280,6 +280,6 @@ DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- -# Configuration::additions related to the search engine +# Configuration::additions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO diff --git a/ports/ARM7-LPC214x/GCC/lpc214x_serial.h b/ports/ARM7-LPC214x/GCC/lpc214x_serial.h index 340856fdc..1eaba687b 100644 --- a/ports/ARM7-LPC214x/GCC/lpc214x_serial.h +++ b/ports/ARM7-LPC214x/GCC/lpc214x_serial.h @@ -17,8 +17,8 @@ along with this program. If not, see . */ -#ifndef _LPC2000_SERIAL_H_ -#define _LPC2000_SERIAL_H_ +#ifndef _LPC214x_SERIAL_H_ +#define _LPC214x_SERIAL_H_ void InitSerial(void); void SetUARTI(UART *u, int speed, int lcr, int fcr); @@ -27,4 +27,4 @@ void UART1IrqHandler(void); extern FullDuplexDriver COM1, COM2; -#endif /* _LPC2000_SERIAL_H_*/ +#endif /* _LPC214x_SERIAL_H_*/ diff --git a/readme.txt b/readme.txt index cda64a64b..07fc0c508 100644 --- a/readme.txt +++ b/readme.txt @@ -11,8 +11,10 @@ under ./demos/. ./ports/ - Architecture/compiler specific portable files. ./demos/ - Demo programs for specific archtectures/boards. -./docs/doxifile - Doxigen project file. -./docs/index.html - ChibiOS/RT documentation (after running doxigen). +./docs/Doxifile - Doxigen project file. +./docs/index.html - ChibiOS/RT documentation (after running doxigen). The + documentation is also available on the project web + page: http://chibios.sourceforge.net/ Current ports under ./demos: @@ -30,6 +32,15 @@ LPC214x-GCC - ChibiOS/RT port for ARM7 LPC2148, the demo targets the *** Releases *** ***************************************************************************** +*** 0.2.1 *** +- Optimizations in the RT semaphores subsystem. The support for this + subsystem should still be considered experimental and further changes may + happen in future versions. +- Bug fix in the virtual timers handling code, now the timers can be re-armed + from within the callback code in order to create periodic virtual timers. +- Modified the t_prio type in the demos to be 32bits wide instead of 16bits, + this results in a better code in critical sections of the kernel. + *** 0.2.0 *** - Introduced support for ARM in thumb mode. - Optimized context switching when thumb-interworking is not required, one @@ -41,4 +52,4 @@ LPC214x-GCC - ChibiOS/RT port for ARM7 LPC2148, the demo targets the - Renamed makefiles to Makefiles, upper case M. *** 0.1.0 *** -- First alpha release \ No newline at end of file +- First alpha release diff --git a/src/chschd.c b/src/chschd.c index b38fe366f..a046f4fbf 100644 --- a/src/chschd.c +++ b/src/chschd.c @@ -188,17 +188,7 @@ void chSchTimerHandlerI(void) { #endif #ifdef CH_USE_VIRTUAL_TIMERS - if (&dlist != (DeltaList *)dlist.dl_next) { - VirtualTimer *vtp; - - --dlist.dl_next->vt_dtime; - while (!(vtp = dlist.dl_next)->vt_dtime) { - vtp->vt_prev->vt_next = vtp->vt_next; - vtp->vt_next->vt_prev = vtp->vt_prev; - vtp->vt_func(vtp->vt_par); - vtp->vt_func = 0; // Required, flags the timer as triggered. - } - } + chVTDoTickI(); #endif } diff --git a/src/chsem.c b/src/chsem.c index 1eab23ea4..058187050 100644 --- a/src/chsem.c +++ b/src/chsem.c @@ -288,7 +288,7 @@ void chSemLowerPrioSignal(Semaphore *sp) { chSysLock(); if (!--currp->p_rtcnt) { - currp->p_prio = currp->p_bakprio; + currp->p_prio -= MEPRIO; if (sp->s_cnt++ < 0) chSchReadyI(dequeue(sp->s_queue.p_next)); chSchRescheduleI(); @@ -308,14 +308,11 @@ void chSemLowerPrioSignal(Semaphore *sp) { * option is enabled in \p chconf.h. */ void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw) { - BOOL flag; chSysLock(); if (sps->s_cnt++ < 0) - chSchReadyI(dequeue(sps->s_queue.p_next)), flag = TRUE; - else - flag = FALSE; + chSchReadyI(dequeue(sps->s_queue.p_next)); if (--spw->s_cnt < 0) { prioenq(currp, &spw->s_queue); @@ -323,19 +320,13 @@ void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw) { if (!currp->p_rtcnt++) currp->p_prio += MEPRIO; - - chSysUnlock(); - return; - } - - if (!currp->p_rtcnt++) { - currp->p_bakprio = currp->p_prio; - currp->p_prio += MEPRIO; - flag = TRUE; } + else { + if (!currp->p_rtcnt++) + currp->p_prio += MEPRIO; - if( flag) chSchRescheduleI(); + } chSysUnlock(); } @@ -349,21 +340,20 @@ void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw) { * option is enabled in \p chconf.h. */ void chSemLowerPrioSignalWait(Semaphore *sps, Semaphore *spw) { - BOOL flag = FALSE; chSysLock(); if (!--currp->p_rtcnt) - currp->p_prio = currp->p_bakprio, flag = TRUE; + currp->p_prio -= MEPRIO; if (sps->s_cnt++ < 0) - chSchReadyI(dequeue(sps->s_queue.p_next)), flag = TRUE; + chSchReadyI(dequeue(sps->s_queue.p_next)); if (--spw->s_cnt < 0) { enqueue(currp, &spw->s_queue); // enqueue() because the spw is a normal sem. chSchGoSleepI(PRWTSEM); } - else if (flag) + else chSchRescheduleI(); chSysUnlock(); diff --git a/src/chthreads.c b/src/chthreads.c index 8f7112647..59c361116 100644 --- a/src/chthreads.c +++ b/src/chthreads.c @@ -61,7 +61,6 @@ void _InitThread(t_prio prio, t_tmode mode, Thread *tp) { tp->p_rdymsg = RDY_OK; #ifdef CH_USE_RT_SEMAPHORES tp->p_rtcnt = 0; - tp->p_bakprio = prio; #endif #ifdef CH_USE_WAITEXIT tp->p_waiting.p_next = (Thread *)&tp->p_waiting; diff --git a/src/include/delta.h b/src/include/delta.h index 2ae4d887f..14f5b550e 100644 --- a/src/include/delta.h +++ b/src/include/delta.h @@ -69,6 +69,20 @@ typedef struct { extern DeltaList dlist; +#define chVTDoTickI() \ + if (&dlist != (DeltaList *)dlist.dl_next) { \ + VirtualTimer *vtp; \ + \ + --dlist.dl_next->vt_dtime; \ + while (!(vtp = dlist.dl_next)->vt_dtime) { \ + t_vtfunc fn = vtp->vt_func; \ + vtp->vt_func = 0; \ + vtp->vt_prev->vt_next = vtp->vt_next; \ + vtp->vt_next->vt_prev = vtp->vt_prev; \ + fn(vtp->vt_par); \ + } \ + } + /* * Virtual Timers APIs. */ diff --git a/src/include/threads.h b/src/include/threads.h index d8937433f..f170ce368 100644 --- a/src/include/threads.h +++ b/src/include/threads.h @@ -80,7 +80,7 @@ struct Thread { #endif }; /** Machine dependent processor context.*/ - Context p_ctx; + Context p_ctx; /* * Start of the optional fields. Note, the null thread may also let its * stack overwrite the following fields since it never uses semaphores, @@ -104,9 +104,8 @@ struct Thread { #endif #ifdef CH_USE_RT_SEMAPHORES /** Priority backup after acquiring a RT semaphore.*/ - t_prio p_bakprio; /** RT semaphores depth counter.*/ - WORD16 p_rtcnt; + int p_rtcnt; #endif }; diff --git a/src/templates/chtypes.h b/src/templates/chtypes.h index 0d6547311..891b850c2 100644 --- a/src/templates/chtypes.h +++ b/src/templates/chtypes.h @@ -40,7 +40,7 @@ typedef BYTE8 t_tmode; typedef BYTE8 t_tstate; -typedef WORD16 t_prio; +typedef LONG32 t_prio; typedef PTR_EQ t_msg; typedef LONG32 t_eventid; typedef ULONG32 t_eventmask; -- cgit v1.2.3