bsps/sparc: Reformat source with clang-format

This commit is contained in:
Matteo Concas
2026-06-03 12:13:16 -05:00
committed by Kinsey Moore
parent da105bb04f
commit aa904d80af
47 changed files with 3011 additions and 2891 deletions
+15 -17
View File
@@ -34,16 +34,15 @@ bool benchmark_timer_find_average_overhead;
bool benchmark_timer_is_initialized = false;
void benchmark_timer_initialize(void)
void benchmark_timer_initialize( void )
{
/*
* Timer runs long and accurate enough not to require an interrupt.
*/
if ( benchmark_timer_is_initialized == false ) {
/* approximately 1 us per countdown */
ERC32_MEC.General_Purpose_Timer_Scalar = CLOCK_SPEED - 1;
ERC32_MEC.General_Purpose_Timer_Scalar = CLOCK_SPEED - 1;
ERC32_MEC.General_Purpose_Timer_Counter = 0xffffffff;
} else {
@@ -52,39 +51,38 @@ void benchmark_timer_initialize(void)
ERC32_MEC_Set_General_Purpose_Timer_Control(
ERC32_MEC_TIMER_COUNTER_ENABLE_COUNTING |
ERC32_MEC_TIMER_COUNTER_LOAD_COUNTER
ERC32_MEC_TIMER_COUNTER_LOAD_COUNTER
);
ERC32_MEC_Set_General_Purpose_Timer_Control(
ERC32_MEC_TIMER_COUNTER_ENABLE_COUNTING
);
}
#define AVG_OVERHEAD 12 /* It typically takes 3.0 microseconds */
/* to start/stop the timer. */
#define LEAST_VALID 13 /* Don't trust a value lower than this */
#define AVG_OVERHEAD 12 /* It typically takes 3.0 microseconds */
/* to start/stop the timer. */
#define LEAST_VALID 13 /* Don't trust a value lower than this */
benchmark_timer_t benchmark_timer_read(void)
benchmark_timer_t benchmark_timer_read( void )
{
uint32_t total;
uint32_t total;
total = ERC32_MEC.General_Purpose_Timer_Counter;
total = 0xffffffff - total;
if ( benchmark_timer_find_average_overhead == true )
return total; /* in one microsecond units */
if ( benchmark_timer_find_average_overhead == true ) {
return total; /* in one microsecond units */
}
if ( total < LEAST_VALID )
return 0; /* below timer resolution */
if ( total < LEAST_VALID ) {
return 0; /* below timer resolution */
}
return total - AVG_OVERHEAD;
}
void benchmark_timer_disable_subtracting_average_overhead(
bool find_flag
)
void benchmark_timer_disable_subtracting_average_overhead( bool find_flag )
{
benchmark_timer_find_average_overhead = find_flag;
}
+16 -17
View File
@@ -45,7 +45,7 @@ static void erc32_clock_init( void )
tc->tc_counter_mask = 0xffffffff;
tc->tc_frequency = ERC32_REAL_TIME_CLOCK_FREQUENCY;
tc->tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
rtems_timecounter_install(tc);
rtems_timecounter_install( tc );
}
uint32_t _CPU_Counter_frequency( void )
@@ -57,12 +57,12 @@ static void erc32_clock_at_tick( SPARC_Counter *counter )
{
rtems_interrupt_level level;
rtems_interrupt_local_disable(level);
rtems_interrupt_local_disable( level );
ERC32_Clear_interrupt( ERC32_INTERRUPT_REAL_TIME_CLOCK );
counter->accumulated += counter->interval;
rtems_interrupt_local_enable(level);
rtems_interrupt_local_enable( level );
}
static void erc32_clock_initialize_early( void )
@@ -74,9 +74,8 @@ static void erc32_clock_initialize_early( void )
ERC32_MEC.Real_Time_Clock_Counter =
rtems_configuration_get_microseconds_per_tick();
ERC32_MEC_Set_Real_Time_Clock_Timer_Control(
ERC32_MEC_TIMER_COUNTER_ENABLE_COUNTING |
ERC32_MEC_TIMER_COUNTER_LOAD_SCALER |
ERC32_MEC_TIMER_COUNTER_LOAD_COUNTER
ERC32_MEC_TIMER_COUNTER_ENABLE_COUNTING |
ERC32_MEC_TIMER_COUNTER_LOAD_SCALER | ERC32_MEC_TIMER_COUNTER_LOAD_COUNTER
);
ERC32_MEC_Set_Real_Time_Clock_Timer_Control(
ERC32_MEC_TIMER_COUNTER_ENABLE_COUNTING |
@@ -88,7 +87,7 @@ static void erc32_clock_initialize_early( void )
counter->read = _SPARC_Counter_read_clock;
counter->counter_register = &ERC32_MEC.Real_Time_Clock_Counter,
counter->pending_register = &ERC32_MEC.Interrupt_Pending;
counter->pending_mask = UINT32_C(1) << ERC32_INTERRUPT_REAL_TIME_CLOCK;
counter->pending_mask = UINT32_C( 1 ) << ERC32_INTERRUPT_REAL_TIME_CLOCK;
counter->accumulated = rtems_configuration_get_microseconds_per_tick();
counter->interval = rtems_configuration_get_microseconds_per_tick();
}
@@ -105,20 +104,20 @@ RTEMS_SYSINIT_ITEM(
#define CLOCK_VECTOR ERC32_TRAP_TYPE( ERC32_INTERRUPT_REAL_TIME_CLOCK )
#define Clock_driver_support_install_isr( _new ) \
(void) rtems_interrupt_handler_install( \
ERC32_INTERRUPT_REAL_TIME_CLOCK, \
"Clock", \
RTEMS_INTERRUPT_SHARED, \
_new, \
&_SPARC_Counter \
(void) rtems_interrupt_handler_install( \
ERC32_INTERRUPT_REAL_TIME_CLOCK, \
"Clock", \
RTEMS_INTERRUPT_SHARED, \
_new, \
&_SPARC_Counter \
)
#define Clock_driver_support_set_interrupt_affinity( _online_processors ) \
do { \
(void) _online_processors; \
} while (0)
do { \
(void) _online_processors; \
} while ( 0 )
#define Clock_driver_support_at_tick(arg) erc32_clock_at_tick(arg)
#define Clock_driver_support_at_tick( arg ) erc32_clock_at_tick( arg )
#define Clock_driver_support_initialize_hardware() erc32_clock_init()
+18 -17
View File
@@ -18,18 +18,15 @@
*
* This routine transmits a character using polling.
*/
void console_outbyte_polled(
int port,
unsigned char ch
)
void console_outbyte_polled( int port, unsigned char ch )
{
if ( port == 0 ) {
while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA) == 0 );
while ( ( ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA ) == 0 );
ERC32_MEC.UART_Channel_A = (unsigned int) ch;
return;
}
while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB) == 0 );
while ( ( ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB ) == 0 );
ERC32_MEC.UART_Channel_B = (unsigned int) ch;
}
@@ -44,30 +41,31 @@ int console_inbyte_nonblocking( int port )
UStat = ERC32_MEC.UART_Status;
switch (port) {
switch ( port ) {
case 0:
if (UStat & ERC32_MEC_UART_STATUS_ERRA) {
if ( UStat & ERC32_MEC_UART_STATUS_ERRA ) {
ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRA;
ERC32_MEC.Control = ERC32_MEC.Control;
}
if ((UStat & ERC32_MEC_UART_STATUS_DRA) == 0)
return -1;
if ( ( UStat & ERC32_MEC_UART_STATUS_DRA ) == 0 ) {
return -1;
}
return (int) ERC32_MEC.UART_Channel_A;
case 1:
if (UStat & ERC32_MEC_UART_STATUS_ERRB) {
if ( UStat & ERC32_MEC_UART_STATUS_ERRB ) {
ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRB;
ERC32_MEC.Control = ERC32_MEC.Control;
}
if ((UStat & ERC32_MEC_UART_STATUS_DRB) == 0)
if ( ( UStat & ERC32_MEC_UART_STATUS_DRB ) == 0 ) {
return -1;
}
return (int) ERC32_MEC.UART_Channel_B;
default:
rtems_fatal_error_occurred( 'D' << 8 | (port & 0xffffff) );
rtems_fatal_error_occurred( 'D' << 8 | ( port & 0xffffff ) );
}
return -1;
@@ -79,7 +77,10 @@ int console_inbyte_nonblocking( int port )
#include <rtems/bspIo.h>
static void BSP_output_char_f(char c) { console_outbyte_polled( 0, c ); }
static void BSP_output_char_f( char c )
{
console_outbyte_polled( 0, c );
}
BSP_output_char_function_type BSP_output_char = BSP_output_char_f;
BSP_polling_getchar_function_type BSP_poll_char = NULL;
BSP_output_char_function_type BSP_output_char = BSP_output_char_f;
BSP_polling_getchar_function_type BSP_poll_char = NULL;
File diff suppressed because it is too large Load Diff
+2 -3
View File
@@ -19,8 +19,7 @@
#include <bsp/gnatcommon.h>
void
__gnat_install_handler (void)
void __gnat_install_handler( void )
{
__gnat_install_handler_common (0x1d, 0x15);
__gnat_install_handler_common( 0x1d, 0x15 );
}
+3 -4
View File
@@ -19,13 +19,12 @@
#include <bsp.h>
void rtems_bsp_delay(int usecs)
void rtems_bsp_delay( int usecs )
{
uint32_t then;
then = ERC32_MEC.Real_Time_Clock_Counter;
then = ERC32_MEC.Real_Time_Clock_Counter;
then += usecs;
while (ERC32_MEC.Real_Time_Clock_Counter >= then)
;
while ( ERC32_MEC.Real_Time_Clock_Counter >= then );
}
+2 -2
View File
@@ -30,8 +30,8 @@ void *bsp_idle_thread( uintptr_t ignored )
{
(void) ignored;
while (1) {
ERC32_MEC.Power_Down = 0; /* value is irrelevant */
while ( 1 ) {
ERC32_MEC.Power_Down = 0; /* value is irrelevant */
}
return NULL;
}
+3 -7
View File
@@ -62,9 +62,7 @@ void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
(void) cpu_count;
}
void _CPU_SMP_Prepare_start_multitasking( void )
{
}
void _CPU_SMP_Prepare_start_multitasking( void ) {}
void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
{
@@ -73,9 +71,7 @@ void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
__asm__ volatile( "ta 0x11; nop " );
}
static rtems_isr bsp_inter_processor_interrupt(
void *vector
)
static rtems_isr bsp_inter_processor_interrupt( void *vector )
{
_SMP_Inter_processor_interrupt_handler( _Per_CPU_Get() );
}
@@ -96,7 +92,7 @@ static void erc32_install_inter_processor_interrupt( void )
&erc32_handle_ipi
);
SPARC_Clear_and_unmask_interrupt(IPI_VECTOR);
SPARC_Clear_and_unmask_interrupt( IPI_VECTOR );
}
RTEMS_SYSINIT_ITEM(
+1 -1
View File
@@ -51,7 +51,7 @@ RTEMS_SYSINIT_ITEM(
RTEMS_SYSINIT_ORDER_MIDDLE
);
void bsp_start(void)
void bsp_start( void )
{
/* Nothing to do */
}
+15 -19
View File
@@ -25,7 +25,6 @@
* European Space Agency.
*/
#include <bsp.h>
#include <rtems/btimer.h>
@@ -33,14 +32,13 @@ bool benchmark_timer_find_average_overhead;
bool benchmark_timer_is_initialized = false;
void benchmark_timer_initialize(void)
void benchmark_timer_initialize( void )
{
/*
* Timer runs long and accurate enough not to require an interrupt.
*/
if ( benchmark_timer_is_initialized == false ) {
/* approximately 1 us per countdown */
LEON_REG.Timer_Counter_2 = 0xffffff;
LEON_REG.Timer_Reload_2 = 0xffffff;
@@ -49,18 +47,16 @@ void benchmark_timer_initialize(void)
benchmark_timer_is_initialized = true;
}
LEON_REG.Timer_Control_2 = (
LEON_REG_TIMER_COUNTER_ENABLE_COUNTING |
LEON_REG_TIMER_COUNTER_LOAD_COUNTER
);
LEON_REG.Timer_Control_2 =
( LEON_REG_TIMER_COUNTER_ENABLE_COUNTING |
LEON_REG_TIMER_COUNTER_LOAD_COUNTER );
}
#define AVG_OVERHEAD 3 /* It typically takes 3.0 microseconds */
/* to start/stop the timer. */
#define LEAST_VALID 2 /* Don't trust a value lower than this */
#define AVG_OVERHEAD 3 /* It typically takes 3.0 microseconds */
/* to start/stop the timer. */
#define LEAST_VALID 2 /* Don't trust a value lower than this */
benchmark_timer_t benchmark_timer_read(void)
benchmark_timer_t benchmark_timer_read( void )
{
uint32_t total;
@@ -68,18 +64,18 @@ benchmark_timer_t benchmark_timer_read(void)
total = 0xffffff - total;
if ( benchmark_timer_find_average_overhead == true )
return total; /* in one microsecond units */
if ( benchmark_timer_find_average_overhead == true ) {
return total; /* in one microsecond units */
}
if ( total < LEAST_VALID )
return 0; /* below timer resolution */
if ( total < LEAST_VALID ) {
return 0; /* below timer resolution */
}
return total - AVG_OVERHEAD;
}
void benchmark_timer_disable_subtracting_average_overhead(
bool find_flag
)
void benchmark_timer_disable_subtracting_average_overhead( bool find_flag )
{
benchmark_timer_find_average_overhead = find_flag;
}
+17 -18
View File
@@ -62,41 +62,40 @@ static void leon2_clock_init( void )
tc->tc_counter_mask = 0xffffffff;
tc->tc_frequency = LEON2_TIMER_1_FREQUENCY;
tc->tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
rtems_timecounter_install(tc);
rtems_timecounter_install( tc );
}
static void leon2_clock_at_tick( void )
{
SPARC_Counter *counter;
SPARC_Counter *counter;
rtems_interrupt_level level;
counter = &_SPARC_Counter;
rtems_interrupt_local_disable(level);
rtems_interrupt_local_disable( level );
LEON_Clear_interrupt( LEON_INTERRUPT_TIMER1 );
counter->accumulated += counter->interval;
rtems_interrupt_local_enable(level);
rtems_interrupt_local_enable( level );
}
static void leon2_clock_initialize_early( void )
{
SPARC_Counter *counter;
LEON_REG.Timer_Reload_1 =
rtems_configuration_get_microseconds_per_tick() - 1;
LEON_REG.Timer_Control_1 = (
LEON_REG_TIMER_COUNTER_ENABLE_COUNTING |
LEON_REG.Timer_Reload_1 = rtems_configuration_get_microseconds_per_tick() -
1;
LEON_REG.Timer_Control_1 =
( LEON_REG_TIMER_COUNTER_ENABLE_COUNTING |
LEON_REG_TIMER_COUNTER_RELOAD_AT_ZERO |
LEON_REG_TIMER_COUNTER_LOAD_COUNTER
);
LEON_REG_TIMER_COUNTER_LOAD_COUNTER );
counter = &_SPARC_Counter;
counter->read_isr_disabled = _SPARC_Counter_read_clock_isr_disabled;
counter->read = _SPARC_Counter_read_clock;
counter->counter_register = &LEON_REG.Timer_Counter_1;
counter->pending_register = &LEON_REG.Interrupt_Pending;
counter->pending_mask = UINT32_C(1) << LEON_INTERRUPT_TIMER1;
counter->pending_mask = UINT32_C( 1 ) << LEON_INTERRUPT_TIMER1;
counter->accumulated = rtems_configuration_get_microseconds_per_tick();
counter->interval = rtems_configuration_get_microseconds_per_tick();
}
@@ -113,15 +112,15 @@ uint32_t _CPU_Counter_frequency( void )
}
#define Clock_driver_support_install_isr( _new ) \
(void) rtems_interrupt_handler_install( \
LEON_INTERRUPT_TIMER1, \
"Clock", \
RTEMS_INTERRUPT_SHARED, \
_new, \
NULL \
(void) rtems_interrupt_handler_install( \
LEON_INTERRUPT_TIMER1, \
"Clock", \
RTEMS_INTERRUPT_SHARED, \
_new, \
NULL \
)
#define Clock_driver_support_at_tick(arg) leon2_clock_at_tick()
#define Clock_driver_support_at_tick( arg ) leon2_clock_at_tick()
#define Clock_driver_support_initialize_hardware() leon2_clock_init()
File diff suppressed because it is too large Load Diff
+10 -8
View File
@@ -25,33 +25,35 @@
void console_outbyte_polled( int port, unsigned char ch )
{
if ( port == 0 ) {
while ( (LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_THE) == 0 );
while ( ( LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_THE ) == 0 );
LEON_REG.UART_Channel_1 = (unsigned int) ch;
return;
}
while ( (LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_THE) == 0 );
while ( ( LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_THE ) == 0 );
LEON_REG.UART_Channel_2 = (unsigned int) ch;
}
int console_inbyte_nonblocking( int port )
{
if ( port == 0 ) {
if (LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_ERR) {
if ( LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_ERR ) {
LEON_REG.UART_Status_1 = ~LEON_REG_UART_STATUS_ERR;
}
if ((LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_DR) == 0)
return -1;
if ( ( LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_DR ) == 0 ) {
return -1;
}
return (int) LEON_REG.UART_Channel_1;
}
if (LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_ERR) {
if ( LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_ERR ) {
LEON_REG.UART_Status_2 = ~LEON_REG_UART_STATUS_ERR;
}
if ((LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_DR) == 0)
return -1;
if ( ( LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_DR ) == 0 ) {
return -1;
}
return (int) LEON_REG.UART_Channel_2;
}
+2 -3
View File
@@ -25,8 +25,7 @@
* 0x12 (UART B interrupt) which is used by the stub.
*/
void
__gnat_install_handler (void)
void __gnat_install_handler( void )
{
__gnat_install_handler_common (0x18, 0x12);
__gnat_install_handler_common( 0x18, 0x12 );
}
File diff suppressed because it is too large Load Diff
+3 -4
View File
@@ -17,13 +17,12 @@
#include <bsp.h>
void rtems_bsp_delay(int usecs)
void rtems_bsp_delay( int usecs )
{
uint32_t then;
then = LEON_REG.Timer_Counter_1;
then = LEON_REG.Timer_Counter_1;
then += usecs;
while (LEON_REG.Timer_Counter_1 >= then)
;
while ( LEON_REG.Timer_Counter_1 >= then );
}
+1 -2
View File
@@ -30,10 +30,9 @@ void *bsp_idle_thread( uintptr_t ignored )
{
(void) ignored;
while (1) {
while ( 1 ) {
/* make sure on load follows store to power-down reg */
LEON_REG.Power_Down = LEON_REG.Power_Down;
}
return NULL;
}
+12 -19
View File
@@ -61,10 +61,10 @@ int CPU_SPARC_HAS_SNOOPING;
* bus snooping is available. This is needed for some drivers so
* that they can select the most efficient copy routines.
*/
static inline int set_snooping(void)
static inline int set_snooping( void )
{
unsigned int tmp = *(unsigned int *)0x80000014; /* Cache control register */
return ((tmp>>23) & 1); /* Data cache snooping enabled */
unsigned int tmp = *(unsigned int *) 0x80000014; /* Cache control register */
return ( ( tmp >> 23 ) & 1 ); /* Data cache snooping enabled */
}
void bsp_start( void )
@@ -87,24 +87,20 @@ void bsp_start( void )
* the devmgr_confdefs.h. No specifc drivers needed by BSP since IRQ/TIMER/UART
* is not drvmgr drivers.
*/
drvmgr_drv_reg_func drvmgr_drivers[] __attribute__((weak)) =
{
drvmgr_drv_reg_func drvmgr_drivers[] __attribute__(( weak )) = {
NULL /* End array with NULL */
};
/* Defines what cores are avilable on the bus in addition to the standard
* LEON2 peripherals.
*/
struct leon2_core leon2_amba_custom_cores[] __attribute__((weak)) =
{
EMPTY_LEON2_CORE
};
struct leon2_core leon2_amba_custom_cores[]
__attribute__(( weak )) = { EMPTY_LEON2_CORE };
/* Configure LEON2 Root bus driver */
struct leon2_bus leon2_bus_config __attribute__((weak)) =
{
&leon2_std_cores[0], /* The standard cores, defined by driver */
&leon2_amba_custom_cores[0], /* custom cores, defined by us */
struct leon2_bus leon2_bus_config __attribute__(( weak )) = {
&leon2_std_cores[ 0 ], /* The standard cores, defined by driver */
&leon2_amba_custom_cores[ 0 ], /* custom cores, defined by us */
DRVMGR_TRANSLATE_ONE2ONE,
DRVMGR_TRANSLATE_ONE2ONE,
};
@@ -113,12 +109,9 @@ struct leon2_bus leon2_bus_config __attribute__((weak)) =
* LEON2 cores, it is up to the driver to look at the configuration paramters
* once started.
*/
struct drvmgr_bus_res leon2_amba_res __attribute__((weak)) =
{
struct drvmgr_bus_res leon2_amba_res __attribute__(( weak )) = {
.next = NULL,
.resource = {
DRVMGR_RES_EMPTY
},
.resource = { DRVMGR_RES_EMPTY },
};
#endif /* RTEMS_DRVMGR_STARTUP */
@@ -134,7 +127,7 @@ static void leon2_pre_driver_hook( void )
bsp_interrupt_initialize();
#ifdef RTEMS_DRVMGR_STARTUP
leon2_root_register(&leon2_bus_config, &leon2_amba_res);
leon2_root_register( &leon2_bus_config, &leon2_amba_res );
#endif
}
+7 -15
View File
@@ -17,9 +17,9 @@
#define CPU_CACHE_SUPPORT_PROVIDES_RANGE_FUNCTIONS
static inline void _CPU_cache_invalidate_entire_instruction ( void )
static inline void _CPU_cache_invalidate_entire_instruction( void )
{
__asm__ volatile ("flush");
__asm__ volatile( "flush" );
}
static inline void _CPU_cache_invalidate_instruction_range(
@@ -30,25 +30,17 @@ static inline void _CPU_cache_invalidate_instruction_range(
(void) i_addr;
(void) n_bytes;
__asm__ volatile ("flush");
__asm__ volatile( "flush" );
}
/* XXX these need to be addressed */
static inline void _CPU_cache_freeze_instruction ( void )
{
}
static inline void _CPU_cache_freeze_instruction( void ) {}
static inline void _CPU_cache_unfreeze_instruction ( void )
{
}
static inline void _CPU_cache_unfreeze_instruction( void ) {}
static inline void _CPU_cache_enable_instruction ( void )
{
}
static inline void _CPU_cache_enable_instruction( void ) {}
static inline void _CPU_cache_disable_instruction ( void )
{
}
static inline void _CPU_cache_disable_instruction( void ) {}
#include "../../../shared/cache/cacheimpl.h"
+18 -18
View File
@@ -19,7 +19,6 @@
* European Space Agency.
*/
#include <leon.h>
#include <rtems/btimer.h>
@@ -27,13 +26,13 @@ bool benchmark_timer_find_average_overhead;
bool benchmark_timer_is_initialized = false;
void benchmark_timer_initialize(void)
void benchmark_timer_initialize( void )
{
/*
* Timer runs long and accurate enough not to require an interrupt.
*/
if (LEON3_Timer_Regs) {
gptimer_timer *timer = &LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX];
if ( LEON3_Timer_Regs ) {
gptimer_timer *timer = &LEON3_Timer_Regs->timer[ LEON3_CLOCK_INDEX ];
if ( benchmark_timer_is_initialized == false ) {
/* approximately 1 us per countdown */
grlib_store_32( &timer->trldval, 0xffffff );
@@ -45,34 +44,35 @@ void benchmark_timer_initialize(void)
}
}
#define AVG_OVERHEAD 3 /* It typically takes 3.0 microseconds */
/* to start/stop the timer. */
#define LEAST_VALID 2 /* Don't trust a value lower than this */
#define AVG_OVERHEAD 3 /* It typically takes 3.0 microseconds */
/* to start/stop the timer. */
#define LEAST_VALID 2 /* Don't trust a value lower than this */
benchmark_timer_t benchmark_timer_read(void)
benchmark_timer_t benchmark_timer_read( void )
{
uint32_t total;
if (LEON3_Timer_Regs) {
total =
grlib_load_32( &LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX].tcntval );
if ( LEON3_Timer_Regs ) {
total = grlib_load_32(
&LEON3_Timer_Regs->timer[ LEON3_CLOCK_INDEX ].tcntval
);
total = 0xffffff - total;
if ( benchmark_timer_find_average_overhead == true )
return total; /* in one microsecond units */
if ( benchmark_timer_find_average_overhead == true ) {
return total; /* in one microsecond units */
}
if ( total < LEAST_VALID )
return 0; /* below timer resolution */
if ( total < LEAST_VALID ) {
return 0; /* below timer resolution */
}
return total - AVG_OVERHEAD;
}
return 0;
}
void benchmark_timer_disable_subtracting_average_overhead(
bool find_flag
)
void benchmark_timer_disable_subtracting_average_overhead( bool find_flag )
{
benchmark_timer_find_average_overhead = find_flag;
}
+32 -25
View File
@@ -34,20 +34,21 @@
#include <bsp/watchdog.h>
struct gptimer_watchdog_priv {
gptimer *regs;
gptimer *regs;
gptimer_timer *timer;
int timerno;
int timerno;
};
struct gptimer_watchdog_priv bsp_watchdogs[1];
int bsp_watchdog_count = 0;
struct gptimer_watchdog_priv bsp_watchdogs[ 1 ];
int bsp_watchdog_count = 0;
int bsp_watchdog_init(void)
int bsp_watchdog_init( void )
{
int timercnt;
if (!LEON3_Timer_Regs)
if ( !LEON3_Timer_Regs ) {
return 0;
}
/* Get Watchdogs in system, this is implemented for one GPTIMER core
* only.
@@ -58,55 +59,61 @@ int bsp_watchdog_init(void)
* functionality is available or not, we assume that it is if we
* reached this function.
*/
bsp_watchdogs[0].regs = LEON3_Timer_Regs;
bsp_watchdogs[ 0 ].regs = LEON3_Timer_Regs;
/* Find Timer that has watchdog functionality */
timercnt = grlib_load_32(&bsp_watchdogs[0].regs->config) & 0x7;
if (timercnt < 2) /* First timer system clock timer */
timercnt = grlib_load_32( &bsp_watchdogs[ 0 ].regs->config ) & 0x7;
if ( timercnt < 2 ) { /* First timer system clock timer */
return 0;
}
bsp_watchdogs[0].timerno = timercnt - 1;
bsp_watchdogs[0].timer = &bsp_watchdogs[0].regs->timer[bsp_watchdogs[0].timerno];
bsp_watchdogs[ 0 ].timerno = timercnt - 1;
bsp_watchdogs[ 0 ].timer = &bsp_watchdogs[ 0 ]
.regs->timer[ bsp_watchdogs[ 0 ].timerno ];
bsp_watchdog_count = 1;
return bsp_watchdog_count;
}
void bsp_watchdog_reload(int watchdog, unsigned int reload_value)
void bsp_watchdog_reload( int watchdog, unsigned int reload_value )
{
gptimer_timer *timer;
uint32_t tctrl;
uint32_t tctrl;
if (bsp_watchdog_count == 0)
if ( bsp_watchdog_count == 0 ) {
bsp_watchdog_init();
}
if (bsp_watchdog_count <= watchdog)
if ( bsp_watchdog_count <= watchdog ) {
return;
}
/* Kick watchdog, and clear interrupt pending bit */
timer = bsp_watchdogs[watchdog].timer;
grlib_store_32(&timer->trldval, reload_value);
tctrl = grlib_load_32(&timer->tctrl);
timer = bsp_watchdogs[ watchdog ].timer;
grlib_store_32( &timer->trldval, reload_value );
tctrl = grlib_load_32( &timer->tctrl );
tctrl |= GPTIMER_TCTRL_LD | GPTIMER_TCTRL_EN;
tctrl &= ~GPTIMER_TCTRL_IP;
grlib_store_32(&timer->tctrl, tctrl);
grlib_store_32( &timer->tctrl, tctrl );
}
void bsp_watchdog_stop(int watchdog)
void bsp_watchdog_stop( int watchdog )
{
if (bsp_watchdog_count == 0)
if ( bsp_watchdog_count == 0 ) {
bsp_watchdog_init();
}
if (bsp_watchdog_count <= watchdog)
if ( bsp_watchdog_count <= watchdog ) {
return;
}
/* Stop watchdog timer */
grlib_store_32(&bsp_watchdogs[watchdog].timer->tctrl, 0);
grlib_store_32( &bsp_watchdogs[ watchdog ].timer->tctrl, 0 );
}
/* Use watchdog timer to reset system */
void bsp_watchdog_system_reset(void)
void bsp_watchdog_system_reset( void )
{
sparc_disable_interrupts();
bsp_watchdog_reload(0, 1);
bsp_watchdog_reload( 0, 1 );
}
+56 -53
View File
@@ -59,44 +59,45 @@
/* LEON3 Timer system interrupt number */
static rtems_vector_number clkirq;
#if defined(RTEMS_PROFILING) && \
(defined(LEON3_HAS_ASR_22_23_UP_COUNTER) || \
defined(LEON3_PROBE_ASR_22_23_UP_COUNTER) || \
defined(LEON3_IRQAMP_PROBE_TIMESTAMP))
#if defined( RTEMS_PROFILING ) && \
( defined( LEON3_HAS_ASR_22_23_UP_COUNTER ) || \
defined( LEON3_PROBE_ASR_22_23_UP_COUNTER ) || \
defined( LEON3_IRQAMP_PROBE_TIMESTAMP ) )
#define LEON3_CLOCK_PROBE_IRQAMP_TIMESTAMP
#define IRQMP_TIMESTAMP_S1_S2 ((1U << 25) | (1U << 26))
#define IRQMP_TIMESTAMP_S1_S2 ( ( 1U << 25 ) | ( 1U << 26 ) )
static void leon3_tc_tick_default(void)
static void leon3_tc_tick_default( void )
{
rtems_timecounter_tick();
}
static void (*leon3_tc_tick)(void) = leon3_tc_tick_default;
static void ( *leon3_tc_tick )( void ) = leon3_tc_tick_default;
static void leon3_tc_do_tick(void)
static void leon3_tc_do_tick( void )
{
(*leon3_tc_tick)();
( *leon3_tc_tick )();
}
static void leon3_tc_tick_irqmp_timestamp(void)
static void leon3_tc_tick_irqmp_timestamp( void )
{
irqamp_timestamp *irqmp_ts =
irqamp_get_timestamp_registers(LEON3_IrqCtrl_Regs);
uint32_t first = grlib_load_32(&irqmp_ts->itstmpas);
uint32_t second = grlib_load_32(&irqmp_ts->itcnt);
uint32_t control = grlib_load_32(&irqmp_ts->itstmpc);
irqamp_timestamp *irqmp_ts = irqamp_get_timestamp_registers(
LEON3_IrqCtrl_Regs
);
uint32_t first = grlib_load_32( &irqmp_ts->itstmpas );
uint32_t second = grlib_load_32( &irqmp_ts->itcnt );
uint32_t control = grlib_load_32( &irqmp_ts->itstmpc );
control |= IRQMP_TIMESTAMP_S1_S2;
grlib_store_32(&irqmp_ts->itstmpc, control);
grlib_store_32( &irqmp_ts->itstmpc, control );
_Profiling_Update_max_interrupt_delay(_Per_CPU_Get(), second - first);
_Profiling_Update_max_interrupt_delay( _Per_CPU_Get(), second - first );
rtems_timecounter_tick();
}
static void leon3_tc_tick_irqmp_timestamp_init(void)
static void leon3_tc_tick_irqmp_timestamp_init( void )
{
/*
* Ignore the first clock interrupt, since it contains the sequential system
@@ -104,54 +105,57 @@ static void leon3_tc_tick_irqmp_timestamp_init(void)
*/
#ifdef RTEMS_SMP
static Atomic_Uint counter = ATOMIC_INITIALIZER_UINT(0);
static Atomic_Uint counter = ATOMIC_INITIALIZER_UINT( 0 );
bool done =
_Atomic_Fetch_add_uint(&counter, 1, ATOMIC_ORDER_RELAXED)
== rtems_scheduler_get_processor_maximum() - 1;
bool done = _Atomic_Fetch_add_uint( &counter, 1, ATOMIC_ORDER_RELAXED ) ==
rtems_scheduler_get_processor_maximum() - 1;
#else
bool done = true;
#endif
irqamp_timestamp *irqmp_ts =
irqamp_get_timestamp_registers(LEON3_IrqCtrl_Regs);
irqamp_timestamp *irqmp_ts = irqamp_get_timestamp_registers(
LEON3_IrqCtrl_Regs
);
uint32_t ks = 1U << 5;
uint32_t control = grlib_load_32(&irqmp_ts->itstmpc);
uint32_t control = grlib_load_32( &irqmp_ts->itstmpc );
control = ks | IRQMP_TIMESTAMP_S1_S2 | clkirq;
grlib_store_32(&irqmp_ts->itstmpc, control);
grlib_store_32( &irqmp_ts->itstmpc, control );
if (done) {
if ( done ) {
leon3_tc_tick = leon3_tc_tick_irqmp_timestamp;
}
rtems_timecounter_tick();
}
#else
static void leon3_tc_do_tick(void)
static void leon3_tc_do_tick( void )
{
rtems_timecounter_tick();
}
#endif
#define Adjust_clkirq_for_node() do { clkirq += LEON3_CLOCK_INDEX; } while(0)
#define Adjust_clkirq_for_node() \
do { \
clkirq += LEON3_CLOCK_INDEX; \
} while ( 0 )
#define Clock_driver_support_find_timer() \
do { \
/* Assume timer found during BSP initialization */ \
if (LEON3_Timer_Regs) { \
clkirq = (grlib_load_32(&LEON3_Timer_Regs->config) & 0xf8) >> 3; \
\
Adjust_clkirq_for_node(); \
} \
} while (0)
#define Clock_driver_support_find_timer() \
do { \
/* Assume timer found during BSP initialization */ \
if ( LEON3_Timer_Regs ) { \
clkirq = ( grlib_load_32( &LEON3_Timer_Regs->config ) & 0xf8 ) >> 3; \
\
Adjust_clkirq_for_node(); \
} \
} while ( 0 )
#define Clock_driver_support_install_isr(isr) \
bsp_clock_handler_install(isr)
#define Clock_driver_support_install_isr( isr ) \
bsp_clock_handler_install( isr )
static rtems_interrupt_entry leon3_clock_interrupt_entry;
static void bsp_clock_handler_install(rtems_interrupt_handler isr)
static void bsp_clock_handler_install( rtems_interrupt_handler isr )
{
rtems_status_code sc;
@@ -166,19 +170,19 @@ static void bsp_clock_handler_install(rtems_interrupt_handler isr)
RTEMS_INTERRUPT_UNIQUE,
&leon3_clock_interrupt_entry
);
if (sc != RTEMS_SUCCESSFUL) {
rtems_fatal(RTEMS_FATAL_SOURCE_BSP, LEON3_FATAL_CLOCK_INITIALIZATION);
if ( sc != RTEMS_SUCCESSFUL ) {
rtems_fatal( RTEMS_FATAL_SOURCE_BSP, LEON3_FATAL_CLOCK_INITIALIZATION );
}
}
#define Clock_driver_support_set_interrupt_affinity(online_processors) \
bsp_interrupt_set_affinity(clkirq, online_processors)
#define Clock_driver_support_set_interrupt_affinity( online_processors ) \
bsp_interrupt_set_affinity( clkirq, online_processors )
static void leon3_clock_initialize(void)
static void leon3_clock_initialize( void )
{
gptimer_timer *timer;
timer = &LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX];
timer = &LEON3_Timer_Regs->timer[ LEON3_CLOCK_INDEX ];
grlib_store_32(
&timer->trldval,
@@ -189,19 +193,18 @@ static void leon3_clock_initialize(void)
GPTIMER_TCTRL_EN | GPTIMER_TCTRL_RS | GPTIMER_TCTRL_LD | GPTIMER_TCTRL_IE
);
#if defined(LEON3_CLOCK_PROBE_IRQAMP_TIMESTAMP)
if (irqamp_get_timestamp_registers(LEON3_IrqCtrl_Regs) != NULL) {
#if defined( LEON3_CLOCK_PROBE_IRQAMP_TIMESTAMP )
if ( irqamp_get_timestamp_registers( LEON3_IrqCtrl_Regs ) != NULL ) {
leon3_tc_tick = leon3_tc_tick_irqmp_timestamp_init;
}
#endif
rtems_timecounter_install(&leon3_timecounter_instance.base);
rtems_timecounter_install( &leon3_timecounter_instance.base );
}
#define Clock_driver_support_initialize_hardware() \
leon3_clock_initialize()
#define Clock_driver_support_initialize_hardware() leon3_clock_initialize()
#define Clock_driver_timecounter_tick(arg) leon3_tc_do_tick()
#define Clock_driver_timecounter_tick( arg ) leon3_tc_do_tick()
#define BSP_FEATURE_IRQ_EXTENSION
+46 -33
View File
@@ -60,58 +60,69 @@
*/
#ifndef RTEMS_DRVMGR_STARTUP
int syscon_uart_index __attribute__((weak)) = 0;
int syscon_uart_index __attribute__(( weak )) = 0;
/* body is in debugputs.c */
static struct apbuart_context apbuarts[BSP_NUMBER_OF_TERMIOS_PORTS];
static int uarts = 0;
static struct apbuart_context apbuarts[ BSP_NUMBER_OF_TERMIOS_PORTS ];
static int uarts = 0;
static rtems_termios_device_context *leon3_console_get_context(int index)
static rtems_termios_device_context *leon3_console_get_context( int index )
{
struct apbuart_context *uart = &apbuarts[index];
struct apbuart_context *uart = &apbuarts[ index ];
rtems_termios_device_context_initialize(&uart->base, "APBUART");
rtems_termios_device_context_initialize( &uart->base, "APBUART" );
return &uart->base;
}
/* AMBA PP find routine. Extract AMBA PnP information into data structure. */
static int find_matching_apbuart(struct ambapp_dev *dev, int index, void *arg)
static int find_matching_apbuart(
struct ambapp_dev *dev,
int index,
void *arg
)
{
(void) index;
(void) arg;
struct ambapp_apb_info *apb = (struct ambapp_apb_info *)dev->devinfo;
struct ambapp_apb_info *apb = (struct ambapp_apb_info *) dev->devinfo;
/* Extract needed information of one APBUART */
apbuarts[uarts].regs = (apbuart *)apb->start;
apbuarts[uarts].irq = apb->common.irq;
apbuarts[ uarts ].regs = (apbuart *) apb->start;
apbuarts[ uarts ].irq = apb->common.irq;
/* Get APBUART core frequency, it is assumed that it is the same
* as Bus frequency where the UART is situated
*/
apbuarts[uarts].freq_hz = ambapp_freq_get(ambapp_plb(), dev);
apbuarts[ uarts ].freq_hz = ambapp_freq_get( ambapp_plb(), dev );
uarts++;
if (uarts >= BSP_NUMBER_OF_TERMIOS_PORTS)
if ( uarts >= BSP_NUMBER_OF_TERMIOS_PORTS ) {
return 1; /* Satisfied number of UARTs, stop search */
else
} else {
return 0; /* Continue searching for more UARTs */
}
}
/* Find all UARTs */
static void leon3_console_scan_uarts(void)
static void leon3_console_scan_uarts( void )
{
memset(apbuarts, 0, sizeof(apbuarts));
memset( apbuarts, 0, sizeof( apbuarts ) );
/* Find APBUART cores */
ambapp_for_each(ambapp_plb(), (OPTIONS_ALL|OPTIONS_APB_SLVS), VENDOR_GAISLER,
GAISLER_APBUART, find_matching_apbuart, NULL);
ambapp_for_each(
ambapp_plb(),
( OPTIONS_ALL | OPTIONS_APB_SLVS ),
VENDOR_GAISLER,
GAISLER_APBUART,
find_matching_apbuart,
NULL
);
}
rtems_device_driver console_initialize(
rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg
rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg
)
{
(void) major;
@@ -125,8 +136,8 @@ rtems_device_driver console_initialize(
&apbuart_handler_polled;
#endif
rtems_status_code status;
int i;
char console_name[16];
int i;
char console_name[ 16 ];
rtems_termios_initialize();
@@ -139,8 +150,8 @@ rtems_device_driver console_initialize(
* non-MP: APBUART[0] is system console
* MP: LEON CPU index select UART
*/
if (syscon_uart_index == 0) {
#if defined(RTEMS_MULTIPROCESSING)
if ( syscon_uart_index == 0 ) {
#if defined( RTEMS_MULTIPROCESSING )
syscon_uart_index = LEON3_Cpu_Index;
#else
syscon_uart_index = 0;
@@ -158,26 +169,28 @@ rtems_device_driver console_initialize(
*
* On a MP system one should not open UARTs that other OS instances use.
*/
if (syscon_uart_index < uarts) {
if ( syscon_uart_index < uarts ) {
status = rtems_termios_device_install(
CONSOLE_DEVICE_NAME,
handler,
NULL,
leon3_console_get_context(syscon_uart_index)
leon3_console_get_context( syscon_uart_index )
);
if (status != RTEMS_SUCCESSFUL)
bsp_fatal(LEON3_FATAL_CONSOLE_REGISTER_DEV);
if ( status != RTEMS_SUCCESSFUL ) {
bsp_fatal( LEON3_FATAL_CONSOLE_REGISTER_DEV );
}
}
strcpy(console_name,"/dev/console_a");
for (i = 0; i < uarts; i++) {
if (i == syscon_uart_index)
strcpy( console_name, "/dev/console_a" );
for ( i = 0; i < uarts; i++ ) {
if ( i == syscon_uart_index ) {
continue; /* skip UART that is registered as /dev/console */
console_name[13] = 'a' + i;
}
console_name[ 13 ] = 'a' + i;
rtems_termios_device_install(
console_name,
handler,
NULL,
leon3_console_get_context(i)
leon3_console_get_context( i )
);
}
+34 -29
View File
@@ -46,55 +46,55 @@
#include <grlib/apbuart.h>
#include <grlib/io.h>
#if !defined(LEON3_APBUART_BASE)
#if !defined( LEON3_APBUART_BASE )
#include <grlib/ambapp.h>
int leon3_debug_uart_index __attribute__((weak)) = 0;
int leon3_debug_uart_index __attribute__(( weak )) = 0;
apbuart *leon3_debug_uart = NULL;
#endif
static void bsp_debug_uart_init(void);
static void bsp_debug_uart_init( void );
static void apbuart_enable_receive_and_transmit(apbuart *regs)
static void apbuart_enable_receive_and_transmit( apbuart *regs )
{
uint32_t ctrl;
ctrl = grlib_load_32(&regs->ctrl);
ctrl = grlib_load_32( &regs->ctrl );
ctrl |= APBUART_CTRL_RE | APBUART_CTRL_TE;
grlib_store_32(&regs->ctrl, ctrl);
grlib_store_32(&regs->status, 0);
grlib_store_32( &regs->ctrl, ctrl );
grlib_store_32( &regs->status, 0 );
}
static void bsp_debug_uart_output_char(char c)
static void bsp_debug_uart_output_char( char c )
{
apbuart_outbyte_polled(leon3_debug_uart, c);
apbuart_outbyte_wait(leon3_debug_uart);
apbuart_outbyte_polled( leon3_debug_uart, c );
apbuart_outbyte_wait( leon3_debug_uart );
}
static int bsp_debug_uart_poll_char(void)
static int bsp_debug_uart_poll_char( void )
{
return apbuart_inbyte_nonblocking(leon3_debug_uart);
return apbuart_inbyte_nonblocking( leon3_debug_uart );
}
static void bsp_debug_uart_pre_init_out(char c)
static void bsp_debug_uart_pre_init_out( char c )
{
bsp_debug_uart_init();
(*BSP_output_char)(c);
( *BSP_output_char )( c );
}
#if defined(LEON3_APBUART_BASE)
#if defined( LEON3_APBUART_BASE )
static void bsp_debug_uart_init(void)
static void bsp_debug_uart_init( void )
{
apbuart_enable_receive_and_transmit(leon3_debug_uart);
apbuart_enable_receive_and_transmit( leon3_debug_uart );
BSP_poll_char = bsp_debug_uart_poll_char;
BSP_output_char = bsp_debug_uart_output_char;
}
#else /* !LEON3_APBUART_BASE */
static void bsp_debug_uart_discard(char c)
static void bsp_debug_uart_discard( char c )
{
(void) c;
}
@@ -102,9 +102,9 @@ static void bsp_debug_uart_discard(char c)
/* Initialize the BSP system debug console layer. It will scan AMBA Plu&Play
* for a debug APBUART and enable RX/TX for that UART.
*/
static void bsp_debug_uart_init(void)
static void bsp_debug_uart_init( void )
{
int i;
int i;
struct ambapp_dev *adev;
if ( BSP_output_char != bsp_debug_uart_pre_init_out ) {
@@ -119,8 +119,8 @@ static void bsp_debug_uart_init(void)
* non-MP: APBUART[0] is debug console
* MP: LEON CPU index select UART
*/
if (leon3_debug_uart_index == 0) {
#if defined(RTEMS_MULTIPROCESSING)
if ( leon3_debug_uart_index == 0 ) {
#if defined( RTEMS_MULTIPROCESSING )
leon3_debug_uart_index = LEON3_Cpu_Index;
#else
leon3_debug_uart_index = 0;
@@ -131,19 +131,24 @@ static void bsp_debug_uart_init(void)
/* Find APBUART core for System Debug Console */
i = leon3_debug_uart_index;
adev = (void *)ambapp_for_each(ambapp_plb(), (OPTIONS_ALL|OPTIONS_APB_SLVS),
VENDOR_GAISLER, GAISLER_APBUART,
ambapp_find_by_idx, (void *)&i);
if (adev != NULL) {
adev = (void *) ambapp_for_each(
ambapp_plb(),
( OPTIONS_ALL | OPTIONS_APB_SLVS ),
VENDOR_GAISLER,
GAISLER_APBUART,
ambapp_find_by_idx,
(void *) &i
);
if ( adev != NULL ) {
struct ambapp_apb_info *apb;
/*
* Found a matching debug console, initialize debug UART if present for
* printk().
*/
apb = (struct ambapp_apb_info *)adev->devinfo;
leon3_debug_uart = (apbuart *)apb->start;
apbuart_enable_receive_and_transmit(leon3_debug_uart);
apb = (struct ambapp_apb_info *) adev->devinfo;
leon3_debug_uart = (apbuart *) apb->start;
apbuart_enable_receive_and_transmit( leon3_debug_uart );
BSP_poll_char = bsp_debug_uart_poll_char;
BSP_output_char = bsp_debug_uart_output_char;
+2 -3
View File
@@ -25,8 +25,7 @@
* 0x12 (UART B interrupt) which is used by the stub.
*/
void
__gnat_install_handler (void)
void __gnat_install_handler( void )
{
__gnat_install_handler_common (0x18, 0x12);
__gnat_install_handler_common( 0x18, 0x12 );
}
+1 -3
View File
@@ -22,9 +22,7 @@
#include <bsp.h>
#include <shm_driver.h>
void *Shm_Convert_address(
void *address
)
void *Shm_Convert_address( void *address )
{
return ( address );
}
+22 -23
View File
@@ -21,59 +21,58 @@
#include <shm_driver.h>
/* Let user override this configuration by declaring this a weak variable */
shm_config_table BSP_shm_cfgtbl __attribute__((weak)) =
{
(vol_u32 *)0x40000000, /* USER OVERRIDABLE */
0x00001000, /* USER OVERRIDABLE */
shm_config_table BSP_shm_cfgtbl __attribute__(( weak )) = {
(vol_u32 *) 0x40000000, /* USER OVERRIDABLE */
0x00001000, /* USER OVERRIDABLE */
SHM_BIG,
NULL_CONVERT,
INTR_MODE,
Shm_Cause_interrupt,
{
NULL,
0, /* USER OVERRIDABLE - Uses default MP-IRQ if 0 */
0, /* USER OVERRIDABLE - Uses default MP-IRQ if 0 */
4,
},
};
void Shm_Get_configuration(
uint32_t localnode,
shm_config_table **shmcfg
)
void Shm_Get_configuration( uint32_t localnode, shm_config_table **shmcfg )
{
(void) localnode;
size_t i;
unsigned int tmp;
size_t i;
unsigned int tmp;
const rtems_multiprocessing_table *mptable;
BSP_shm_cfgtbl.format = SHM_BIG;
BSP_shm_cfgtbl.format = SHM_BIG;
/*
* Override cause_intr or shm_isr if your target has
* special requirements.
*/
BSP_shm_cfgtbl.cause_intr = Shm_Cause_interrupt;
BSP_shm_cfgtbl.cause_intr = Shm_Cause_interrupt;
#ifdef NEUTRAL_BIG
BSP_shm_cfgtbl.convert = NULL_CONVERT;
BSP_shm_cfgtbl.convert = NULL_CONVERT;
#else
BSP_shm_cfgtbl.convert = CPU_swap_u32;
BSP_shm_cfgtbl.convert = CPU_swap_u32;
#endif
BSP_shm_cfgtbl.poll_intr = INTR_MODE;
BSP_shm_cfgtbl.Intr.address =
(vol_u32 *) &(LEON3_IrqCtrl_Regs->piforce[LEON3_Cpu_Index]);
if (BSP_shm_cfgtbl.Intr.value == 0)
BSP_shm_cfgtbl.poll_intr = INTR_MODE;
BSP_shm_cfgtbl.Intr.address = (vol_u32 *) &(
LEON3_IrqCtrl_Regs->piforce[ LEON3_Cpu_Index ]
);
if ( BSP_shm_cfgtbl.Intr.value == 0 ) {
BSP_shm_cfgtbl.Intr.value = 1 << LEON3_mp_irq; /* Use default MP-IRQ */
BSP_shm_cfgtbl.Intr.length = 4;
}
BSP_shm_cfgtbl.Intr.length = 4;
if (LEON3_Cpu_Index == 0) {
if ( LEON3_Cpu_Index == 0 ) {
tmp = 0;
mptable = rtems_configuration_get_user_multiprocessing_table();
for (i = 1; i < mptable->maximum_nodes; i++)
tmp |= (1 << i);
for ( i = 1; i < mptable->maximum_nodes; i++ ) {
tmp |= ( 1 << i );
}
LEON3_IrqCtrl_Regs->mpstat = tmp;
}
+16 -28
View File
@@ -25,13 +25,10 @@
#include <bsp.h>
#include <shm_driver.h>
/*
* Initialize the lock for the specified locked queue.
*/
void Shm_Initialize_lock(
Shm_Locked_queue_Control *lq_cb
)
void Shm_Initialize_lock( Shm_Locked_queue_Control *lq_cb )
{
lq_cb->lock = LQ_UNLOCKED;
}
@@ -41,36 +38,30 @@ void Shm_Initialize_lock(
* specified locked queue. It disables interrupts to prevent
* a deadlock condition.
*/
extern unsigned int LEON3_Atomic_Swap(uint32_t value, uint32_t *address);
extern unsigned int LEON3_Atomic_Swap( uint32_t value, uint32_t *address );
__asm__ (
".text\n"
".align 4\n"
"LEON3_Atomic_Swap:\n"
" retl\n"
" swapa [%o1] 1, %o0\n"
);
__asm__( ".text\n"
".align 4\n"
"LEON3_Atomic_Swap:\n"
" retl\n"
" swapa [%o1] 1, %o0\n" );
void Shm_Lock(
Shm_Locked_queue_Control *lq_cb
)
void Shm_Lock( Shm_Locked_queue_Control *lq_cb )
{
uint32_t isr_level;
uint32_t isr_level;
uint32_t *lockptr = (uint32_t *) &lq_cb->lock;
uint32_t lock_value;
uint32_t lock_value;
lock_value = SHM_LOCK_VALUE;
rtems_interrupt_disable( isr_level );
Shm_isrstat = isr_level;
while ( lock_value ) {
lock_value = LEON3_Atomic_Swap(lock_value, lockptr);
/*
Shm_isrstat = isr_level;
while ( lock_value ) {
lock_value = LEON3_Atomic_Swap( lock_value, lockptr );
/*
* If not available, then may want to delay to reduce load on lock.
*/
}
}
}
/*
@@ -79,9 +70,7 @@ void Shm_Lock(
* Unlock the lock for the specified locked queue.
*/
void Shm_Unlock(
Shm_Locked_queue_Control *lq_cb
)
void Shm_Unlock( Shm_Locked_queue_Control *lq_cb )
{
uint32_t isr_level;
@@ -89,4 +78,3 @@ void Shm_Unlock(
isr_level = Shm_isrstat;
rtems_interrupt_enable( isr_level );
}
+48 -38
View File
@@ -47,11 +47,11 @@
#include <string.h>
#if !defined(LEON3_GPTIMER_BASE)
unsigned int leon3_timer_prescaler __attribute__((weak)) = 0;
#if !defined( LEON3_GPTIMER_BASE )
unsigned int leon3_timer_prescaler __attribute__(( weak )) = 0;
#endif
int leon3_timer_core_index __attribute__((weak)) = 0;
int leon3_timer_core_index __attribute__(( weak )) = 0;
/* AMBA Plug&Play information description.
*
@@ -66,13 +66,13 @@ static void *ambapp_plb_alloc( size_t size )
}
static void *ambapp_memcpy(
void *dest,
const void *src,
int n,
void *dest,
const void *src,
int n,
struct ambapp_bus *abus RTEMS_UNUSED
)
{
return memcpy(dest, src, n);
return memcpy( dest, src, n );
}
struct ambapp_bus *ambapp_plb( void )
@@ -109,11 +109,9 @@ struct ambapp_bus *ambapp_plb( void )
* so that the user may override it, if the defualt settings are not
* enough.
*/
struct drvmgr_bus_res grlib_drv_resources __attribute__((weak)) =
{
struct drvmgr_bus_res grlib_drv_resources __attribute__(( weak )) = {
.next = NULL,
.resource =
{
.resource = {
DRVMGR_RES_EMPTY,
}
};
@@ -126,7 +124,7 @@ static void ambapp_grlib_root_initialize( void )
/* Register Root bus, Use GRLIB AMBA PnP bus as root bus for LEON3 */
grlib_bus_config.abus = ambapp_plb();
grlib_bus_config.resources = &grlib_drv_resources;
ambapp_grlib_root_register(&grlib_bus_config);
ambapp_grlib_root_register( &grlib_bus_config );
}
RTEMS_SYSINIT_ITEM(
@@ -136,13 +134,13 @@ RTEMS_SYSINIT_ITEM(
);
#endif
#if !defined(LEON3_IRQAMP_BASE)
irqamp *LEON3_IrqCtrl_Regs;
#if !defined( LEON3_IRQAMP_BASE )
irqamp *LEON3_IrqCtrl_Regs;
struct ambapp_dev *LEON3_IrqCtrl_Adev;
#endif
#if !defined(LEON3_GPTIMER_BASE)
gptimer *LEON3_Timer_Regs;
#if !defined( LEON3_GPTIMER_BASE )
gptimer *LEON3_Timer_Regs;
struct ambapp_dev *LEON3_Timer_Adev;
#endif
@@ -156,33 +154,38 @@ struct ambapp_dev *LEON3_Timer_Adev;
* amba_ahb_masters, amba_ahb_slaves and amba.
*/
static void amba_initialize(void)
static void amba_initialize( void )
{
struct ambapp_dev *adev;
struct ambapp_bus *plb;
plb = ambapp_plb();
#if defined(LEON3_IRQAMP_BASE) && defined(LEON3_GPTIMER_BASE)
#if defined( LEON3_IRQAMP_BASE ) && defined( LEON3_GPTIMER_BASE )
(void) plb;
(void) adev;
#endif
#if !defined(LEON3_IRQAMP_BASE)
#if !defined( LEON3_IRQAMP_BASE )
/* Find LEON3 Interrupt controller */
adev = (void *)ambapp_for_each(plb, (OPTIONS_ALL|OPTIONS_APB_SLVS),
VENDOR_GAISLER, GAISLER_IRQMP,
ambapp_find_by_idx, NULL);
if (adev == NULL) {
adev = (void *) ambapp_for_each(
plb,
( OPTIONS_ALL | OPTIONS_APB_SLVS ),
VENDOR_GAISLER,
GAISLER_IRQMP,
ambapp_find_by_idx,
NULL
);
if ( adev == NULL ) {
/* PANIC IRQ controller not found!
*
* What else can we do but stop ...
*/
bsp_fatal(LEON3_FATAL_NO_IRQMP_CONTROLLER);
bsp_fatal( LEON3_FATAL_NO_IRQMP_CONTROLLER );
}
LEON3_IrqCtrl_Regs = (irqamp *)DEV_TO_APB(adev)->start;
LEON3_IrqCtrl_Regs = (irqamp *) DEV_TO_APB( adev )->start;
LEON3_IrqCtrl_Adev = adev;
if ((grlib_load_32(&LEON3_IrqCtrl_Regs->asmpctrl) >> 28) > 0) {
if ( ( grlib_load_32( &LEON3_IrqCtrl_Regs->asmpctrl ) >> 28 ) > 0 ) {
uint32_t icsel;
/* IRQ Controller has support for multiple IRQ Controllers, each
@@ -190,35 +193,42 @@ static void amba_initialize(void)
* controller by looking at the IRQCTRL Select Register for this CPU.
* Each Controller is located at a 4KByte offset.
*/
icsel = grlib_load_32(&LEON3_IrqCtrl_Regs->icselr[LEON3_Cpu_Index/8]);
icsel = (icsel >> ((7 - (LEON3_Cpu_Index & 0x7)) * 4)) & 0xf;
icsel = grlib_load_32(
&LEON3_IrqCtrl_Regs->icselr[ LEON3_Cpu_Index / 8 ]
);
icsel = ( icsel >> ( ( 7 - ( LEON3_Cpu_Index & 0x7 ) ) * 4 ) ) & 0xf;
LEON3_IrqCtrl_Regs += icsel;
}
#endif
/* find GP Timer */
adev = (void *)ambapp_for_each(plb, (OPTIONS_ALL|OPTIONS_APB_SLVS),
VENDOR_GAISLER, GAISLER_GPTIMER,
ambapp_find_by_idx, &leon3_timer_core_index);
if (adev) {
gptimer *timer_regs = (gptimer *)DEV_TO_APB(adev)->start;
adev = (void *) ambapp_for_each(
plb,
( OPTIONS_ALL | OPTIONS_APB_SLVS ),
VENDOR_GAISLER,
GAISLER_GPTIMER,
ambapp_find_by_idx,
&leon3_timer_core_index
);
if ( adev ) {
gptimer *timer_regs = (gptimer *) DEV_TO_APB( adev )->start;
/* Register AMBA Bus Frequency */
ambapp_freq_init(
plb,
adev,
(grlib_load_32(&timer_regs->sreload) + 1)
* LEON3_GPTIMER_0_FREQUENCY_SET_BY_BOOT_LOADER
( grlib_load_32( &timer_regs->sreload ) + 1 ) *
LEON3_GPTIMER_0_FREQUENCY_SET_BY_BOOT_LOADER
);
#if !defined(LEON3_GPTIMER_BASE)
#if !defined( LEON3_GPTIMER_BASE )
/* Set user prescaler configuration. Use this to increase accuracy of timer
* and accociated services like cpucounter.
* Note that minimum value is the number of timer instances present in
* GRTIMER/GPTIMER hardware. See HW manual.
*/
if (leon3_timer_prescaler) {
grlib_store_32(&timer_regs->sreload, leon3_timer_prescaler);
if ( leon3_timer_prescaler ) {
grlib_store_32( &timer_regs->sreload, leon3_timer_prescaler );
}
LEON3_Timer_Regs = timer_regs;
+5 -6
View File
@@ -18,15 +18,14 @@
#include <bsp.h>
#include <bsp/leon3.h>
void rtems_bsp_delay(int usecs)
void rtems_bsp_delay( int usecs )
{
uint32_t then;
uint32_t then;
gptimer_timer *regs;
regs = &LEON3_Timer_Regs->timer[0];
then =grlib_load_32(&regs->tcntval);
regs = &LEON3_Timer_Regs->timer[ 0 ];
then = grlib_load_32( &regs->tcntval );
then += usecs;
while (grlib_load_32(&regs->tcntval) >= then)
;
while ( grlib_load_32( &regs->tcntval ) >= then );
}
+17 -16
View File
@@ -26,7 +26,7 @@
#include <rtems/score/smpimpl.h>
#include <stdlib.h>
#if !defined(__leon__) || defined(RTEMS_PARAVIRT)
#if !defined( __leon__ ) || defined( RTEMS_PARAVIRT )
uint32_t _CPU_SMP_Get_current_processor( void )
{
return _LEON3_Get_current_processor();
@@ -36,20 +36,20 @@ uint32_t _CPU_SMP_Get_current_processor( void )
static void bsp_inter_processor_interrupt( void *arg )
{
(void) arg;
_SMP_Inter_processor_interrupt_handler(_Per_CPU_Get());
_SMP_Inter_processor_interrupt_handler( _Per_CPU_Get() );
}
void bsp_start_on_secondary_processor(Per_CPU_Control *cpu_self)
void bsp_start_on_secondary_processor( Per_CPU_Control *cpu_self )
{
if ( !leon3_data_cache_snooping_enabled() ) {
bsp_fatal( LEON3_FATAL_INVALID_CACHE_CONFIG_SECONDARY_PROCESSOR );
}
_SMP_Start_multitasking_on_secondary_processor(cpu_self);
_SMP_Start_multitasking_on_secondary_processor( cpu_self );
}
static rtems_interrupt_entry leon3_inter_processor_interrupt_entry =
RTEMS_INTERRUPT_ENTRY_INITIALIZER(
static rtems_interrupt_entry
leon3_inter_processor_interrupt_entry = RTEMS_INTERRUPT_ENTRY_INITIALIZER(
bsp_inter_processor_interrupt,
NULL,
"IPI"
@@ -57,7 +57,7 @@ static rtems_interrupt_entry leon3_inter_processor_interrupt_entry =
static void leon3_install_inter_processor_interrupt( void )
{
rtems_status_code sc;
rtems_status_code sc;
rtems_vector_number irq;
irq = LEON3_mp_irq;
@@ -74,21 +74,22 @@ static void leon3_install_inter_processor_interrupt( void )
uint32_t _CPU_SMP_Initialize( void )
{
if ( !leon3_data_cache_snooping_enabled() )
if ( !leon3_data_cache_snooping_enabled() ) {
bsp_fatal( LEON3_FATAL_INVALID_CACHE_CONFIG_BOOT_PROCESSOR );
}
return leon3_get_cpu_count(LEON3_IrqCtrl_Regs);
return leon3_get_cpu_count( LEON3_IrqCtrl_Regs );
}
bool _CPU_SMP_Start_processor( uint32_t cpu_index )
{
#if defined(RTEMS_DEBUG)
printk( "Waking CPU %d\n", cpu_index );
#if defined( RTEMS_DEBUG )
printk( "Waking CPU %d\n", cpu_index );
#endif
grlib_store_32(
&LEON3_IrqCtrl_Regs->mpstat,
IRQAMP_MPSTAT_STATUS(1U << cpu_index)
IRQAMP_MPSTAT_STATUS( 1U << cpu_index )
);
return true;
@@ -98,7 +99,7 @@ void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
{
(void) cpu_count;
#if !defined(RTEMS_DRVMGR_STARTUP)
#if !defined( RTEMS_DRVMGR_STARTUP )
leon3_install_inter_processor_interrupt();
#endif
}
@@ -108,16 +109,16 @@ void _CPU_SMP_Prepare_start_multitasking( void )
/* Do nothing */
}
void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
{
/* send interrupt to destination CPU */
grlib_store_32(
&LEON3_IrqCtrl_Regs->piforce[target_processor_index],
&LEON3_IrqCtrl_Regs->piforce[ target_processor_index ],
1U << LEON3_mp_irq
);
}
#if defined(RTEMS_DRVMGR_STARTUP)
#if defined( RTEMS_DRVMGR_STARTUP )
RTEMS_SYSINIT_ITEM(
leon3_install_inter_processor_interrupt,
RTEMS_SYSINIT_DRVMGR_LEVEL_1,
+5 -5
View File
@@ -48,11 +48,11 @@
#include <bsp/bootcard.h>
#include <rtems/sysinit.h>
#if defined(RTEMS_SMP) || defined(RTEMS_MULTIPROCESSING)
#if defined( RTEMS_SMP ) || defined( RTEMS_MULTIPROCESSING )
/* Irq used by shared memory driver and for inter-processor interrupts.
* Can be overridden by being defined in the application.
*/
const unsigned char LEON3_mp_irq __attribute__((weak)) = 14;
const unsigned char LEON3_mp_irq __attribute__(( weak )) = 14;
#endif
/*
@@ -72,9 +72,9 @@ uint32_t LEON3_Cpu_Index = 0;
*
*/
static inline int set_snooping(void)
static inline int set_snooping( void )
{
return (leon3_get_cache_control_register() >> 23) & 1;
return ( leon3_get_cache_control_register() >> 23 ) & 1;
}
/*
@@ -91,7 +91,7 @@ void bsp_start( void )
#endif
}
static void leon3_cpu_index_init(void)
static void leon3_cpu_index_init( void )
{
/* Get the LEON3 CPU index, normally 0, but for MP systems we do
* _not_ assume that this is CPU0. One may run another OS on CPU0
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+3 -5
View File
@@ -40,17 +40,15 @@
#ifdef RTEMS_DRVMGR_STARTUP
#include <drvmgr/drvmgr.h>
extern void gptimer_register_drv (void);
extern void apbuart_cons_register_drv(void);
extern void gptimer_register_drv( void );
extern void apbuart_cons_register_drv( void );
/* All drivers included by BSP, this is overridden by the user by including
* the drvmgr_confdefs.h. By default the Timer and UART driver are included.
*/
drvmgr_drv_reg_func drvmgr_drivers[] __attribute__((weak)) =
{
drvmgr_drv_reg_func drvmgr_drivers[] __attribute__(( weak )) = {
gptimer_register_drv,
apbuart_cons_register_drv,
NULL /* End array with NULL */
};
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+46 -52
View File
@@ -17,86 +17,74 @@
* 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;
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 */
signal = SIGFPE; /* Will cause Constraint_Error */
real_trap = SPARC_REAL_TRAP_NUMBER( trap );
switch ( real_trap ) {
case 0x08: /* FPU exception */
case 0x0A: /* TAG overflow */
case 0x82: /* divide by zero */
signal = SIGFPE; /* Will cause Constraint_Error */
break;
case 0x01: /* Instruction access exception */
case 0x09: /* Data access exception */
signal = SIGSEGV; /* Will cause Storage_Error */
case 0x01: /* Instruction access exception */
case 0x09: /* Data access exception */
signal = SIGSEGV; /* Will cause Storage_Error */
break;
default: /* Anything else ... */
signal = SIGILL; /* Will cause Program_Error */
default: /* Anything else ... */
signal = SIGILL; /* Will cause Program_Error */
break;
}
kill (getpid (), signal);
kill( getpid(), signal );
}
/*
* 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;
real_trap = SPARC_REAL_TRAP_NUMBER (trap);
kill (getpid (), 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)
{
switch ( signo ) {
case SIGFPE:
printk("\nConstraint_Error\n");
printk( "\nConstraint_Error\n" );
break;
case SIGSEGV:
printk("\nStorage_Error\n");
printk( "\nStorage_Error\n" );
break;
default:
printk("\nProgram_Error\n");
printk( "\nProgram_Error\n" );
break;
}
exit(1);
exit( 1 );
}
const struct sigaction __gnat_error_vector =
{0, -1,
{__gnat_signals_Abnormal_termination_handler}};
{ 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 )
{
int trap;
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);
sigaction( SIGSEGV, &__gnat_error_vector, NULL );
sigaction( SIGFPE, &__gnat_error_vector, NULL );
sigaction( SIGILL, &__gnat_error_vector, NULL );
for (trap = 0; trap < 256; trap++)
{
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
@@ -107,17 +95,23 @@ void __gnat_install_handler_common (
* 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);
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)))
{
rtems_interrupt_catch (__gnat_exception_handler, SPARC_SYNCHRONOUS_TRAP (trap), &previous_isr_b);
SPARC_Clear_and_unmask_interrupt(SPARC_SYNCHRONOUS_TRAP (trap));
} else if (
( trap != 5 && trap != 6 ) && ( ( trap < 0x70 ) || ( trap > 0x83 ) )
) {
rtems_interrupt_catch(
__gnat_exception_handler,
SPARC_SYNCHRONOUS_TRAP( trap ),
&previous_isr_b
);
SPARC_Clear_and_unmask_interrupt( SPARC_SYNCHRONOUS_TRAP( trap ) );
}
}
}
+40 -40
View File
@@ -31,28 +31,28 @@
#include <bsp/irq-generic.h>
#include <rtems/score/processormaskimpl.h>
static inline int bsp_irq_cpu(int irq)
static inline int bsp_irq_cpu( int irq )
{
(void) irq;
return 0;
}
bool bsp_interrupt_is_valid_vector(rtems_vector_number vector)
bool bsp_interrupt_is_valid_vector( rtems_vector_number vector )
{
if (vector == 0) {
if ( vector == 0 ) {
return false;
}
return vector <= BSP_INTERRUPT_VECTOR_MAX_STD;
}
void bsp_interrupt_facility_initialize(void)
void bsp_interrupt_facility_initialize( void )
{
/* Nothing to do */
}
static bool is_maskable(rtems_vector_number vector)
static bool is_maskable( rtems_vector_number vector )
{
return vector != 15;
}
@@ -62,11 +62,11 @@ rtems_status_code bsp_interrupt_get_attributes(
rtems_interrupt_attributes *attributes
)
{
attributes->is_maskable = is_maskable(vector);
attributes->is_maskable = is_maskable( vector );
attributes->can_enable = true;
attributes->maybe_enable = true;
attributes->can_disable = is_maskable(vector);
attributes->maybe_disable = is_maskable(vector);
attributes->can_disable = is_maskable( vector );
attributes->maybe_disable = is_maskable( vector );
attributes->can_raise = true;
attributes->can_raise_on = true;
attributes->can_clear = true;
@@ -80,37 +80,37 @@ rtems_status_code bsp_interrupt_is_pending(
bool *pending
)
{
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
bsp_interrupt_assert(pending != NULL);
*pending = BSP_Is_interrupt_pending(vector) ||
BSP_Is_interrupt_forced(vector);
bsp_interrupt_assert( bsp_interrupt_is_valid_vector( vector ) );
bsp_interrupt_assert( pending != NULL );
*pending = BSP_Is_interrupt_pending( vector ) ||
BSP_Is_interrupt_forced( vector );
return RTEMS_SUCCESSFUL;
}
rtems_status_code bsp_interrupt_raise(rtems_vector_number vector)
rtems_status_code bsp_interrupt_raise( rtems_vector_number vector )
{
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
BSP_Force_interrupt(vector);
bsp_interrupt_assert( bsp_interrupt_is_valid_vector( vector ) );
BSP_Force_interrupt( vector );
return RTEMS_SUCCESSFUL;
}
#if defined(RTEMS_SMP)
#if defined( RTEMS_SMP )
rtems_status_code bsp_interrupt_raise_on(
rtems_vector_number vector,
uint32_t cpu_index
)
{
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
BSP_Force_interrupt(vector);
bsp_interrupt_assert( bsp_interrupt_is_valid_vector( vector ) );
BSP_Force_interrupt( vector );
return RTEMS_SUCCESSFUL;
}
#endif
rtems_status_code bsp_interrupt_clear(rtems_vector_number vector)
rtems_status_code bsp_interrupt_clear( rtems_vector_number vector )
{
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
BSP_Clear_forced_interrupt(vector);
BSP_Clear_interrupt(vector);
bsp_interrupt_assert( bsp_interrupt_is_valid_vector( vector ) );
BSP_Clear_forced_interrupt( vector );
BSP_Clear_interrupt( vector );
return RTEMS_SUCCESSFUL;
}
@@ -119,60 +119,60 @@ rtems_status_code bsp_interrupt_vector_is_enabled(
bool *enabled
)
{
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
bsp_interrupt_assert(enabled != NULL);
*enabled = !BSP_Cpu_Is_interrupt_masked(vector, bsp_irq_cpu(vector));
bsp_interrupt_assert( bsp_interrupt_is_valid_vector( vector ) );
bsp_interrupt_assert( enabled != NULL );
*enabled = !BSP_Cpu_Is_interrupt_masked( vector, bsp_irq_cpu( vector ) );
return RTEMS_SUCCESSFUL;
}
rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
rtems_status_code bsp_interrupt_vector_enable( rtems_vector_number vector )
{
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
BSP_Cpu_Unmask_interrupt(vector, 0);
bsp_interrupt_assert( bsp_interrupt_is_valid_vector( vector ) );
BSP_Cpu_Unmask_interrupt( vector, 0 );
return RTEMS_SUCCESSFUL;
}
rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
rtems_status_code bsp_interrupt_vector_disable( rtems_vector_number vector )
{
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
bsp_interrupt_assert( bsp_interrupt_is_valid_vector( vector ) );
if (!is_maskable(vector)) {
if ( !is_maskable( vector ) ) {
return RTEMS_UNSATISFIED;
}
BSP_Cpu_Mask_interrupt(vector, 0);
BSP_Cpu_Mask_interrupt( vector, 0 );
return RTEMS_SUCCESSFUL;
}
rtems_status_code bsp_interrupt_set_priority(
rtems_vector_number vector,
uint32_t priority
uint32_t priority
)
{
(void) vector;
(void) priority;
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
bsp_interrupt_assert( bsp_interrupt_is_valid_vector( vector ) );
return RTEMS_UNSATISFIED;
}
rtems_status_code bsp_interrupt_get_priority(
rtems_vector_number vector,
uint32_t *priority
uint32_t *priority
)
{
(void) vector;
(void) priority;
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
bsp_interrupt_assert(priority != NULL);
bsp_interrupt_assert( bsp_interrupt_is_valid_vector( vector ) );
bsp_interrupt_assert( priority != NULL );
return RTEMS_UNSATISFIED;
}
#if defined(RTEMS_SMP)
#if defined( RTEMS_SMP )
rtems_status_code bsp_interrupt_get_affinity(
rtems_vector_number vector,
Processor_mask *affinity
rtems_vector_number vector,
Processor_mask *affinity
)
{
(void) vector;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -31,16 +31,16 @@
#include <libcpu/access.h>
struct pci_memreg_ops pci_memreg_sparc_be_ops = {
.ld8 = _ld8,
.st8 = _st8,
.ld8 = _ld8,
.st8 = _st8,
.ld_le16 = _ld_be16,
.st_le16 = _st_be16,
.ld_be16 = _ld_le16,
.st_be16 = _st_le16,
.ld_le16 = _ld_be16,
.st_le16 = _st_be16,
.ld_be16 = _ld_le16,
.st_be16 = _st_le16,
.ld_le32 = _ld_be32,
.st_le32 = _st_be32,
.ld_be32 = _ld_le32,
.st_be32 = _st_le32,
.ld_le32 = _ld_be32,
.st_le32 = _st_be32,
.ld_be32 = _ld_le32,
.st_be32 = _st_le32,
};
+10 -11
View File
@@ -27,21 +27,20 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <pci.h>
#include <libcpu/access.h>
struct pci_memreg_ops pci_memreg_sparc_le_ops = {
.ld8 = _ld8,
.st8 = _st8,
.ld8 = _ld8,
.st8 = _st8,
.ld_le16 = _ld_le16,
.st_le16 = _st_le16,
.ld_be16 = _ld_be16,
.st_be16 = _st_be16,
.ld_le16 = _ld_le16,
.st_le16 = _st_le16,
.ld_be16 = _ld_be16,
.st_be16 = _st_be16,
.ld_le32 = _ld_le32,
.st_le32 = _st_le32,
.ld_be32 = _ld_be32,
.st_be32 = _st_be32,
.ld_le32 = _ld_le32,
.st_le32 = _st_le32,
.ld_be32 = _ld_be32,
.st_be32 = _st_be32,
};
+2 -2
View File
@@ -35,7 +35,7 @@
#include <bsp.h>
#include <rtems/score/cpu.h>
void BSP_fatal_exit(uint32_t error)
void BSP_fatal_exit( uint32_t error )
{
sparc_syscall_exit(RTEMS_FATAL_SOURCE_BSP, error);
sparc_syscall_exit( RTEMS_FATAL_SOURCE_BSP, error );
}
+2 -2
View File
@@ -42,8 +42,8 @@ void _SPARC_Memory_initialize( void *end_of_usable_ram );
static Memory_Area _Memory_Areas[ 1 ];
static const Memory_Information _Memory_Information =
MEMORY_INFORMATION_INITIALIZER( _Memory_Areas );
static const Memory_Information
_Memory_Information = MEMORY_INFORMATION_INITIALIZER( _Memory_Areas );
void _SPARC_Memory_initialize( void *end_of_usable_ram )
{
+5 -6
View File
@@ -37,12 +37,11 @@
#include <bsp.h>
void SPARC_Clear_and_unmask_interrupt(rtems_vector_number vector)
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);
if ( SPARC_IS_INTERRUPT_TRAP( vector ) ) {
uint32_t source = SPARC_INTERRUPT_TRAP_TO_SOURCE( vector );
BSP_Clear_interrupt( source );
BSP_Unmask_interrupt( source );
}
}