git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@53 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2007-10-15 14:52:56 +00:00
parent 779840691f
commit 70c86d43ec
17 changed files with 117 additions and 57 deletions

View File

@ -69,7 +69,7 @@ void PlaySound(int freq, t_time duration) {
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.
StopCounter(tc);
}

View File

@ -51,6 +51,10 @@
* function is included in the kernel.*/
#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()
* and \p chThdShouldTerminate() functions are included in the kernel.*/
#define CH_USE_TERMINATE

View File

@ -52,6 +52,10 @@
* function is included in the kernel.*/
#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()
* and \p chThdShouldTerminate() functions are included in the kernel.*/
#define CH_USE_TERMINATE

View File

@ -56,6 +56,10 @@
* function is included in the kernel.*/
#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()
* and \p chThdShouldTerminate() functions are included in the kernel.*/
#define CH_USE_TERMINATE

View File

@ -56,6 +56,10 @@
* function is included in the kernel.*/
#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()
* and \p chThdShouldTerminate() functions are included in the kernel.*/
#define CH_USE_TERMINATE

View File

@ -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 = ./img
INPUT_FILTER =
FILTER_PATTERNS =
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,22 +211,23 @@ 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 \
CH_USE_SYSTEMTIME \
CH_USE_SLEEP \
CH_USE_RESUME \
CH_USE_SUSPEND \
CH_USE_TERMINATE \
CH_USE_WAITEXIT \
CH_USE_SEMAPHORES \
@ -243,18 +244,18 @@ PREDEFINED = __JUST_STUBS__ \
CH_USE_MESSAGES_TIMEOUT \
CH_USE_MESSAGES_EVENT \
CH_USE_SEMSW
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
@ -271,8 +272,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
@ -281,6 +282,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

View File

@ -106,12 +106,12 @@ static void OutNotify2(void) {
u->UART_IER |= IER_THRE;
}
void UART0Irq(void){
void UART0Irq(void) {
ServeInterrupt(U0Base, &COM1);
}
void UART1Irq(void){
void UART1Irq(void) {
ServeInterrupt(U1Base, &COM2);
}

View File

@ -40,9 +40,11 @@ AVR-AT90CANx-GCC - Port on AVER AT90CAN128, not complete yet.
*** 0.3.4 ***
- Fixed a problem in chVTSetI().
- Modified chEvtWaitTimeout() to work correctly in the TIME_INFINITE
scenario.
- New API, chVTIsArmedI(), it is a macro in delta.h.
- 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 ***
- Modified the chVTSetI(), now for the "time" parameter can have value zero
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
priority is then lowered to the minimum value into the chSysPause(). This
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 a generic events generator timer modulee to the library code.
- Modified the ARM7-LPC214x-GCC demo to show the use of the event timer.

View File

@ -40,7 +40,9 @@ void chVTInit(void) {
* Enables a virtual timer.
* @param vtp the \p VirtualTimer structure pointer
* @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
* the timer is disabled and the structure can be disposed or
* reused.
@ -51,8 +53,8 @@ void chVTInit(void) {
void chVTSetI(VirtualTimer *vtp, t_time time, t_vtfunc vtfunc, void *par) {
vtp->vt_par = par;
vtp->vt_func = vtfunc;
if (time) {
vtp->vt_func = vtfunc;
VirtualTimer *p = dlist.dl_next;
while (p->vt_dtime < time) {
time -= p->vt_dtime;
@ -66,7 +68,7 @@ void chVTSetI(VirtualTimer *vtp, t_time time, t_vtfunc vtfunc, void *par) {
p->vt_dtime -= time;
}
else
vtp->vt_func = NULL;
vtp->vt_next = vtp->vt_prev = vtp; // Allows a chVTResetI() on the fake timer.
}
/**

View File

@ -205,7 +205,6 @@ t_eventid chEvtWaitTimeout(t_eventmask ewmask,
t_time time) {
t_eventid i;
t_eventmask m;
t_msg msg;
chSysLock();
@ -221,11 +220,10 @@ t_eventid chEvtWaitTimeout(t_eventmask ewmask,
chVTSetI(&vt, time, unwait, currp);
currp->p_ewmask = ewmask;
chSchGoSleepS(PRWTEVENT);
if (!vt.vt_func) {
t_msg msg = currp->p_rdymsg;
if (!chVTIsArmedI(&vt)) {
chSysUnlock();
return msg;
return RDY_TIMEOUT;
}
chVTResetI(&vt);
}

View File

@ -115,7 +115,7 @@ t_msg chMsgSendTimeout(Thread *tp, t_msg msg, t_time time) {
currp->p_msg = msg;
chSchGoSleepS(PRSNDMSG);
msg = currp->p_rdymsg;
if (vt.vt_func)
if (chVTIsArmedI(&vt))
chVTResetI(&vt);
chSysUnlock();

View File

@ -139,7 +139,7 @@ t_msg chSemWaitTimeout(Semaphore *sp, t_time time) {
currp->p_semp = sp;
chSchGoSleepS(PRWTSEM);
msg = currp->p_rdymsg;
if (vt.vt_func)
if (chVTIsArmedI(&vt))
chVTResetI(&vt);
chSysUnlock();
@ -169,7 +169,7 @@ t_msg chSemWaitTimeoutS(Semaphore *sp, t_time time) {
fifo_insert(currp, &sp->s_queue);
currp->p_semp = sp;
chSchGoSleepS(PRWTSEM);
if (vt.vt_func)
if (chVTIsArmedI(&vt))
chVTResetI(&vt);
return currp->p_rdymsg;
}

View File

@ -121,9 +121,34 @@ void chThdSetPriority(t_prio newprio) {
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
/**
* 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
* @note The function has no effect on threads in any other state than
* \p PRSUSPENDED.
@ -134,8 +159,8 @@ void chThdResume(Thread *tp) {
chSysLock();
if (tp->p_state == PRSUSPENDED)
chSchWakeupS(tp, RDY_OK);
if ((tp)->p_state == PRSUSPENDED)
chSchWakeupS((tp), RDY_OK);
chSysUnlock();
}

View File

@ -97,6 +97,9 @@ extern "C" {
}
#endif
/** Returns TRUE if the speciified timer is armed.*/
#define chVTIsArmedI(vtp) ((vtp)->vt_func != NULL)
#endif /* CH_USE_VIRTUAL_TIMER */
#endif /* _DELTA_H_ */

View File

@ -192,8 +192,10 @@ extern "C" {
Thread *chThdCreate(t_prio prio, t_tmode mode, void *workspace,
t_size wsize, t_tfunc pf, void *arg);
void chThdSetPriority(t_prio newprio);
void chThdResume(Thread *tp);
void chThdExit(t_msg msg);
#ifdef CH_USE_RESUME
void chThdResume(Thread *tp);
#endif
#ifdef CH_USE_TERMINATE
void chThdTerminate(Thread *tp);
#endif
@ -240,6 +242,13 @@ extern "C" {
*/
#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_ */
/** @} */

View File

@ -45,7 +45,7 @@ void evtStart(EvTimer *etp) {
chSysLock();
if (!etp->et_vt.vt_func)
if (!chVTIsArmedI(&etp->et_vt))
chVTSetI(&etp->et_vt, etp->et_interval, tmrcb, etp);
chSysUnlock();
@ -60,7 +60,7 @@ void evtStop(EvTimer *etp) {
chSysLock();
if (etp->et_vt.vt_func)
if (chVTIsArmedI(&etp->et_vt))
chVTResetI(&etp->et_vt);
chSysUnlock();

View File

@ -52,6 +52,10 @@
* function is included in the kernel.*/
#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()
* and \p chThdShouldTerminate() functions are included in the kernel.*/
#define CH_USE_TERMINATE