diff --git a/header/fsw_misc.h b/header/fsw_misc.h --- a/header/fsw_misc.h +++ b/header/fsw_misc.h @@ -10,6 +10,17 @@ #include "fsw_spacewire.h" #include "lfr_cpu_usage_report.h" +enum lfr_reset_cause_t{ + UNKNOWN_CAUSE, + POWER_ON, + TC_RESET, + WATCHDOG, + ERROR_RESET, + UNEXP_RESET +}; + +#define LFR_RESET_CAUSE_UNKNOWN_CAUSE 0 + rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic rtems_id HK_id; // id of the HK rate monotonic period @@ -40,7 +51,7 @@ void get_cpu_load( unsigned char *resour void set_hk_lfr_sc_potential_flag( bool state ); void set_hk_lfr_mag_fields_flag( bool state ); void set_hk_lfr_calib_enable( bool state ); - +void set_hk_lfr_reset_cause( enum lfr_reset_cause_t lfr_reset_cause ); extern int sched_yield( void ); extern void rtems_cpu_usage_reset(); diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -189,6 +189,8 @@ rtems_task hous_task(rtems_task_argument status = rtems_rate_monotonic_cancel(HK_id); DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) + set_hk_lfr_reset_cause( POWER_ON ); + while(1){ // launch the rate monotonic task status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); if ( status != RTEMS_SUCCESSFUL ) { @@ -562,3 +564,8 @@ void set_hk_lfr_calib_enable( bool state } } +void set_hk_lfr_reset_cause( enum lfr_reset_cause_t lfr_reset_cause ) +{ + housekeeping_packet.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1] + | (lfr_reset_cause & 0x07 ); // [0000 0111] +}