{ *************************************************************************** } MODULE mod_init_geosec ; { Created 29-APR-1989 MICHIGAN STATE UNIVERSITY, TRIGGER CONTROL SOFTWARE } { *************************************************************************** } INCLUDE mod_common_global_flags, mod_def_physics_tables, mod_handle_tracing, mod_io_allocation_handling, mod_handle_geosec, mod_common_hard_io ; {from the TRICS hardware IO library } { *************************************************************************** } EXPORT init_all_geosec, {PROCEDURE initialize all geographic sections } restore_all_geosec,{PROCEDURE restore programming of all gsect from database} initialize_geosec, {PROCEDURE initialize one geographic section } check_alloc_geosec_coor ;{PROCEDURE check/allocate geo section to COOR } { *************************************************************************** } IMPORT status_type, {from module MOD_COMMON_GLOBAL_FLAGS } ok,{already_done,}io_failure, {from module MOD_COMMON_GLOBAL_FLAGS } trc_err_init_odb_FW, {from module MOD_DEF_PHYSICS_TABLES } {possible_allocation,}all_none, all_coor,{all_phat, all_redundancy,} {from module MOD_DEF_PHYSICS_TABLES } geosec, {from module MOD_DEF_PHYSICS_TABLES } {state_type,} ON, OFF, {from module MOD_HANDLE_TRACING } trace_info,{trace_warn,}trace_error,{from module MOD_HANDLE_TRACING } inline_tracing, {from module MOD_HANDLE_TRACING } handle_trc_inf, {from module MOD_HANDLE_TRACING } handle_trc_err, {from module MOD_HANDLE_TRACING } handle_trc_sys, {from module MOD_HANDLE_TRACING } modify_trace_inf, {from module MOD_HANDLE_TRACING } modify_trace_wrn, {from module MOD_HANDLE_TRACING } modify_trace_err, {from module MOD_HANDLE_TRACING } modify_io_tracing, {from module MOD_HANDLE_TRACING } modify_db_tracing, {from module MOD_HANDLE_TRACING } save_tracing_status, {from module MOD_HANDLE_TRACING } restore_tracing_status, {from module MOD_HANDLE_TRACING } allocate_trigger, {from module MOD_IO_ALLOCATION_HADLLING } deallocate_trigger, {from module MOD_IO_ALLOCATION_HADLLING } geosec_start_dgtz_signal, {from module MOD_HANDLE_GEOSEC } reset_geosec_strtdig_scaler, {from module MOD_HANDLE_GEOSEC } reset_geosec_febusy_scaler, {from module MOD_HANDLE_GEOSEC } cbus_param_list ; {from module MOD_COMMON_HARD_IO } { *************************************************************************** } { *************************************************************************** } %INCLUDE 'SITE_DEPENDENT.CST/LIST' TYPE byte = [BYTE] 0..255 ; VAR tag : VARYING_STRING(8) := 'INI/ODB%' ; { *************************************************************************** } { *************************************************************************** } PROCEDURE init_all_geosec ( tagext : VARYING_STRING(16) := 'ini_spt%' ; inipar :^cbus_param_list := NIL ; VAR status : [OPTIONAL] status_type ) ; VAR geosecnum : INTEGER ; ini_status : status_type ; local_io_param : BOOLEAN := TRUE ; fail_count : INTEGER ; BEGIN IF PRESENT(status) THEN status := ok ; handle_trc_sys ( TAG := tag + tagext , MESSAGE := ' Initializing all Geographic Sections ' ) ; save_tracing_status ; modify_trace_inf ( CONSOLE := OFF, LOGFILE := OFF, REPORT := FALSE ) ; modify_trace_wrn ( CONSOLE := OFF, LOGFILE := OFF, REPORT := FALSE ) ; IF ( trace_error.logfile = ON ) THEN modify_trace_err ( CONSOLE := OFF, LOGFILE := trc_err_init_odb_fw, REPORT := FALSE ) ELSE modify_trace_err ( CONSOLE := OFF, LOGFILE := OFF, REPORT := FALSE ) ; modify_db_tracing ( STATE := ON, REPORT := FALSE ) ; modify_io_tracing ( STATE := OFF, REPORT := FALSE ) ; { *** allocate memory for the register initialization parameter list *** } IF ( inipar = NIL ) THEN BEGIN local_io_param := TRUE ; NEW ( inipar ) ; deallocate_trigger ( TAGEXT := tagext, REPORT := FALSE ) ; allocate_trigger ( TAGEXT := tagext, CALLER_ID := inipar, REPORT := FALSE ); END ELSE local_io_param := FALSE ; fail_count := 0 ; FOR geosecnum := firstgeosec TO lastgeosec DO BEGIN initialize_geosec ( GEOSECNUM := geosecnum, TAGEXT := tagext, INIPAR := inipar, STATUS := ini_status ) ; IF ( ini_status = io_failure ) THEN BEGIN fail_count := fail_count + 1 ; IF ( inline_tracing(trace_error) <> 0 ) THEN handle_trc_err ( TAG := tag + tagext, MESSAGE := ' Failure Initializing Geographic Section #' + CONVERT(STRING,geosecnum) ) ; END ; END ; { *** release the memory from the register initialization io parameters *** } IF ( local_io_param = TRUE ) THEN BEGIN DISPOSE ( inipar ) ; deallocate_trigger ( TAGEXT := tagext, REPORT := FALSE ) ; END ; restore_tracing_status ( REPORT := FALSE ) ; IF ( fail_count <> 0 ) THEN BEGIN handle_trc_err ( TAG := tag + tagext, MESSAGE := ' Geo Section Initialization Failure Count Is ' + CONVERT(STRING,fail_count) + ', Check Log File' ) ; IF PRESENT(status) THEN status := io_failure ; END ; END ; { *************************************************************************** } { *************************************************************************** } PROCEDURE initialize_geosec ( tagext : VARYING_STRING(16) := '' ; geosecnum : INTEGER ; inipar :^cbus_param_list := NIL ; VAR status :[OPTIONAL] status_type ) ; VAR ini_status : status_type ; local_io_param : BOOLEAN := TRUE ; BEGIN IF PRESENT(status) THEN status := ok ; { *** allocate memory for the register initialization parameter list *** } IF ( inipar = NIL ) THEN NEW ( inipar ) ELSE local_io_param := FALSE ; IF ( inline_tracing(trace_info) <> 0 ) THEN handle_trc_inf ( TAG := tag + tagext, MESSAGE := ' Initializing Geo Section # ' + CONVERT(STRING,geosecnum) ) ; geosec_start_dgtz_signal ( TAGEXT := tagext, GEOSECNUM := geosecnum, ENABLE := TRUE, IOPAR := inipar, STATUS := ini_status ) ; IF ( ini_status = io_failure ) THEN BEGIN IF ( inline_tracing(trace_error) <> 0 ) THEN handle_trc_err ( TAG := tag + tagext, MESSAGE := ' Failure Initializing Geo Section #' + CONVERT(STRING,geosecnum) + ' for Normal Start Digitize' ) ; IF PRESENT(status) THEN status := ini_status ; END ; reset_geosec_strtdig_scaler ( TAGEXT := tagext, GEOSECNUM := geosecnum, IOPAR := inipar, STATUS := ini_status ) ; IF ( ini_status = io_failure ) THEN BEGIN IF ( inline_tracing(trace_error) <> 0 ) THEN handle_trc_err ( TAG := tag + tagext, MESSAGE := ' Failure Initializing Geo Section #' + CONVERT(STRING,geosecnum) + ' Reset Start Digitize Scaler ' ) ; IF PRESENT(status) THEN status := ini_status ; END ; reset_geosec_febusy_scaler ( TAGEXT := tagext, GEOSECNUM := geosecnum, IOPAR := inipar, STATUS := ini_status ) ; IF ( ini_status = io_failure ) THEN BEGIN IF ( inline_tracing(trace_error) <> 0 ) THEN handle_trc_err ( TAG := tag + tagext, MESSAGE := ' Failure Initializing Geo Section #' + CONVERT(STRING,geosecnum) + ' Reset Front End Busy Scaler ' ) ; IF PRESENT(status) THEN status := ini_status ; END ; { *** release the memory from the register initialization io parameters *** } IF ( local_io_param = TRUE ) THEN BEGIN DISPOSE ( inipar ) ; END ; geosec[geosecnum]^.status.initialized := TRUE ; geosec[geosecnum]^.allocated := ALL_NONE ; END ; { *************************************************************************** } { *************************************************************************** } PROCEDURE restore_all_geosec ( tagext : VARYING_STRING(16) := 'ini_spt%' ; inipar :^cbus_param_list := NIL ; VAR status : [OPTIONAL] status_type ) ; VAR geosecnum : INTEGER ; ini_status : status_type ; local_io_param : BOOLEAN := TRUE ; fail_count : INTEGER ; BEGIN IF PRESENT(status) THEN status := ok ; handle_trc_sys ( TAG := tag + tagext , MESSAGE := ' Restoring all Geographic Sections ' ) ; save_tracing_status ; modify_trace_inf ( CONSOLE := OFF, LOGFILE := OFF, REPORT := FALSE ) ; modify_trace_wrn ( CONSOLE := OFF, LOGFILE := OFF, REPORT := FALSE ) ; IF ( trace_error.logfile = ON ) THEN modify_trace_err ( CONSOLE := OFF, LOGFILE := trc_err_init_odb_fw, REPORT := FALSE ) ELSE modify_trace_err ( CONSOLE := OFF, LOGFILE := OFF, REPORT := FALSE ) ; modify_db_tracing ( STATE := ON, REPORT := FALSE ) ; modify_io_tracing ( STATE := OFF, REPORT := FALSE ) ; { *** allocate memory for the register initialization parameter list *** } IF ( inipar = NIL ) THEN BEGIN local_io_param := TRUE ; NEW ( inipar ) ; deallocate_trigger ( TAGEXT := tagext, REPORT := FALSE ) ; allocate_trigger ( TAGEXT := tagext, CALLER_ID := inipar, REPORT := FALSE ); END ELSE local_io_param := FALSE ; fail_count := 0 ; FOR geosecnum := firstgeosec TO lastgeosec DO BEGIN restore_geosec ( GEOSECNUM := geosecnum, TAGEXT := tagext, INIPAR := inipar, STATUS := ini_status ) ; IF ( ini_status = io_failure ) THEN BEGIN fail_count := fail_count + 1 ; IF ( inline_tracing(trace_error) <> 0 ) THEN handle_trc_err ( TAG := tag + tagext, MESSAGE := ' Failure Restoring Geographic Section #' + CONVERT(STRING,geosecnum) ) ; END ; END ; { *** release the memory from the register initialization io parameters *** } IF ( local_io_param = TRUE ) THEN BEGIN DISPOSE ( inipar ) ; deallocate_trigger ( TAGEXT := tagext, REPORT := FALSE ) ; END ; restore_tracing_status ( REPORT := FALSE ) ; IF ( fail_count <> 0 ) THEN BEGIN handle_trc_err ( TAG := tag + tagext, MESSAGE := ' Geo Section Initialization Failure Count Is ' + CONVERT(STRING,fail_count) + ', Check Log File' ) ; IF PRESENT(status) THEN status := io_failure ; END ; END ; { *************************************************************************** } { *************************************************************************** } PROCEDURE restore_geosec ( tagext : VARYING_STRING(16) := '' ; geosecnum : INTEGER ; inipar :^cbus_param_list := NIL ; VAR status :[OPTIONAL] status_type ) ; VAR ini_status : status_type ; local_io_param : BOOLEAN := TRUE ; restore_start_dgtz : byte ; BEGIN IF PRESENT(status) THEN status := ok ; { *** allocate memory for the register initialization parameter list *** } IF ( inipar = NIL ) THEN NEW ( inipar ) ELSE local_io_param := FALSE ; IF ( inline_tracing(trace_info) <> 0 ) THEN handle_trc_inf ( TAG := tag + tagext, MESSAGE := ' Restoring Geo Section # ' + CONVERT(STRING,geosecnum) ) ; restore_start_dgtz := 1 - geosec[geosecnum]^.acqsignal.start_digit::byte ; geosec_start_dgtz_signal ( TAGEXT := tagext, GEOSECNUM := geosecnum, ENABLE := restore_start_dgtz::BOOLEAN, IOPAR := inipar, STATUS := ini_status ) ; IF ( ini_status = io_failure ) THEN BEGIN IF ( inline_tracing(trace_error) <> 0 ) THEN handle_trc_err ( TAG := tag + tagext, MESSAGE := ' Failure Restoring Geo Section #' + CONVERT(STRING,geosecnum) + ' Start Digitize ' + CONVERT(STRING,geosec[geosecnum]^.acqsignal.start_digit) ) ; IF PRESENT(status) THEN status := ini_status ; END ; reset_geosec_strtdig_scaler ( TAGEXT := tagext, GEOSECNUM := geosecnum, IOPAR := inipar, STATUS := ini_status ) ; IF ( ini_status = io_failure ) THEN BEGIN IF ( inline_tracing(trace_error) <> 0 ) THEN handle_trc_err ( TAG := tag + tagext, MESSAGE := ' Failure Restoring Geo Section #' + CONVERT(STRING,geosecnum) + ' Reset Start Digitize Scaler ' ) ; IF PRESENT(status) THEN status := ini_status ; END ; reset_geosec_febusy_scaler ( TAGEXT := tagext, GEOSECNUM := geosecnum, IOPAR := inipar, STATUS := ini_status ) ; IF ( ini_status = io_failure ) THEN BEGIN IF ( inline_tracing(trace_error) <> 0 ) THEN handle_trc_err ( TAG := tag + tagext, MESSAGE := ' Failure Restoring Geo Section #' + CONVERT(STRING,geosecnum) + ' Reset Front End Busy Scaler ' ) ; IF PRESENT(status) THEN status := ini_status ; END ; { *** release the memory from the register initialization io parameters *** } IF ( local_io_param = TRUE ) THEN BEGIN DISPOSE ( inipar ) ; END ; END ; { *************************************************************************** } { *************************************************************************** } PROCEDURE check_alloc_geosec_coor ( geosecnum : INTEGER ; tagext : VARYING_STRING(8) := '' ) ; BEGIN IF ( geosec[geosecnum]^.allocated <> all_coor ) THEN BEGIN IF ( geosec[geosecnum]^.status.initialized <> TRUE ) THEN initialize_geosec ( GEOSECNUM := geosecnum, TAGEXT := tagext ) ; IF ( inline_tracing(trace_info) <> 0 ) THEN handle_trc_inf ( TAG := tag + tagext, MESSAGE := ' Allocating Geographic Section #' + CONVERT(STRING,geosecnum) + ' to COOR' ) ; geosec[geosecnum]^.allocated := all_coor ; END ; END ; { *************************************************************************** } { *************************************************************************** } END .