1 /****^  ***********************************************************
  2         *                                                         *
  3         * Copyright, (C) Honeywell Bull Inc., 1987                *
  4         *                                                         *
  5         * Copyright, (C) Honeywell Information Systems Inc., 1983 *
  6         *                                                         *
  7         *********************************************************** */
  8 
  9 /****^  HISTORY COMMENTS:
 10   1) change(85-09-09,Farley), approve(85-09-09,MCR6979),
 11      audit(86-01-16,CLJones), install(86-03-21,MR12.0-1033):
 12      Support FIPS by
 13      adding "ipc fips" card.
 14                                                    END HISTORY COMMENTS */
 15 
 16 /* config deck searches and the like */
 17 
 18 /* Written Patriots' Day, 1983 by Chris Jones */
 19 /* Modified Jan 1985 by Paul Farley to add IPC FIPS. */
 20 
 21 /* format: style4,delnl,insnl,indattr,ifthen,dclind10 */
 22 ioi_config:
 23      proc;
 24 
 25 dcl       p_chanid               char (8) aligned;
 26 
 27 dcl       chanid                 char (8) aligned;
 28 dcl       channo                 fixed bin (7);
 29 dcl       code                   fixed bin (35);
 30 dcl       iomno                  fixed bin (3);
 31 dcl       portno                 fixed bin;
 32 
 33 dcl       config_$find           entry (char (4) aligned, ptr);
 34 
 35 dcl       (divide, hbound, lbound, max, null, substr)
 36                                  builtin;
 37 ^L
 38 /* Entry to find the controller (e.g. MPC or IPC) card in the config deck which contains a given channel.
 39    It returns a pointer to the first such card it finds (there should only be one of them)
 40    or null if it can't find one. */
 41 
 42 find_controller_card:
 43      entry (p_chanid) returns (ptr);
 44 
 45           call find_controller_card_proc;
 46           return (mpc_cardp);
 47 ^L
 48 /* Entry to return the base channel of the given channel. */
 49 
 50 find_base_channel:
 51      entry (p_chanid) returns (char (8) aligned);
 52 
 53           call find_controller_card_proc;                   /* leaves mpc_cardp pointing at the right card */
 54           if mpc_cardp = null () then
 55                return ("");                                 /* let our caller decide what to make of this */
 56           if mpc_card.word = IPC_CARD_WORD then do;
 57                ipc_cardp = mpc_cardp;
 58                if (ipc_card.iom = iomno) & (ipc_card.chan <= channo) & (channo < ipc_card.chan + ipc_card.nchan) then do;
 59                     call io_chnl_util$iom_to_name (ipc_card.iom, (ipc_card.chan), chanid, code);
 60                     if code = 0 then
 61                          return (chanid);
 62                     else return ("");                       /* oh well... */
 63                end;
 64           end;
 65           if (substr (mpc_card.name, 1, 3) ^= "msp") & (substr (mpc_card.name, 1, 3) ^= "mtp") then
 66                return (p_chanid);                           /* not a multiplexed MPC, every channel is a base */
 67 
 68           do portno = lbound (mpc_card_array.port, 1) to hbound (mpc_card_array.port, 1);
 69                if (mpc_card_array.port (portno).iom = iomno) & (mpc_card_array.port (portno).chan <= channo)
 70                     & (channo < mpc_card_array.port (portno).chan + mpc_card_array.port (portno).nchan) then do;
 71                     call io_chnl_util$iom_to_name (mpc_card_array.port (portno).iom, (mpc_card_array.port (portno).chan),
 72                          chanid, code);
 73                     if code = 0 then
 74                          return (chanid);
 75                     else return ("");                       /* oh well... */
 76                end;
 77           end;
 78 
 79           return ("");                                      /* can't happen... */
 80 ^L
 81 find_controller_card_proc:
 82      proc;
 83 
 84           chanid = p_chanid;
 85           mpc_cardp, ipc_cardp = null ();                   /* Start at the beginning of the config deck. */
 86           call io_chnl_util$name_to_iom (chanid, iomno, channo, code);
 87           if code ^= 0 then
 88                return;                                      /* illegal chanid, can't be on any mpc card */
 89 
 90           call config_$find (MPC_CARD_WORD, mpc_cardp);     /* find first mpc card */
 91           do while (mpc_cardp ^= null ());                  /* ...or until we find what we're looking for */
 92                do portno = lbound (mpc_card_array.port, 1) to hbound (mpc_card_array.port, 1);
 93                     if (mpc_card_array.port (portno).iom = iomno) & (mpc_card_array.port (portno).chan <= channo)
 94                          & (channo < mpc_card_array.port (portno).chan + mpc_card_array.port (portno).nchan) then
 95                          return;                            /* this is the one */
 96                end;
 97                call config_$find (MPC_CARD_WORD, mpc_cardp);/* on to the next one */
 98           end;
 99 
100           call config_$find (IPC_CARD_WORD, ipc_cardp);     /* find first ipc card */
101           do while (ipc_cardp ^= null ());                  /* ...or until we find what we're looking for */
102                if ipc_card.type = IPC_FIPS then do;         /* for now only fips */
103                     if (ipc_card.iom = iomno) & (ipc_card.chan <= channo) & (channo < ipc_card.chan + ipc_card.nchan)
104                     then do;
105                          mpc_cardp = ipc_cardp;             /* this is the one */
106                          return;
107                     end;
108                end;
109                call config_$find (IPC_CARD_WORD, ipc_cardp);/* on to the next one */
110           end;
111           return;                                           /* wasn't on any of the card, signal failure */
112 
113      end find_controller_card_proc;
114 ^L
115 %include io_chnl_util_dcls;
116 %page;
117 %include config_mpc_card;
118 %page;
119 %include config_ipc_card;
120      end ioi_config;