
{ DECK: IOT$IPI_TAPE_STATUS

  CONST  { in bytes }
    ioc$ipi_tape_status_size = 3 * 8,  { length up to major status header }
    ioc$ipi_max_status_size = 256,  { includes major status }
    ioc$major_status_size = 10,
    ioc$min_ipi_total_resp_size = ioc$min_response_length + ioc$bid_area_size + ioc$ipi_tape_status_size;

  TYPE
    iot$ipi_tape_status = PACKED RECORD
      error_id: 0 .. 0ffff(16),               { see CONST below
      function_with_timeout: 0 .. 0ffff(16),
      ipi_status_register: 0 .. 0ffff(16),
      ipi_error_register: 0 .. 0ffff(16),
      down_status: 0 .. 0ffff(16),
      i4_dma_control_register: 0 .. 0ffff(16),
      i4_dma_operational_status_reg: 0 .. 0ffff(16),
      i4_dma_error_register: 0 .. 0ffff(16),
      special_status: iot$special_ipi_status,
      major_status_header: ALIGNED iot$ipi_major_status_header,
      major_status: iot$ipi_major_status,
      ipi_status: ARRAY [ioc$major_status_size + 1 .. ioc$ipi_max_status_size] OF 0 .. 0ff(16),
    RECEND;

  TYPE
    iot$special_ipi_status = PACKED RECORD
      length: 0 .. 0ff(16),   {02}
      parm: 0 .. 0ff(16),     {52(16)}
      beginning_of_media: boolean,
      end_of_media: boolean,
      media_present: boolean,
      logical_end_of_media: boolean,
      fill: 0 .. 3,
      density: boolean,        { F = 1600, T = 6250 }
      write_protect: boolean,  { F = ring in, T = ring out }
      fill1: 0 .. 0ffffffffff(16),
    RECEND,

    iot$ipi_major_status_header = PACKED RECORD
      length: 0 .. 0ffff(16),
      fill: 0 .. 0ffff(16),
      ipi_command: 0 .. 0ffff(16),
      slave_address: 0 .. 0ff(16),
      facility_address: 0 .. 0ff(16),
    RECEND,

    iot$ipi_major_status = PACKED RECORD
      command_exception: boolean,
      machine_exception: boolean,
      alternate_port_exception: boolean,
      intervention_required: boolean,
      microcode_exception: boolean,
      fill1: 0 .. 7,
      response_type: 0 .. 0f(16),    { see CONST below
      successful: boolean,
      incomplete: boolean,
      conditional_success: boolean,
      command_aborted: boolean,
    RECEND;

  CONST  {define constants for response_type in iot$ipi_major_status

    ioc$standard_command_completion = 1,
    ioc$asynchronous_response = 4,
    ioc$transfer_notification = 5;

  CONST  { define constants for error_id in iot$ipi_major_status

    ioc$ipi_indeterminate_error = 0,
    ioc$ipi_function_timeout = 1,
    ioc$chan_empty_when_act = 2,
    ioc$period_counter_error = 3,
    ioc$upper_ici_parity = 4,
    ioc$lower_ici_parity = 5,
    ioc$iou_error = 6,
    ioc$incomplete_i4_transfer = 7,
    ioc$channel_not_empty = 8,
    ioc$central_memory_error = 9,
    ioc$invalid_cm_resp_code = 10,
    ioc$cm_resp_code_parity = 11,
    ioc$cmi_read_data_parity = 12,
    ioc$jy_data_error = 13,
    ioc$bas_parity_error = 14,
    ioc$lz_error = 15,
    ioc$yj_error = 16,
    ioc$lx_error = 17,
    ioc$dma_test_mode_failure = 18,
    ioc$illegal_operation = 19,
    ioc$can_not_select_controller = 20,
    ioc$bit_sign_response_error = 21,
    ioc$no_sync_in = 22,
    ioc$sync_in_did_not_drop = 23,
    ioc$ipi_sequence_error = 24,
    ioc$upper_ipi_chan_parity = 25,
    ioc$lower_ipi_chan_parity = 26,
    ioc$slave_in_not_set = 27,
    ioc$slave_in_did_not_drop = 28,
    ioc$incomplete_transfer = 29,
    ioc$channel_stayed_active = 30,
    ioc$buffer_counter_error = 31,
    ioc$sync_counter_error = 32,
    ioc$lost_data = 33,
    ioc$bus_parity = 34,
    ioc$command_reject = 35,
    ioc$sync_outs_ne_sync_ins = 36,
    ioc$bus_b_ack_incorrect = 37,
    ioc$no_controller_interrupt = 38,
    ioc$ending_status_wrong = 39,
    ioc$slave_encoded_end_status = 40,
    ioc$executing_controller_diag = 50,
    ioc$controller_diag_passed = 51,
    ioc$hdw_corrected_errors = 52,
    ioc$ipi_controller_failure = 60,
    ioc$drive_failure = 61,
    ioc$internal_controller_error = 70,
    ioc$controller_intervention_req = 71,
    ioc$controller_mach_excep = 72,
    ioc$command_exception = 73,
    ioc$microcode_execution_error = 74,
    ioc$alternate_port_exception = 75,
    ioc$unexpected_response = 76,
    ioc$drive_reserved = 77,
    ioc$no_block_id_returned = 78,
    ioc$unexpected_class_2 = 79,
    ioc$drive_not_operational = 80,
    ioc$drive_not_ready = 81,
    ioc$drive_intervention_req = 82,
    ioc$physical_interface_check = 83,
    ioc$operation_timeout = 84,
    ioc$drive_machine_exception = 85,
    ioc$fatal_error = 86,
    ioc$drive_conditional_success = 87,
    ioc$position_lost = 88,
    ioc$drive_res_to_other_cont = 89,
    ioc$no_end_of_extent = 90,
    ioc$data_length_difference = 91,
    ioc$ipi_tape_medium_failure = 100,
    ioc$ipi_id_burst_error = 101,
    ioc$ipi_unable_to_set_agc = 102,
    ioc$master_slave_data_integrity = 110,
    ioc$slave_fac_data_integrity = 111,
    ioc$pp_detect_software_failure = 120,
    ioc$illegal_abnormal_status = 121,
    ioc$interface_error_wo_eid = 122,
    ioc$invalid_response_type = 123,
    ioc$no_alert_cond_set = 124,
    ioc$no_bits_in_abnormal_status = 125,
    ioc$max_ipi_error_id = 130;

  TYPE
    iot$analyzed_ipi_tape_response = PACKED RECORD
      id24_present: boolean,
      id26_present: boolean,
      id19_present: boolean,
      id29_present: boolean,
      id2a_present: boolean,
      sense_bytes_present: boolean,
      id24_byte1: ALIGNED iot$id24_byte1,
      id26_byte1: ALIGNED iot$id26_byte1,
      id26_byte2: ALIGNED iot$id26_byte2,
      id26_byte4: ALIGNED iot$id26_byte4,
      id2a_byte3: ALIGNED iot$id2a_byte3,
      sense_bytes: ALIGNED iot$mtc_sense_bytes,
    recend;

  TYPE
    iot$id24_byte1 = PACKED RECORD
      not_p_available: boolean,
      not_ready: boolean,
      not_p_avail_transition: boolean,
      not_ready_transition: boolean,
      fill1: 0 .. 1,
      corrupted_attr_table: boolean,
      addressee_busy: boolean,
      fill2: 0 .. 1,
    recend,

    iot$id26_byte1 = PACKED RECORD
      no_longer_busy: boolean,
      p_avail_transition: boolean,
      ready_transition: boolean,
      operation_timeout: boolean,
      physical_interface_check: boolean,
      fill1: 0 .. 7,
    recend,

    iot$id26_byte2 = PACKED RECORD
      fill1: 0 .. 1,
      data_check: boolean,
      fatal_error: boolean,
      hardware_write_protected: boolean,
      queue_full_check: boolean,
      fill2: 0 .. 7,
    recend,

    iot$id26_byte4 = PACKED RECORD
      error_log_full: boolean,
      fill1: 0 .. 3,
      position_lost: boolean,
      fill2: 0 .. 0f(16),
    recend,

    iot$id2a_byte3 = PACKED RECORD
      beginning_of_media: boolean,
      end_of_media: boolean,
      end_of_extent: boolean,
      block_length_difference: boolean,
      blank_tape: boolean,
      data_length_difference: boolean,
      fill1: 0 .. 3,
    recend,

    iot$mtc_sense_bytes = PACKED RECORD
      command_reject: boolean,             { byte 0
      intervention_required: boolean,
      bus_out_check: boolean,
      equip_check: boolean,
      data_check: boolean,
      overrun: boolean,
      wordcount_zero: boolean,
      fill1: 0 .. 1,
      noise: boolean,                      { byte 1
      mt_status_a: boolean,
      mt_status_b: boolean,
      fill2: 0 .. 1,
      beginning_of_tape: boolean,
      write_status: boolean,
      file_protect: boolean,    { true = ring out
      not_capable_of_density: boolean,
      track_in_error: 0 .. 0ff(16),        { byte 2
      r_w_vrc: boolean,                    { byte 3
      mte_lrc: boolean,
      skew_error: boolean,
      edc_crc: boolean,
      env_ecc: boolean,
      tu_set_1600_bpi: boolean,
      backward: boolean,
      c_p_compare: boolean,
      mp_hdw_error: boolean,               { byte 4
      reject_tu: boolean,
      end_of_tape: boolean,
      write_vrc: boolean,
      valid_tape_mark: boolean,
      lwr: boolean,
      tu_check: boolean,
      dead_par_track: boolean,
      fill3: 0 .. 3,                       { byte 5
      tm_check: boolean,
      id_burst_check: boolean,
      start_rd_check: boolean,
      partial_record: boolean,
      postamble_error: boolean,
      fill4: 0 .. 1,
      fill5: 0 .. 3,                       { byte 6
      dual_density: boolean,
      not_1600_bpi: boolean,
      model: 0 .. 0f(16),
      lamp_failure: boolean,               { byte 7
      tape_bottom: boolean,
      dsp_error: boolean,
      reset_key: boolean,
      dse: boolean,
      head_failure: boolean,
      micro_p_check: boolean,
      load_failure: boolean,
      ibg_detect: boolean,                 { byte 8
      compress_bytcnt_err: boolean,
      fill6: 0 .. 1,
      early_rd_back_check: boolean,
      control_burst_check: boolean,
      slow_rd_back_check: boolean,
      slow_end_read_check: boolean,
      velocity_retry: boolean,
      den_6250_correct: boolean,           { byte 9
      velocity_change: boolean,
      ch_buffer_check: boolean,
      crc_iii: boolean,
      den_6250_capable: boolean,
      fill7: 0 .. 3,
      tcu_reserved: boolean,
    recend;

?? PUSH(LISTEXT := ON) ??
*copyc iot$pp_response
*copyc iot$tape_device_status
?? POP ??
