rename chx_request_preemption
This commit is contained in:
@@ -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>
|
2013-05-22 Niibe Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
* chopstx.c (chx_enable_intr, chx_disable_intr): Implement.
|
* chopstx.c (chx_enable_intr, chx_disable_intr): Implement.
|
||||||
|
|||||||
24
chopstx.c
24
chopstx.c
@@ -62,7 +62,7 @@ static struct chx_timer q_timer;
|
|||||||
/* XXX: q_exit; Queue for threads already exited. */
|
/* XXX: q_exit; Queue for threads already exited. */
|
||||||
|
|
||||||
/* Forward declaration(s). */
|
/* 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);
|
chx_UNLOCK (&q_timer.lock);
|
||||||
asm volatile ("cpsie i" : : : "memory");
|
asm volatile ("cpsie i" : : : "memory");
|
||||||
}
|
}
|
||||||
@@ -525,17 +525,11 @@ chx_handle_intr (void)
|
|||||||
if (intr->irq_num == irq_num)
|
if (intr->irq_num == irq_num)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (intr == NULL)
|
if (intr && intr->t && intr->t->v == THREAD_WAIT_INT)
|
||||||
{ /* Interrupt from unregistered source. */
|
|
||||||
asm volatile ("cpsie i" : : : "memory");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (intr->t && intr->t->v == THREAD_WAIT_INT)
|
|
||||||
{
|
{
|
||||||
intr->ready++;
|
intr->ready++;
|
||||||
chx_ready_enqueue (intr->t);
|
chx_ready_enqueue (intr->t);
|
||||||
chx_preempt ();
|
chx_request_preemption ();
|
||||||
}
|
}
|
||||||
asm volatile ("cpsie i" : : : "memory");
|
asm volatile ("cpsie i" : : : "memory");
|
||||||
}
|
}
|
||||||
@@ -571,7 +565,7 @@ chx_init (struct chx_thread *tp)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
chx_preempt (void)
|
chx_request_preemption (void)
|
||||||
{
|
{
|
||||||
static volatile uint32_t *const ICSR = (uint32_t *const)0xE000ED04;
|
static volatile uint32_t *const ICSR = (uint32_t *const)0xE000ED04;
|
||||||
|
|
||||||
@@ -846,13 +840,15 @@ chopstx_cond_broadcast (chopstx_cond_t *cond)
|
|||||||
void
|
void
|
||||||
chopstx_intr_register (chopstix_intr_t *intr, uint8_t irq_num)
|
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_disable_intr (irq_num);
|
||||||
chx_set_intr_prio (irq_num);
|
chx_set_intr_prio (irq_num);
|
||||||
intr->next = intr_top;
|
intr->next = intr_top;
|
||||||
intr_top = intr;
|
intr_top = intr;
|
||||||
intr->irq_num = irq_num;
|
asm volatile ("cpsie i" : : : "memory");
|
||||||
intr->t = running;
|
|
||||||
intr->ready = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
10
entry.c
10
entry.c
@@ -328,10 +328,10 @@ handler vector_table[] __attribute__ ((section(".startup.vectors"))) = {
|
|||||||
preempt, /* PendSV */
|
preempt, /* PendSV */
|
||||||
chx_timer_expired, /* SysTick */
|
chx_timer_expired, /* SysTick */
|
||||||
/* 0x40 */
|
/* 0x40 */
|
||||||
chx_handle_intr /* WWDG */, chx_handle_intr /* PVD */,
|
chx_handle_intr /* WWDG */, chx_handle_intr /* PVD */,
|
||||||
chx_handle_intr /* TAMPER */, chx_handle_intr /* RTC */,
|
chx_handle_intr /* TAMPER */, chx_handle_intr /* RTC */,
|
||||||
chx_handle_intr /* FLASH */, chx_handle_intr /* RCC */,
|
chx_handle_intr /* FLASH */, chx_handle_intr /* RCC */,
|
||||||
chx_handle_intr /* EXTI0 */, chx_handle_intr /* EXTI1 */,
|
chx_handle_intr /* EXTI0 */, chx_handle_intr /* EXTI1 */,
|
||||||
/* 0x60 */
|
/* 0x60 */
|
||||||
chx_handle_intr /* EXTI2 */, chx_handle_intr /* EXTI3 */,
|
chx_handle_intr /* EXTI2 */, chx_handle_intr /* EXTI3 */,
|
||||||
chx_handle_intr /* EXTI4 */, chx_handle_intr /* DMA1 CH1 */,
|
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 */,
|
chx_handle_intr /* DMA1 CH4 */, chx_handle_intr /* DMA1 CH5 */,
|
||||||
/* 0x80 */
|
/* 0x80 */
|
||||||
chx_handle_intr /* DMA1 CH6 */, chx_handle_intr /* DMA1 CH7 */,
|
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 */
|
/* 0x90 */
|
||||||
chx_handle_intr, /* USB LP */
|
chx_handle_intr, /* USB LP */
|
||||||
/* ... and more. CAN, EXT9_5, TIMx, I2C, SPI, USART, EXT15_10 */
|
/* ... and more. CAN, EXT9_5, TIMx, I2C, SPI, USART, EXT15_10 */
|
||||||
|
|||||||
Reference in New Issue
Block a user