mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
arch/risc-v: Internal functions should be prefixed with riscv_ not up_
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
3b23f3f0b8
commit
44ada05549
@@ -82,7 +82,7 @@ void up_irqinitialize(void)
|
|||||||
/* Colorize the interrupt stack for debug purposes */
|
/* Colorize the interrupt stack for debug purposes */
|
||||||
|
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
riscv_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
||||||
intstack_size);
|
intstack_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
/* Attach the ecall interrupt handler */
|
/* Attach the ecall interrupt handler */
|
||||||
|
|
||||||
irq_attach(BL602_IRQ_ECALLM, up_swint, NULL);
|
irq_attach(BL602_IRQ_ECALLM, riscv_swint, NULL);
|
||||||
|
|
||||||
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
|
|
||||||
@@ -171,14 +171,14 @@ void up_enable_irq(int irq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_get_newintctx
|
* Name: riscv_get_newintctx
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return initial mstatus when a task is created.
|
* Return initial mstatus when a task is created.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uint32_t up_get_newintctx(void)
|
uint32_t riscv_get_newintctx(void)
|
||||||
{
|
{
|
||||||
/* Set machine previous privilege mode to machine mode.
|
/* Set machine previous privilege mode to machine mode.
|
||||||
* Also set machine previous interrupt enable
|
* Also set machine previous interrupt enable
|
||||||
@@ -192,14 +192,14 @@ uint32_t up_get_newintctx(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_ack_irq
|
* Name: riscv_ack_irq
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Acknowledge the IRQ
|
* Acknowledge the IRQ
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_ack_irq(int irq)
|
void riscv_ack_irq(int irq)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ void *bl602_dispatch_irq(uint32_t vector, uint32_t *regs)
|
|||||||
|
|
||||||
/* Acknowledge the interrupt */
|
/* Acknowledge the interrupt */
|
||||||
|
|
||||||
up_ack_irq(irq);
|
riscv_ack_irq(irq);
|
||||||
|
|
||||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
PANIC();
|
PANIC();
|
||||||
@@ -103,7 +103,7 @@ void *bl602_dispatch_irq(uint32_t vector, uint32_t *regs)
|
|||||||
#ifdef CONFIG_ARCH_FPU
|
#ifdef CONFIG_ARCH_FPU
|
||||||
/* Restore floating point registers */
|
/* Restore floating point registers */
|
||||||
|
|
||||||
up_restorefpu((uint32_t *)g_current_regs);
|
riscv_restorefpu((uint32_t *)g_current_regs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
|
|||||||
@@ -333,14 +333,14 @@ void bl602_uart_configure(const struct uart_config_s *config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_lowputc
|
* Name: riscv_lowputc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Output one byte on the serial console
|
* Output one byte on the serial console
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_lowputc(char ch)
|
void riscv_lowputc(char ch)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SERIAL_CONSOLE
|
#ifdef HAVE_SERIAL_CONSOLE
|
||||||
/* Wait for FIFO */
|
/* Wait for FIFO */
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
|
|
||||||
/* Common initialization logic will not not know that the all of the UARTs
|
/* Common initialization logic will not not know that the all of the UARTs
|
||||||
* have been disabled. So, as a result, we may still have to provide
|
* have been disabled. So, as a result, we may still have to provide
|
||||||
* stub implementations of up_earlyserialinit(), up_serialinit(), and
|
* stub implementations of riscv_earlyserialinit(), riscv_serialinit(), and
|
||||||
* up_putc().
|
* up_putc().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -812,18 +812,18 @@ static bool bl602_txempty(struct uart_dev_s *dev)
|
|||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_earlyserialinit
|
* Name: riscv_earlyserialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Performs the low level UART initialization early in debug so that the
|
* Performs the low level UART initialization early in debug so that the
|
||||||
* serial console will be available during bootup. This must be called
|
* serial console will be available during bootup. This must be called
|
||||||
* before up_serialinit. NOTE: This function depends on GPIO pin
|
* before riscv_serialinit. NOTE: This function depends on GPIO pin
|
||||||
* configuration performed in up_consoleinit() and main clock
|
* configuration performed in up_consoleinit() and main clock
|
||||||
* initialization performed in up_clkinitialize().
|
* initialization performed in up_clkinitialize().
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_earlyserialinit(void)
|
void riscv_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SERIAL_CONSOLE
|
#ifdef HAVE_SERIAL_CONSOLE
|
||||||
/* Configuration whichever one is the console */
|
/* Configuration whichever one is the console */
|
||||||
@@ -835,15 +835,15 @@ void up_earlyserialinit(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_serialinit
|
* Name: riscv_serialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register serial console and serial ports. This assumes
|
* Register serial console and serial ports. This assumes
|
||||||
* that up_earlyserialinit was called previously.
|
* that riscv_earlyserialinit was called previously.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_serialinit(void)
|
void riscv_serialinit(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char devname[16];
|
char devname[16];
|
||||||
@@ -900,17 +900,17 @@ int up_putc(int ch)
|
|||||||
{
|
{
|
||||||
/* Add CR */
|
/* Add CR */
|
||||||
|
|
||||||
up_lowputc('\r');
|
riscv_lowputc('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
up_lowputc(ch);
|
riscv_lowputc(ch);
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
#endif
|
#endif
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_earlyserialinit, up_serialinit, and up_putc
|
* Name: riscv_earlyserialinit, riscv_serialinit, and up_putc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* stubs that may be needed. These stubs would be used if all UARTs are
|
* stubs that may be needed. These stubs would be used if all UARTs are
|
||||||
@@ -921,11 +921,11 @@ int up_putc(int ch)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#else /* HAVE_UART_DEVICE */
|
#else /* HAVE_UART_DEVICE */
|
||||||
void up_earlyserialinit(void)
|
void riscv_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void up_serialinit(void)
|
void riscv_serialinit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -954,10 +954,10 @@ int up_putc(int ch)
|
|||||||
{
|
{
|
||||||
/* Add CR */
|
/* Add CR */
|
||||||
|
|
||||||
up_lowputc('\r');
|
riscv_lowputc('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
up_lowputc(ch);
|
riscv_lowputc(ch);
|
||||||
#endif
|
#endif
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FEATURES
|
#ifdef CONFIG_DEBUG_FEATURES
|
||||||
#define showprogress(c) up_lowputc(c)
|
#define showprogress(c) riscv_lowputc(c)
|
||||||
#else
|
#else
|
||||||
#define showprogress(c)
|
#define showprogress(c)
|
||||||
#endif
|
#endif
|
||||||
@@ -118,7 +118,7 @@ void bfl_main(void)
|
|||||||
modifyreg32(BL602_HBN_IRQ_MODE, 0, HBN_IRQ_MODE_REG_AON_PAD_IE_SMT);
|
modifyreg32(BL602_HBN_IRQ_MODE, 0, HBN_IRQ_MODE_REG_AON_PAD_IE_SMT);
|
||||||
|
|
||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
up_earlyserialinit();
|
riscv_earlyserialinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Do board initialization */
|
/* Do board initialization */
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 7
|
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~7);
|
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~7);
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
riscv_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
||||||
intstack_size);
|
intstack_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -97,10 +97,10 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
/* Attach the ecall interrupt handler */
|
/* Attach the ecall interrupt handler */
|
||||||
|
|
||||||
irq_attach(C906_IRQ_ECALLM, up_swint, NULL);
|
irq_attach(C906_IRQ_ECALLM, riscv_swint, NULL);
|
||||||
|
|
||||||
#ifdef CONFIG_BUILD_PROTECTED
|
#ifdef CONFIG_BUILD_PROTECTED
|
||||||
irq_attach(C906_IRQ_ECALLU, up_swint, NULL);
|
irq_attach(C906_IRQ_ECALLU, riscv_swint, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
@@ -198,14 +198,14 @@ void up_enable_irq(int irq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_get_newintctx
|
* Name: riscv_get_newintctx
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return initial mstatus when a task is created.
|
* Return initial mstatus when a task is created.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uint32_t up_get_newintctx(void)
|
uint32_t riscv_get_newintctx(void)
|
||||||
{
|
{
|
||||||
/* Set machine previous privilege mode to machine mode. Reegardless of
|
/* Set machine previous privilege mode to machine mode. Reegardless of
|
||||||
* how NuttX is configured and of what kind of thread is being started.
|
* how NuttX is configured and of what kind of thread is being started.
|
||||||
@@ -223,14 +223,14 @@ uint32_t up_get_newintctx(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_ack_irq
|
* Name: riscv_ack_irq
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Acknowledge the IRQ
|
* Acknowledge the IRQ
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_ack_irq(int irq)
|
void riscv_ack_irq(int irq)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ void *c906_dispatch_irq(uint64_t vector, uint64_t *regs)
|
|||||||
|
|
||||||
/* Acknowledge the interrupt */
|
/* Acknowledge the interrupt */
|
||||||
|
|
||||||
up_ack_irq(irq);
|
riscv_ack_irq(irq);
|
||||||
|
|
||||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
PANIC();
|
PANIC();
|
||||||
@@ -126,7 +126,7 @@ void *c906_dispatch_irq(uint64_t vector, uint64_t *regs)
|
|||||||
#ifdef CONFIG_ARCH_FPU
|
#ifdef CONFIG_ARCH_FPU
|
||||||
/* Restore floating point registers */
|
/* Restore floating point registers */
|
||||||
|
|
||||||
up_restorefpu((uint64_t *)CURRENT_REGS);
|
riscv_restorefpu((uint64_t *)CURRENT_REGS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
|
|||||||
@@ -70,14 +70,14 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_lowputc
|
* Name: riscv_lowputc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Output one byte on the serial console
|
* Output one byte on the serial console
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_lowputc(char ch)
|
void riscv_lowputc(char ch)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SERIAL_CONSOLE
|
#ifdef HAVE_SERIAL_CONSOLE
|
||||||
/* Wait until the TX data register is empty */
|
/* Wait until the TX data register is empty */
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
/* Common initialization logic will not not know that the all of the UARTs
|
/* Common initialization logic will not not know that the all of the UARTs
|
||||||
* have been disabled. So, as a result, we may still have to provide
|
* have been disabled. So, as a result, we may still have to provide
|
||||||
* stub implementations of up_earlyserialinit(), up_serialinit(), and
|
* stub implementations of riscv_earlyserialinit(), riscv_serialinit(), and
|
||||||
* up_putc().
|
* up_putc().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -599,18 +599,18 @@ static bool up_txempty(struct uart_dev_s *dev)
|
|||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_earlyserialinit
|
* Name: riscv_earlyserialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Performs the low level UART initialization early in debug so that the
|
* Performs the low level UART initialization early in debug so that the
|
||||||
* serial console will be available during bootup. This must be called
|
* serial console will be available during bootup. This must be called
|
||||||
* before up_serialinit. NOTE: This function depends on GPIO pin
|
* before riscv_serialinit. NOTE: This function depends on GPIO pin
|
||||||
* configuration performed in up_consoleinit() and main clock iniialization
|
* configuration performed in up_consoleinit() and main clock iniialization
|
||||||
* performed in up_clkinitialize().
|
* performed in up_clkinitialize().
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_earlyserialinit(void)
|
void riscv_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
/* Disable interrupts from all UARTS. The console is enabled in
|
/* Disable interrupts from all UARTS. The console is enabled in
|
||||||
* c906_consoleinit().
|
* c906_consoleinit().
|
||||||
@@ -631,15 +631,15 @@ void up_earlyserialinit(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_serialinit
|
* Name: riscv_serialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register serial console and serial ports. This assumes
|
* Register serial console and serial ports. This assumes
|
||||||
* that up_earlyserialinit was called previously.
|
* that riscv_earlyserialinit was called previously.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_serialinit(void)
|
void riscv_serialinit(void)
|
||||||
{
|
{
|
||||||
/* Register the console */
|
/* Register the console */
|
||||||
|
|
||||||
@@ -677,17 +677,17 @@ int up_putc(int ch)
|
|||||||
{
|
{
|
||||||
/* Add CR */
|
/* Add CR */
|
||||||
|
|
||||||
up_lowputc('\r');
|
riscv_lowputc('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
up_lowputc(ch);
|
riscv_lowputc(ch);
|
||||||
up_restoreuartint(priv, imr);
|
up_restoreuartint(priv, imr);
|
||||||
#endif
|
#endif
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_earlyserialinit, up_serialinit, and up_putc
|
* Name: riscv_earlyserialinit, riscv_serialinit, and up_putc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* stubs that may be needed. These stubs would be used if all UARTs are
|
* stubs that may be needed. These stubs would be used if all UARTs are
|
||||||
@@ -698,11 +698,11 @@ int up_putc(int ch)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#else /* HAVE_UART_DEVICE */
|
#else /* HAVE_UART_DEVICE */
|
||||||
void up_earlyserialinit(void)
|
void riscv_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void up_serialinit(void)
|
void riscv_serialinit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -731,10 +731,10 @@ int up_putc(int ch)
|
|||||||
{
|
{
|
||||||
/* Add CR */
|
/* Add CR */
|
||||||
|
|
||||||
up_lowputc('\r');
|
riscv_lowputc('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
up_lowputc(ch);
|
riscv_lowputc(ch);
|
||||||
#endif
|
#endif
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FEATURES
|
#ifdef CONFIG_DEBUG_FEATURES
|
||||||
# define showprogress(c) up_lowputc(c)
|
# define showprogress(c) riscv_lowputc(c)
|
||||||
#else
|
#else
|
||||||
# define showprogress(c)
|
# define showprogress(c)
|
||||||
#endif
|
#endif
|
||||||
@@ -112,7 +112,7 @@ void __c906_start(uint32_t mhartid)
|
|||||||
showprogress('A');
|
showprogress('A');
|
||||||
|
|
||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
up_earlyserialinit();
|
riscv_earlyserialinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
showprogress('B');
|
showprogress('B');
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
|||||||
sizeof(struct tls_info_s);
|
sizeof(struct tls_info_s);
|
||||||
stack_size = tcb->adj_stack_size -
|
stack_size = tcb->adj_stack_size -
|
||||||
sizeof(struct tls_info_s);
|
sizeof(struct tls_info_s);
|
||||||
up_stack_color((FAR void *)stack_base, stack_size);
|
riscv_stack_color((FAR void *)stack_base, stack_size);
|
||||||
|
|
||||||
#endif /* CONFIG_STACK_COLORATION */
|
#endif /* CONFIG_STACK_COLORATION */
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_stack_color
|
* Name: riscv_stack_color
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Write a well know value into the stack
|
* Write a well know value into the stack
|
||||||
@@ -273,7 +273,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
void up_stack_color(FAR void *stackbase, size_t nbytes)
|
void riscv_stack_color(FAR void *stackbase, size_t nbytes)
|
||||||
{
|
{
|
||||||
/* Take extra care that we do not write outsize the stack boundaries */
|
/* Take extra care that we do not write outsize the stack boundaries */
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ void up_initialize(void)
|
|||||||
* with the power management subsystem).
|
* with the power management subsystem).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_pminitialize();
|
riscv_pminitialize();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Register devices */
|
/* Register devices */
|
||||||
@@ -143,7 +143,7 @@ void up_initialize(void)
|
|||||||
/* Initialize the serial device driver */
|
/* Initialize the serial device driver */
|
||||||
|
|
||||||
#ifdef USE_SERIALDRIVER
|
#ifdef USE_SERIALDRIVER
|
||||||
up_serialinit();
|
riscv_serialinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_RPMSG_UART
|
#ifdef CONFIG_RPMSG_UART
|
||||||
|
|||||||
@@ -70,11 +70,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_RV64GC
|
#ifdef CONFIG_ARCH_RV64GC
|
||||||
#define up_savestate(regs) up_copystate(regs, (uint64_t*)CURRENT_REGS)
|
#define riscv_savestate(regs) riscv_copystate(regs, (uint64_t*)CURRENT_REGS)
|
||||||
#define up_restorestate(regs) (CURRENT_REGS = regs)
|
#define riscv_restorestate(regs) (CURRENT_REGS = regs)
|
||||||
#else
|
#else
|
||||||
#define up_savestate(regs) up_copystate(regs, (uint32_t*)g_current_regs)
|
#define riscv_savestate(regs) riscv_copystate(regs, (uint32_t*)g_current_regs)
|
||||||
#define up_restorestate(regs) (g_current_regs = regs)
|
#define riscv_restorestate(regs) (g_current_regs = regs)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _START_TEXT &_stext
|
#define _START_TEXT &_stext
|
||||||
@@ -182,53 +182,53 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size);
|
|||||||
|
|
||||||
/* IRQ initialization *******************************************************/
|
/* IRQ initialization *******************************************************/
|
||||||
|
|
||||||
void up_ack_irq(int irq);
|
void riscv_ack_irq(int irq);
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_RV64GC
|
#ifdef CONFIG_ARCH_RV64GC
|
||||||
void up_copystate(uint64_t *dest, uint64_t *src);
|
void riscv_copystate(uint64_t *dest, uint64_t *src);
|
||||||
void up_copyfullstate(uint64_t *dest, uint64_t *src);
|
void riscv_copyfullstate(uint64_t *dest, uint64_t *src);
|
||||||
#else
|
#else
|
||||||
void up_copystate(uint32_t *dest, uint32_t *src);
|
void riscv_copystate(uint32_t *dest, uint32_t *src);
|
||||||
void up_copyfullstate(uint32_t *dest, uint32_t *src);
|
void riscv_copyfullstate(uint32_t *dest, uint32_t *src);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void up_sigdeliver(void);
|
void riscv_sigdeliver(void);
|
||||||
int up_swint(int irq, FAR void *context, FAR void *arg);
|
int riscv_swint(int irq, FAR void *context, FAR void *arg);
|
||||||
uint32_t up_get_newintctx(void);
|
uint32_t riscv_get_newintctx(void);
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_FPU
|
#ifdef CONFIG_ARCH_FPU
|
||||||
#ifdef CONFIG_ARCH_RV64GC
|
#ifdef CONFIG_ARCH_RV64GC
|
||||||
void up_savefpu(uint64_t *regs);
|
void riscv_savefpu(uint64_t *regs);
|
||||||
void up_restorefpu(const uint64_t *regs);
|
void riscv_restorefpu(const uint64_t *regs);
|
||||||
#else /* !CONFIG_ARCH_RV64GC */
|
#else /* !CONFIG_ARCH_RV64GC */
|
||||||
void up_savefpu(uint32_t *regs);
|
void riscv_savefpu(uint32_t *regs);
|
||||||
void up_restorefpu(const uint32_t *regs);
|
void riscv_restorefpu(const uint32_t *regs);
|
||||||
#endif /* CONFIG_ARCH_RV64GC */
|
#endif /* CONFIG_ARCH_RV64GC */
|
||||||
#else
|
#else
|
||||||
# define up_savefpu(regs)
|
# define riscv_savefpu(regs)
|
||||||
# define up_restorefpu(regs)
|
# define riscv_restorefpu(regs)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Power management *********************************************************/
|
/* Power management *********************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
void up_pminitialize(void);
|
void riscv_pminitialize(void);
|
||||||
#else
|
#else
|
||||||
# define up_pminitialize()
|
# define riscv_pminitialize()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Low level serial output **************************************************/
|
/* Low level serial output **************************************************/
|
||||||
|
|
||||||
void up_lowputc(char ch);
|
void riscv_lowputc(char ch);
|
||||||
void up_puts(const char *str);
|
void riscv_puts(const char *str);
|
||||||
void up_lowputs(const char *str);
|
void riscv_lowputs(const char *str);
|
||||||
|
|
||||||
#ifdef USE_SERIALDRIVER
|
#ifdef USE_SERIALDRIVER
|
||||||
void up_serialinit(void);
|
void riscv_serialinit(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
void up_earlyserialinit(void);
|
void riscv_earlyserialinit(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_RPMSG_UART
|
#ifdef CONFIG_RPMSG_UART
|
||||||
@@ -242,7 +242,7 @@ void riscv_exception(uint32_t mcause, uint32_t *regs);
|
|||||||
/* Debug ********************************************************************/
|
/* Debug ********************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
void up_stack_color(FAR void *stackbase, size_t nbytes);
|
void riscv_stack_color(FAR void *stackbase, size_t nbytes);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
|
|||||||
@@ -47,14 +47,14 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_puts
|
* Name: riscv_puts
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is a low-level helper function used to support debug.
|
* This is a low-level helper function used to support debug.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_puts(const char *str)
|
void riscv_puts(const char *str)
|
||||||
{
|
{
|
||||||
while (*str)
|
while (*str)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
|||||||
* water marks.
|
* water marks.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_stack_color((FAR void *)((uintptr_t)tcb->stack_alloc_ptr +
|
riscv_stack_color((FAR void *)((uintptr_t)tcb->stack_alloc_ptr +
|
||||||
sizeof(struct tls_info_s)),
|
sizeof(struct tls_info_s)),
|
||||||
size_of_stack - sizeof(struct tls_info_s));
|
size_of_stack - sizeof(struct tls_info_s));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
/* Attach the ECALL interrupt. */
|
/* Attach the ECALL interrupt. */
|
||||||
|
|
||||||
irq_attach(ESP32C3_IRQ_ECALL_M, up_swint, NULL);
|
irq_attach(ESP32C3_IRQ_ECALL_M, riscv_swint, NULL);
|
||||||
|
|
||||||
#ifdef CONFIG_ESP32C3_GPIO_IRQ
|
#ifdef CONFIG_ESP32C3_GPIO_IRQ
|
||||||
/* Initialize GPIO interrupt support */
|
/* Initialize GPIO interrupt support */
|
||||||
@@ -112,14 +112,14 @@ void up_irqinitialize(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_get_newintctx
|
* Name: riscv_get_newintctx
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return initial mstatus when a task is created.
|
* Return initial mstatus when a task is created.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uint32_t up_get_newintctx(void)
|
uint32_t riscv_get_newintctx(void)
|
||||||
{
|
{
|
||||||
/* Set machine previous privilege mode to machine mode.
|
/* Set machine previous privilege mode to machine mode.
|
||||||
* Also set machine previous interrupt enable
|
* Also set machine previous interrupt enable
|
||||||
|
|||||||
@@ -632,7 +632,7 @@ void esp32c3_lowputc_restore_pins(const struct esp32c3_uart_s *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_lowputc
|
* Name: riscv_lowputc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Output one byte on the serial console.
|
* Output one byte on the serial console.
|
||||||
@@ -642,7 +642,7 @@ void esp32c3_lowputc_restore_pins(const struct esp32c3_uart_s *priv)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_lowputc(char ch)
|
void riscv_lowputc(char ch)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SERIAL_CONSOLE
|
#ifdef HAVE_SERIAL_CONSOLE
|
||||||
|
|
||||||
|
|||||||
@@ -872,12 +872,12 @@ static int esp32c3_ioctl(struct file *filep, int cmd, unsigned long arg)
|
|||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_earlyserialinit
|
* Name: riscv_earlyserialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Performs the low level UART initialization early in debug so that the
|
* Performs the low level UART initialization early in debug so that the
|
||||||
* serial console will be available during bootup. This must be called
|
* serial console will be available during bootup. This must be called
|
||||||
* before up_serialinit. NOTE: This function depends on GPIO pin
|
* before riscv_serialinit. NOTE: This function depends on GPIO pin
|
||||||
* configuration performed in up_consoleinit() and main clock
|
* configuration performed in up_consoleinit() and main clock
|
||||||
* initialization performed in up_clkinitialize().
|
* initialization performed in up_clkinitialize().
|
||||||
*
|
*
|
||||||
@@ -885,7 +885,7 @@ static int esp32c3_ioctl(struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
|
||||||
void up_earlyserialinit(void)
|
void riscv_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
/* I've been looking at others chips/arches and I noticed
|
/* I've been looking at others chips/arches and I noticed
|
||||||
* that <chips>_lowsetup performs almost the same of this func and it's
|
* that <chips>_lowsetup performs almost the same of this func and it's
|
||||||
@@ -897,15 +897,15 @@ void up_earlyserialinit(void)
|
|||||||
#endif /* USE_EARLYSERIALINIT */
|
#endif /* USE_EARLYSERIALINIT */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_serialinit
|
* Name: riscv_serialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register serial console and serial ports. This assumes
|
* Register serial console and serial ports. This assumes
|
||||||
* that up_earlyserialinit was called previously.
|
* that riscv_earlyserialinit was called previously.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_serialinit(void)
|
void riscv_serialinit(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SERIAL_CONSOLE
|
#ifdef HAVE_SERIAL_CONSOLE
|
||||||
uart_register("/dev/console", &CONSOLE_DEV);
|
uart_register("/dev/console", &CONSOLE_DEV);
|
||||||
@@ -941,10 +941,10 @@ int up_putc(int ch)
|
|||||||
{
|
{
|
||||||
/* Add CR */
|
/* Add CR */
|
||||||
|
|
||||||
up_lowputc('\r');
|
riscv_lowputc('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
up_lowputc(ch);
|
riscv_lowputc(ch);
|
||||||
esp32c3_lowputc_restore_all_uart_int(CONSOLE_DEV.priv, &int_status);
|
esp32c3_lowputc_restore_all_uart_int(CONSOLE_DEV.priv, &int_status);
|
||||||
#endif
|
#endif
|
||||||
return ch;
|
return ch;
|
||||||
@@ -953,7 +953,7 @@ int up_putc(int ch)
|
|||||||
#else /* HAVE_UART_DEVICE */
|
#else /* HAVE_UART_DEVICE */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_earlyserialinit, up_serialinit, and up_putc
|
* Name: riscv_earlyserialinit, riscv_serialinit, and up_putc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* stubs that may be needed. These stubs will be used if all UARTs are
|
* stubs that may be needed. These stubs will be used if all UARTs are
|
||||||
@@ -963,11 +963,11 @@ int up_putc(int ch)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_earlyserialinit(void)
|
void riscv_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void up_serialinit(void)
|
void riscv_serialinit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -981,7 +981,7 @@ int up_putc(int ch)
|
|||||||
|
|
||||||
/* Common initialization logic will not not know that the all of the UARTs
|
/* Common initialization logic will not not know that the all of the UARTs
|
||||||
* have been disabled. So, as a result, we may still have to provide
|
* have been disabled. So, as a result, we may still have to provide
|
||||||
* stub implementations of up_earlyserialinit(), up_serialinit(), and
|
* stub implementations of riscv_earlyserialinit(), riscv_serialinit(), and
|
||||||
* up_putc().
|
* up_putc().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1006,10 +1006,10 @@ int up_putc(int ch)
|
|||||||
{
|
{
|
||||||
/* Add CR */
|
/* Add CR */
|
||||||
|
|
||||||
up_lowputc('\r');
|
riscv_lowputc('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
up_lowputc(ch);
|
riscv_lowputc(ch);
|
||||||
esp32c3_lowputc_restore_all_uart_int(CONSOLE_DEV.priv, &int_status);
|
esp32c3_lowputc_restore_all_uart_int(CONSOLE_DEV.priv, &int_status);
|
||||||
#endif
|
#endif
|
||||||
return ch;
|
return ch;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FEATURES
|
#ifdef CONFIG_DEBUG_FEATURES
|
||||||
# define showprogress(c) up_lowputc(c)
|
# define showprogress(c) riscv_lowputc(c)
|
||||||
#else
|
#else
|
||||||
# define showprogress(c)
|
# define showprogress(c)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
riscv_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
||||||
intstack_size);
|
intstack_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
/* Attach the ecall interrupt handler */
|
/* Attach the ecall interrupt handler */
|
||||||
|
|
||||||
irq_attach(FE310_IRQ_ECALLM, up_swint, NULL);
|
irq_attach(FE310_IRQ_ECALLM, riscv_swint, NULL);
|
||||||
|
|
||||||
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
|
|
||||||
@@ -169,14 +169,14 @@ void up_enable_irq(int irq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_get_newintctx
|
* Name: riscv_get_newintctx
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return initial mstatus when a task is created.
|
* Return initial mstatus when a task is created.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uint32_t up_get_newintctx(void)
|
uint32_t riscv_get_newintctx(void)
|
||||||
{
|
{
|
||||||
/* Set machine previous privilege mode to machine mode.
|
/* Set machine previous privilege mode to machine mode.
|
||||||
* Also set machine previous interrupt enable
|
* Also set machine previous interrupt enable
|
||||||
@@ -186,14 +186,14 @@ uint32_t up_get_newintctx(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_ack_irq
|
* Name: riscv_ack_irq
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Acknowledge the IRQ
|
* Acknowledge the IRQ
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_ack_irq(int irq)
|
void riscv_ack_irq(int irq)
|
||||||
{
|
{
|
||||||
board_autoled_on(LED_CPU);
|
board_autoled_on(LED_CPU);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ void *fe310_dispatch_irq(uint32_t vector, uint32_t *regs)
|
|||||||
|
|
||||||
/* Acknowledge the interrupt */
|
/* Acknowledge the interrupt */
|
||||||
|
|
||||||
up_ack_irq(irq);
|
riscv_ack_irq(irq);
|
||||||
|
|
||||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
PANIC();
|
PANIC();
|
||||||
|
|||||||
@@ -70,14 +70,14 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_lowputc
|
* Name: riscv_lowputc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Output one byte on the serial console
|
* Output one byte on the serial console
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_lowputc(char ch)
|
void riscv_lowputc(char ch)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SERIAL_CONSOLE
|
#ifdef HAVE_SERIAL_CONSOLE
|
||||||
/* Wait until the TX data register is empty */
|
/* Wait until the TX data register is empty */
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
/* Common initialization logic will not not know that the all of the UARTs
|
/* Common initialization logic will not not know that the all of the UARTs
|
||||||
* have been disabled. So, as a result, we may still have to provide
|
* have been disabled. So, as a result, we may still have to provide
|
||||||
* stub implementations of up_earlyserialinit(), up_serialinit(), and
|
* stub implementations of riscv_earlyserialinit(), riscv_serialinit(), and
|
||||||
* up_putc().
|
* up_putc().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -589,18 +589,18 @@ static bool up_txempty(struct uart_dev_s *dev)
|
|||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_earlyserialinit
|
* Name: riscv_earlyserialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Performs the low level UART initialization early in debug so that the
|
* Performs the low level UART initialization early in debug so that the
|
||||||
* serial console will be available during bootup. This must be called
|
* serial console will be available during bootup. This must be called
|
||||||
* before up_serialinit. NOTE: This function depends on GPIO pin
|
* before riscv_serialinit. NOTE: This function depends on GPIO pin
|
||||||
* configuration performed in up_consoleinit() and main clock
|
* configuration performed in up_consoleinit() and main clock
|
||||||
* initialization performed in up_clkinitialize().
|
* initialization performed in up_clkinitialize().
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_earlyserialinit(void)
|
void riscv_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
/* Disable interrupts from all UARTS. The console is enabled in
|
/* Disable interrupts from all UARTS. The console is enabled in
|
||||||
* fe310_consoleinit().
|
* fe310_consoleinit().
|
||||||
@@ -621,15 +621,15 @@ void up_earlyserialinit(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_serialinit
|
* Name: riscv_serialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register serial console and serial ports. This assumes
|
* Register serial console and serial ports. This assumes
|
||||||
* that up_earlyserialinit was called previously.
|
* that riscv_earlyserialinit was called previously.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_serialinit(void)
|
void riscv_serialinit(void)
|
||||||
{
|
{
|
||||||
/* Register the console */
|
/* Register the console */
|
||||||
|
|
||||||
@@ -667,17 +667,17 @@ int up_putc(int ch)
|
|||||||
{
|
{
|
||||||
/* Add CR */
|
/* Add CR */
|
||||||
|
|
||||||
up_lowputc('\r');
|
riscv_lowputc('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
up_lowputc(ch);
|
riscv_lowputc(ch);
|
||||||
up_restoreuartint(priv, imr);
|
up_restoreuartint(priv, imr);
|
||||||
#endif
|
#endif
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_earlyserialinit, up_serialinit, and up_putc
|
* Name: riscv_earlyserialinit, riscv_serialinit, and up_putc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* stubs that may be needed. These stubs would be used if all UARTs are
|
* stubs that may be needed. These stubs would be used if all UARTs are
|
||||||
@@ -688,11 +688,11 @@ int up_putc(int ch)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#else /* HAVE_UART_DEVICE */
|
#else /* HAVE_UART_DEVICE */
|
||||||
void up_earlyserialinit(void)
|
void riscv_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void up_serialinit(void)
|
void riscv_serialinit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -721,10 +721,10 @@ int up_putc(int ch)
|
|||||||
{
|
{
|
||||||
/* Add CR */
|
/* Add CR */
|
||||||
|
|
||||||
up_lowputc('\r');
|
riscv_lowputc('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
up_lowputc(ch);
|
riscv_lowputc(ch);
|
||||||
#endif
|
#endif
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FEATURES
|
#ifdef CONFIG_DEBUG_FEATURES
|
||||||
# define showprogress(c) up_lowputc(c)
|
# define showprogress(c) riscv_lowputc(c)
|
||||||
#else
|
#else
|
||||||
# define showprogress(c)
|
# define showprogress(c)
|
||||||
#endif
|
#endif
|
||||||
@@ -103,7 +103,7 @@ void __fe310_start(void)
|
|||||||
showprogress('A');
|
showprogress('A');
|
||||||
|
|
||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
up_earlyserialinit();
|
riscv_earlyserialinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
showprogress('B');
|
showprogress('B');
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ int up_cpu_paused(int cpu)
|
|||||||
* of the assigned task list for this CPU.
|
* of the assigned task list for this CPU.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_savestate(tcb->xcp.regs);
|
riscv_savestate(tcb->xcp.regs);
|
||||||
|
|
||||||
/* Wait for the spinlock to be released */
|
/* Wait for the spinlock to be released */
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ int up_cpu_paused(int cpu)
|
|||||||
* will be made when the interrupt returns.
|
* will be made when the interrupt returns.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_restorestate(tcb->xcp.regs);
|
riscv_restorestate(tcb->xcp.regs);
|
||||||
|
|
||||||
spin_unlock(&g_cpu_wait[cpu]);
|
spin_unlock(&g_cpu_wait[cpu]);
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FEATURES
|
#ifdef CONFIG_DEBUG_FEATURES
|
||||||
# define showprogress(c) up_lowputc(c)
|
# define showprogress(c) riscv_lowputc(c)
|
||||||
#else
|
#else
|
||||||
# define showprogress(c)
|
# define showprogress(c)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 7
|
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~7);
|
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~7);
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
riscv_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
||||||
intstack_size);
|
intstack_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -105,10 +105,10 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
/* Attach the ecall interrupt handler */
|
/* Attach the ecall interrupt handler */
|
||||||
|
|
||||||
irq_attach(K210_IRQ_ECALLM, up_swint, NULL);
|
irq_attach(K210_IRQ_ECALLM, riscv_swint, NULL);
|
||||||
|
|
||||||
#ifdef CONFIG_BUILD_PROTECTED
|
#ifdef CONFIG_BUILD_PROTECTED
|
||||||
irq_attach(K210_IRQ_ECALLU, up_swint, NULL);
|
irq_attach(K210_IRQ_ECALLU, riscv_swint, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
@@ -217,14 +217,14 @@ void up_enable_irq(int irq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_get_newintctx
|
* Name: riscv_get_newintctx
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return initial mstatus when a task is created.
|
* Return initial mstatus when a task is created.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uint32_t up_get_newintctx(void)
|
uint32_t riscv_get_newintctx(void)
|
||||||
{
|
{
|
||||||
/* Set machine previous privilege mode to machine mode. Reegardless of
|
/* Set machine previous privilege mode to machine mode. Reegardless of
|
||||||
* how NuttX is configured and of what kind of thread is being started.
|
* how NuttX is configured and of what kind of thread is being started.
|
||||||
@@ -238,14 +238,14 @@ uint32_t up_get_newintctx(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_ack_irq
|
* Name: riscv_ack_irq
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Acknowledge the IRQ
|
* Acknowledge the IRQ
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_ack_irq(int irq)
|
void riscv_ack_irq(int irq)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ void *k210_dispatch_irq(uint64_t vector, uint64_t *regs)
|
|||||||
|
|
||||||
/* Acknowledge the interrupt */
|
/* Acknowledge the interrupt */
|
||||||
|
|
||||||
up_ack_irq(irq);
|
riscv_ack_irq(irq);
|
||||||
|
|
||||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
PANIC();
|
PANIC();
|
||||||
|
|||||||
@@ -70,14 +70,14 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_lowputc
|
* Name: riscv_lowputc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Output one byte on the serial console
|
* Output one byte on the serial console
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_lowputc(char ch)
|
void riscv_lowputc(char ch)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SERIAL_CONSOLE
|
#ifdef HAVE_SERIAL_CONSOLE
|
||||||
/* Wait until the TX data register is empty */
|
/* Wait until the TX data register is empty */
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
/* Common initialization logic will not not know that the all of the UARTs
|
/* Common initialization logic will not not know that the all of the UARTs
|
||||||
* have been disabled. So, as a result, we may still have to provide
|
* have been disabled. So, as a result, we may still have to provide
|
||||||
* stub implementations of up_earlyserialinit(), up_serialinit(), and
|
* stub implementations of riscv_earlyserialinit(), riscv_serialinit(), and
|
||||||
* up_putc().
|
* up_putc().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -589,18 +589,18 @@ static bool up_txempty(struct uart_dev_s *dev)
|
|||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_earlyserialinit
|
* Name: riscv_earlyserialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Performs the low level UART initialization early in debug so that the
|
* Performs the low level UART initialization early in debug so that the
|
||||||
* serial console will be available during bootup. This must be called
|
* serial console will be available during bootup. This must be called
|
||||||
* before up_serialinit. NOTE: This function depends on GPIO pin
|
* before riscv_serialinit. NOTE: This function depends on GPIO pin
|
||||||
* configuration performed in up_consoleinit() and main clock
|
* configuration performed in up_consoleinit() and main clock
|
||||||
* initialization performed in up_clkinitialize().
|
* initialization performed in up_clkinitialize().
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_earlyserialinit(void)
|
void riscv_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
/* Disable interrupts from all UARTS. The console is enabled in
|
/* Disable interrupts from all UARTS. The console is enabled in
|
||||||
* k210_consoleinit().
|
* k210_consoleinit().
|
||||||
@@ -621,15 +621,15 @@ void up_earlyserialinit(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_serialinit
|
* Name: riscv_serialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register serial console and serial ports. This assumes
|
* Register serial console and serial ports. This assumes
|
||||||
* that up_earlyserialinit was called previously.
|
* that riscv_earlyserialinit was called previously.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_serialinit(void)
|
void riscv_serialinit(void)
|
||||||
{
|
{
|
||||||
/* Register the console */
|
/* Register the console */
|
||||||
|
|
||||||
@@ -667,17 +667,17 @@ int up_putc(int ch)
|
|||||||
{
|
{
|
||||||
/* Add CR */
|
/* Add CR */
|
||||||
|
|
||||||
up_lowputc('\r');
|
riscv_lowputc('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
up_lowputc(ch);
|
riscv_lowputc(ch);
|
||||||
up_restoreuartint(priv, imr);
|
up_restoreuartint(priv, imr);
|
||||||
#endif
|
#endif
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_earlyserialinit, up_serialinit, and up_putc
|
* Name: riscv_earlyserialinit, riscv_serialinit, and up_putc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* stubs that may be needed. These stubs would be used if all UARTs are
|
* stubs that may be needed. These stubs would be used if all UARTs are
|
||||||
@@ -688,11 +688,11 @@ int up_putc(int ch)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#else /* HAVE_UART_DEVICE */
|
#else /* HAVE_UART_DEVICE */
|
||||||
void up_earlyserialinit(void)
|
void riscv_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void up_serialinit(void)
|
void riscv_serialinit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -721,10 +721,10 @@ int up_putc(int ch)
|
|||||||
{
|
{
|
||||||
/* Add CR */
|
/* Add CR */
|
||||||
|
|
||||||
up_lowputc('\r');
|
riscv_lowputc('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
up_lowputc(ch);
|
riscv_lowputc(ch);
|
||||||
#endif
|
#endif
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FEATURES
|
#ifdef CONFIG_DEBUG_FEATURES
|
||||||
# define showprogress(c) up_lowputc(c)
|
# define showprogress(c) riscv_lowputc(c)
|
||||||
#else
|
#else
|
||||||
# define showprogress(c)
|
# define showprogress(c)
|
||||||
#endif
|
#endif
|
||||||
@@ -112,7 +112,7 @@ void __k210_start(uint32_t mhartid)
|
|||||||
showprogress('A');
|
showprogress('A');
|
||||||
|
|
||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
up_earlyserialinit();
|
riscv_earlyserialinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
showprogress('B');
|
showprogress('B');
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||||
up_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
riscv_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
||||||
intstack_size);
|
intstack_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
/* Attach the ecall interrupt handler */
|
/* Attach the ecall interrupt handler */
|
||||||
|
|
||||||
irq_attach(LITEX_IRQ_ECALLM, up_swint, NULL);
|
irq_attach(LITEX_IRQ_ECALLM, riscv_swint, NULL);
|
||||||
|
|
||||||
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
|
|
||||||
@@ -175,14 +175,14 @@ void up_enable_irq(int irq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_get_newintctx
|
* Name: riscv_get_newintctx
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Return initial mstatus when a task is created.
|
* Return initial mstatus when a task is created.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uint32_t up_get_newintctx(void)
|
uint32_t riscv_get_newintctx(void)
|
||||||
{
|
{
|
||||||
/* Set machine previous privilege mode to machine mode.
|
/* Set machine previous privilege mode to machine mode.
|
||||||
* Also set machine previous interrupt enable
|
* Also set machine previous interrupt enable
|
||||||
@@ -192,14 +192,14 @@ uint32_t up_get_newintctx(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_ack_irq
|
* Name: riscv_ack_irq
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Acknowledge the IRQ
|
* Acknowledge the IRQ
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_ack_irq(int irq)
|
void riscv_ack_irq(int irq)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ void *litex_dispatch_irq(uint32_t vector, uint32_t *regs)
|
|||||||
|
|
||||||
/* Acknowledge the interrupt */
|
/* Acknowledge the interrupt */
|
||||||
|
|
||||||
up_ack_irq(irq);
|
riscv_ack_irq(irq);
|
||||||
|
|
||||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
PANIC();
|
PANIC();
|
||||||
|
|||||||
@@ -70,14 +70,14 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_lowputc
|
* Name: riscv_lowputc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Output one byte on the serial console
|
* Output one byte on the serial console
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_lowputc(char ch)
|
void riscv_lowputc(char ch)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SERIAL_CONSOLE
|
#ifdef HAVE_SERIAL_CONSOLE
|
||||||
/* Wait until the TX data register is empty */
|
/* Wait until the TX data register is empty */
|
||||||
|
|||||||
@@ -107,7 +107,7 @@
|
|||||||
|
|
||||||
/* Common initialization logic will not not know that the all of the UARTs
|
/* Common initialization logic will not not know that the all of the UARTs
|
||||||
* have been disabled. So, as a result, we may still have to provide
|
* have been disabled. So, as a result, we may still have to provide
|
||||||
* stub implementations of up_earlyserialinit(), up_serialinit(), and
|
* stub implementations of riscv_earlyserialinit(), riscv_serialinit(), and
|
||||||
* up_putc().
|
* up_putc().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -621,18 +621,18 @@ static bool up_txempty(struct uart_dev_s *dev)
|
|||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_earlyserialinit
|
* Name: riscv_earlyserialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Performs the low level UART initialization early in debug so that the
|
* Performs the low level UART initialization early in debug so that the
|
||||||
* serial console will be available during bootup. This must be called
|
* serial console will be available during bootup. This must be called
|
||||||
* before up_serialinit. NOTE: This function depends on GPIO pin
|
* before riscv_serialinit. NOTE: This function depends on GPIO pin
|
||||||
* configuration performed in up_consoleinit() and main clock
|
* configuration performed in up_consoleinit() and main clock
|
||||||
* initialization performed in up_clkinitialize().
|
* initialization performed in up_clkinitialize().
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_earlyserialinit(void)
|
void riscv_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
/* Disable interrupts from all UARTS. The console is enabled in
|
/* Disable interrupts from all UARTS. The console is enabled in
|
||||||
* litex_consoleinit().
|
* litex_consoleinit().
|
||||||
@@ -653,15 +653,15 @@ void up_earlyserialinit(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_serialinit
|
* Name: riscv_serialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register serial console and serial ports. This assumes
|
* Register serial console and serial ports. This assumes
|
||||||
* that up_earlyserialinit was called previously.
|
* that riscv_earlyserialinit was called previously.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_serialinit(void)
|
void riscv_serialinit(void)
|
||||||
{
|
{
|
||||||
/* Register the console */
|
/* Register the console */
|
||||||
|
|
||||||
@@ -699,17 +699,17 @@ int up_putc(int ch)
|
|||||||
{
|
{
|
||||||
/* Add CR */
|
/* Add CR */
|
||||||
|
|
||||||
up_lowputc('\r');
|
riscv_lowputc('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
up_lowputc(ch);
|
riscv_lowputc(ch);
|
||||||
up_restoreuartint(priv, imr);
|
up_restoreuartint(priv, imr);
|
||||||
#endif
|
#endif
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_earlyserialinit, up_serialinit, and up_putc
|
* Name: riscv_earlyserialinit, riscv_serialinit, and up_putc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* stubs that may be needed. These stubs would be used if all UARTs are
|
* stubs that may be needed. These stubs would be used if all UARTs are
|
||||||
@@ -720,11 +720,11 @@ int up_putc(int ch)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#else /* HAVE_UART_DEVICE */
|
#else /* HAVE_UART_DEVICE */
|
||||||
void up_earlyserialinit(void)
|
void riscv_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void up_serialinit(void)
|
void riscv_serialinit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,10 +753,10 @@ int up_putc(int ch)
|
|||||||
{
|
{
|
||||||
/* Add CR */
|
/* Add CR */
|
||||||
|
|
||||||
up_lowputc('\r');
|
riscv_lowputc('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
up_lowputc(ch);
|
riscv_lowputc(ch);
|
||||||
#endif
|
#endif
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FEATURES
|
#ifdef CONFIG_DEBUG_FEATURES
|
||||||
# define showprogress(c) up_lowputc(c)
|
# define showprogress(c) riscv_lowputc(c)
|
||||||
#else
|
#else
|
||||||
# define showprogress(c)
|
# define showprogress(c)
|
||||||
#endif
|
#endif
|
||||||
@@ -105,7 +105,7 @@ void __litex_start(void)
|
|||||||
showprogress('A');
|
showprogress('A');
|
||||||
|
|
||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
up_earlyserialinit();
|
riscv_earlyserialinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
showprogress('B');
|
showprogress('B');
|
||||||
|
|||||||
@@ -81,10 +81,10 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_stackdump
|
* Name: riscv_stackdump
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void up_stackdump(uint32_t sp, uint32_t stack_base)
|
static void riscv_stackdump(uint32_t sp, uint32_t stack_base)
|
||||||
{
|
{
|
||||||
uint32_t stack ;
|
uint32_t stack ;
|
||||||
|
|
||||||
@@ -98,11 +98,11 @@ static void up_stackdump(uint32_t sp, uint32_t stack_base)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_taskdump
|
* Name: riscv_taskdump
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg)
|
static void riscv_taskdump(FAR struct tcb_s *tcb, FAR void *arg)
|
||||||
{
|
{
|
||||||
/* Dump interesting properties of this task */
|
/* Dump interesting properties of this task */
|
||||||
|
|
||||||
@@ -119,25 +119,25 @@ static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_showtasks
|
* Name: riscv_showtasks
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
static inline void up_showtasks(void)
|
static inline void riscv_showtasks(void)
|
||||||
{
|
{
|
||||||
/* Dump interesting properties of each task in the crash environment */
|
/* Dump interesting properties of each task in the crash environment */
|
||||||
|
|
||||||
nxsched_foreach(up_taskdump, NULL);
|
nxsched_foreach(riscv_taskdump, NULL);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define up_showtasks()
|
# define riscv_showtasks()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_registerdump
|
* Name: riscv_registerdump
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static inline void up_registerdump(void)
|
static inline void riscv_registerdump(void)
|
||||||
{
|
{
|
||||||
/* Are user registers available from interrupt processing? */
|
/* Are user registers available from interrupt processing? */
|
||||||
|
|
||||||
@@ -179,10 +179,10 @@ static inline void up_registerdump(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_dumpstate
|
* Name: riscv_dumpstate
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void up_dumpstate(void)
|
static void riscv_dumpstate(void)
|
||||||
{
|
{
|
||||||
struct tcb_s *rtcb = running_task();
|
struct tcb_s *rtcb = running_task();
|
||||||
uint32_t sp = riscv_getsp();
|
uint32_t sp = riscv_getsp();
|
||||||
@@ -195,7 +195,7 @@ static void up_dumpstate(void)
|
|||||||
|
|
||||||
/* Dump the registers (if available) */
|
/* Dump the registers (if available) */
|
||||||
|
|
||||||
up_registerdump();
|
riscv_registerdump();
|
||||||
|
|
||||||
/* Get the limits on the user stack memory */
|
/* Get the limits on the user stack memory */
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ static void up_dumpstate(void)
|
|||||||
{
|
{
|
||||||
/* Yes.. dump the interrupt stack */
|
/* Yes.. dump the interrupt stack */
|
||||||
|
|
||||||
up_stackdump(sp, istackbase);
|
riscv_stackdump(sp, istackbase);
|
||||||
|
|
||||||
/* Extract the user stack pointer which should lie
|
/* Extract the user stack pointer which should lie
|
||||||
* at the base of the interrupt stack.
|
* at the base of the interrupt stack.
|
||||||
@@ -235,7 +235,7 @@ static void up_dumpstate(void)
|
|||||||
else if (g_current_regs)
|
else if (g_current_regs)
|
||||||
{
|
{
|
||||||
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
|
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
|
||||||
up_stackdump(istackbase - istacksize, istackbase);
|
riscv_stackdump(istackbase - istacksize, istackbase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show user stack info */
|
/* Show user stack info */
|
||||||
@@ -256,21 +256,21 @@ static void up_dumpstate(void)
|
|||||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||||
{
|
{
|
||||||
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
||||||
up_stackdump(ustackbase - ustacksize, ustackbase);
|
riscv_stackdump(ustackbase - ustacksize, ustackbase);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
up_stackdump(sp, ustackbase);
|
riscv_stackdump(sp, ustackbase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_ARCH_STACKDUMP */
|
#endif /* CONFIG_ARCH_STACKDUMP */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: _up_assert
|
* Name: riscv_assert
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void _up_assert(void)
|
static void riscv_assert(void)
|
||||||
{
|
{
|
||||||
/* Flush any buffered SYSLOG data */
|
/* Flush any buffered SYSLOG data */
|
||||||
|
|
||||||
@@ -354,11 +354,11 @@ void up_assert(const char *filename, int lineno)
|
|||||||
filename, lineno);
|
filename, lineno);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
up_dumpstate();
|
riscv_dumpstate();
|
||||||
|
|
||||||
/* Dump the state of all tasks (if available) */
|
/* Dump the state of all tasks (if available) */
|
||||||
|
|
||||||
up_showtasks();
|
riscv_showtasks();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_USBDUMP
|
#ifdef CONFIG_ARCH_USBDUMP
|
||||||
/* Dump USB trace data */
|
/* Dump USB trace data */
|
||||||
@@ -374,5 +374,5 @@ void up_assert(const char *filename, int lineno)
|
|||||||
board_crashdump(riscv_getsp(), running_task(), filename, lineno);
|
board_crashdump(riscv_getsp(), running_task(), filename, lineno);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_up_assert();
|
riscv_assert();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
* Just copy the g_current_regs into the OLD rtcb.
|
* Just copy the g_current_regs into the OLD rtcb.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_savestate(rtcb->xcp.regs);
|
riscv_savestate(rtcb->xcp.regs);
|
||||||
|
|
||||||
/* Restore the exception context of the rtcb at the (new) head
|
/* Restore the exception context of the rtcb at the (new) head
|
||||||
* of the ready-to-run task list.
|
* of the ready-to-run task list.
|
||||||
@@ -137,7 +137,7 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
* changes will be made when the interrupt returns.
|
* changes will be made when the interrupt returns.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_restorestate(rtcb->xcp.regs);
|
riscv_restorestate(rtcb->xcp.regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No, then we will need to perform the user context switch */
|
/* No, then we will need to perform the user context switch */
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_copyfullstate
|
* Name: riscv_copyfullstate
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Copy the entire register save area (including the floating point
|
* Copy the entire register save area (including the floating point
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_copyfullstate(uint32_t *dest, uint32_t *src)
|
void riscv_copyfullstate(uint32_t *dest, uint32_t *src)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
@@ -61,12 +61,12 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_copystate
|
* Name: riscv_copystate
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* A little faster than most memcpy's */
|
/* A little faster than most memcpy's */
|
||||||
|
|
||||||
void up_copystate(uint32_t *dest, uint32_t *src)
|
void riscv_copystate(uint32_t *dest, uint32_t *src)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ void up_copystate(uint32_t *dest, uint32_t *src)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_FPU
|
#ifdef CONFIG_ARCH_FPU
|
||||||
up_savefpu(regs);
|
riscv_savefpu(regs);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ uint32_t *up_doirq(int irq, uint32_t *regs)
|
|||||||
#ifdef CONFIG_ARCH_FPU
|
#ifdef CONFIG_ARCH_FPU
|
||||||
/* Restore floating point registers */
|
/* Restore floating point registers */
|
||||||
|
|
||||||
up_restorefpu((uint32_t *)g_current_regs);
|
riscv_restorefpu((uint32_t *)g_current_regs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
|
|||||||
@@ -36,8 +36,8 @@
|
|||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
.globl up_fpuconfig
|
.globl up_fpuconfig
|
||||||
.globl up_savefpu
|
.globl riscv_savefpu
|
||||||
.globl up_restorefpu
|
.globl riscv_restorefpu
|
||||||
|
|
||||||
.file "up_fpu.S"
|
.file "up_fpu.S"
|
||||||
|
|
||||||
@@ -88,14 +88,14 @@ up_fpuconfig:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: up_savefpu
|
* Name: riscv_savefpu
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Given the pointer to a register save area (in A0), save the state of the
|
* Given the pointer to a register save area (in A0), save the state of the
|
||||||
* floating point registers.
|
* floating point registers.
|
||||||
*
|
*
|
||||||
* C Function Prototype:
|
* C Function Prototype:
|
||||||
* void up_savefpu(uint32_t *regs);
|
* void riscv_savefpu(uint32_t *regs);
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* regs - A pointer to the register save area in which to save the floating point
|
* regs - A pointer to the register save area in which to save the floating point
|
||||||
@@ -106,9 +106,9 @@ up_fpuconfig:
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
.type up_savefpu, function
|
.type riscv_savefpu, function
|
||||||
|
|
||||||
up_savefpu:
|
riscv_savefpu:
|
||||||
lw t0, REG_INT_CTX(a0)
|
lw t0, REG_INT_CTX(a0)
|
||||||
li t1, FS_MASK
|
li t1, FS_MASK
|
||||||
and t2, t0, t1
|
and t2, t0, t1
|
||||||
@@ -162,14 +162,14 @@ up_savefpu:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: up_restorefpu
|
* Name: riscv_restorefpu
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Given the pointer to a register save area (in A0), restore the state of the
|
* Given the pointer to a register save area (in A0), restore the state of the
|
||||||
* floating point registers.
|
* floating point registers.
|
||||||
*
|
*
|
||||||
* C Function Prototype:
|
* C Function Prototype:
|
||||||
* void up_restorefpu(const uint32_t *regs);
|
* void riscv_restorefpu(const uint32_t *regs);
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* regs - A pointer to the register save area containing the floating point
|
* regs - A pointer to the register save area containing the floating point
|
||||||
@@ -181,9 +181,9 @@ up_savefpu:
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
.type up_restorefpu, function
|
.type riscv_restorefpu, function
|
||||||
|
|
||||||
up_restorefpu:
|
riscv_restorefpu:
|
||||||
lw t0, REG_INT_CTX(a0)
|
lw t0, REG_INT_CTX(a0)
|
||||||
li t1, FS_MASK
|
li t1, FS_MASK
|
||||||
and t2, t0, t1
|
and t2, t0, t1
|
||||||
|
|||||||
@@ -125,6 +125,6 @@ void up_initial_state(struct tcb_s *tcb)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
regval = up_get_newintctx();
|
regval = riscv_get_newintctx();
|
||||||
xcp->regs[REG_INT_CTX] = regval;
|
xcp->regs[REG_INT_CTX] = regval;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ void up_release_pending(void)
|
|||||||
* Just copy the g_current_regs into the OLD rtcb.
|
* Just copy the g_current_regs into the OLD rtcb.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_savestate(rtcb->xcp.regs);
|
riscv_savestate(rtcb->xcp.regs);
|
||||||
|
|
||||||
/* Restore the exception context of the rtcb at the (new) head
|
/* Restore the exception context of the rtcb at the (new) head
|
||||||
* of the ready-to-run task list.
|
* of the ready-to-run task list.
|
||||||
@@ -109,7 +109,7 @@ void up_release_pending(void)
|
|||||||
* changes will be made when the interrupt returns.
|
* changes will be made when the interrupt returns.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_restorestate(rtcb->xcp.regs);
|
riscv_restorestate(rtcb->xcp.regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No, then we will need to perform the user context switch */
|
/* No, then we will need to perform the user context switch */
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
* Just copy the g_current_regs into the OLD rtcb.
|
* Just copy the g_current_regs into the OLD rtcb.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_savestate(rtcb->xcp.regs);
|
riscv_savestate(rtcb->xcp.regs);
|
||||||
|
|
||||||
/* Restore the exception context of the rtcb at the (new) head
|
/* Restore the exception context of the rtcb at the (new) head
|
||||||
* of the ready-to-run task list.
|
* of the ready-to-run task list.
|
||||||
@@ -162,7 +162,7 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
* changes will be made when the interrupt returns.
|
* changes will be made when the interrupt returns.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_restorestate(rtcb->xcp.regs);
|
riscv_restorestate(rtcb->xcp.regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No, then we will need to perform the user context switch */
|
/* No, then we will need to perform the user context switch */
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
* disabled
|
* disabled
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_current_regs[REG_EPC] = (uint32_t)up_sigdeliver;
|
g_current_regs[REG_EPC] = (uint32_t)riscv_sigdeliver;
|
||||||
|
|
||||||
int_ctx = g_current_regs[REG_INT_CTX];
|
int_ctx = g_current_regs[REG_INT_CTX];
|
||||||
int_ctx &= ~MSTATUS_MPIE;
|
int_ctx &= ~MSTATUS_MPIE;
|
||||||
@@ -144,7 +144,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
* is the same as the interrupt return context.
|
* is the same as the interrupt return context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_savestate(tcb->xcp.regs);
|
riscv_savestate(tcb->xcp.regs);
|
||||||
|
|
||||||
sinfo("PC/STATUS Saved: %08" PRIx32 "/%08" PRIx32
|
sinfo("PC/STATUS Saved: %08" PRIx32 "/%08" PRIx32
|
||||||
" New: %08" PRIx32 "/%08" PRIx32 "\n",
|
" New: %08" PRIx32 "/%08" PRIx32 "\n",
|
||||||
@@ -174,7 +174,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
* disabled
|
* disabled
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tcb->xcp.regs[REG_EPC] = (uint32_t)up_sigdeliver;
|
tcb->xcp.regs[REG_EPC] = (uint32_t)riscv_sigdeliver;
|
||||||
|
|
||||||
int_ctx = tcb->xcp.regs[REG_INT_CTX];
|
int_ctx = tcb->xcp.regs[REG_INT_CTX];
|
||||||
int_ctx &= ~MSTATUS_MPIE;
|
int_ctx &= ~MSTATUS_MPIE;
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_sigdeliver
|
* Name: riscv_sigdeliver
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is the a signal handling trampoline. When a signal action was
|
* This is the a signal handling trampoline. When a signal action was
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_sigdeliver(void)
|
void riscv_sigdeliver(void)
|
||||||
{
|
{
|
||||||
struct tcb_s *rtcb = this_task();
|
struct tcb_s *rtcb = this_task();
|
||||||
uint32_t regs[XCPTCONTEXT_REGS];
|
uint32_t regs[XCPTCONTEXT_REGS];
|
||||||
@@ -93,7 +93,7 @@ void up_sigdeliver(void)
|
|||||||
|
|
||||||
/* Save the return state on the stack. */
|
/* Save the return state on the stack. */
|
||||||
|
|
||||||
up_copyfullstate(regs, rtcb->xcp.regs);
|
riscv_copyfullstate(regs, rtcb->xcp.regs);
|
||||||
|
|
||||||
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
/* Then make sure that interrupts are enabled. Signal handlers must always
|
/* Then make sure that interrupts are enabled. Signal handlers must always
|
||||||
|
|||||||
@@ -43,11 +43,11 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_registerdump
|
* Name: riscv_registerdump
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_SYSCALL_INFO
|
#ifdef CONFIG_DEBUG_SYSCALL_INFO
|
||||||
static void up_registerdump(const uint32_t *regs)
|
static void riscv_registerdump(const uint32_t *regs)
|
||||||
{
|
{
|
||||||
svcinfo("EPC:%08x\n",
|
svcinfo("EPC:%08x\n",
|
||||||
regs[REG_EPC]);
|
regs[REG_EPC]);
|
||||||
@@ -74,7 +74,7 @@ static void up_registerdump(const uint32_t *regs)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define up_registerdump(regs)
|
# define riscv_registerdump(regs)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -113,7 +113,7 @@ static void dispatch_syscall(void)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_swint
|
* Name: riscv_swint
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is software interrupt exception handler that performs context
|
* This is software interrupt exception handler that performs context
|
||||||
@@ -121,7 +121,7 @@ static void dispatch_syscall(void)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int up_swint(int irq, FAR void *context, FAR void *arg)
|
int riscv_swint(int irq, FAR void *context, FAR void *arg)
|
||||||
{
|
{
|
||||||
uint32_t *regs = (uint32_t *)context;
|
uint32_t *regs = (uint32_t *)context;
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ int up_swint(int irq, FAR void *context, FAR void *arg)
|
|||||||
|
|
||||||
#ifdef CONFIG_DEBUG_SYSCALL_INFO
|
#ifdef CONFIG_DEBUG_SYSCALL_INFO
|
||||||
svcinfo("Entry: regs: %p cmd: %d\n", regs, regs[REG_A0]);
|
svcinfo("Entry: regs: %p cmd: %d\n", regs, regs[REG_A0]);
|
||||||
up_registerdump(regs);
|
riscv_registerdump(regs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Skip ECALL instruction */
|
/* Skip ECALL instruction */
|
||||||
@@ -165,7 +165,7 @@ int up_swint(int irq, FAR void *context, FAR void *arg)
|
|||||||
case SYS_save_context:
|
case SYS_save_context:
|
||||||
{
|
{
|
||||||
DEBUGASSERT(regs[REG_A1] != 0);
|
DEBUGASSERT(regs[REG_A1] != 0);
|
||||||
up_copystate((uint32_t *)regs[REG_A1], regs);
|
riscv_copystate((uint32_t *)regs[REG_A1], regs);
|
||||||
((uint32_t *)regs[REG_A1])[REG_A0] = 1;
|
((uint32_t *)regs[REG_A1])[REG_A0] = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -212,7 +212,7 @@ int up_swint(int irq, FAR void *context, FAR void *arg)
|
|||||||
case SYS_switch_context:
|
case SYS_switch_context:
|
||||||
{
|
{
|
||||||
DEBUGASSERT(regs[REG_A1] != 0 && regs[REG_A2] != 0);
|
DEBUGASSERT(regs[REG_A1] != 0 && regs[REG_A2] != 0);
|
||||||
up_copystate((uint32_t *)regs[REG_A1], regs);
|
riscv_copystate((uint32_t *)regs[REG_A1], regs);
|
||||||
g_current_regs = (uint32_t *)regs[REG_A2];
|
g_current_regs = (uint32_t *)regs[REG_A2];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -309,7 +309,7 @@ int up_swint(int irq, FAR void *context, FAR void *arg)
|
|||||||
if (regs != g_current_regs)
|
if (regs != g_current_regs)
|
||||||
{
|
{
|
||||||
svcinfo("SWInt Return: Context switch!\n");
|
svcinfo("SWInt Return: Context switch!\n");
|
||||||
up_registerdump((const uint32_t *)g_current_regs);
|
riscv_registerdump((const uint32_t *)g_current_regs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||||||
* Just copy the g_current_regs into the OLD rtcb.
|
* Just copy the g_current_regs into the OLD rtcb.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_savestate(rtcb->xcp.regs);
|
riscv_savestate(rtcb->xcp.regs);
|
||||||
|
|
||||||
/* Restore the exception context of the rtcb at the (new) head
|
/* Restore the exception context of the rtcb at the (new) head
|
||||||
* of the ready-to-run task list.
|
* of the ready-to-run task list.
|
||||||
@@ -122,7 +122,7 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||||||
* changes will be made when the interrupt returns.
|
* changes will be made when the interrupt returns.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_restorestate(rtcb->xcp.regs);
|
riscv_restorestate(rtcb->xcp.regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No, then we will need to perform the user context switch */
|
/* No, then we will need to perform the user context switch */
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
* Just copy the CURRENT_REGS into the OLD rtcb.
|
* Just copy the CURRENT_REGS into the OLD rtcb.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_savestate(rtcb->xcp.regs);
|
riscv_savestate(rtcb->xcp.regs);
|
||||||
|
|
||||||
/* Restore the exception context of the rtcb at the (new) head
|
/* Restore the exception context of the rtcb at the (new) head
|
||||||
* of the ready-to-run task list.
|
* of the ready-to-run task list.
|
||||||
@@ -137,7 +137,7 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
* changes will be made when the interrupt returns.
|
* changes will be made when the interrupt returns.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_restorestate(rtcb->xcp.regs);
|
riscv_restorestate(rtcb->xcp.regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No, then we will need to perform the user context switch */
|
/* No, then we will need to perform the user context switch */
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user