static void test_watchdog_static_init( void ) { #if defined(RTEMS_USE_16_BIT_OBJECT) #define JUNK_ID 0x1234 #else #define JUNK_ID 0x12345678 #endif static Watchdog_Control a = WATCHDOG_INITIALIZER( test_watchdog_routine, JUNK_ID, (void *) 0xdeadbeef ); Watchdog_Control b; memset( &b, 0, sizeof( b ) ); _Watchdog_Initialize( &b, test_watchdog_routine, JUNK_ID, (void *) 0xdeadbeef ); rtems_test_assert( memcmp( &a, &b, sizeof( a ) ) == 0 ); }
static void test_watchdog_static_init( void ) { static Watchdog_Control a = WATCHDOG_INITIALIZER( test_watchdog_routine ); Watchdog_Control b; memset( &b, 0, sizeof( b ) ); _Watchdog_Preinitialize( &b, _Per_CPU_Get_by_index( 0 ) ); _Watchdog_Initialize( &b, test_watchdog_routine ); rtems_test_assert( memcmp( &a, &b, sizeof( a ) ) == 0 ); }
static void test_watchdog_static_init( void ) { static Watchdog_Control a = WATCHDOG_INITIALIZER( test_watchdog_routine, 0x12345678, (void *) 0xdeadbeef ); Watchdog_Control b; memset( &b, 0, sizeof( b ) ); _Watchdog_Initialize( &b, test_watchdog_routine, 0x12345678, (void *) 0xdeadbeef ); rtems_test_assert( memcmp( &a, &b, sizeof( a ) ) == 0 ); }
status = kill( getpid(), SIGALRM ); #if defined(RTEMS_DEBUG) /* * There is no reason to think this might fail but we should be * cautious. */ _Assert(status == 0); #else (void) status; #endif } static Watchdog_Control _POSIX_signals_Alarm_watchdog = WATCHDOG_INITIALIZER( _POSIX_signals_Alarm_TSR ); unsigned int alarm( unsigned int seconds ) { unsigned int remaining; Watchdog_Control *the_watchdog; ISR_lock_Context lock_context; ISR_lock_Context lock_context2; Per_CPU_Control *cpu; uint64_t now; uint32_t ticks_per_second; uint32_t ticks;
#endif #include <signal.h> #include <unistd.h> #include <rtems/posix/pthreadimpl.h> #include <rtems/posix/psignalimpl.h> #include <rtems/score/threaddispatch.h> #include <rtems/score/todimpl.h> #include <rtems/score/watchdogimpl.h> static void _POSIX_signals_Ualarm_TSR( Objects_Id id, void *argument ); static Watchdog_Control _POSIX_signals_Ualarm_timer = WATCHDOG_INITIALIZER( _POSIX_signals_Ualarm_TSR, 0, NULL ); /* * _POSIX_signals_Ualarm_TSR */ static void _POSIX_signals_Ualarm_TSR( Objects_Id id RTEMS_UNUSED, void *argument RTEMS_UNUSED ) { /* * Send a SIGALRM but if there is a problem, ignore it. * It's OK, there isn't a way this should fail.