From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, T_FILL_THIS_FORM_SHORT,XPRIO,XPRIO_SHORT_SUBJ autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d75f04f109545fcd,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-19 12:55:52 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!news.gtei.net!enews.sgi.com!coop.net!newsfeed1.global.lmco.com!news.orl.lmco.com!news From: "mop" Newsgroups: comp.lang.ada Subject: help Date: Wed, 19 Sep 2001 15:51:54 -0400 Organization: Lockheed Martin -- Information Systems Center Message-ID: <9oat17$psl$1@zeus.orl.lmco.com> NNTP-Posting-Host: orlsr006538.orl.lmco.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Xref: archiver1.google.com comp.lang.ada:13189 Date: 2001-09-19T15:51:54-04:00 List-Id: 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);