git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@126 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
443c9c7db6
commit
bef9d20d8e
|
@ -184,6 +184,6 @@ void NonVectoredIrq(void) {
|
||||||
void Timer0Irq(void) {
|
void Timer0Irq(void) {
|
||||||
|
|
||||||
T0IR = 1; /* Clear interrupt on match MR0. */
|
T0IR = 1; /* Clear interrupt on match MR0. */
|
||||||
chSchTimerHandlerI();
|
chSysTimerHandlerI();
|
||||||
VICVectAddr = 0;
|
VICVectAddr = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,6 +185,6 @@ void NonVectoredIrq(void) {
|
||||||
void Timer0Irq(void) {
|
void Timer0Irq(void) {
|
||||||
|
|
||||||
T0IR = 1; /* Clear interrupt on match MR0. */
|
T0IR = 1; /* Clear interrupt on match MR0. */
|
||||||
chSchTimerHandlerI();
|
chSysTimerHandlerI();
|
||||||
VICVectAddr = 0;
|
VICVectAddr = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ __vector_17:
|
||||||
in r0, _SFR_IO_ADDR(SREG)
|
in r0, _SFR_IO_ADDR(SREG)
|
||||||
push r0
|
push r0
|
||||||
clr r1
|
clr r1
|
||||||
call chSchTimerHandlerI
|
call chSysTimerHandlerI
|
||||||
intcommon:
|
intcommon:
|
||||||
call chSchRescRequiredI
|
call chSchRescRequiredI
|
||||||
tst r24
|
tst r24
|
||||||
|
|
|
@ -62,7 +62,7 @@ void ChkIntSources(void) {
|
||||||
QueryPerformanceCounter(&n);
|
QueryPerformanceCounter(&n);
|
||||||
if (n.QuadPart > nextcnt.QuadPart) {
|
if (n.QuadPart > nextcnt.QuadPart) {
|
||||||
nextcnt.QuadPart += slice.QuadPart;
|
nextcnt.QuadPart += slice.QuadPart;
|
||||||
chSchTimerHandlerI();
|
chSysTimerHandlerI();
|
||||||
if (chSchRescRequiredI())
|
if (chSchRescRequiredI())
|
||||||
chSchDoRescheduleI();
|
chSchDoRescheduleI();
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ void ChkIntSources(void) {
|
||||||
QueryPerformanceCounter(&n);
|
QueryPerformanceCounter(&n);
|
||||||
if (n.QuadPart > nextcnt.QuadPart) {
|
if (n.QuadPart > nextcnt.QuadPart) {
|
||||||
nextcnt.QuadPart += slice.QuadPart;
|
nextcnt.QuadPart += slice.QuadPart;
|
||||||
chSchTimerHandlerI();
|
chSysTimerHandlerI();
|
||||||
if (chSchRescRequiredI())
|
if (chSchRescRequiredI())
|
||||||
chSchDoRescheduleI();
|
chSchDoRescheduleI();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
- 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.
|
will make easier to track stack usage using a JTAG probe.
|
||||||
- Added an I/O Queues benchmark to the test suite.
|
- 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 ***
|
*** 0.4.3 ***
|
||||||
- Size optimization in the events code, now the chEvtWait() reuses the
|
- Size optimization in the events code, now the chEvtWait() reuses the
|
||||||
|
|
18
src/chinit.c
18
src/chinit.c
|
@ -58,4 +58,22 @@ void chSysInit(void) {
|
||||||
chThdCreate(IDLEPRIO, 0, waIdleThread, sizeof(waIdleThread), (t_tfunc)_IdleThread, NULL);
|
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
|
||||||
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -125,8 +125,11 @@ t_msg chIQGetTimeout(Queue *qp, t_time time) {
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
||||||
if ((msg = chSemWaitTimeoutS(&qp->q_sem, time)) < RDY_OK)
|
if ((msg = chSemWaitTimeoutS(&qp->q_sem, time)) < RDY_OK) {
|
||||||
|
|
||||||
|
chSysUnlock();
|
||||||
return msg;
|
return msg;
|
||||||
|
}
|
||||||
b = *qp->q_rdptr++;
|
b = *qp->q_rdptr++;
|
||||||
if (qp->q_rdptr >= qp->q_top)
|
if (qp->q_rdptr >= qp->q_top)
|
||||||
qp->q_rdptr = qp->q_buffer;
|
qp->q_rdptr = qp->q_buffer;
|
||||||
|
|
18
src/chschd.c
18
src/chschd.c
|
@ -166,22 +166,4 @@ BOOL chSchRescRequiredI(void) {
|
||||||
return TRUE;
|
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
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -27,10 +27,7 @@
|
||||||
#ifdef CH_USE_SLEEP
|
#ifdef CH_USE_SLEEP
|
||||||
static void wakeup(void *p) {
|
static void wakeup(void *p) {
|
||||||
|
|
||||||
#ifdef CH_USE_DEBUG
|
chDbgAssert(((Thread *)p)->p_state == PRSLEEP, "chsleep.c, wakeup()");
|
||||||
if (((Thread *)p)->p_state != PRSLEEP)
|
|
||||||
chDbgPanic("chsleep.c, wakeup()");
|
|
||||||
#endif
|
|
||||||
chSchReadyI(p, RDY_OK);
|
chSchReadyI(p, RDY_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,4 +69,3 @@ void chThdSleepUntil(t_time time) {
|
||||||
#endif /* CH_USE_SLEEP */
|
#endif /* CH_USE_SLEEP */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void chSysInit(void);
|
void chSysInit(void);
|
||||||
|
void chSysTimerHandlerI(void);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -64,7 +64,6 @@ extern "C" {
|
||||||
void chSchRescheduleS(void);
|
void chSchRescheduleS(void);
|
||||||
void chSchDoRescheduleI(void);
|
void chSchDoRescheduleI(void);
|
||||||
BOOL chSchRescRequiredI(void);
|
BOOL chSchRescRequiredI(void);
|
||||||
void chSchTimerHandlerI(void);
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue