forked from Imagelibrary/rtems
bsps/sparc: Remove set_vector() usage and implementation
Removed all uses and implementations of set_vector() function across ERC32, LEON2, and LEON3 BSPs. Replaced with rtems_interrupt_handler_install() and rtems_interrupt_entry_install(). - Added ERC32_Clear_and_unmask_interrupt() and LEON_Clear_and_unmask_interrupt() for unmasking logic previously in set_vector(). - Deleted set_vector() definitions and implementations in each BSP. - Updated related obj.yml files. - Replaced set_vector() with rtems_interrupt_catch() in shared/gnatcommon.c.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
|
||||
#define CONSOLE_UART_A_TRAP ERC32_TRAP_TYPE(ERC32_INTERRUPT_UART_A_RX_TX)
|
||||
#define CONSOLE_UART_B_TRAP ERC32_TRAP_TYPE(ERC32_INTERRUPT_UART_B_RX_TX)
|
||||
#define CONSOLE_UART_ERROR_TRAP ERC32_TRAP_TYPE(ERC32_INTERRUPT_UART_ERROR)
|
||||
|
||||
static uint8_t erc32_console_get_register(uintptr_t addr, uint8_t i)
|
||||
{
|
||||
@@ -47,39 +48,43 @@ static void erc32_console_set_register(uintptr_t addr, uint8_t i, uint8_t val)
|
||||
static int erc32_console_first_open(int major, int minor, void *arg);
|
||||
|
||||
#if (CONSOLE_USE_INTERRUPTS)
|
||||
static ssize_t erc32_console_write_support_int(
|
||||
int minor, const char *buf, size_t len);
|
||||
static ssize_t erc32_console_write_support_int(
|
||||
int minor, const char *buf, size_t len);
|
||||
static rtems_interrupt_entry erc32_UART_A;
|
||||
static rtems_interrupt_entry erc32_UART_B;
|
||||
static rtems_interrupt_entry erc32_UART_ERROR;
|
||||
#else
|
||||
int console_inbyte_nonblocking( int port );
|
||||
static ssize_t erc32_console_write_support_polled(
|
||||
int minor, const char *buf, size_t len);
|
||||
int console_inbyte_nonblocking( int port );
|
||||
static ssize_t erc32_console_write_support_polled(
|
||||
int minor, const char *buf, size_t len);
|
||||
#endif
|
||||
|
||||
static void erc32_console_initialize(int minor);
|
||||
|
||||
#if (CONSOLE_USE_INTERRUPTS)
|
||||
const console_fns erc32_fns = {
|
||||
libchip_serial_default_probe, /* deviceProbe */
|
||||
erc32_console_first_open, /* deviceFirstOpen */
|
||||
NULL, /* deviceLastClose */
|
||||
NULL, /* deviceRead */
|
||||
erc32_console_write_support_int, /* deviceWrite */
|
||||
erc32_console_initialize, /* deviceInitialize */
|
||||
NULL, /* deviceWritePolled */
|
||||
NULL, /* deviceSetAttributes */
|
||||
true /* deviceOutputUsesInterrupts */
|
||||
};
|
||||
const console_fns erc32_fns = {
|
||||
libchip_serial_default_probe, /* deviceProbe */
|
||||
erc32_console_first_open, /* deviceFirstOpen */
|
||||
NULL, /* deviceLastClose */
|
||||
NULL, /* deviceRead */
|
||||
erc32_console_write_support_int, /* deviceWrite */
|
||||
erc32_console_initialize, /* deviceInitialize */
|
||||
NULL, /* deviceWritePolled */
|
||||
NULL, /* deviceSetAttributes */
|
||||
true /* deviceOutputUsesInterrupts */
|
||||
};
|
||||
#else
|
||||
const console_fns erc32_fns = {
|
||||
libchip_serial_default_probe, /* deviceProbe */
|
||||
erc32_console_first_open, /* deviceFirstOpen */
|
||||
NULL, /* deviceLastClose */
|
||||
console_inbyte_nonblocking, /* deviceRead */
|
||||
erc32_console_write_support_polled, /* deviceWrite */
|
||||
erc32_console_initialize, /* deviceInitialize */
|
||||
NULL, /* deviceWritePolled */
|
||||
NULL, /* deviceSetAttributes */
|
||||
false /* deviceOutputUsesInterrupts */
|
||||
};
|
||||
const console_fns erc32_fns = {
|
||||
libchip_serial_default_probe, /* deviceProbe */
|
||||
erc32_console_first_open, /* deviceFirstOpen */
|
||||
NULL, /* deviceLastClose */
|
||||
console_inbyte_nonblocking, /* deviceRead */
|
||||
erc32_console_write_support_polled, /* deviceWrite */
|
||||
erc32_console_initialize, /* deviceInitialize */
|
||||
NULL, /* deviceWritePolled */
|
||||
NULL, /* deviceSetAttributes */
|
||||
false /* deviceOutputUsesInterrupts */
|
||||
};
|
||||
#endif
|
||||
|
||||
console_tbl Console_Configuration_Ports [] = {
|
||||
@@ -148,7 +153,7 @@ static int erc32_console_first_open(int major, int minor, void *arg)
|
||||
|
||||
#if (CONSOLE_USE_INTERRUPTS)
|
||||
static ssize_t erc32_console_write_support_int(
|
||||
int minor, const char *buf, size_t len)
|
||||
int minor, const char *buf, size_t len)
|
||||
{
|
||||
if (len > 0) {
|
||||
console_data *cd = &Console_Port_Data[minor];
|
||||
@@ -177,9 +182,7 @@ static ssize_t erc32_console_write_support_int(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void erc32_console_isr_error(
|
||||
rtems_vector_number vector
|
||||
)
|
||||
static rtems_isr erc32_console_isr_error( void *vector )
|
||||
{
|
||||
int UStat;
|
||||
|
||||
@@ -198,9 +201,7 @@ static void erc32_console_isr_error(
|
||||
ERC32_Clear_interrupt( ERC32_INTERRUPT_UART_ERROR );
|
||||
}
|
||||
|
||||
static void erc32_console_isr_a(
|
||||
rtems_vector_number vector
|
||||
)
|
||||
static rtems_isr erc32_console_isr_a( void *vector )
|
||||
{
|
||||
console_data *cd = &Console_Port_Data[0];
|
||||
|
||||
@@ -239,9 +240,7 @@ static void erc32_console_isr_a(
|
||||
} while (ERC32_Is_interrupt_pending (ERC32_INTERRUPT_UART_A_RX_TX));
|
||||
}
|
||||
|
||||
static void erc32_console_isr_b(
|
||||
rtems_vector_number vector
|
||||
)
|
||||
static rtems_isr erc32_console_isr_b( void *vector )
|
||||
{
|
||||
console_data *cd = &Console_Port_Data[1];
|
||||
|
||||
@@ -300,17 +299,16 @@ static ssize_t erc32_console_write_support_polled(
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Console Device Driver Entry Points
|
||||
*
|
||||
*/
|
||||
|
||||
static void erc32_console_initialize(
|
||||
int minor
|
||||
)
|
||||
static void erc32_console_initialize( int minor )
|
||||
{
|
||||
console_data *cd = &Console_Port_Data [minor];
|
||||
#if (CONSOLE_USE_INTERRUPTS)
|
||||
static bool interrupts_installed = false;
|
||||
#endif
|
||||
|
||||
cd->bActive = false;
|
||||
cd->pDeviceContext = 0;
|
||||
@@ -326,9 +324,47 @@ static void erc32_console_initialize(
|
||||
* Initialize Hardware
|
||||
*/
|
||||
#if (CONSOLE_USE_INTERRUPTS)
|
||||
set_vector(erc32_console_isr_a, CONSOLE_UART_A_TRAP, 1);
|
||||
set_vector(erc32_console_isr_b, CONSOLE_UART_B_TRAP, 1);
|
||||
set_vector(erc32_console_isr_error, CONSOLE_UART_ERROR_TRAP, 1);
|
||||
if (!interrupts_installed) {
|
||||
rtems_interrupt_entry_initialize(
|
||||
&erc32_UART_A,
|
||||
erc32_console_isr_a,
|
||||
NULL,
|
||||
"process UART A"
|
||||
);
|
||||
rtems_interrupt_entry_install(
|
||||
ERC32_INTERRUPT_UART_A_RX_TX,
|
||||
RTEMS_INTERRUPT_UNIQUE,
|
||||
&erc32_UART_A
|
||||
);
|
||||
SPARC_Clear_and_unmask_interrupt(CONSOLE_UART_A_TRAP);
|
||||
|
||||
rtems_interrupt_entry_initialize(
|
||||
&erc32_UART_B,
|
||||
erc32_console_isr_b,
|
||||
NULL,
|
||||
"process UART B"
|
||||
);
|
||||
rtems_interrupt_entry_install(
|
||||
ERC32_INTERRUPT_UART_B_RX_TX,
|
||||
RTEMS_INTERRUPT_UNIQUE,
|
||||
&erc32_UART_B
|
||||
);
|
||||
SPARC_Clear_and_unmask_interrupt(CONSOLE_UART_B_TRAP);
|
||||
|
||||
rtems_interrupt_entry_initialize(
|
||||
&erc32_UART_ERROR,
|
||||
erc32_console_isr_error,
|
||||
NULL,
|
||||
"process UART Error"
|
||||
);
|
||||
rtems_interrupt_entry_install(
|
||||
ERC32_INTERRUPT_UART_ERROR,
|
||||
RTEMS_INTERRUPT_UNIQUE,
|
||||
&erc32_UART_ERROR
|
||||
);
|
||||
SPARC_Clear_and_unmask_interrupt(CONSOLE_UART_ERROR_TRAP);
|
||||
interrupts_installed = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Clear any previous error flags */
|
||||
|
||||
@@ -84,11 +84,7 @@ extern int end; /* last address in the program */
|
||||
|
||||
/* functions */
|
||||
|
||||
rtems_isr_entry set_vector( /* returns old vector */
|
||||
rtems_isr_entry handler, /* isr routine */
|
||||
rtems_vector_number vector, /* vector number */
|
||||
int type /* RTEMS or RAW intr */
|
||||
);
|
||||
void SPARC_Clear_and_unmask_interrupt(rtems_vector_number vector);
|
||||
|
||||
void BSP_fatal_exit(uint32_t error);
|
||||
|
||||
|
||||
@@ -62,7 +62,14 @@
|
||||
#define TM27_USE_VECTOR_HANDLER
|
||||
|
||||
#define Install_tm27_vector( handler ) \
|
||||
set_vector( (handler), TEST_VECTOR, 1 );
|
||||
rtems_interrupt_handler_install( \
|
||||
TEST_VECTOR, \
|
||||
"test tm27 interrupt", \
|
||||
RTEMS_INTERRUPT_UNIQUE, \
|
||||
handler, \
|
||||
NULL \
|
||||
); \
|
||||
SPARC_Clear_and_unmask_interrupt(TEST_VECTOR);
|
||||
|
||||
#define Cause_tm27_intr() \
|
||||
__asm__ volatile( "ta 0x10; nop " );
|
||||
|
||||
@@ -66,7 +66,7 @@ void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
|
||||
}
|
||||
|
||||
static rtems_isr bsp_inter_processor_interrupt(
|
||||
rtems_vector_number vector
|
||||
void *vector
|
||||
)
|
||||
{
|
||||
_SMP_Inter_processor_interrupt_handler( _Per_CPU_Get() );
|
||||
@@ -74,7 +74,21 @@ static rtems_isr bsp_inter_processor_interrupt(
|
||||
|
||||
static void erc32_install_inter_processor_interrupt( void )
|
||||
{
|
||||
set_vector( bsp_inter_processor_interrupt, IPI_VECTOR, 1 );
|
||||
rtems_interrupt_entry erc32_handle_ipi;
|
||||
rtems_interrupt_entry_initialize(
|
||||
&erc32_handle_ipi,
|
||||
bsp_inter_processor_interrupt,
|
||||
NULL,
|
||||
"process IPI Interrupt"
|
||||
);
|
||||
|
||||
rtems_interrupt_entry_install(
|
||||
IPI_VECTOR,
|
||||
RTEMS_INTERRUPT_UNIQUE,
|
||||
&erc32_handle_ipi
|
||||
);
|
||||
|
||||
SPARC_Clear_and_unmask_interrupt(IPI_VECTOR);
|
||||
}
|
||||
|
||||
RTEMS_SYSINIT_ITEM(
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/* set_vector
|
||||
*
|
||||
* This routine installs an interrupt vector on the SPARC simulator.
|
||||
*
|
||||
* INPUT PARAMETERS:
|
||||
* handler - interrupt handler entry point
|
||||
* vector - vector number
|
||||
* type - 0 indicates raw hardware connect
|
||||
* 1 indicates RTEMS interrupt connect
|
||||
*
|
||||
* OUTPUT PARAMETERS: NONE
|
||||
*
|
||||
* RETURNS:
|
||||
* address of previous interrupt handler
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*
|
||||
* Ported to ERC32 implementation of the SPARC by On-Line Applications
|
||||
* Research Corporation (OAR) under contract to the European Space
|
||||
* Agency (ESA).
|
||||
*
|
||||
* ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
|
||||
* European Space Agency.
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
|
||||
rtems_isr_entry set_vector( /* returns old vector */
|
||||
rtems_isr_entry handler, /* isr routine */
|
||||
rtems_vector_number vector, /* vector number */
|
||||
int type /* RTEMS or RAW intr */
|
||||
)
|
||||
{
|
||||
rtems_isr_entry previous_isr;
|
||||
|
||||
if ( type ) {
|
||||
rtems_interrupt_catch( handler, vector, &previous_isr );
|
||||
} else {
|
||||
_CPU_ISR_install_raw_handler(
|
||||
vector,
|
||||
(void *)handler,
|
||||
(void *)&previous_isr
|
||||
);
|
||||
}
|
||||
|
||||
if ( SPARC_IS_INTERRUPT_TRAP( vector ) ) {
|
||||
uint32_t source;
|
||||
|
||||
source = SPARC_INTERRUPT_TRAP_TO_SOURCE( vector );
|
||||
|
||||
ERC32_Clear_interrupt( source );
|
||||
ERC32_Unmask_interrupt( source );
|
||||
}
|
||||
|
||||
return previous_isr;
|
||||
}
|
||||
@@ -39,6 +39,9 @@ bool Is_TX_active[ 2 ];
|
||||
|
||||
void *console_termios_data[ 2 ];
|
||||
|
||||
static rtems_interrupt_entry leon_UART_1;
|
||||
static rtems_interrupt_entry leon_UART_2;
|
||||
|
||||
/*
|
||||
* console_isr_a
|
||||
*
|
||||
@@ -204,11 +207,35 @@ void console_initialize_interrupts( void )
|
||||
LEON_REG.UART_Control_1 |= LEON_REG_UART_CTRL_RI | LEON_REG_UART_CTRL_TI;
|
||||
LEON_REG.UART_Control_2 |= LEON_REG_UART_CTRL_RI | LEON_REG_UART_CTRL_TI;
|
||||
|
||||
set_vector( console_isr_a, CONSOLE_UART_1_TRAP, 1 );
|
||||
#ifdef RDB_BREAK_IN
|
||||
if (trap_table[0x150/4] == 0x91d02000)
|
||||
#endif
|
||||
set_vector( console_isr_b, CONSOLE_UART_2_TRAP, 1 );
|
||||
rtems_interrupt_entry_initialize(
|
||||
&leon_UART_1,
|
||||
console_isr_a,
|
||||
NULL,
|
||||
"process UART 1"
|
||||
);
|
||||
rtems_interrupt_entry_install(
|
||||
LEON_INTERRUPT_UART_1_RX_TX,
|
||||
RTEMS_INTERRUPT_UNIQUE,
|
||||
&leon_UART_1
|
||||
);
|
||||
SPARC_Clear_and_unmask_interrupt(CONSOLE_UART_1_TRAP);
|
||||
|
||||
rtems_interrupt_entry_initialize(
|
||||
&leon_UART_2,
|
||||
console_isr_b,
|
||||
NULL,
|
||||
"process UART 2"
|
||||
);
|
||||
#ifdef RDB_BREAK_IN
|
||||
if (trap_table[0x150/4] == 0x91d02000)
|
||||
#endif
|
||||
rtems_interrupt_entry_install(
|
||||
LEON_INTERRUPT_UART_2_RX_TX,
|
||||
RTEMS_INTERRUPT_UNIQUE,
|
||||
&leon_UART_2
|
||||
);
|
||||
SPARC_Clear_and_unmask_interrupt(CONSOLE_UART_2_TRAP);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -106,13 +106,7 @@ extern int CLOCK_SPEED;
|
||||
|
||||
extern int end; /* last address in the program */
|
||||
|
||||
/* miscellaneous stuff assumed to exist */
|
||||
|
||||
rtems_isr_entry set_vector( /* returns old vector */
|
||||
rtems_isr_entry handler, /* isr routine */
|
||||
rtems_vector_number vector, /* vector number */
|
||||
int type /* RTEMS or RAW intr */
|
||||
);
|
||||
void SPARC_Clear_and_unmask_interrupt(rtems_vector_number vector);
|
||||
|
||||
void BSP_fatal_exit(uint32_t error);
|
||||
|
||||
|
||||
@@ -62,7 +62,15 @@
|
||||
#define TM27_USE_VECTOR_HANDLER
|
||||
|
||||
#define Install_tm27_vector( handler ) \
|
||||
set_vector( (handler), TEST_VECTOR, 1 );
|
||||
rtems_interrupt_handler_install( \
|
||||
TEST_VECTOR, \
|
||||
"test tm27 interrupt", \
|
||||
RTEMS_INTERRUPT_UNIQUE, \
|
||||
handler, \
|
||||
NULL \
|
||||
); \
|
||||
SPARC_Clear_and_unmask_interrupt(TEST_VECTOR);
|
||||
|
||||
|
||||
#define Cause_tm27_intr() \
|
||||
__asm__ volatile( "ta 0x10; nop " );
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
* @ingroup RTEMSBSPsSPARCLEON2
|
||||
* @brief Installs an interrupt vector on the SPARC simulator
|
||||
*/
|
||||
|
||||
/* set_vector
|
||||
*
|
||||
* This routine installs an interrupt vector on the SPARC simulator.
|
||||
*
|
||||
* INPUT PARAMETERS:
|
||||
* handler - interrupt handler entry point
|
||||
* vector - vector number
|
||||
* type - 0 indicates raw hardware connect
|
||||
* 1 indicates RTEMS interrupt connect
|
||||
*
|
||||
* OUTPUT PARAMETERS: NONE
|
||||
*
|
||||
* RETURNS:
|
||||
* address of previous interrupt handler
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*
|
||||
* Ported to LEON implementation of the SPARC by On-Line Applications
|
||||
* Research Corporation (OAR) under contract to the European Space
|
||||
* Agency (ESA).
|
||||
*
|
||||
* LEON modifications of respective RTEMS file: COPYRIGHT (c) 1995.
|
||||
* European Space Agency.
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
|
||||
rtems_isr_entry set_vector( /* returns old vector */
|
||||
rtems_isr_entry handler, /* isr routine */
|
||||
rtems_vector_number vector, /* vector number */
|
||||
int type /* RTEMS or RAW intr */
|
||||
)
|
||||
{
|
||||
rtems_isr_entry previous_isr;
|
||||
|
||||
if ( type )
|
||||
rtems_interrupt_catch( handler, vector, &previous_isr );
|
||||
else
|
||||
_CPU_ISR_install_raw_handler( vector, handler, (void *)&previous_isr );
|
||||
|
||||
if ( SPARC_IS_INTERRUPT_TRAP( vector ) ) {
|
||||
uint32_t source;
|
||||
|
||||
source = SPARC_INTERRUPT_TRAP_TO_SOURCE( vector );
|
||||
|
||||
LEON_Clear_interrupt( source );
|
||||
LEON_Unmask_interrupt( source );
|
||||
}
|
||||
|
||||
return previous_isr;
|
||||
}
|
||||
@@ -122,13 +122,7 @@ extern int CLOCK_SPEED;
|
||||
|
||||
extern int end; /* last address in the program */
|
||||
|
||||
/* miscellaneous stuff assumed to exist */
|
||||
|
||||
rtems_isr_entry set_vector( /* returns old vector */
|
||||
rtems_isr_entry handler, /* isr routine */
|
||||
rtems_vector_number vector, /* vector number */
|
||||
int type /* RTEMS or RAW intr */
|
||||
);
|
||||
void SPARC_Clear_and_unmask_interrupt(rtems_vector_number vector);
|
||||
|
||||
void BSP_fatal_exit(uint32_t error);
|
||||
|
||||
|
||||
@@ -69,7 +69,14 @@
|
||||
#define TM27_USE_VECTOR_HANDLER
|
||||
|
||||
#define Install_tm27_vector( handler ) \
|
||||
set_vector( (handler), TEST_VECTOR, 1 );
|
||||
rtems_interrupt_handler_install( \
|
||||
TEST_VECTOR, \
|
||||
"test tm27 interrupt", \
|
||||
RTEMS_INTERRUPT_UNIQUE, \
|
||||
handler, \
|
||||
NULL \
|
||||
); \
|
||||
SPARC_Clear_and_unmask_interrupt(TEST_VECTOR);
|
||||
|
||||
#define Cause_tm27_intr() \
|
||||
__asm__ volatile( "ta 0x10; nop " );
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
* @ingroup RTEMSBSPsSPARCLEON3
|
||||
* @brief Install an interrupt vector on SPARC
|
||||
*/
|
||||
|
||||
/* This routine installs an interrupt vector on the SPARC simulator.
|
||||
*
|
||||
* INPUT PARAMETERS:
|
||||
* handler - interrupt handler entry point
|
||||
* vector - vector number
|
||||
* type - 0 indicates raw hardware connect
|
||||
* 1 indicates RTEMS interrupt connect
|
||||
*
|
||||
* OUTPUT PARAMETERS: NONE
|
||||
*
|
||||
* RETURNS:
|
||||
* address of previous interrupt handler
|
||||
*/
|
||||
|
||||
/* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*
|
||||
* Ported to LEON implementation of the SPARC by On-Line Applications
|
||||
* Research Corporation (OAR) under contract to the European Space
|
||||
* Agency (ESA).
|
||||
*
|
||||
* LEON modifications of respective RTEMS file: COPYRIGHT (c) 1995.
|
||||
* European Space Agency.
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
#include <leon.h>
|
||||
|
||||
rtems_isr_entry set_vector( /* returns old vector */
|
||||
rtems_isr_entry handler, /* isr routine */
|
||||
rtems_vector_number vector, /* vector number */
|
||||
int type /* RTEMS or RAW intr */
|
||||
)
|
||||
{
|
||||
rtems_isr_entry previous_isr;
|
||||
|
||||
if ( type )
|
||||
rtems_interrupt_catch( handler, vector, &previous_isr );
|
||||
else
|
||||
_CPU_ISR_install_raw_handler( vector, (void *)handler, (void *)&previous_isr );
|
||||
|
||||
if ( SPARC_IS_INTERRUPT_TRAP( vector ) ) {
|
||||
uint32_t source;
|
||||
|
||||
source = SPARC_INTERRUPT_TRAP_TO_SOURCE( vector );
|
||||
|
||||
LEON_Clear_interrupt( source );
|
||||
LEON_Unmask_interrupt( source );
|
||||
}
|
||||
|
||||
return previous_isr;
|
||||
}
|
||||
@@ -17,15 +17,16 @@
|
||||
* Synchronous trap handler. Map the trap number of SIGFPE, SIGSEGV
|
||||
* or SIGILL to generate the corresponding Ada exception.
|
||||
*/
|
||||
static rtems_isr
|
||||
__gnat_exception_handler(rtems_vector_number trap)
|
||||
static rtems_isr __gnat_exception_handler(
|
||||
rtems_vector_number trap
|
||||
)
|
||||
{
|
||||
uint32_t real_trap;
|
||||
uint32_t signal;
|
||||
|
||||
real_trap = SPARC_REAL_TRAP_NUMBER (trap);
|
||||
switch (real_trap)
|
||||
{
|
||||
{
|
||||
case 0x08: /* FPU exception */
|
||||
case 0x0A: /* TAG overflow */
|
||||
case 0x82: /* divide by zero */
|
||||
@@ -38,7 +39,7 @@ __gnat_exception_handler(rtems_vector_number trap)
|
||||
default: /* Anything else ... */
|
||||
signal = SIGILL; /* Will cause Program_Error */
|
||||
break;
|
||||
}
|
||||
}
|
||||
kill (getpid (), signal);
|
||||
}
|
||||
|
||||
@@ -46,26 +47,25 @@ __gnat_exception_handler(rtems_vector_number trap)
|
||||
* Asynchronous trap handler. As it happens, the interrupt trap numbers for
|
||||
* SPARC is 17 - 31, so we just map then directly on the same signal number.
|
||||
*/
|
||||
static rtems_isr
|
||||
__gnat_interrupt_handler (rtems_vector_number trap)
|
||||
static rtems_isr __gnat_interrupt_handler (
|
||||
rtems_vector_number trap
|
||||
)
|
||||
{
|
||||
uint32_t real_trap;
|
||||
|
||||
uint32_t real_trap;
|
||||
real_trap = SPARC_REAL_TRAP_NUMBER (trap);
|
||||
|
||||
kill (getpid (), real_trap);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Default signal handler with error reporting
|
||||
*/
|
||||
|
||||
static void
|
||||
__gnat_signals_Abnormal_termination_handler (int signo)
|
||||
static void __gnat_signals_Abnormal_termination_handler (
|
||||
int signo
|
||||
)
|
||||
{
|
||||
switch (signo)
|
||||
{
|
||||
{
|
||||
case SIGFPE:
|
||||
printk("\nConstraint_Error\n");
|
||||
break;
|
||||
@@ -75,43 +75,49 @@ __gnat_signals_Abnormal_termination_handler (int signo)
|
||||
default:
|
||||
printk("\nProgram_Error\n");
|
||||
break;
|
||||
}
|
||||
exit (1);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
const struct sigaction __gnat_error_vector =
|
||||
{0, -1,
|
||||
{__gnat_signals_Abnormal_termination_handler}};
|
||||
|
||||
void
|
||||
__gnat_install_handler_common (int t1, int t2)
|
||||
void __gnat_install_handler_common (
|
||||
int t1, int t2
|
||||
)
|
||||
{
|
||||
uint32_t trap;
|
||||
rtems_isr_entry previous_isr;
|
||||
rtems_isr_entry previous_isr_a;
|
||||
rtems_isr_entry previous_isr_b;
|
||||
|
||||
sigaction (SIGSEGV, &__gnat_error_vector, NULL);
|
||||
sigaction (SIGFPE, &__gnat_error_vector, NULL);
|
||||
sigaction (SIGILL, &__gnat_error_vector, NULL);
|
||||
|
||||
for (trap = 0; trap < 256; trap++)
|
||||
{
|
||||
/*
|
||||
* Skip window overflow, underflow, and flush as well as software
|
||||
* trap 0 which we will use as a shutdown. Also avoid trap 0x70 - 0x7f
|
||||
* which cannot happen and where some of the space is used to pass
|
||||
* parameters to the program. 0x80 for system traps and
|
||||
* 0x81 - 0x83 by the remote debugging stub.
|
||||
* Avoid two bsp specific interrupts which normally are used
|
||||
* by the real-time clock and UART B.
|
||||
*/
|
||||
|
||||
if ((trap >= 0x11) && (trap <= 0x1f))
|
||||
{
|
||||
if ((trap != t1) && (trap != t2))
|
||||
{
|
||||
rtems_interrupt_catch (__gnat_interrupt_handler, trap, &previous_isr_a);
|
||||
}
|
||||
}
|
||||
else if ((trap != 5 && trap != 6) && ((trap < 0x70) || (trap > 0x83)))
|
||||
{
|
||||
|
||||
/*
|
||||
* Skip window overflow, underflow, and flush as well as software
|
||||
* trap 0 which we will use as a shutdown. Also avoid trap 0x70 - 0x7f
|
||||
* which cannot happen and where some of the space is used to pass
|
||||
* paramaters to the program. 0x80 for system traps and
|
||||
* 0x81 - 0x83 by the remote debugging stub.
|
||||
* Avoid two bsp specific interrupts which normally are used
|
||||
* by the real-time clock and UART B.
|
||||
*/
|
||||
|
||||
if ((trap >= 0x11) && (trap <= 0x1f))
|
||||
{
|
||||
if ((trap != t1) && (trap != t2))
|
||||
rtems_interrupt_catch (__gnat_interrupt_handler, trap, &previous_isr);
|
||||
}
|
||||
else if ((trap != 5 && trap != 6) && ((trap < 0x70) || (trap > 0x83)))
|
||||
set_vector (__gnat_exception_handler, SPARC_SYNCHRONOUS_TRAP (trap), 1);
|
||||
rtems_interrupt_catch (__gnat_exception_handler, SPARC_SYNCHRONOUS_TRAP (trap), &previous_isr_b);
|
||||
SPARC_Clear_and_unmask_interrupt(SPARC_SYNCHRONOUS_TRAP (trap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
48
bsps/sparc/shared/start/sparctrap.c
Normal file
48
bsps/sparc/shared/start/sparctrap.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/**
|
||||
* @file leontrap.c
|
||||
* @ingroup RTEMSBSPsSPARCERC32
|
||||
* @ingroup RTEMSBSPsLEON2
|
||||
* @ingroup RTEMSBSPsLEON3
|
||||
* @ingroup RTEMSBSPsSPARCShared
|
||||
* @brief Clears and unmasks a SPARC interrupt on LEON.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2025 On-Line Applications Research Corporation (OAR)
|
||||
* Copyright (c) 2025 Sunil Hegde <sunil1hegde@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
|
||||
void SPARC_Clear_and_unmask_interrupt(rtems_vector_number vector)
|
||||
{
|
||||
if (SPARC_IS_INTERRUPT_TRAP(vector)) {
|
||||
uint32_t source = SPARC_INTERRUPT_TRAP_TO_SOURCE(vector);
|
||||
BSP_Clear_interrupt(source);
|
||||
BSP_Unmask_interrupt(source);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ source:
|
||||
- bsps/sparc/erc32/start/bspidle.c
|
||||
- bsps/sparc/erc32/start/bspstart.c
|
||||
- bsps/sparc/erc32/start/erc32mec.c
|
||||
- bsps/sparc/erc32/start/setvec.c
|
||||
- bsps/sparc/shared/start/sparctrap.c
|
||||
- bsps/sparc/shared/gnatcommon.c
|
||||
- bsps/sparc/shared/irq/bsp_isr_handler.c
|
||||
- bsps/sparc/shared/irq/irq-shared.c
|
||||
|
||||
@@ -29,6 +29,7 @@ source:
|
||||
- bsps/shared/irq/irq-default-handler.c
|
||||
- bsps/shared/start/gettargethash-default.c
|
||||
- bsps/shared/start/sbrk.c
|
||||
- bsps/sparc/shared/start/sparctrap.c
|
||||
- bsps/sparc/leon2/btimer/btimer.c
|
||||
- bsps/sparc/leon2/clock/ckinit.c
|
||||
- bsps/sparc/leon2/console/console.c
|
||||
@@ -39,7 +40,6 @@ source:
|
||||
- bsps/sparc/leon2/start/bspidle.c
|
||||
- bsps/sparc/leon2/start/bspstart.c
|
||||
- bsps/sparc/leon2/start/cache.c
|
||||
- bsps/sparc/leon2/start/setvec.c
|
||||
- bsps/sparc/shared/drvmgr/ambapp_bus_leon2.c
|
||||
- bsps/sparc/shared/drvmgr/leon2_amba_bus.c
|
||||
- bsps/sparc/shared/gnatcommon.c
|
||||
|
||||
@@ -36,6 +36,7 @@ source:
|
||||
- bsps/shared/dev/serial/console-termios.c
|
||||
- bsps/shared/irq/irq-default-handler.c
|
||||
- bsps/shared/start/sbrk.c
|
||||
- bsps/sparc/shared/start/sparctrap.c
|
||||
- bsps/sparc/leon3/btimer/btimer.c
|
||||
- bsps/sparc/leon3/btimer/watchdog.c
|
||||
- bsps/sparc/leon3/clock/ckinit.c
|
||||
@@ -51,7 +52,6 @@ source:
|
||||
- bsps/sparc/leon3/start/drvmgr_def_drivers.c
|
||||
- bsps/sparc/leon3/start/eirq.c
|
||||
- bsps/sparc/leon3/start/gettargethash.c
|
||||
- bsps/sparc/leon3/start/setvec.c
|
||||
- bsps/sparc/shared/gnatcommon.c
|
||||
- bsps/sparc/shared/irq/bsp_isr_handler.c
|
||||
- bsps/sparc/shared/pci/gr_cpci_gr740.c
|
||||
|
||||
Reference in New Issue
Block a user