[platform] switch arm-m platforms to using new arm-m irq header/footer

This commit is contained in:
Travis Geiselbrecht
2013-03-10 17:41:35 -07:00
parent d36b762ea8
commit 867b31d499
10 changed files with 30 additions and 42 deletions

View File

@@ -39,15 +39,16 @@ static cbuf_t debug_rx_buf;
void sam3_uart_irq(void)
{
inc_critical_section();
arm_cm_irq_entry();
bool resched = false;
unsigned char c;
if (uart_read(UART, &c) == 0) {
cbuf_write_char(&debug_rx_buf, c, false);
arm_cm_trigger_preempt();
resched = true;
}
dec_critical_section();
arm_cm_irq_exit(resched);
}
void sam_debug_early_init(void)

View File

@@ -44,7 +44,7 @@ static void *cb_args;
/* use systick as the kernel tick */
void _systick(void)
{
inc_critical_section();
arm_cm_irq_entry();
bool resched = false;
if (cb) {
@@ -53,12 +53,7 @@ void _systick(void)
resched = true;
}
if (resched) {
// have the cortex-m3 queue a preemption
arm_cm_trigger_preempt();
}
dec_critical_section();
arm_cm_irq_exit(resched);
}
status_t platform_set_periodic_timer(platform_timer_callback callback, void *arg, lk_time_t interval)

View File

@@ -42,7 +42,7 @@ static cbuf_t debug_rx_buf;
void stellaris_uart_irq(void)
{
inc_critical_section();
arm_cm_irq_entry();
//
// Get the interrrupt status.
@@ -57,6 +57,7 @@ void stellaris_uart_irq(void)
//
// Loop while there are characters in the receive FIFO.
//
bool resched = false;
while (UARTCharsAvail(DEBUG_UART)) {
//
// Read the next character from the UART and write it back to the UART.
@@ -64,10 +65,10 @@ void stellaris_uart_irq(void)
unsigned char c = UARTCharGetNonBlocking(DEBUG_UART);
cbuf_write_char(&debug_rx_buf, c, false);
arm_cm_trigger_preempt();
resched = true;
}
dec_critical_section();
arm_cm_irq_exit(resched);
}
void stellaris_debug_early_init(void)

View File

@@ -45,7 +45,7 @@ static void *cb_args;
/* use systick as the kernel tick */
void _systick(void)
{
inc_critical_section();
arm_cm_irq_entry();
ticks++;
bool resched = false;
@@ -55,12 +55,7 @@ void _systick(void)
resched = true;
}
if (resched) {
// have the cortex-m3 queue a preemption
arm_cm_trigger_preempt();
}
dec_critical_section();
arm_cm_irq_exit(resched);
}
status_t platform_set_periodic_timer(platform_timer_callback callback, void *arg, lk_time_t interval)

View File

@@ -44,7 +44,7 @@ static void *cb_args;
/* use systick as the kernel tick */
void _systick(void)
{
inc_critical_section();
arm_cm_irq_entry();
bool resched = false;
ticks += 10;
@@ -53,12 +53,7 @@ void _systick(void)
resched = true;
}
if (resched) {
// have the cortex-m3 queue a preemption
arm_cm_trigger_preempt();
}
dec_critical_section();
arm_cm_irq_exit(resched);
}
status_t platform_set_periodic_timer(platform_timer_callback callback, void *arg, lk_time_t interval)

View File

@@ -128,8 +128,9 @@ void uart_init(void)
void uart_rx_irq(USART_TypeDef *usart, cbuf_t *rxbuf)
{
inc_critical_section();
arm_cm_irq_entry();
bool resched = false;
while (USART_GetFlagStatus(usart, USART_FLAG_RXNE)) {
if (!cbuf_space_avail(rxbuf)) {
// Overflow - let flow control do its thing by not
@@ -140,11 +141,10 @@ void uart_rx_irq(USART_TypeDef *usart, cbuf_t *rxbuf)
char c = USART_ReceiveData(usart);
cbuf_write_char(rxbuf, c, false);
resched = true;
}
arm_cm_trigger_preempt();
dec_critical_section();
arm_cm_irq_exit(resched);
}
#ifdef ENABLE_UART1

View File

@@ -23,6 +23,7 @@
#include <debug.h>
#include <compiler.h>
#include <stm32f10x.h>
#include <arch/arm/cm.h>
#include <platform/stm32.h>
#include <target/debugconfig.h>
#include <lib/cbuf.h>
@@ -30,6 +31,8 @@
/* un-overridden irq handler */
void stm32_dummy_irq(void)
{
arm_cm_irq_entry();
panic("unhandled irq\n");
}

View File

@@ -44,7 +44,7 @@ static void *cb_args;
/* use systick as the kernel tick */
void _systick(void)
{
inc_critical_section();
arm_cm_irq_entry();
bool resched = false;
ticks += 10;
@@ -53,12 +53,7 @@ void _systick(void)
resched = true;
}
if (resched) {
// have the cortex-m3 queue a preemption
arm_cm_trigger_preempt();
}
dec_critical_section();
arm_cm_irq_exit(resched);
}
status_t platform_set_periodic_timer(platform_timer_callback callback, void *arg, lk_time_t interval)

View File

@@ -128,8 +128,9 @@ void uart_init(void)
void uart_rx_irq(USART_TypeDef *usart, cbuf_t *rxbuf)
{
inc_critical_section();
arm_cm_irq_entry();
bool resched = false;
while (USART_GetFlagStatus(usart, USART_FLAG_RXNE)) {
if (!cbuf_space_avail(rxbuf)) {
// Overflow - let flow control do its thing by not
@@ -140,11 +141,10 @@ void uart_rx_irq(USART_TypeDef *usart, cbuf_t *rxbuf)
char c = USART_ReceiveData(usart);
cbuf_write_char(rxbuf, c, false);
resched = true;
}
arm_cm_trigger_preempt();
dec_critical_section();
arm_cm_irq_exit(resched);
}
#ifdef ENABLE_UART1

View File

@@ -23,6 +23,7 @@
#include <debug.h>
#include <compiler.h>
#include <stm32f2xx.h>
#include <arch/arm/cm.h>
#include <platform/stm32.h>
#include <target/debugconfig.h>
#include <lib/cbuf.h>
@@ -30,6 +31,8 @@
/* un-overridden irq handler */
void stm32_dummy_irq(void)
{
arm_cm_irq_entry();
panic("unhandled irq\n");
}