git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@53 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
779840691f
commit
70c86d43ec
|
@ -69,7 +69,7 @@ void PlaySound(int freq, t_time duration) {
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
||||||
if (bvt.vt_func) { // If a sound is already being played
|
if (chVTIsArmedI(&bvt)) { // If a sound is already being played
|
||||||
chVTResetI(&bvt); // then aborts it.
|
chVTResetI(&bvt); // then aborts it.
|
||||||
StopCounter(tc);
|
StopCounter(tc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,10 @@
|
||||||
* function is included in the kernel.*/
|
* function is included in the kernel.*/
|
||||||
#define CH_USE_RESUME
|
#define CH_USE_RESUME
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the \p chThdSuspend()
|
||||||
|
* function is included in the kernel.*/
|
||||||
|
#define CH_USE_SUSPEND
|
||||||
|
|
||||||
/** Configuration option: if specified then the \p chThdTerminate()
|
/** Configuration option: if specified then the \p chThdTerminate()
|
||||||
* and \p chThdShouldTerminate() functions are included in the kernel.*/
|
* and \p chThdShouldTerminate() functions are included in the kernel.*/
|
||||||
#define CH_USE_TERMINATE
|
#define CH_USE_TERMINATE
|
||||||
|
|
|
@ -52,6 +52,10 @@
|
||||||
* function is included in the kernel.*/
|
* function is included in the kernel.*/
|
||||||
#define CH_USE_RESUME
|
#define CH_USE_RESUME
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the \p chThdSuspend()
|
||||||
|
* function is included in the kernel.*/
|
||||||
|
#define CH_USE_SUSPEND
|
||||||
|
|
||||||
/** Configuration option: if specified then the \p chThdTerminate()
|
/** Configuration option: if specified then the \p chThdTerminate()
|
||||||
* and \p chThdShouldTerminate() functions are included in the kernel.*/
|
* and \p chThdShouldTerminate() functions are included in the kernel.*/
|
||||||
#define CH_USE_TERMINATE
|
#define CH_USE_TERMINATE
|
||||||
|
|
|
@ -56,6 +56,10 @@
|
||||||
* function is included in the kernel.*/
|
* function is included in the kernel.*/
|
||||||
#define CH_USE_RESUME
|
#define CH_USE_RESUME
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the \p chThdSuspend()
|
||||||
|
* function is included in the kernel.*/
|
||||||
|
#define CH_USE_SUSPEND
|
||||||
|
|
||||||
/** Configuration option: if specified then the \p chThdTerminate()
|
/** Configuration option: if specified then the \p chThdTerminate()
|
||||||
* and \p chThdShouldTerminate() functions are included in the kernel.*/
|
* and \p chThdShouldTerminate() functions are included in the kernel.*/
|
||||||
#define CH_USE_TERMINATE
|
#define CH_USE_TERMINATE
|
||||||
|
|
|
@ -56,6 +56,10 @@
|
||||||
* function is included in the kernel.*/
|
* function is included in the kernel.*/
|
||||||
#define CH_USE_RESUME
|
#define CH_USE_RESUME
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the \p chThdSuspend()
|
||||||
|
* function is included in the kernel.*/
|
||||||
|
#define CH_USE_SUSPEND
|
||||||
|
|
||||||
/** Configuration option: if specified then the \p chThdTerminate()
|
/** Configuration option: if specified then the \p chThdTerminate()
|
||||||
* and \p chThdShouldTerminate() functions are included in the kernel.*/
|
* and \p chThdShouldTerminate() functions are included in the kernel.*/
|
||||||
#define CH_USE_TERMINATE
|
#define CH_USE_TERMINATE
|
||||||
|
|
|
@ -26,7 +26,7 @@ ALWAYS_DETAILED_SEC = NO
|
||||||
INLINE_INHERITED_MEMB = NO
|
INLINE_INHERITED_MEMB = NO
|
||||||
FULL_PATH_NAMES = NO
|
FULL_PATH_NAMES = NO
|
||||||
STRIP_FROM_PATH = "C:/Documents and Settings/Administrator/"
|
STRIP_FROM_PATH = "C:/Documents and Settings/Administrator/"
|
||||||
STRIP_FROM_INC_PATH =
|
STRIP_FROM_INC_PATH =
|
||||||
SHORT_NAMES = NO
|
SHORT_NAMES = NO
|
||||||
JAVADOC_AUTOBRIEF = YES
|
JAVADOC_AUTOBRIEF = YES
|
||||||
MULTILINE_CPP_IS_BRIEF = NO
|
MULTILINE_CPP_IS_BRIEF = NO
|
||||||
|
@ -34,7 +34,7 @@ DETAILS_AT_TOP = YES
|
||||||
INHERIT_DOCS = NO
|
INHERIT_DOCS = NO
|
||||||
SEPARATE_MEMBER_PAGES = NO
|
SEPARATE_MEMBER_PAGES = NO
|
||||||
TAB_SIZE = 2
|
TAB_SIZE = 2
|
||||||
ALIASES =
|
ALIASES =
|
||||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||||
OPTIMIZE_OUTPUT_JAVA = NO
|
OPTIMIZE_OUTPUT_JAVA = NO
|
||||||
BUILTIN_STL_SUPPORT = NO
|
BUILTIN_STL_SUPPORT = NO
|
||||||
|
@ -64,11 +64,11 @@ GENERATE_TODOLIST = YES
|
||||||
GENERATE_TESTLIST = YES
|
GENERATE_TESTLIST = YES
|
||||||
GENERATE_BUGLIST = YES
|
GENERATE_BUGLIST = YES
|
||||||
GENERATE_DEPRECATEDLIST= YES
|
GENERATE_DEPRECATEDLIST= YES
|
||||||
ENABLED_SECTIONS =
|
ENABLED_SECTIONS =
|
||||||
MAX_INITIALIZER_LINES = 30
|
MAX_INITIALIZER_LINES = 30
|
||||||
SHOW_USED_FILES = NO
|
SHOW_USED_FILES = NO
|
||||||
SHOW_DIRECTORIES = NO
|
SHOW_DIRECTORIES = NO
|
||||||
FILE_VERSION_FILTER =
|
FILE_VERSION_FILTER =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to warning and progress messages
|
# configuration options related to warning and progress messages
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
@ -78,7 +78,7 @@ WARN_IF_UNDOCUMENTED = YES
|
||||||
WARN_IF_DOC_ERROR = YES
|
WARN_IF_DOC_ERROR = YES
|
||||||
WARN_NO_PARAMDOC = NO
|
WARN_NO_PARAMDOC = NO
|
||||||
WARN_FORMAT = "$file:$line: $text"
|
WARN_FORMAT = "$file:$line: $text"
|
||||||
WARN_LOGFILE =
|
WARN_LOGFILE =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the input files
|
# configuration options related to the input files
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
@ -115,15 +115,15 @@ FILE_PATTERNS = *.c \
|
||||||
*.py \
|
*.py \
|
||||||
*.ddf
|
*.ddf
|
||||||
RECURSIVE = YES
|
RECURSIVE = YES
|
||||||
EXCLUDE =
|
EXCLUDE =
|
||||||
EXCLUDE_SYMLINKS = NO
|
EXCLUDE_SYMLINKS = NO
|
||||||
EXCLUDE_PATTERNS =
|
EXCLUDE_PATTERNS =
|
||||||
EXAMPLE_PATH =
|
EXAMPLE_PATH =
|
||||||
EXAMPLE_PATTERNS = *
|
EXAMPLE_PATTERNS = *
|
||||||
EXAMPLE_RECURSIVE = NO
|
EXAMPLE_RECURSIVE = NO
|
||||||
IMAGE_PATH = ./img
|
IMAGE_PATH = ./img
|
||||||
INPUT_FILTER =
|
INPUT_FILTER =
|
||||||
FILTER_PATTERNS =
|
FILTER_PATTERNS =
|
||||||
FILTER_SOURCE_FILES = NO
|
FILTER_SOURCE_FILES = NO
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to source browsing
|
# configuration options related to source browsing
|
||||||
|
@ -141,20 +141,20 @@ VERBATIM_HEADERS = NO
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
ALPHABETICAL_INDEX = NO
|
ALPHABETICAL_INDEX = NO
|
||||||
COLS_IN_ALPHA_INDEX = 5
|
COLS_IN_ALPHA_INDEX = 5
|
||||||
IGNORE_PREFIX =
|
IGNORE_PREFIX =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the HTML output
|
# configuration options related to the HTML output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
GENERATE_HTML = YES
|
GENERATE_HTML = YES
|
||||||
HTML_OUTPUT = html
|
HTML_OUTPUT = html
|
||||||
HTML_FILE_EXTENSION = .html
|
HTML_FILE_EXTENSION = .html
|
||||||
HTML_HEADER =
|
HTML_HEADER =
|
||||||
HTML_FOOTER =
|
HTML_FOOTER =
|
||||||
HTML_STYLESHEET =
|
HTML_STYLESHEET =
|
||||||
HTML_ALIGN_MEMBERS = YES
|
HTML_ALIGN_MEMBERS = YES
|
||||||
GENERATE_HTMLHELP = NO
|
GENERATE_HTMLHELP = NO
|
||||||
CHM_FILE =
|
CHM_FILE =
|
||||||
HHC_LOCATION =
|
HHC_LOCATION =
|
||||||
GENERATE_CHI = NO
|
GENERATE_CHI = NO
|
||||||
BINARY_TOC = NO
|
BINARY_TOC = NO
|
||||||
TOC_EXPAND = NO
|
TOC_EXPAND = NO
|
||||||
|
@ -171,8 +171,8 @@ LATEX_CMD_NAME = latex
|
||||||
MAKEINDEX_CMD_NAME = makeindex
|
MAKEINDEX_CMD_NAME = makeindex
|
||||||
COMPACT_LATEX = NO
|
COMPACT_LATEX = NO
|
||||||
PAPER_TYPE = a4wide
|
PAPER_TYPE = a4wide
|
||||||
EXTRA_PACKAGES =
|
EXTRA_PACKAGES =
|
||||||
LATEX_HEADER =
|
LATEX_HEADER =
|
||||||
PDF_HYPERLINKS = NO
|
PDF_HYPERLINKS = NO
|
||||||
USE_PDFLATEX = NO
|
USE_PDFLATEX = NO
|
||||||
LATEX_BATCHMODE = NO
|
LATEX_BATCHMODE = NO
|
||||||
|
@ -184,8 +184,8 @@ GENERATE_RTF = NO
|
||||||
RTF_OUTPUT = rtf
|
RTF_OUTPUT = rtf
|
||||||
COMPACT_RTF = NO
|
COMPACT_RTF = NO
|
||||||
RTF_HYPERLINKS = NO
|
RTF_HYPERLINKS = NO
|
||||||
RTF_STYLESHEET_FILE =
|
RTF_STYLESHEET_FILE =
|
||||||
RTF_EXTENSIONS_FILE =
|
RTF_EXTENSIONS_FILE =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the man page output
|
# configuration options related to the man page output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
@ -198,8 +198,8 @@ MAN_LINKS = NO
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
GENERATE_XML = NO
|
GENERATE_XML = NO
|
||||||
XML_OUTPUT = xml
|
XML_OUTPUT = xml
|
||||||
XML_SCHEMA =
|
XML_SCHEMA =
|
||||||
XML_DTD =
|
XML_DTD =
|
||||||
XML_PROGRAMLISTING = YES
|
XML_PROGRAMLISTING = YES
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options for the AutoGen Definitions output
|
# configuration options for the AutoGen Definitions output
|
||||||
|
@ -211,22 +211,23 @@ GENERATE_AUTOGEN_DEF = NO
|
||||||
GENERATE_PERLMOD = NO
|
GENERATE_PERLMOD = NO
|
||||||
PERLMOD_LATEX = NO
|
PERLMOD_LATEX = NO
|
||||||
PERLMOD_PRETTY = YES
|
PERLMOD_PRETTY = YES
|
||||||
PERLMOD_MAKEVAR_PREFIX =
|
PERLMOD_MAKEVAR_PREFIX =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the preprocessor
|
# Configuration options related to the preprocessor
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
ENABLE_PREPROCESSING = YES
|
ENABLE_PREPROCESSING = YES
|
||||||
MACRO_EXPANSION = NO
|
MACRO_EXPANSION = NO
|
||||||
EXPAND_ONLY_PREDEF = NO
|
EXPAND_ONLY_PREDEF = NO
|
||||||
SEARCH_INCLUDES = YES
|
SEARCH_INCLUDES = YES
|
||||||
INCLUDE_PATH =
|
INCLUDE_PATH =
|
||||||
INCLUDE_FILE_PATTERNS =
|
INCLUDE_FILE_PATTERNS =
|
||||||
PREDEFINED = __JUST_STUBS__ \
|
PREDEFINED = __JUST_STUBS__ \
|
||||||
__DOXIGEN__ \
|
__DOXIGEN__ \
|
||||||
CH_USE_VIRTUAL_TIMERS \
|
CH_USE_VIRTUAL_TIMERS \
|
||||||
CH_USE_SYSTEMTIME \
|
CH_USE_SYSTEMTIME \
|
||||||
CH_USE_SLEEP \
|
CH_USE_SLEEP \
|
||||||
CH_USE_RESUME \
|
CH_USE_RESUME \
|
||||||
|
CH_USE_SUSPEND \
|
||||||
CH_USE_TERMINATE \
|
CH_USE_TERMINATE \
|
||||||
CH_USE_WAITEXIT \
|
CH_USE_WAITEXIT \
|
||||||
CH_USE_SEMAPHORES \
|
CH_USE_SEMAPHORES \
|
||||||
|
@ -243,18 +244,18 @@ PREDEFINED = __JUST_STUBS__ \
|
||||||
CH_USE_MESSAGES_TIMEOUT \
|
CH_USE_MESSAGES_TIMEOUT \
|
||||||
CH_USE_MESSAGES_EVENT \
|
CH_USE_MESSAGES_EVENT \
|
||||||
CH_USE_SEMSW
|
CH_USE_SEMSW
|
||||||
EXPAND_AS_DEFINED =
|
EXPAND_AS_DEFINED =
|
||||||
SKIP_FUNCTION_MACROS = YES
|
SKIP_FUNCTION_MACROS = YES
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration::additions related to external references
|
# Configuration::additions related to external references
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
TAGFILES =
|
TAGFILES =
|
||||||
GENERATE_TAGFILE =
|
GENERATE_TAGFILE =
|
||||||
ALLEXTERNALS = NO
|
ALLEXTERNALS = NO
|
||||||
EXTERNAL_GROUPS = YES
|
EXTERNAL_GROUPS = YES
|
||||||
PERL_PATH = /usr/bin/perl
|
PERL_PATH = /usr/bin/perl
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the dot tool
|
# Configuration options related to the dot tool
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
CLASS_DIAGRAMS = NO
|
CLASS_DIAGRAMS = NO
|
||||||
HIDE_UNDOC_RELATIONS = YES
|
HIDE_UNDOC_RELATIONS = YES
|
||||||
|
@ -271,8 +272,8 @@ CALLER_GRAPH = NO
|
||||||
GRAPHICAL_HIERARCHY = YES
|
GRAPHICAL_HIERARCHY = YES
|
||||||
DIRECTORY_GRAPH = YES
|
DIRECTORY_GRAPH = YES
|
||||||
DOT_IMAGE_FORMAT = png
|
DOT_IMAGE_FORMAT = png
|
||||||
DOT_PATH =
|
DOT_PATH =
|
||||||
DOTFILE_DIRS =
|
DOTFILE_DIRS =
|
||||||
MAX_DOT_GRAPH_WIDTH = 1024
|
MAX_DOT_GRAPH_WIDTH = 1024
|
||||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||||
MAX_DOT_GRAPH_DEPTH = 1000
|
MAX_DOT_GRAPH_DEPTH = 1000
|
||||||
|
@ -281,6 +282,6 @@ DOT_MULTI_TARGETS = NO
|
||||||
GENERATE_LEGEND = YES
|
GENERATE_LEGEND = YES
|
||||||
DOT_CLEANUP = YES
|
DOT_CLEANUP = YES
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration::additions related to the search engine
|
# Configuration::additions related to the search engine
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
SEARCHENGINE = NO
|
SEARCHENGINE = NO
|
||||||
|
|
|
@ -106,12 +106,12 @@ static void OutNotify2(void) {
|
||||||
u->UART_IER |= IER_THRE;
|
u->UART_IER |= IER_THRE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UART0Irq(void){
|
void UART0Irq(void) {
|
||||||
|
|
||||||
ServeInterrupt(U0Base, &COM1);
|
ServeInterrupt(U0Base, &COM1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UART1Irq(void){
|
void UART1Irq(void) {
|
||||||
|
|
||||||
ServeInterrupt(U1Base, &COM2);
|
ServeInterrupt(U1Base, &COM2);
|
||||||
}
|
}
|
||||||
|
|
10
readme.txt
10
readme.txt
|
@ -40,9 +40,11 @@ AVR-AT90CANx-GCC - Port on AVER AT90CAN128, not complete yet.
|
||||||
|
|
||||||
*** 0.3.4 ***
|
*** 0.3.4 ***
|
||||||
- Fixed a problem in chVTSetI().
|
- Fixed a problem in chVTSetI().
|
||||||
- Modified chEvtWaitTimeout() to work correctly in the TIME_INFINITE
|
- New API, chVTIsArmedI(), it is a macro in delta.h.
|
||||||
scenario.
|
- New API, chThdResumeI(), it is a macro in threads.h. This function is just
|
||||||
|
an alias for chSchReadyI() but makes the code more readable.
|
||||||
|
- New API, chThdSuspend(). New switch CH_USE_SUSPEND added to chconf.h.
|
||||||
|
|
||||||
*** 0.3.3 ***
|
*** 0.3.3 ***
|
||||||
- Modified the chVTSetI(), now for the "time" parameter can have value zero
|
- Modified the chVTSetI(), now for the "time" parameter can have value zero
|
||||||
with meaning "infinite". This allows all the APIs with timeout parameters
|
with meaning "infinite". This allows all the APIs with timeout parameters
|
||||||
|
@ -54,7 +56,7 @@ AVR-AT90CANx-GCC - Port on AVER AT90CAN128, not complete yet.
|
||||||
- Modified the chSysInit() to give the idle thread absolute priority, the
|
- Modified the chSysInit() to give the idle thread absolute priority, the
|
||||||
priority is then lowered to the minimum value into the chSysPause(). This
|
priority is then lowered to the minimum value into the chSysPause(). This
|
||||||
is done in order to ensure that the initializations performed into the
|
is done in order to ensure that the initializations performed into the
|
||||||
main() procedure are performed before any thread starts.
|
main() procedure are finished before any thread starts.
|
||||||
- Added chThdSetPriority() new API.
|
- Added chThdSetPriority() new API.
|
||||||
- Added a generic events generator timer modulee to the library code.
|
- Added a generic events generator timer modulee to the library code.
|
||||||
- Modified the ARM7-LPC214x-GCC demo to show the use of the event timer.
|
- Modified the ARM7-LPC214x-GCC demo to show the use of the event timer.
|
||||||
|
|
|
@ -40,7 +40,9 @@ void chVTInit(void) {
|
||||||
* Enables a virtual timer.
|
* Enables a virtual timer.
|
||||||
* @param vtp the \p VirtualTimer structure pointer
|
* @param vtp the \p VirtualTimer structure pointer
|
||||||
* @param time the number of time ticks, the value zero is allowed with
|
* @param time the number of time ticks, the value zero is allowed with
|
||||||
* meaning "infinite".
|
* meaning "infinite". In this case the structure is initialized
|
||||||
|
* but not inserted in the delta list, the timer will never be
|
||||||
|
* triggered.
|
||||||
* @param vtfunc the timer callback function. After invoking the callback
|
* @param vtfunc the timer callback function. After invoking the callback
|
||||||
* the timer is disabled and the structure can be disposed or
|
* the timer is disabled and the structure can be disposed or
|
||||||
* reused.
|
* reused.
|
||||||
|
@ -51,8 +53,8 @@ void chVTInit(void) {
|
||||||
void chVTSetI(VirtualTimer *vtp, t_time time, t_vtfunc vtfunc, void *par) {
|
void chVTSetI(VirtualTimer *vtp, t_time time, t_vtfunc vtfunc, void *par) {
|
||||||
|
|
||||||
vtp->vt_par = par;
|
vtp->vt_par = par;
|
||||||
|
vtp->vt_func = vtfunc;
|
||||||
if (time) {
|
if (time) {
|
||||||
vtp->vt_func = vtfunc;
|
|
||||||
VirtualTimer *p = dlist.dl_next;
|
VirtualTimer *p = dlist.dl_next;
|
||||||
while (p->vt_dtime < time) {
|
while (p->vt_dtime < time) {
|
||||||
time -= p->vt_dtime;
|
time -= p->vt_dtime;
|
||||||
|
@ -66,7 +68,7 @@ void chVTSetI(VirtualTimer *vtp, t_time time, t_vtfunc vtfunc, void *par) {
|
||||||
p->vt_dtime -= time;
|
p->vt_dtime -= time;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vtp->vt_func = NULL;
|
vtp->vt_next = vtp->vt_prev = vtp; // Allows a chVTResetI() on the fake timer.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -205,7 +205,6 @@ t_eventid chEvtWaitTimeout(t_eventmask ewmask,
|
||||||
t_time time) {
|
t_time time) {
|
||||||
t_eventid i;
|
t_eventid i;
|
||||||
t_eventmask m;
|
t_eventmask m;
|
||||||
t_msg msg;
|
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
||||||
|
@ -221,11 +220,10 @@ t_eventid chEvtWaitTimeout(t_eventmask ewmask,
|
||||||
chVTSetI(&vt, time, unwait, currp);
|
chVTSetI(&vt, time, unwait, currp);
|
||||||
currp->p_ewmask = ewmask;
|
currp->p_ewmask = ewmask;
|
||||||
chSchGoSleepS(PRWTEVENT);
|
chSchGoSleepS(PRWTEVENT);
|
||||||
if (!vt.vt_func) {
|
if (!chVTIsArmedI(&vt)) {
|
||||||
t_msg msg = currp->p_rdymsg;
|
|
||||||
|
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
return msg;
|
return RDY_TIMEOUT;
|
||||||
}
|
}
|
||||||
chVTResetI(&vt);
|
chVTResetI(&vt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ t_msg chMsgSendTimeout(Thread *tp, t_msg msg, t_time time) {
|
||||||
currp->p_msg = msg;
|
currp->p_msg = msg;
|
||||||
chSchGoSleepS(PRSNDMSG);
|
chSchGoSleepS(PRSNDMSG);
|
||||||
msg = currp->p_rdymsg;
|
msg = currp->p_rdymsg;
|
||||||
if (vt.vt_func)
|
if (chVTIsArmedI(&vt))
|
||||||
chVTResetI(&vt);
|
chVTResetI(&vt);
|
||||||
|
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
|
|
|
@ -139,7 +139,7 @@ t_msg chSemWaitTimeout(Semaphore *sp, t_time time) {
|
||||||
currp->p_semp = sp;
|
currp->p_semp = sp;
|
||||||
chSchGoSleepS(PRWTSEM);
|
chSchGoSleepS(PRWTSEM);
|
||||||
msg = currp->p_rdymsg;
|
msg = currp->p_rdymsg;
|
||||||
if (vt.vt_func)
|
if (chVTIsArmedI(&vt))
|
||||||
chVTResetI(&vt);
|
chVTResetI(&vt);
|
||||||
|
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
|
@ -169,7 +169,7 @@ t_msg chSemWaitTimeoutS(Semaphore *sp, t_time time) {
|
||||||
fifo_insert(currp, &sp->s_queue);
|
fifo_insert(currp, &sp->s_queue);
|
||||||
currp->p_semp = sp;
|
currp->p_semp = sp;
|
||||||
chSchGoSleepS(PRWTSEM);
|
chSchGoSleepS(PRWTSEM);
|
||||||
if (vt.vt_func)
|
if (chVTIsArmedI(&vt))
|
||||||
chVTResetI(&vt);
|
chVTResetI(&vt);
|
||||||
return currp->p_rdymsg;
|
return currp->p_rdymsg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,9 +121,34 @@ void chThdSetPriority(t_prio newprio) {
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CH_USE_SUSPEND
|
||||||
|
/**
|
||||||
|
* Suspends the invoking thread.
|
||||||
|
*
|
||||||
|
* @param tpp pointer to a \p Thread pointer, the \p Thread pointer is set
|
||||||
|
* to point to the suspended process before it enters the
|
||||||
|
* \p PRSUSPENDED state, it is set to \p NULL after it is resumed.
|
||||||
|
* This allows to implement a "test and resume" on the variable
|
||||||
|
* into interrupt handlers.
|
||||||
|
* @note The function is available only if the \p CH_USE_SUSPEND
|
||||||
|
* option is enabled in \p chconf.h.
|
||||||
|
*/
|
||||||
|
void chThdSuspend(Thread **tpp) {
|
||||||
|
|
||||||
|
chSysLock();
|
||||||
|
|
||||||
|
*tpp = currp;
|
||||||
|
chSchGoSleepS(PRSUSPENDED);
|
||||||
|
*tpp = NULL;
|
||||||
|
|
||||||
|
chSysUnlock();
|
||||||
|
}
|
||||||
|
#endif /* CH_USE_SUSPEND */
|
||||||
|
|
||||||
#ifdef CH_USE_RESUME
|
#ifdef CH_USE_RESUME
|
||||||
/**
|
/**
|
||||||
* Resumes a thread created with the \p P_SUSPENDED option.
|
* Resumes a thread created with the \p P_SUSPENDED option or suspended with
|
||||||
|
* \p chThdSuspend().
|
||||||
* @param tp the pointer to the thread
|
* @param tp the pointer to the thread
|
||||||
* @note The function has no effect on threads in any other state than
|
* @note The function has no effect on threads in any other state than
|
||||||
* \p PRSUSPENDED.
|
* \p PRSUSPENDED.
|
||||||
|
@ -134,8 +159,8 @@ void chThdResume(Thread *tp) {
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
||||||
if (tp->p_state == PRSUSPENDED)
|
if ((tp)->p_state == PRSUSPENDED)
|
||||||
chSchWakeupS(tp, RDY_OK);
|
chSchWakeupS((tp), RDY_OK);
|
||||||
|
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,9 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** Returns TRUE if the speciified timer is armed.*/
|
||||||
|
#define chVTIsArmedI(vtp) ((vtp)->vt_func != NULL)
|
||||||
|
|
||||||
#endif /* CH_USE_VIRTUAL_TIMER */
|
#endif /* CH_USE_VIRTUAL_TIMER */
|
||||||
|
|
||||||
#endif /* _DELTA_H_ */
|
#endif /* _DELTA_H_ */
|
||||||
|
|
|
@ -192,8 +192,10 @@ extern "C" {
|
||||||
Thread *chThdCreate(t_prio prio, t_tmode mode, void *workspace,
|
Thread *chThdCreate(t_prio prio, t_tmode mode, void *workspace,
|
||||||
t_size wsize, t_tfunc pf, void *arg);
|
t_size wsize, t_tfunc pf, void *arg);
|
||||||
void chThdSetPriority(t_prio newprio);
|
void chThdSetPriority(t_prio newprio);
|
||||||
void chThdResume(Thread *tp);
|
|
||||||
void chThdExit(t_msg msg);
|
void chThdExit(t_msg msg);
|
||||||
|
#ifdef CH_USE_RESUME
|
||||||
|
void chThdResume(Thread *tp);
|
||||||
|
#endif
|
||||||
#ifdef CH_USE_TERMINATE
|
#ifdef CH_USE_TERMINATE
|
||||||
void chThdTerminate(Thread *tp);
|
void chThdTerminate(Thread *tp);
|
||||||
#endif
|
#endif
|
||||||
|
@ -240,6 +242,13 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define chThdGetExitEventSource(tp) (&(tp)->p_exitesource)
|
#define chThdGetExitEventSource(tp) (&(tp)->p_exitesource)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resumes a thread created with the \p P_SUSPENDED option or suspended with
|
||||||
|
* \p chThdSuspend().
|
||||||
|
* @param tp the pointer to the thread
|
||||||
|
*/
|
||||||
|
#define chThdResumeI(tp) chSchReadyI(tp)
|
||||||
|
|
||||||
#endif /* _THREADS_H_ */
|
#endif /* _THREADS_H_ */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -45,7 +45,7 @@ void evtStart(EvTimer *etp) {
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
||||||
if (!etp->et_vt.vt_func)
|
if (!chVTIsArmedI(&etp->et_vt))
|
||||||
chVTSetI(&etp->et_vt, etp->et_interval, tmrcb, etp);
|
chVTSetI(&etp->et_vt, etp->et_interval, tmrcb, etp);
|
||||||
|
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
|
@ -60,7 +60,7 @@ void evtStop(EvTimer *etp) {
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
||||||
if (etp->et_vt.vt_func)
|
if (chVTIsArmedI(&etp->et_vt))
|
||||||
chVTResetI(&etp->et_vt);
|
chVTResetI(&etp->et_vt);
|
||||||
|
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
|
|
|
@ -52,6 +52,10 @@
|
||||||
* function is included in the kernel.*/
|
* function is included in the kernel.*/
|
||||||
#define CH_USE_RESUME
|
#define CH_USE_RESUME
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the \p chThdSuspend()
|
||||||
|
* function is included in the kernel.*/
|
||||||
|
#define CH_USE_SUSPEND
|
||||||
|
|
||||||
/** Configuration option: if specified then the \p chThdTerminate()
|
/** Configuration option: if specified then the \p chThdTerminate()
|
||||||
* and \p chThdShouldTerminate() functions are included in the kernel.*/
|
* and \p chThdShouldTerminate() functions are included in the kernel.*/
|
||||||
#define CH_USE_TERMINATE
|
#define CH_USE_TERMINATE
|
||||||
|
|
Loading…
Reference in New Issue