rename chx_request_preemption

This commit is contained in:
NIIBE Yutaka
2013-05-24 14:09:33 +09:00
parent 6209b54ffd
commit ed305567f2
3 changed files with 22 additions and 19 deletions

View File

@@ -1,3 +1,10 @@
2013-05-24 Niibe Yutaka <gniibe@fsij.org>
* chopstx.c (chx_request_preemption): Rename from chx_preempt.
* entry.c: "sys.h" is only for to new sys 2.0, keeping
compatibility to 1.0, it is if-def out now.
2013-05-22 Niibe Yutaka <gniibe@fsij.org>
* chopstx.c (chx_enable_intr, chx_disable_intr): Implement.

View File

@@ -62,7 +62,7 @@ static struct chx_timer q_timer;
/* XXX: q_exit; Queue for threads already exited. */
/* Forward declaration(s). */
static void chx_preempt (void);
static void chx_request_preemption (void);
/**************/
@@ -480,7 +480,7 @@ chx_timer_expired (void)
}
}
chx_preempt ();
chx_request_preemption ();
chx_UNLOCK (&q_timer.lock);
asm volatile ("cpsie i" : : : "memory");
}
@@ -525,17 +525,11 @@ chx_handle_intr (void)
if (intr->irq_num == irq_num)
break;
if (intr == NULL)
{ /* Interrupt from unregistered source. */
asm volatile ("cpsie i" : : : "memory");
return;
}
if (intr->t && intr->t->v == THREAD_WAIT_INT)
if (intr && intr->t && intr->t->v == THREAD_WAIT_INT)
{
intr->ready++;
chx_ready_enqueue (intr->t);
chx_preempt ();
chx_request_preemption ();
}
asm volatile ("cpsie i" : : : "memory");
}
@@ -571,7 +565,7 @@ chx_init (struct chx_thread *tp)
static void
chx_preempt (void)
chx_request_preemption (void)
{
static volatile uint32_t *const ICSR = (uint32_t *const)0xE000ED04;
@@ -846,13 +840,15 @@ chopstx_cond_broadcast (chopstx_cond_t *cond)
void
chopstx_intr_register (chopstix_intr_t *intr, uint8_t irq_num)
{
intr->irq_num = irq_num;
intr->t = running;
intr->ready = 0;
asm volatile ("cpsid i" : : : "memory");
chx_disable_intr (irq_num);
chx_set_intr_prio (irq_num);
intr->next = intr_top;
intr_top = intr;
intr->irq_num = irq_num;
intr->t = running;
intr->ready = 0;
asm volatile ("cpsie i" : : : "memory");
}

10
entry.c
View File

@@ -328,10 +328,10 @@ handler vector_table[] __attribute__ ((section(".startup.vectors"))) = {
preempt, /* PendSV */
chx_timer_expired, /* SysTick */
/* 0x40 */
chx_handle_intr /* WWDG */, chx_handle_intr /* PVD */,
chx_handle_intr /* TAMPER */, chx_handle_intr /* RTC */,
chx_handle_intr /* FLASH */, chx_handle_intr /* RCC */,
chx_handle_intr /* EXTI0 */, chx_handle_intr /* EXTI1 */,
chx_handle_intr /* WWDG */, chx_handle_intr /* PVD */,
chx_handle_intr /* TAMPER */, chx_handle_intr /* RTC */,
chx_handle_intr /* FLASH */, chx_handle_intr /* RCC */,
chx_handle_intr /* EXTI0 */, chx_handle_intr /* EXTI1 */,
/* 0x60 */
chx_handle_intr /* EXTI2 */, chx_handle_intr /* EXTI3 */,
chx_handle_intr /* EXTI4 */, chx_handle_intr /* DMA1 CH1 */,
@@ -339,7 +339,7 @@ handler vector_table[] __attribute__ ((section(".startup.vectors"))) = {
chx_handle_intr /* DMA1 CH4 */, chx_handle_intr /* DMA1 CH5 */,
/* 0x80 */
chx_handle_intr /* DMA1 CH6 */, chx_handle_intr /* DMA1 CH7 */,
chx_handle_intr /* ADC1_2 */, chx_handle_intr /* USB HP */,
chx_handle_intr /* ADC1_2 */, chx_handle_intr /* USB HP */,
/* 0x90 */
chx_handle_intr, /* USB LP */
/* ... and more. CAN, EXT9_5, TIMx, I2C, SPI, USART, EXT15_10 */