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

This commit is contained in:
gdisirio 2007-12-04 14:48:41 +00:00
parent 443c9c7db6
commit bef9d20d8e
12 changed files with 34 additions and 30 deletions

View File

@ -184,6 +184,6 @@ void NonVectoredIrq(void) {
void Timer0Irq(void) {
T0IR = 1; /* Clear interrupt on match MR0. */
chSchTimerHandlerI();
chSysTimerHandlerI();
VICVectAddr = 0;
}

View File

@ -185,6 +185,6 @@ void NonVectoredIrq(void) {
void Timer0Irq(void) {
T0IR = 1; /* Clear interrupt on match MR0. */
chSchTimerHandlerI();
chSysTimerHandlerI();
VICVectAddr = 0;
}

View File

@ -97,7 +97,7 @@ __vector_17:
in r0, _SFR_IO_ADDR(SREG)
push r0
clr r1
call chSchTimerHandlerI
call chSysTimerHandlerI
intcommon:
call chSchRescRequiredI
tst r24

View File

@ -62,7 +62,7 @@ void ChkIntSources(void) {
QueryPerformanceCounter(&n);
if (n.QuadPart > nextcnt.QuadPart) {
nextcnt.QuadPart += slice.QuadPart;
chSchTimerHandlerI();
chSysTimerHandlerI();
if (chSchRescRequiredI())
chSchDoRescheduleI();
}

View File

@ -85,7 +85,7 @@ void ChkIntSources(void) {
QueryPerformanceCounter(&n);
if (n.QuadPart > nextcnt.QuadPart) {
nextcnt.QuadPart += slice.QuadPart;
chSchTimerHandlerI();
chSysTimerHandlerI();
if (chSchRescRequiredI())
chSchDoRescheduleI();
}

View File

@ -46,6 +46,11 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet.
- Now the threads working area is filled with a 0x55 when in debug mode, this
will make easier to track stack usage using a JTAG probe.
- Added an I/O Queues benchmark to the test suite.
- Fixed a bug in chIQGetTimeout(), interrupts were not re-enabled when exiting
the function because a timeout. The problem affected that API only.
- Removed the chSchTimerHandlerI() routine from chschd.c and moved it into
chinit.c renaming it chSysTimerHandlerI() because it is not part of the
scheduler.
*** 0.4.3 ***
- Size optimization in the events code, now the chEvtWait() reuses the

View File

@ -58,4 +58,22 @@ void chSysInit(void) {
chThdCreate(IDLEPRIO, 0, waIdleThread, sizeof(waIdleThread), (t_tfunc)_IdleThread, NULL);
}
/**
* Preemption routine, this function must be called into an interrupt
* handler invoked by a system timer.
* The frequency of the timer determines the system tick granularity and,
* together with the \p CH_TIME_QUANTUM macro, the round robin interval.
*/
void chSysTimerHandlerI(void) {
rlist.r_preempt--;
#ifdef CH_USE_SYSTEMTIME
rlist.r_stime++;
#endif
#ifdef CH_USE_VIRTUAL_TIMERS
chVTDoTickI();
#endif
}
/** @} */

View File

@ -125,8 +125,11 @@ t_msg chIQGetTimeout(Queue *qp, t_time time) {
chSysLock();
if ((msg = chSemWaitTimeoutS(&qp->q_sem, time)) < RDY_OK)
if ((msg = chSemWaitTimeoutS(&qp->q_sem, time)) < RDY_OK) {
chSysUnlock();
return msg;
}
b = *qp->q_rdptr++;
if (qp->q_rdptr >= qp->q_top)
qp->q_rdptr = qp->q_buffer;

View File

@ -166,22 +166,4 @@ BOOL chSchRescRequiredI(void) {
return TRUE;
}
/**
* Preemption routine, this function must be called into an interrupt
* handler invoked by a system timer.
* The frequency of the timer determines the system tick granularity and,
* together with the \p CH_TIME_QUANTUM macro, the round robin interval.
*/
void chSchTimerHandlerI(void) {
rlist.r_preempt--;
#ifdef CH_USE_SYSTEMTIME
rlist.r_stime++;
#endif
#ifdef CH_USE_VIRTUAL_TIMERS
chVTDoTickI();
#endif
}
/** @} */

View File

@ -27,10 +27,7 @@
#ifdef CH_USE_SLEEP
static void wakeup(void *p) {
#ifdef CH_USE_DEBUG
if (((Thread *)p)->p_state != PRSLEEP)
chDbgPanic("chsleep.c, wakeup()");
#endif
chDbgAssert(((Thread *)p)->p_state == PRSLEEP, "chsleep.c, wakeup()");
chSchReadyI(p, RDY_OK);
}
@ -72,4 +69,3 @@ void chThdSleepUntil(t_time time) {
#endif /* CH_USE_SLEEP */
/** @} */

View File

@ -106,6 +106,7 @@
extern "C" {
#endif
void chSysInit(void);
void chSysTimerHandlerI(void);
#ifdef __cplusplus
}
#endif

View File

@ -64,7 +64,6 @@ extern "C" {
void chSchRescheduleS(void);
void chSchDoRescheduleI(void);
BOOL chSchRescRequiredI(void);
void chSchTimerHandlerI(void);
#ifdef __cplusplus
}
#endif