// $RCSfile: main.c,v $Revision: 1.16 $Date: 2005/03/11 15:08:57 #include "allnodes.h" #include "node1.h" #include #include "configura.h" #include "pubfuncs.h" #include "hs0.h" #include "hs1.h" #include "ls.h" #include "cmd_seq.h" #include "hk_ask.h" #include "tables.h" #include "MM_crc.h" #include "MM_MISC.h" #include "mem_serv.h" #include "cmd_exec.h" #include "asm.h" #include "data_hdl.h" #include "main.h" #include "vm_lib.h" #include "Eprm.h" #include "init1553.h" #include "err_hdl.h" #include "tmtc_if.h" #include "hs_lib.h" //---- Local functions -------------------------------------------------------- void init_KS_stuff(void); void init_main(void); //---- task entry_point -------------------------------------------------------- void entry_point (void) { // Init registers and reset 1553 init_main(); // Init module tables init_tables(); // initialization of HK module hk_init(); // initialization of the SD handlers init_sdh(); // initialization of high speed instruments init_hs1(); // flush HW FIFOs reset_FIFO(); // reset hs task reset_HS(); // init_ls ls_init(); // init the SD handlers init_spec_table(); // this also sets the VM event to call upon completion: to be moved elsewhere init_conf_spec_table(); init_science_data(); // init events and other virtuoso related variables init_KS_stuff(); // init for 1553 and tmtc task align_ptr_counter ( ); force_1553_reset ( ); main_1553_init(); // init for mem_serv init_memory_manager(); // init some variables for the eeprom write service with HIFI specific values init_eprm_write_interr_prio(5, 6, 8, 3); // init VM_lib init_VM_lib(HW_TIMER_CTRL, HW_TIMER_LOAD, IRQ3_N, LTXREGADD, WNUM_Spectroscopy_table); // issue a HIFI_goto_safe force_HIFI_goto_safe(); } //---- Function init_main ---------------------------------------------------------------- //! performs initialization of module main void init_main (void) { unsigned int counters_at_boot[9]; unsigned int i; // interrupt manager: acknowledge register init *IRQACK = 0x78; // ack everything *IRQACK = 0x00; // ignored // default values for several global variables Hk_enable = 0; Hk_enable = 1; // TRUE Observation_ID = 0; Meas_BuildingBlock_ID = 0; Cur_BuildingBlock_ID = 0; AID_spectroscopy = 0; // By default, all subsystem are off SubsysStatus = 0; HK_SubsysStatus = 0; Active_spectr = 0; LCU_non_interaction = FALSE; // Initialize HRS attenuators tables for (i = 0; i < HRS_ATTVAL2_LEN; i++) HRS_ATT_VAL2[i] = i; HRS_ATT_VAL1[0] = 0xee; for (i = 0; i < (HRS_ATTVAL1_LEN-1); i++) HRS_ATT_VAL1[i+1] = i + 0x10; // read boot software counters and init the corresponding OBS counters. Note: APID_500 in pacs is APID_400 in HIFI read_BSW_counters(counters_at_boot); init_APID_counter(counters_at_boot); init_event_counters(counters_at_boot); } //------ init_KS_stuff --------------------------------------------------------- void init_KS_stuff (void) { // enable Virtuoso events KS_EventEnable (HK_EVENT); // Enables event (end of hk req transaction) KS_EventEnable (HS_EVENT); // Enables HS event set by IRQ0 interrupt handler KS_EventEnable (HS_FLUSH_EVENT); // Enables HS_flush event set by vm and tuning procedures KS_EventEnable (MEAS_EVENT); // Enables event (end of hk req transaction in case of parameters scan) // set interrupt handler for IRQ0 KS_IRQSetHandler(IRQ0_N, isr0); KS_IRQSetHandler(IRQ3_N, irq3); //===================================================================== // cgs interrupt manager setting *IRQLEV = 0x78; // low level = TRUE; adg:da CONFERMARE!!! *IRQTYPE = 0x0; // type set to edge KS_ISREnable(IRQ0_N); // ADG: modifica temporanea per tests. DA CONFERMARE //===================================================================== // enable interrupt nesting (set bit 11 of MODE1 register) __asm("BIT SET MODE1 0x800;"); __asm("BIT SET MODE2 0x10000020;"); // default setting; all IRQ level, timer enabled //set the workload measuring period to 1 sec- //the workload measure will appear in OBSHK#30, measured in res_check KS_WorkloadSetPeriod(1000); }