comp.lang.ada
 help / color / mirror / Atom feed
From: "mop" <mop65715@pegasus.cc.ucf.edu>
Subject: help
Date: Wed, 19 Sep 2001 15:51:54 -0400
Date: 2001-09-19T15:51:54-04:00	[thread overview]
Message-ID: <9oat17$psl$1@zeus.orl.lmco.com> (raw)


i need a procedure/function to compute the checksum on this record and put
result in last byte "Checksum" of record.  my data is really 8 8 bit words
though my for use clause has a 32 bit "type" setup.

in my spec.
  type COMMAND_TYPE is
    record
      Command                         : CT.UNSIGNED_3;
      Mode                            :  MODE_TYPE;
      Spare1                          : CT.UNSIGNED_3;
      Mode_Command                    : MODE_COMMAND_TYPE;
      Spare2                          : CT.UNSIGNED_2;
      Power_Removal_Indication        : POWER_REMOVAL_INDICATION_TYPE;
      Spare3                          : CT.UNSIGNED_2;
      Energy                          : ENERGY_TYPE;
      Spare4                          : CT.UNSIGNED_1;
      Fan_Control                     : FAN_CONTROL_TYPE;
      Receiver_Test                   : RECEIVER_TEST_TYPE;
      TPG_Control                     : TPG_CONTROL_TYPE;
      Position                        : POSITION_TYPE;
      Length                          : LENGTH_TYPE;
      Spare5                          : CT.BYTE;
      Spare6                          : CT.BYTE;
      Spare7                          : CT.BYTE;
      Table_Number                    : CT.UNSIGNED_4;
      Spare8                          : CT.UNSIGNED_4;
      Checksum                        : CT.BYTE;
    end record;

  --  Variable_Name                     Base_Offset  Size
  ----------------------------------------------------------
  for COMMAND_TYPE use
    record
      Command                         at 0 range 0 .. 2;     -- 3 bits
      Mode                            at 0 range 3 .. 3;     -- 1 bit
      Spare1                          at 0 range 4 .. 7;     -- 3 bits
      Mode_Command                    at 0 range 8 .. 10;    -- 3 bits
      Spare2                          at 0 range 11 ..12;    -- 2 bits
      Power_Removal_Indication        at 0 range 13 .. 13;   -- 1 bit
      Spare3                          at 0 range 14 .. 15;   -- 2 bits
      Energy                          at 0 range 16 .. 17;   -- 2 bits
      Spare4                          at 0 range 18 .. 18;   -- 1 bit
      Fan_Control                     at 0 range 19 .. 19;   -- 1 bit
      Receiver_Test                   at 0 range 20 .. 20;   -- 1 bit
      TPG_Control                     at 0 range 21 .. 21;   -- 1 bit
      Position                        at 0 range 22 .. 22;   -- 1 bit
      Length                          at 0 range 23 .. 23;   -- 1 bit
      Spare5                          at 0 range 24 .. 31;
      Spare6                          at 1 range 0  .. 7;
      Spare7                          at 1 range 8  .. 15;
      Table_Number                    at 1 range 16 .. 19;   -- 4 bits
      Spare8                          at 1 range 20 .. 23;   -- 4 bits
      Checksum                        at 1 range 24 .. 31;
    end record;
  for COMMAND_TYPE'size use 64;



in my body.  I have default values setup.  this will change of course
depending on user selection.  Again I need a procedure/function to compute
the checksum and store value in "Checksum"

 CMD_Data : COMMAND_TYPE := (
     Command                   => 1,
     Mode                      => Normal_Mode,
     Spare1                    => 0,
     Mode_Command              => Standby,
     Spare2                    => 0,
     Power_Removal_Indication  => Power_Applied,
     Spare3                    => 0,
     Energy                    => Normal_Mode,
     Spare4                    => 0,
     Fan_Control               => Turn_Fan_Off,
     Receiver_Test             => Receiver_Normal,
     TPG_Control               => TPG_Normal,
     Position                  => Left,
     Length                    => Short,
     Spare5                    => 0,
     Spare6                    => 0,
     Spare7                    => 0,
     Table_Number              => 0,
     Spare8                    => 0,
     Checksum                  => 1);



















             reply	other threads:[~2001-09-19 19:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-19 19:51 mop [this message]
2001-09-20  8:41 ` help John McCabe
  -- strict thread matches above, loose matches on Subject: below --
1998-12-07  0:00 help Salvador
1998-12-07  0:00 ` help dennison
1997-02-27  0:00 Help Desperate
1997-03-04  0:00 ` Help Jim Dorman
1996-11-15  0:00 Help Alexander B. Schmidt
1996-11-15  0:00 ` Help Michael Paus
1996-11-18  0:00 ` Help Norman H. Cohen
1996-11-19  0:00 ` Help Matthew Heaney
1994-10-19 16:26 HELP CONDIC
1994-10-14  3:33 HELP Chiu Bo (Hung Chiu Hung)
1994-10-14 13:21 ` HELP Robert Dewar
1994-10-15 14:56   ` HELP Bob Duff
1994-10-18 16:31     ` HELP Robert Dewar
1994-10-16  5:11   ` HELP Chiu Bo (Hung Chiu Hung)
1994-10-14 19:36 ` HELP riehler
1994-10-14 19:36 ` HELP Richard Riehle
1994-10-19  3:10 ` HELP Michael M. Bishop
1993-03-12 22:28 Help Basavaraj B Patil
1990-08-01 18:19 Help Kenneth Anderson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox