# HG changeset patch # User paul # Date 2016-02-01 14:39:41 # Node ID e2f22269a98c85a0dd683498f4b3257406cccc4c # Parent 197b0a2858dda25ee27ea9d13bef5e90b22b9f11 sy_lfr_watchdog_enabled handled exit(0) if the timer has fired watchdog_reload executed by the LINK task when this one is awaken diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -1,2 +1,2 @@ 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters -ad7698268954c5d3d203a3b3ad09fcdf2d536472 header/lfr_common_headers +fa4fff498e7a3208f9f7ba469d6e25c84fe6ad71 header/lfr_common_headers diff --git a/header/fsw_misc.h b/header/fsw_misc.h --- a/header/fsw_misc.h +++ b/header/fsw_misc.h @@ -39,6 +39,7 @@ void timer_set_clock_divider(unsigned ch rtems_isr watchdog_isr( rtems_vector_number vector ); void watchdog_configure(void); void watchdog_stop(void); +void watchdog_reload(void); void watchdog_start(void); // SERIAL LINK @@ -61,6 +62,7 @@ void get_v_e1_e2_f3( unsigned char *spac void get_cpu_load( unsigned char *resource_statistics ); void set_hk_lfr_sc_potential_flag( bool state ); void set_hk_lfr_mag_fields_flag( bool state ); +void set_sy_lfr_watchdog_enabled( bool state ); void set_hk_lfr_calib_enable( bool state ); void set_hk_lfr_reset_cause( enum lfr_reset_cause_t lfr_reset_cause ); void hk_lfr_le_me_he_update(); diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -86,6 +86,10 @@ rtems_isr watchdog_isr( rtems_vector_num rtems_status_code status_code; status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_12 ); + + PRINTF("watchdog_isr *** this is the end, exit(0)\n"); + + exit(0); } void watchdog_configure(void) @@ -200,6 +204,8 @@ rtems_task load_task(rtems_task_argument watchdog_start(); + set_sy_lfr_watchdog_enabled( true ); + while(1){ status = rtems_rate_monotonic_period( watchdog_period_id, WATCHDOG_PERIOD ); watchdog_reload(); @@ -645,6 +651,18 @@ void set_hk_lfr_mag_fields_flag( bool st } } +void set_sy_lfr_watchdog_enabled( bool state ) +{ + if (state == true) + { + housekeeping_packet.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1] | 0x10; // [0001 0000] + } + else + { + housekeeping_packet.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1] & 0xef; // [1110 1111] + } +} + void set_hk_lfr_calib_enable( bool state ) { if (state == true) diff --git a/src/fsw_spacewire.c b/src/fsw_spacewire.c --- a/src/fsw_spacewire.c +++ b/src/fsw_spacewire.c @@ -349,6 +349,7 @@ rtems_task link_task( rtems_task_argumen { status = rtems_task_wake_after( 10 ); // monitor the link each 100ms status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status + watchdog_reload(); } status = spacewire_stop_and_start_link( fdSPW );