Language selection

Search

Patent 2374782 Summary

Third-party information liability

Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements.

Claims and Abstract availability

Any discrepancies in the text and image of the Claims and Abstract are due to differing posting times. Text of the Claims and Abstract are posted:

  • At the time the application is open to public inspection;
  • At the time of issue of the patent (grant).
(12) Patent Application: (11) CA 2374782
(54) English Title: BROADCAST DOWNLOAD TECHNIQUE
(54) French Title: TECHNIQUE DE TELECHARGEMENT DE DONNEES DE DIFFUSION
Status: Dead
Bibliographic Data
(51) International Patent Classification (IPC):
  • H04W 24/02 (2009.01)
  • G06F 9/445 (2018.01)
  • H04B 7/26 (2006.01)
  • H04L 12/28 (2006.01)
  • H04W 4/06 (2009.01)
  • H04W 16/26 (2009.01)
  • H04W 88/08 (2009.01)
  • H04W 92/04 (2009.01)
  • G06F 9/445 (2006.01)
  • H04Q 7/32 (2006.01)
(72) Inventors :
  • PELLETIER, JAMES A. (United States of America)
  • HERBERT, THOMAS G. (United States of America)
  • RIGAZIO, JOSEPH L., III (United States of America)
(73) Owners :
  • TRANSCEPT, INC. (United States of America)
(71) Applicants :
  • TRANSCEPT, INC. (United States of America)
(74) Agent: RIDOUT & MAYBEE LLP
(74) Associate agent:
(45) Issued:
(86) PCT Filing Date: 2000-05-19
(87) Open to Public Inspection: 2000-11-30
Examination requested: 2001-11-20
Availability of licence: N/A
(25) Language of filing: English

Patent Cooperation Treaty (PCT): Yes
(86) PCT Filing Number: PCT/US2000/013889
(87) International Publication Number: WO2000/072139
(85) National Entry: 2001-11-20

(30) Application Priority Data:
Application No. Country/Territory Date
09/315,752 United States of America 1999-05-20

Abstracts

English Abstract




In a wireless microcell distribution system, a multicast system is provided
for broadcasting software updates, enable and disable capabilities, channel
reassignments or other downloadable data simultaneously to a plurality of
cable microcell integrators, thereby precluding the lengthy unicast process of
updating cable microcell integrators manually or suffering prior unreliable
message delivery in which each of the cable microcell integrators in
individually addressed and the response tallied. In one embodiment, the
request is transmitted simultaneously in a broadcast mode to multiple cable
microcell integrators with no response required. Thereafter, each cable
microcell integrator is queried on a unicast basis as to receipt of broadcast
information and as to whether or not any portion must be re-broadcast. If so
optionally the entire information set can be rebroadcast, with only affected
cable microcell integrators downloading the broadcast information. The
multicast broadcast technique thus provides rapid simultaneous updating of
each of the cable microcell integrators from a central location.


French Abstract

L'invention concerne un système de répartition de microcellules sans fil dans lequel un système multidestinataire est destiné à diffuser des mises à jour de logiciels, des capacités d'activation et de désactivation ou d'autres données pouvant être téléchargées simultanément vers plusieurs circuits d'intégration de microcellules à câble, ce qui évite de recourir au procédé long, sur la base d'un destinataire unique, de mise à jour de circuits d'intégration de microcellules à câble manuellement ou d'envoi antérieur non fiable de messages adressés individuellement à chaque circuit d'intégration de microcellule à câble, suivi d'un contrôle de la réponse. Dans un mode de réalisation, la demande est transmise simultanément en mode de diffusion à plusieurs circuits d'intégration de microcellules à câble sans exigence de réponse. Ensuite, chaque circuit d'intégration de microcellule à câble est interrogé, sur la base d'un destinataire unique, sur la réception des données de diffusion et sur la nécessité ou non de rediffuser une partie déterminée. Si éventuellement les données doivent être rediffusées dans leur intégralité, seuls les circuits d'intégration de microcellules à câble concernés téléchargent les données de diffusion. Ainsi, la technique de diffusion multidestinataire permet d'effectuer une mise à jour simultanée rapide de chaque circuit d'intégration de microcellule à câble à partir d'une position centrale.

Claims

Note: Claims are shown in the official language in which they were submitted.





WHAT IS CLAIMED IS:

1. A system for use in a wireless microcell distribution system for rapidly
downloading information from a first location to a plurality of remote
locations at which
cable microcell integrators (14, 16, 18, 20) are located, comprising:
means (10) for broadcasting information to update said cable microcell
integrators
from said first location;
and characterized in that:
said that multiple cable microcell integrators are simultaneously provided
with update
information with no response required from the cable microcell integrators to
said first
location; and
means (10), at said first location, for transmitting to said cable microcell
integrators a
request to have each of said cable microcell integrators reconfigure itself to
receive broadcast
messages, thereby to establish a broadcast mode for each of said cable
microcell integrators.

2. The system of Claim 1, and further including means (10) at said first
location for
sending a query message to each of said cable microcell integrators
separately, with said
message inquiring as to the receipt of the information broadcast.

3. The system of Claim 1, wherein the transmission of said reconfiguration
request is
accomplished serially on an address-by-address unicast basis.

4. The system of Claim 1, and further including at each cable microcell
integrator
means for ascertaining the integrity of the message broadcast from said first
location, thus to
provide the status of the information broadcast to the cable microcell
integrator; and means
for transmitting the status of a received broadcast at a cable microcell
integrator to said first
location.

5. The system of Claim 4, and further including means (10) at said first
location for
evaluating the status of broadcast messages from each of the associated cable
microcell
integrators and for rebroadcasting information back to all of said cable
microcell integrators
for the purpose of correcting improperly received information at a cable
microcell integrator.



75



6. The system of Claim 7, and further including means at each of said cable
microcell
integrators for ascertaining which of said re-broadcast information is to
replace improperly
received information and for replacing the improperly received information
with the
appropriate re-broadcast information.

7. A method for transmitting information from a head end control unit (10) of
a
wireless microcell distribution system to a plurality of cable microcell
integrators (14,16,18,
20), comprising:
broadcasting the information from the head end control unit to each of the
cable
microcell integrators;
and characterized by:
unicasting a message from the head end control unit to each of the plurality
of cable
microcell integrators to enter a broadcast mode; and
unicasting a message from the head end control unit to each of the plurality
of cable
microcell integrators to exit the broadcast mode.

8. The method of claim 7, further comprising unicasting a broadcast status
query
message from the head end control unit to each of the plurality of cable
microcell integrators.

9. The method of claim 8, wherein broadcasting the information is selected
from
the group consisting of broadcasting a software update and broadcasting a
channel
reassignment.

10. The method of claim 8, further comprising each of the plurality of cable
microcell integrators computing a checksum indicative of a confirmed receipt
of the
information.

11. The method of claim 10, further comprising transmitting from each of the
cable microcell integrators the checksum to the head end control unit in
response to the
broadcast status query message.

76



12. The method of claim 11, further comprising rebroadcasting at least a
portion
of the information to at least one of the plurality of cable microcell
integrators in response to
transmission of the checksum from the cable microcell integrators to the head
end control
unit.

77

Description

Note: Descriptions are shown in the official language in which they were submitted.



CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
TITLE OF INVIENTION
BROADCAST DOWNLOAD TECHNIQUE
FIELD OF INVENTION
This invention relates to wireless microcell distribution systems and more
particularly to a
S technique for providing software updates and other information to a
plurality of microcells for
decreasing the amount of download time required.
BACKGROUND OF THE INVENTION
In wireless n~,icrocell distribution systems, a number of microcells are
coupled to a cable for
the transmission and receipt of wireless signals to and from wireless
terminals. It will be
appreciated that there may be as many as thirty six microcells coupled to a
cable, and that each of
these microcells on occasion must be provided with downloadable software
updates. The type of
information which is transmitted to each of the microcells is for instance,
software to reconfigure
each of the microcells, to reconfigure the enable and disable capabilities of
each of the microcells, to
change the channel assignments, or to provide other information to each of the
microcells.
In the past, this has been accomplished on a unicast basis in which messages
from a head
end control unit are transmitted one at a time to each of the microcells, with
each of the microcells
having a so-called cable microcell integrator thereat. The cable microcell
integrator responds to a
request message from the head end interface converter and reconfigures its own
internal software to
comply with the information transmitted to it. Upon the download, the cable
microcell integrator
transmits a response back to the head end control unit indicating the status
of the downloaded
information.
It will be appreciated that this unicast technique requires considerable time.
For instance, it
may require as much as an hour to download 1,000 messages to a particular
cable microcell
1


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
integrator. This is multiplied by the number of cable microcell integrators
communicating with the
particular head end control unit, such that a software download can sometimes
take up to a number
of weeks to accomplish.
While it will be appreciated that the prior techniques adequately permit
downloading of
information to each of the cable microcell integrators, it is preferable to be
able to accomplish the
process in a shorter period of time.
SUMMARY OF THE INVENTION
Rather than addressing each of the cable microcell integrators separately, in
an improved
process, a message is sent from the head end control unit to each of the cable
microcell integrators
to reconfigure each cable microcell integrator to go into the broadcast mode.
This transmission is
done on a unicast basis.
Thereafter, the downloadable information is broadcast to all of the cable
microcell
integrators in a so-called broadcast mode in which the information is
transmitted simultaneously to
each of the cable microcell integrators.
After the broadcast has been completed, an exit broadcast mode message is
broadcast to
each of the cable microcell integrators. Thereafter, in a unicast mode, each
of the cable microcell
integrators is queried as to the broadcast status. In one embodiment, what
each of the cable
microcell integrator computes is a check sum, indicative of the confirmed
receipt of each of the
downloads.
Upon ascertaining at each of the cable microcell integrators the status of
each broadcast, this
information is transmitted back to the head end control unit on a unicast
basis. If it appears that a
large portion of the message has been lost or could have been misinterpreted
by a number of cable
microcell integrators, in one embodiment the head end control unit re-
broadcasts either all or part
2


CA 02374782 2001-11-20
WO 00/72139 PCT/L1S00/13889
of the download with those cable microcell integrators having confirmed
receipt of the original
message simply ignoring the additional broadcast or that portion of it that
they have properly
received.
In this manner, the process which in some cases can take as much as several
weeks, is
completed in a matter of hours or even minutes. It is important to note that
only that information
which is required of each cable microcell integrator which it did not get, is
required to be
transmitted back to it.
Thus, the subject system combines unicast and broadcast in an efficient manner
to be able to
provide detection and correction of erroneous messages at each cable microcell
integrator.
In summary, in a wireless microcell distribution system, a multicast system is
provided for
broadcasting software updates, enable and disable capabilities, channel
reassignments or other
downloadable data simultaneously to a plurality of cable microcell
integrators, thereby precluding
the lengthy unicast process of updating cable microcell integrators manually
or suffering prior
unreliable message delivery in which each of the cable microcell integrators
is individually
addressed and the response tallied. In one embodiment, the request is
transmitted simultaneously in
a broadcast mode to multiple cable microcell integrators with no response
required. Thereafter,
each cable microcell integrator is queried on a unicast basis as to receipt of
broadcast information
and as to whether or not any portion must be re-broadcast. If so optionally,
all or portions of the
information set can be re-broadcast, with only affected cable microcell
integrators downloading the
broadcast information. The multicast broadcast technique thus provides rapid
simultaneous
updating of each of the cable microcell integrators from a central location.
3


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
BRIEF DESCRIPTION OF THE DRAWINGS
These and other features of the Subject Invention will be better understood in
connection
with the Detailed Description in conjunction with the Drawings of which:
Figure 1 is a block diagram of a prior art unicast system in which information
is downloaded
to each of the cable microcell integrators separately, with the response from
each of the cable
microcell integrators also being evaluated on an microcell-by-microcell basis;
Figure 2 is a block diagram of the subject system in which software updates
and other
information are broadcast simultaneously to each of the cable microcell
integrators with no response
required;
Figure 3 is a block diagram of the system in Figure 2 in which after the
information has been
broadcast to each of the cable microcell integrators, a query message is sent
on a unicast basis to
each of the cable microcell integrators and the response therefrom evaluated;
and
Figure 4 is a flow chart illustrating the sequence of events in the download
of information to
be broadcast to each of the cable microcell integrators.
DETAILED DESCRIPTION
Referring now to Figure 1, in a wireless microcell distribution system, a head
end control
unit 10 is coupled to a head end interface converter 12 which is serially
connected to a number of
cable microcell integrators 14, 16, 18 and 20 over a network which includes a
cable television plant,
be it fiber optic, cable or microcell. It will be appreciated that from time
to time, each of the cable
microcell integrators must be provided with software updates, channel
reassignments or enable and
disable capabilities which must be changed. Thus on occasion requirements
include fixing,
software bugs, enhancing capabilities or channel configurations. In the past,
as mentioned before,
these software updates have been accomplished by downloading to each of the
cable microcell
4


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
integrators, the required information on a separate basis. Thus for instance,
each of the cable
microcell integrators is addressed separately and is provided with the
downloaded information at
that time. Thereafter, validation of receipt of such information is
transmitted back to the head end
control unit over the network. Should some of the information not be properly
downloaded, the
proper information is resent to the particular cable microcell integrator
requiring it.
Referring now to Figure 2, in contradistinction to the above method of
providing software
updates to the cable microcell integrators, in the subject system the
information is transmitted to
each of the cable microcell integrators on a multicast basis in which the
information to be
downloaded is transmitted simultaneously to each of the cable microcell
integrators. This is
indicated by information on a request path here illustrated at 22.
Referring now to Figure 3, while the broadcast of the downloadable information
is
accomplished in a multicast or simultaneous mode, after the information has
been transmitted, the
system is placed in a unicast query mode, as illustrated in Figure 3, in which
a query message, as
illustrated in line 24, is sent to a specific cable microcell integrator and
the response therefrom
evaluated, with the response being sent back as illustrated on path 26.
In one embodiment, the query message requests a response from the addressed
cable
microcell integrator for a validation message, in one case a simple check sum.
Other types of
validation messages are possible, including those that indicate which portion
of which message has
not been properly downloaded or received. As is typical in such validation
techniques, check sums
are provided on sections of the downloaded information. Another technique for
validation includes
a cyclic redundancy check.
Referring now to Figure 4, from the point of view of the flow of information,
the head end
control unit, as illustrated in box 30, transmits to each cable microcell
integrator the need to place
5


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
the cable microcell integrator in its broadcast mode. Thereafter, the
downloadable information is
broadcast, as illustrated at box 32, to send N broadcast messages, which in
some cases can exceed
1,000 messages. These messages, as indicated above, are sent simultaneously to
each of the cable
microcell integrators from the particular head end control unit.
As can be seen from box 34, after the broadcast of the information to each of
the cable
microcell integrators, an "exit" broadcast message is simultaneously multicast
to each of the cable
microcell integrators followed by a unicast "query" message as illustrated at
box 36 as to the
broadcast status. Thus in this task, each of the cable microcell integrators
is serially queried by the
head end control unit, with its broadcast status evaluated one at a time.
Thereafter, assuming that
there is a common transmission of any, all or a part of a broadcast message,
the original information
may be broadcast back to all of the cable microcell integrators as indicated
by dotted line 38, with
each of the cable microcell integrators responding only to that portion of the
message that was not
properly received.
What follows is a program written in C, describing the combined unicast-
broadcast system
for one embodiment of the subject invention.
Code Pertaining to CDL Extracted from HLROM.C
/*****************************************x*******+**************************


** TITLE: Proc Mess
** -


** DESCRIPTION: To process the messages received while in PROM
and some of the messages


** received while in EEprom will call this procedure!


**
** INPUTS: none
**


** OUTPUTS: continue_Download Flag: True or False
**


** ASSUMPTIONS/LIMITATIONS:


** This routine handles broadcast messages


** This procedure does not handle every CMI message.


'* This procedure will NACK messages and report a reason for the
** Nack


** Revision History:


**


** PCSC-122 3/15/98


* This procedure now sends the response msg to the appropriate
source


** CMI Number of BROADCAST indicates that the message received
was a


** broadcast


** message and therefore should not be ackknowledged by the CMI.


** dl_stat is now a local variable not a global.


** This procedure now processes new download messages.


6


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
** This procedure now checks for multiple faults,
not just two.


** Removed the xdata declaration on local variable
j.


'* This routine can now receive broadcast messages:
but this particular


** CMI may not want to be processing the broadcast
message; check the


** global flag prior to processing.


** This procedure now checks the global flag download
mode prior to


"* processing any download messages.


** This procedure now handles filling all/part
of EEprom wita 1 msg


This procedure now handles performing a checksum
on any defined area


to **


** PCSC-161 Added _CMI message to ROM - note it does not perform
the ACT some of


'* the action if the CMI is in ROM waiting for
download


** 4/24/98 Set EEP _ONLINE to false when CDL xsum is received.


** Nack the old 15.4 download messages.


IS ** 4/28/98 will handle a random delay to the response
This procedure of a broad-


** cast RUA_LOST_CMI message.
**


** PCSC-174 5/20/98 The flush routine must ensure download mode
xx is active to process !


** PCSC-178 6/9/98 This routine now processes fre~stat messages.


** This routine is set up to handle two future
features on


* the Rua_Lost CMI message.


** PCSC-213 7/17/98 Changed the fre~stat msg to report back the
RAM value of


* fwd
channel and type (not what is in EEprom)


25 * _
On ACT_CMI, if sector changes, re-tune FWD
PLLs


x**x************x*x*xxxxx*x*x
**xxx*xxx*x**x*xxxxxxxx**xxxx*xx*x**x**********/


/* This is
the Process
Message
Routine
*/


unsigned
char Proc_Mess
void )


30 (
unsigned i,j;
char


unsigned int i;
int


unsigned xdata
char *addr;.


unsigned s addr; ll contain a pointer */
int /* wi


unsigned count;
int


35 unsigned pattern;
char


unsigned load stat;
char


unsigned contin;
char


unsigned ret_stat;
char


unsigned chksum;
long


unsigned *x_addr;
char


unsigned cnt;
char


unsigned n,temp;
char


45 contin = TRUE;
load_stat = TRUE; /* unless otherwise changed by any proc. called from this
proc */
recvd_brdcst msg = msg_in.dat.raw.dat[0) ~ BRCDST_MSK;/* DF# 1 contains
num/sector OE brdcst */
/* -____________-_-__-____-_-__________________________________________-_-
_____-_.____ */
50 /* Ensure that any broadcast message received is to be processed by
this'CMI */ "
/* -___-_-_-_-_____-_-_-_________________________________________________-____-
_-_-_-_____ */
if ( recvd_brdcst msg == BROADCAST) /* was the msg received broadcast ? */
( /' yes -check to see that the process broadcast msg flag has been previously
set */
55 if ( process broadcast msgs != TRUE 1 /* are we currently accepting brdcast
? */
(/* NO - but, it may be a Broadcast call for Lost CMI ! check before ignoring
*/
if ( lost cmi )/* are we a lost cmi ? */
t /* yes - check to see if this is a lost inquerey */
( if ( msg_in.number != RUA_LOST_CMI )
if ( ! serial_data_flag ) /* is it from the Neuorn ? */
( /* yes - */
contin = FALSE; /* do not process and do not ack ! */
Drop_It();
else /* it's from rs232 - we can process it */
contin = TRUE;
else /* it is an RUA_LOST_CMI msg - process it */
contin = TRUE;
else /* not a lost CMI, and not processing Brdcst, drop it on the floor ! */
(
contin = FALSE; /* no, do not process and do not ack ! */
Drop_It ( ) ;
7


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
)
else
( /* the message received was not broadcast, but should we process it ? */
/* _________________--__-___________=====c=c=====__________________________-_-
_-_ */
/* Since we are in ROM, we need to have-an established communications with our
HIC in order to properly respond to any message received. Until we receive
an RUA_LOST CMI(or ACT_CMI), we will not process any messages ! ~/
/* -____..-__-_-_-_-_______________________________________________.-_-_-
_____________ */
if (( lost_cmi ) && ( neuron msg_flag))/* are we a lost_cmi? AND receiving
Neuron ? */
( /* yes - check to see if this is a lost inquerey OR an Activate CMI */
if (( msg_in.number == RUA_LOST_CMI ) ~~ (msg_in.number == ACT_CMI MSG ))
contin = TRUE; /* process and do not ack ! */
else /* no, do not process the message */
IS contin = FALSE;
else /* we are not lost(or we are but msg is from 232)- so process the message
*/
contin = TRUE;
if ( contin == TRUE )
( /* this CMI is supposed to process the message
x/
/*
._____..._________________________________________________________________*/


switch( msg_in.number ) /* which message was received
?


*/


/* ____-__________________________________-_________-____-_________-____-__-_-
_..___*/



/*
{......______________________________...__.........._____________.________*/


/* improved download commands (post Version 4 EEprom */
code)


/*
____._____________________________________________________________________x/


case CMI CDL_FILL_PATT :/* indicates a fill pattern


/


_
_
case CMI CDL NORM :/* all data in one record


x/


case CMI CDL START CONT :/* start of a continuation
load
- - -


*/


CONT :/* a continuation load
case CMI
CDL


_
_
* /


case CMI CDL_FUTURE :/* a future enhancement downloa d


*/


if 1 download
mode == TRUE ) /* are we supposed to be getting these
? */


_
( /* yes - process the download message */


load_stat = Improved_DL_COde(); /* process the downloadmsg */


Return_Message(); /* acknowledge msg is processed*/



lse/* we are not in the correct mode to receive this */
message !


{ '


Send_Back Nack( /* Nack the msg is NOT processed */


CDL_WRONG_MODE, /* Reason code */


msg_in.number);/* supporting data */


) break;


/* -_-_-_-____-_______-______-___________-
___________________________________________*/


case CMI FREQ_STAT_MSG: /* SSSSSSSS Read the Frequency*/
status SS5SS5S$


* __.__~____._____.___________________________________~_~_____._____._.__.._*/


t msg_in dat send_freq_stat rev~ri_freq = *(char xdata PRI FREQ;
VO *)EEP REV_


msg_in.dat.send_freq_stat.rev_div_freq = *Ichar xdataDIV_FREQ;
*)EEP_REV_


msg_in.dat.send_freq_stat.fwd_chn = fwd chap;


msg_in.dat.send_freq_stat.fwd_chn_type = fwd_type;


tx freq_msb = *Ichar xdata *)EEP PCS_ CHAN
freq MSB;
stat.pcs
~g-ln.dat.send


65 _ _
_ CHAN_LSB;
_
msg_in.dat.send_freq_stat.pcs tx_freq_lsb = *(char
xdata *)EEP_PCS


Return Message(); /* acknowledge msg is processed
*/


break;


/* -________________-_-_-____-__-__--_-_____-__-
__________________________________-_____*/


70 case CMI CDL_CALC_SECT 7CSUM /* CMI calculate sector a */
xsum dat


)* -_._-_-_..__-____________-_________-___________________-
____.___________________*/


Return_Message(); /* acknowledge msg is received priorseconds
: it takes 10 ! */


Calc_sector xsum();


break;


75


/* _____________.-______-_-___________-______________________-_-
___________________*/


g


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
case CDL_RPT _XSUM: /* CMI Report sector xsum
CMI SCT data


*/


/ -_. _-_______-_____-___-________-___-_____________-___-
_______________________-_-_-____
*/


msg _in.dat.rptxsum.fld2sector
= xsum[0];


msg _in.dat.rptxsum.fld3_
= sector_xsum[1];


msg _in.dat.rptxsum.fld4sector xsum(2];
=


msg _in.dat.rptxsum.fld5sector_xsum[3];
=


msg _in.dat.rptxsum.fld6sector_xsum[4];
=


msg _in.dat.rptxsum.fld7sector
= xsum[5];


to msg _in.dat.rptxsum.fld8_
= sector_xsum(6];


msg _in.dat.rptxsum.fld9sector_xsum[7];
=


msg _in.dat.rptxsum.f1d10= 0; /* clear for calc xsum */


for (i=0; i++) clac xsum of msg */
i<8; /* now


msg _in.dat.rptxsum.f1d10+= sector
xsum[i]; /* byte checksum of this
msg */


IS Return_Message _
(); /*
acknowledge
msg
is processed
*/


bre ak;


* ______________________________.._._.____________________________________._
*/
2o case CMI CDL_RESET: /* CMI Reset instructions
_____________________________ */
/* first verify the patterns in the message are correct */
if (( msg_in.dat.cdl_reset cmi.pattl == OxB ) &&
msg_in.dat.cdl_reset_cmi.patt2 == OxE ) &&
25 ( msg_in.dat.cdl_reset_cmi.patt3 == OxE ) &&
msg_in.dat.cdl_reset cmi.patt4 == OxF ))
(/* correct pattern - so process the message */
Return_Message(1; /* acknowledge msg is received */
/* allow a first time succ run of the new downloaded code to store its version
to EE */
Write_EEprom((char xdata *)EEP CMI ONLINE, FALSE);/* not acquired is the key !
*/
Write EEprom((char xdata *)EEP_INTENT RESET, TRUE);
3 5 /* update the flag in EE so the reset code knows where to get values from
*/
if ( msg_in.dat.cdl_reset cmi.source == OxEE )/* the HIC wants reset to last
known
values ? */
(/* yes - OR in the bit */
pattern = *(char xdata *)EEP CMI STATUS ~ PU_FRM_STATUS_BIT;
Write EEprom((char xdata *)EEP CMI STATUS, pattern);
] _ _ _
else if ( msg_in.dat.cdl_reset_cmi.source == OxDE )/* want reset from DEfaults
? */
( /* yes - Clear the bit */
pattern = *(char xdata *)EEP CMI STATUS & -PU_FRM_STATUS_BIT;
45 Write_EEprom((char xdata *)EEP CMI_STATUS, pattern);
)
/* don't update EE if the value isn't one of the above ! */
/* indicate the reset instructions */
load_stat = msg_in.dat.cdl_reset cmi.reset_inst;
]
else /* the message is corrupted or illegal */
Send_Back Nack( /* Nack the msg is NOT processed */
ENCODED_MSG_CORRUPTED, /* reason code */
msg_in.number); /* support data */
55 break;
/* =c=====_________.________===-_c=====________________.___-
___________________ */
case CMI CDL STAT INSTR :/* indicates download instructions
*/
/* ._________________________________________________________________________
*/
60 /* first verify the patterns in the message are correct */
if (( msg_in.dat.cdl_stat_recv.pattl == OxB ) &&
1 msg_in.dat.cdl_stat_recv.patt2 == OxE ) &&
( msg in.dat.cdl_stat_recv.patt3 == OxE ) &&
msg_in.dat.cdl_stat_recv.patt4 == OxF ))
65 (/* correct pattern - so process the message */
download_mode = msg_in.dat.cdl_stat recv.dl mode; /* indicate dl mode */
process_broadcast msgs = msg_in.dat.cdl_stat_recv.proc brdcast msgs; /*
indicates
brdcast instructions */
,7o verify~age_write = msg_in.dat.cdl_stat recv.verify~age_write; /* verify or
not */
if ( msg_in.dat.cdl_stat_recv.sparel )
/* are we to invalidate last sector xsum bit map ? */
(/* yes */
for (i=0; i<8; i++) /* now clac xsum of msg */
75 sector_xsum[i]=OxFF; /* invalidated old bit map of sector checksums */
]
Return_Message(); /* acknowledge msg is processed */
9


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
else /' the message is corrupted or illegal
*/
Send_Back_Nack( /* Nack the msg is NOT processed */
ENCODED_MSG_CORRUPTED, /* reason code */
msg_in.number); /* support data */
break;
1 /* --__----__________-
0 ______-
-
___-
-
____
-
-


_
_
_
_
_
_
______
___________-_______________________ */


case CMI CDL_FLUSH :/* indicates a ~flush~ of the EEprom


*/


/ __________________________________________________________________________
*/


IS if ( download_mode == TRUE ) /* are we supposed to be
getting these ? */
*


( /
yes - process the message */


/* first verify the patterns in the message are correct
*/


if (( msg_in.dat.cdl_flush.pattl == OxF ) &~


1 msg_in.dat.cdl_flush.patt2 == OxA ) &&


20 ( msg_in.dat.cdl_flush.patt3 == OxD ) &&


1 msg_in.dat.cdl_flush.patt4 == OxE ))


(/* correct pattern - so process the message */


/" NOTE:we are verifying these writes which does take longer
- but since it */


25 /* only takes one message from the HECU to clear all of
EEprom - who cares !*/


s_addr = msg_in.dat.cdl_flush.s_addr; /* indicate the
start_address */


count = msg_in.dat.cdl_flush.count; /* indicate the
amount of bytes */


pattern = msg_in.dat.cdl_flush.pattern;/* indicates
the pattern */


/* Ensure that we are not in a download (using the contiguous
buffer) */


if ( ! improved_dl_struct.in_use)


(/* structure is not in use by a download - so we can
use it in the flush */


35 if ( ! verify~age_write )/* if we are not going to verify */
Return Message(); /* acknowledge msg is received prior to processing */
for ( int_i=0; int i< MAR-CDL_BUF; int_i++ )/* put the pattern in a buffer */
contiguous_dl data[int i) = pattern;
i = count / MAX CDL_BUF; /* number of full buffer writes */
for( j=0; j<i; j++)/* using page_write put out as many MAX CDL BUF byte
buffers */
_ _
Enable_EEproml); /* enable EEprom for writes */
45 ret_stat = Page_Write_EEPROM(
(xdata unsigned int*)&s_addr,/* dest. addres */
MAX_CDL_BUF, /* num_bytes to write */
contiguous dl_data,/* pointer to source */
verify~age_write ); /* verify flag */
Protect EEprom(); /* protectthe EE from writes *i
s addr += MAX_CDL_BUF; /* move the destination pointer up */
if ( ret_stat != SUCCESS)
5 (/* the page write failed - indicate failure to the HECU */
Set Up_A_Nack( PAGE_WRITE_FAILURE,/* reason */
ret stat); /* support data: the failure stat code */
break; /* from loop no need to continue ! */
60 )/* end for loop */
if( ret stat == SUCCESS )
( /* continue and put out the remainder of the count */
i = count $ MAX_CDL_BUF; /* the last (remainder) write */
65 Enable_EEpromf); /* enable EEprom for writes */
ret_stat = Page_Write_EEPROM( (xdata unsigned int*)&s_addr,/* dest. addr */
i /* num_bytes to write */
contiguous_dl_data,/* pointer to source */
verify~age_write ); /* verify flag */
Protect_EEprom(); /* protectthe EE from writes */
)/* end if the ret stat !- Fail */
if ( verify~age_write )/* if we are verifying */
( /* then we did NOT respond prior to processing - so respond now */
if ( recvd_brdcst msg != BROADCAST)
( /* not a broadcasted message */
l


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
if ( ret_stat != SUCCESS )
Send_Back_Nack(
PAGE_WRITE_FAILURE,/* reason code */
msg_in.number ); /* support data */
else /* the message processed was succesful */
Return Message(); /* acknowledge msg is processed */
?/* end if the msg was a broadcasted msg */
)
else/* the structure we need to use is already in use - Nack the msgs */
Send_Back_Nack(
CDL_STRUCT_IN_USE, /* reason code */
IS msg_in.number ); /* support data */
)
else /* the message is corrupted or illegal */
i
2o Send_Back_Nack( /* Nack the msg is NOT processed */
ENCODED_MSG_CORRUPTED,/* reason code */
msg_in.number); /* support data */
)
25 else/* we are not in the correct mode to receive this message ! */
Send_Back_Nack( /* Nack the msg is NOT processed */
CDL_WRONG_MODE, /* Reason code */
msg_in.number);/* supporting data */
break;
/* -_-_-__--__-______________-_-______-_-______________.__________-_-
_________________-___ */
case CMI CDL_PART XSUM:/* Calculate a checksum of the code in EEPROM */
/* ....__..__.___________...___.._______.______._____________________________
*/
x_addr = (unsigned char xdata *)msg_in.dat.cdl~art_xsum.s_addr;
/* where to start */
chksum = 0; /* start at zero */
count = msg_in.dat.cdl~art_xsum.count;
for ( int i = 0; int_i < count; int i++)
chksum +_ *x_addr; /* add in this byte */
x_addr++; /* next byte */
50
(unsigned long)msg_in.dat.cdl~art_xsum.xsum = chksum;/* report it back */
Return Message(); /* acknowledge msg is processed */
break;
/x*xxxx*xx*x**xx*xx*x**x**x*xxx****xr*x**x**xx*x*****xxxx******xx******x*xx**
** TITLE: Improved DL Code
xx
'* DESCRIPTION:
6o This procedure is the improved download code. It processes a number
*" if different message types to increase the amount of data received
.x in messages, and to reduce the amount of data sent if the data is
°x redundant. The' procedure also calls a Page Write EE function. This
** procedure can write data to the EEprom much faster and as many bytes
65 as needed (not hard coded to 6 bytes).
xx
** INPUTS: None
xx
'* OUTPUTS: Continue Download flag: T or F-this is the end of the download
x*
7O '* ASSUMPTIONS/LIMITATIONS:
** This procedure will look into the received msg for indications of size.
'* The maximum amount of contiguous DL data is 256 bytes.
** The maximum amount of fill data is 256 bytes.
.75 ** This procedure will not properly handle re-sends of any CONTINUATION
*' type download messages (it expects the next message is sequence (not
ii a resend of a previous msgs; this would happen if the HIC was re-sending
msgs in a broadcast mode to a failed CMI)
11


CA 02374782 2001-11-20
WO 00/72139 PCT/CTS00/13889
'* The caller ensures we are in download mode.
**
** This procedure will NOT handle Unicast downloads.
**
$ ** Revision History:
** PCSC-122 2/23/98 Created
**
** PCSC-161 4/24/98 Moved the Ack of EEprom sent CDL messages prior to
processing
** also added NACK of 15.4 download message.
** PCSC-174 5/20/98 This procedure no longer handles Unicast CDL messages.
There is
** NO check for contiguous Tags, and no check for re-sends of a message.
********x*r***x**********************************************x**************/
1$ char Improved_DL_Code(void)
{ unsigned int i;
unsigned int j,z;
2o unsigned char continue_download;
unsigned char ret stat;
continue_download = TRUE;
/* -__-______-__-_-_______________-_-____________________-_-_________-_-
2$ ______________ */


switch ( msg_in.number ) /* which message are we processing
? */


/* ___-_-_.-_-_-_.-_-_________-______-___-_________________.-__________-_-_-
_________-_.____
*/



/* -____-_____________-______________________-__--_-_________-__-_-_________
-_ */
*


case CMI CDL_FILL_PATT: /
fill pattern message


*/


/_ __________-__-________________.-_..-_-_-_-_-_____________-_--__________-
_.________-_-___
*/


for ( i=0; i<msg
in.dat.cdl
fill
recv.num
bytes; i++)


3$ _
_
_
_
contiguous dl data[i] = msg_in.dat.cdl_fill_recv.pattern; /*
fill in array */


Enable EEprom(); /* enable EEprom for writes ~ */


ret stat = Page_Write_EEPROM( (xdata unsigned int*)&msg_in.dat.cdl
fill_recv.addr,


40 /* pointer to dest. addres */


msg_in.dat.cdl_fill_recv.num_bytes, /* DF # 4 = num_bytes */


contiguous_dl_data,/* pointer to source */


verify~age_write ); /* verify flag */


Protect EEprom(); /* protectthe EE from writes */


if( ret
stat != succESS)


4$ _
(/* the page write failed - indicate failure to the HECU */


Set Up_A_Nack( PAGE_WRITE FAILURE,/* reason */


ret_stat); /* support data: the failure code */
]


break;


$O


/* ___-_.__________-________-____-_.__________________________________-_-
__________
*/


case CMI CDL_NORM: /* download data message


*/


/* ...____________-_._______-__-__-___________.__-______________-_________-___-
____
$$ */


Enable EEprom(); /* enable EEprom for writes


*/


ret_stat =


Page_Write_EEPROM((xdata unsigned int*)&msg_in.dat.cdl norm_recv.addr,


60 /* pointer to dest. addres */


msg_in.dat.cdl norm_recv.num_bytes,/* DF # 4 = num_bytes */


&msg_in.dat.cdl_norm_recv.dat(0], /* pointer to source */


verify~age_write ); /* verify flag */


Protect EEprom(); /* protect the EE from writes


6$ /


if ( ret_stat != SUCCESS)


(/* the page write failed - indicate failure to the HECU */


Set Up_A_Nack( PAGE WRITE_FAILURE, /* reason */


ret stat); /* support data: the failure code */


70


break;


/ -___________-_-_____-__-____-___-_.____________________________-___________-
______
*/


Case CMI CDL_START_CONT: /* start of a continuation load



/* =cc= / __=-_-_cc-_==c-_===_=====c=-_-_________-______________-
_____________________
*/


/* This message allows for the HIC/HECU to send many packets of
data, with


the address and length overhead in just this message. It will be followed by
12


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
CMI_CDL_CONT msgs until the length is satisfied. Once all data is in, the
whole array will be written to EEprom in a page write. */
S improved_dl_struct.data_index = MAX_NORM_DL_DATA; /* next place to store */
improved_dl_struct.num_bytes = msg_in.dat.cdl strt cont recv.num_bytes ; /* DF
# 4 =
num_bytes */
improved_dl_struct.address - (unsigned int)msg_in.dat.cdl strt cont_recv.addr;
j=0; /* index into message data */
IO for ( i=0; i< MAR NORM_DL_DATA; i++ )
contiguous dl data[i] = msg_in.dat.cdl strt cont recv.dat[j++];
improved_dl struct.in_use = TRUE; /w other places check this */
15 break;
/~ -____--_-_-_-_-_-__--__-_____________-__-__-_.______-
_______________________.-_-___________ */
case CMI CDL_CONT: /* a continuation load: see note on CMI_CDL_START_CONT */
/* ______________________-_-__-.___________________________________________--_-
_-___ */
2O i = improved_dl_struct.data_index; /* current index into array */
/* determine how much to read in
*/
z = (limproved_dl struct.num_bytes - improved_dl struct.data_index) <
MAX_CONT_DL_DATA)
25 ? (improved dl_struct.num_bytes - improved_dl struct.data_index):
MAX_CONT_DL_DATA;
for (j=0; j< z; j++,i++ )
contiguous dl data[i] = msg_in.dat.cdl cont_recv.dat[j];
3O improved_dl struct.data_index = i; /* next place to store */
if ( i >= improved_dl_struct.num_bytes ) /* do we have all the data ? */
(/* yes: not checking for exect count: ok if its over, we will only
write the exact amount to EE anyway */
35 Enable_EEprom(); /* enable EEprom for writes */
ret_stat = Page_Write_EEPROM(~improved_dl_struct.address,/* pointer to dest.
addres
improved_dl_struct.num_bytes,
contiguous_dl_data,/* pointer to source */
verify~age_write);/* verify flag */
40 Protect EEprom(); /* protect the EE from writes */
/* Clean up the data structure to indicate end */
improved_dl_struct.in_use = FALSE; /* other places check this */
45 if( ret_stat != success)


(/* the page write failed - indicate failure to the HECU
*/


Set Up A Nack( PAGE_WRITE_FAILURE, /* reason */


ret_statl; /* support data: the failure code */


SO } }


break;


* ________-_-____-_-_______-_-____________________-_--______________-______-
__________
/ ./
___________


case CMI CDL FUTURE: /* special DL msg that has no code
in ROM: jump to EE *i


/= ____...___..__ __. _________________..._____________________._____________
5 */


/* IF the EEPROM has a bad checksum, the ROM code will never
jum into EE. This


message will "Allow" us to jump to EE. IT will jump to
code in the last


EEprom sector to the Future_Stub() which does a bunch
of junk and then returns.


This area of EE can be used to poke code, diagnostics
or whatever, to get the


6O ROM to jump to it. What ever happens there is NOT defined
here.


THis is just the Hook ! */


/* NOTE: Remember that there are 10 data fields in the msg
that can be used !!! */


Future_Stub();


break;


65


_________________ *,


default: /* these are not handled by this routine */


/* ___-_-_____-___________-_-__-_-__________________-_-____--______-_________-
____-________
*/


SUPPRTD
Set Up A Nack( MSG
NOT
BY
ROM CODE,/* reason */


7O _
_
_
_
msg_in.number); /* support data: the msg received */


break;


}/* end switch */
75 return(continue_download);
/* end ROM:Download_Code */
13


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
/a*exrwxra*r**rarrr*xa*aaaarrra**r*r*xa***xxx*a**x**x***a**rr***aa***a**aaa**


' TITLE: Dnload_Code
a*


DESCRIPTION: This procedure coordinates the downloading
of code to EEprom.


* Once this procedure is called, it becomes the main loop.
It


'* waits for a download sequence to end cleanly.
*x


** INPUTS:


load_flag - indicates who the originator is: PROM or EEPROM
"


OUTPUTS:


' None
*a


* ASSUMPTIONS/LIMITATIONS:


a*
IS ** Revision History:
a*


** PCSC-122 2/17/98 This procedure now checks to see if Poll_Neuron
is


"* returning an error status. If it does, the Neuron


* will be reset.



PCSC-122 2/23/98 ' Removed the xdata declaration on local
variable i


* PCSC-174 6/2/98 Removed the timer stuff at the beg of this
procedure.


Removed the clearing of serial comminications variables.


* PCSC-213 7/17/98 Added Flsuh msg type to this procedure
rx **axx*a*r*a*ax***ax*x*ax**rx******aa*aax****xx**x*xx****x**


******xx***axxx/


void Dnload_Code(char load_flag)


unsigned char dl stat;


dl stat = TRUE; /* indicate that a download is in progress
*/


/ -___-_______-_-_____-________-___________________________________-_____-_-_-
______
*/


if (load flag == RELOAD ) /* is entry from eeprom resident
code ? */


( /* yes - downloads can start from a request made to the
code in EEprom */
*


/
and the request must be replied to. The code in EEprom
must ensure that*/


/ this message was supposed to be processed (accepting
broadcast messages*/


/ for example )


*/


a -_-_-__-_-_-_-_____-_ __________-_-______________-_-___*_____-_-_-_______=-
_=~ic=====_-_._
*


FeedWD(), / do not let WDT a re


*/


___________________-______________________________________________________
/ x/
_______________________________________________________


switch) msg_in.number ) /* which message was received ?


*/


/* ____-_____-_-________-________-__________________________________-
____________-
*/



* ___-__________ _______________________________ ______________
/ ______. -_. ../
___________-______________________________________________________.


/ improved download commands (post Version 4 EEprom code)


/
a


/* __________________________________________________________________________
*/


case CMI_CDL_FILL PATT: /* indicates a fill pattern */


case CMI_CDL_NORM: /* all data in one record */


case CMI_CDL_START_CONT: /* start of a continuation load
*/


case CMI_CDL CONT: /* a continuation load */


case CMI_CDL_FUTURE: /* a future enhancement download */


Return Message(); /* acknowledge msg is processed*/


dl_stat = Improved_DL Code(); /* process the download msg
*/


break;



* ......__..__.__.__.________.___________.._________.______________._____.__
*


case CMI_CDL RESET: /* CMI Reset instructions */


case CMI_CDL_FLUSH :/* indicates a 'flush' of the Eeprom
*/


/* _-____________________________ ________________
____________________________
_ */


dl stat = Proc Mess();/* process the Reset message and
acknowledge */


break;


/* -___-________-__-__-___-_-_________________________________-_-_____-_____-
______
*/


default: /* these messages are not processed - send back
a NACK */


/* __________________________________________________________________________
*/


Send_Back_Nack( /* Nack the message */


MSG_NOT_SUPPRTD_BY ROM_CODE,/* reason code x/


,75 msg_in.number); /* support data */


break;


)/ end switch */


)/* end if this is a RELOAD */


14


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
/* _______-__-____________-__-_____________-__-___-_______-___-
_________.____________.
*/


while (dl stat)/* continue processing msgs while the download
is not complete */


/* ______._____________._______________...__.______._..._____.____.._________
*/



FeedWD(); /* don't let timer expire */


if (serial data-flag == TRUE) /* is there an RS232 message avail?
*/


/*
1~ *
*/


/ _
(
yes there is an RS232 message ready


*/


/w __________________________________________________________________________
*/


memcpy(&msg_in.number,


&rs232 msg[0),
1S


sizeof(msg_in));


dl_stat = Proc Mess(); /* process the message and Acknowledge
*/


}


else /* there is no msg from RS232 avail */


2o


if (neuron msg_flag == TRUE) /* is there an HIC/HECU msg avail
? */


* _______________-__________________________________________________________
/ */
___________________________________________________________


( /* yes- there is a NEURON message from the HIC/HECU available
*/


* _ */
2S *


/ Flash the COMMs LED: turn it on (on receipt)- off (on Response)
*/


led_save = (led_save & -COMMs_LED); /* LED on is a clear of
just that bit*/


*(unsigned char xdata *)LED_ADR = led_save; /* updates the actual
LEDs */


Reset_Neuron_Timer();


Read Neuronl(char xdata *)&msg_in.number);


Reset Comms Timer_0();


/* prior to processing, check the debug flag to see if we are to
dump


3S the input message out the RS232 spicket ! */


if ( dump neuron_input)


(


serial_data_flag = TRUE; /* will be cleared after the send */


Return_Message(); /* dump it out 232 */


send_msg_flg = TRUE; /* fix this back */


neuron_msg_flag = TRUE; /* fix this back */



dl_stat = Proc Mess();/* process the message and acknowledge
*/


}


4S else/* there is no Neuron message available */


(


if ( neuron_msg_flag == TIMEOUT_ERROR)/* does Neuron indicate
an error ? */


(/* yes - reset the Neuron */


SO Reset Neuron();


}/* end if */
neuron_msg_flag = Poll Neuron(); /* poll the Neuron for new messages */
SS ? /= endwhile */
/* _____________________-___-_____________-________________________-________-
_.-____ */
/* The download has completed.
*/
/* This procedure will force the processor to reset, so that on reset, */
/* the prom code will go out and check the EEprom code (checksum) matches
what*/
/* is in the EEprom, and if it is valid, it will then jump to it */
/* -_________.______-_________________-____-________________________-______-
________ */
/* Force processor reset by performing invalid feed of watchdog */
6S Disable_Timer_0(); /* do not allow the Interrupt handler
to get us out of the infinite loop */
WFEED1 = OxAS; /* reload with a small value */
while (1); /* forces a processor reset */
} /* end ROM:Dnload_Code */
/* END OF CMI BROADCAST DOWNLOAD CODE */
7S /* BEGIN HECU BROADCAST DOWNLOAD CODE */
/wwwww*w*w**ww*ww**wx*www*****x***w*w********x**************************w****
1S


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
*
* FILENAME: m_cmi dl.cpp
*
CSCI Name: HECU
* ABSTRACT: This class will handle the process of Broadcast Download to all
the CMIs on a given HIC. The basic flow is such that the
Initiate_Download method is called with the list of desired CMIs
and the file to download passed to this method. Error checking is
1 o then performed in this method as well as in Perform_File Validation.
Once validation is complete, a series of steps are performed with
the use of Perform-Next Step. Each step must be completed on ALL
CMIS before proceeding to the next step. Upon startup, completion,
or a failure that causes the process to be aborted, the
IS Initialize_Class method will be called to perform cleanup of the
class to prepare it for next use.
*
' REVISION HISTORY:
ZO * CHANGE DOC. REV DATE ENGINEER DESCRIPTION
* PCSC-357 12/7/98 Moody new ~ile
***********x**x**x**x****************************x***x*x**********xxx****+x*x
x
25 * 'This material is considered and contains PROPRIETARY Information of
* Sanders, a Lockheed-Martin Company. Disclosure to others, use or
* copying without the express written consent of Sanders is strictly
probihited."
* "(c) Copyright 1995, Sanders, a Lockheed Martin Company.
* Unpublished work. All rights reserved.
********x**x*x****x****x**************xx**x****x**+x***********xx*******x*xx/
#include "m cmi dl. h"
#include 'defaults. h"
3 5 #include <fstream.h>
#include <dir.h>
#include <stdio.h>
#define MYNL 10
40 #define LINESIZE 8192
/***********************its**********+****+xxxx***x*x****x********
* Name: Download_CMI_Class (constructor)
* Class: Download CMI Class
4$ ' Abstract: Initialize attributes
Rev History:
* PCR Number Date Engineer Description
* PCSC-152 3/31/98 Moody New
******x********x*****++*x***x**xx*************x+***x*rxx*x*x*x****/
Download_CMI Class::Download_CMI Class(HEC * parent)
(
//store pointer to parent
parent class = parent;
55 l/poll flag
poll_flag = FALSE;
//stake call to function to initialize class attributes
6o Initialize_Class();
//Fill in the Valid Message Table
Fill Valid_Message Table();
/***x*******rx***x**xx**+*xx*x**x*x*+***x*******x***x+x********x**
* Name: Download_CMI_Class (destructor)
* Class: Download_CMI_Class
* Abstract:
* Rev History:
* PCR Number Date Engineer Description
x PCSC-152 3/31/98 Moody New
x***a*x+******xx*xx********x*x**x**xx********+**x*x*xx*****xx*****/
,75 Download_CMI Class::-Download_CMI Class()
16


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
/w***w*x*****x*a+*a*x*w***xa*x**wwxxx+waw****ax**wx****r**x***x**x


* Name: Fill_Valid_Message Table


w Class: Download_CMI_Class


' Abstract: Function to define for each phase
the valid messages


S w Rev History:


PCR Number Date Engineer Description


* PCSC-152 4/30/98 Moody New


xaww***x**+w*axx+x++++w******+**x*w**+***w*w**+**ww*+***x*****+***/


void


Download_CMI Class::Fil1 Valid_Message
Table()



//initialize them first


for(int i = 0; i < NUM MODES; i++)



IS forlint j = 0; j < MAX MSG TYPES;
j++)



Valid_Message_Types[i][j] _ -1;


]


]



//fill in valid values


for(int k = 0; k < NUM MODES; k++)


t


switch (k)


2S


case FIND_CMIS:


Valid_Message_Types[k][0] = rua_lost cmi;


break;


case WAKE UP CMIS:


Valid_Message_Types[k](0] = act cmi msg;


break;


case DL
XSUMS:
SECTOR


_
_
case DOWNLOAD_MESSAGES:


Valid_Message_Types[k](0] = cmi_cdl_cont;


Valid_Message_Types(k](1] = cmi_cdl_fill~att;


Valid_Message_Types[k][2] = cmi_cdl_norm;


Types[k](3] = cmi_cdl_start
Valid Message cont;


_ _
Valid_Message_Types[k](4] = cmi_cdl_flush;


break;


case TURN_FLAGS_ON:


Types[k][0] = cmi cdl_stat_instr;
Valid
Message


4S _
_
break;


case CALC_SECTOR_XSUMS:


Valid_Message_Types(k][0) = cmi_cdl calc_sect
xsum;


break;


SO


case GET_SECTOR_XSUMS:


Valid_Message_Types[k)(O] = cmi_cdl_rpt_sect
xsum;


break;


S case VALIDATE_CMI_DL:
S


Valid Message_Types(k][0] = cmi~ower_stat
msg;


break;


case RESET_CMIS:
60


Valid_Message_Types(k](0] = cmi cdl_reset;


break;


default:


6S case NONE:


case FINISHED:


case ABORT_MODE:


break;


]


]


7O )


/x*xaaa*x*rxrw**++**x+**xxxx***xw+x*+***xw*****xw*xx**********xx**


* Name: Initialize_Class


* Class: Download
CMI Class


'~S_
* Abstract:


* Rev History:


* PCR Number Date Engineer Description


17


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
x PCSC-152 3/31/98 Moody New
x*x*x*a*****xx*****xx***w*******x*x*x**x********x****r************/
VOld
Download CMI_Class::Initialize_Class()
broadcast mode = NONE;
HIC_id = NULL;
for lint i = 0; i < MAX_CMIS; i++)
(
1~ for(int j = 0; j < NUM_SECTORS; j++)
(
cmi_number_array[j][i] = DO_NOT_DOWNLOAD;
cmi_status_array(j][i] = NO_ERROR;
15 ] ]
cmi_counter = 0;
dl_file[0] _ '\0';
nu~cmi s = 0 ;
num_bytes = 0;
2~ file_checksum = 0;
file~os = 0;
step_flag = AUTO;
for lint j = 0; j < NUM_DL_PAGES; j++)
25 (
pages_to_download[j] = DO_NOT_DOWNLOAD;
]
//call this to stop timer if it's on and to set reset flag to OFF
3o dl timer_flag = OFF;
//set the parent class logging flag to ON
parent class->log_flag = TRUE;
3 5 //restore parent poll flag
if(poll_flag == TRUE)
(
parent class->Polling_Enable = TRUE;
poll_flag = FALSE;
40 ]
force_state = FALSE;
/*x************************x**************************************
45 * Name: Initiate_Download (broadcast)
* Class: Download_CMI_Class
* Abstract: Begin download for a sector of CMIS in broadcast
* Rev History:
* PCR Number Date Engineer Descriptio-:
* PCSC-152 3/31/98 Moody ~~ew
*xx*x*****x*x*****x*******x*******x***xx************************'x/
int
Download_CMI_Class::Initiate_Download(HIC * HICin, int **cmi_ids, char * file,
55 int
/'sector*/, int force)
f
int status = NO_ERROR;
60 1nt CMI IDs[NUM_SECTORS][M.A7C_CMIS];
if (cmi ids)
memcpy((void *) CMI_IDs, (void *) cmi_ids, NUM_SECTORS * MAX CMIS *
sizeof(int));
//make sure that we are in a mode that will allow a download
if( (broadcast mode != NONE) && (broadcast mode != FINISHED) )
f
,70 jtatus = DOWNLOAD_IN_PROGRESS;
else
(
//initialize all of the class attributes
Initialize_Class();
//set the class member attributes
HIC_id = HICin;
Ig


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
strcpy(dl_file,file);
force_st.=to = force;
S
//validate file checksum
if(status == NO_ERROR)
(
to }tatus = Perform_File_Validation(file);
//get and check the CMIs to download
if(status == NO_ERROR)
IS (
if(cmi ids != NULL)
_(
for lint j=0; j<NUM_SECTORS;j++)
(
2o for(int { = o; i<MAX_CMIS; i++)
if(CMI IDs[j][i] _= GO_DOWNLOAD)
_(
cmi number_array[j][i] = CMI_IDs[j][i];
25 n~ cmis++;
)
else
(
cmi number array[j][i] = DO_NOT_DOWNLOAD;
30 ] )
]
iflnum_cmis == 0)
35 (
status = NO_CMIS_SELECTED;
]
else
status = NO_CMIS_SELECTED;
)
)
//begin the download process
iflstatus == NO_ERROR)
(
if(parent class->POlling_Enable == TRUE)
(_
Sn Poll_flag = TRUE;
V parent class->Polling_Enable = FALSE;
]
status = Perform_Next_Step();
)
//set the remaining attributes
if(status == NO_ERROR)
(
//make call to update the interfaces
parent class->Update_DL_Status(broadcast mode. lint **) cmi_status array);
//set HEC flag
parent class->System_Mode_Flag = DOWNLOAD MODE;
f)5 else
(
//set the data back to initialized values
Initialize Class();
)
return ( status ) ;
/*******x****r*****************r**********************************
7~J * Name: Perform_File_Validation
* Class: Download_CMI_Class
* Abstract: Verify that the file chosen has valid checksum
19


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
* Rev History:
' PCR Number Date Engineer Description
' PCSC-152 3/31/98 Moody New
*******************************x**********x*****x******x*******x**/
int
Download_CMI Class::Perform_File_Validation(char * file)
int status = NO_ERROR;
to ifstream infile;
ofstream outfile;
//get handle to file stream and create buffer for line of code
infile.open(file, ios::in~ios::binary~ios::nocreate);
Is //make sure file exists
if(!infile)
status = BAD_FILENAME;
]
2o infile.close();
if(status == NO_ERROR)
// If Extension =- .cd2 / run through CRC-32
25 char Extension(5];
char * Parse_FileName = strrchr(file, ' ');
strcpy(Extension, ++Parse FileName);
char temp_filename[MAX FILENAME SIZE];
iflstrcmplExtension, "cd2") _= 0)
// Get Checksum from file
char * First Line;
char * File Check_Sum_Ptr;
35 unsigned long File Check_Sum;
First Line = new char[LINESIZE];
FILE * fptr;
40 fptr = fopenlfile, "rt");
fgets(First Line, LINESIZE, fptrl;
File Check_Sum_Ptr = strchr(First Line, '.');
45 if(File_Check_Sum_Ptr == NULL)
delete First_Line;
fclose(fptr)
return(INVALID_FILE_DATA);
50 ]
File_Check_Sum_Ptr++;
File_Check_Sum = strtoul(File_Check_Sum_Ptr, NULL, 10);
55 // Create CRC Table in Memory
unsigned long ' CRC_Table;
unsigned long CRC For_Table;
unsigned long CRC_POly;
6o int tempi, tempj;
CRC_Table = new unsigned long[256];
CRC_POly = OxEDB88320L;
6$ for(tempi = 0; tempi < 256; tempi++)
CRC_For_Table = tempi;
for(tempj = 8; temp] > 0; tempj--)
7o if(CRC For_Table & 1)
_{
CRC_For Table = (CRC_For_Table » 1) ~ CRC_POly;
else
75 CRC_For_Table » = 1;
]
]


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
CRC_Table[tempi] = CRC_FOr_Table;
S // Calculate crc
int Line_Buffer_Length;
char * Line_Buffer;
IO Line Buffer = new char[LINESIZE);
if(Line_Buffer =- NULL)
fclose(fptr):
delete CRC_Table;
1S delete First Line;
return(INVALID_FILE DATA);
)
unsigned long CRC Save;
ZO unsigned long CRC code;
int Trailing = 0;
CRC_Save = CRC_Code = OxFFFFFFFFL;
2S Line Buffer_Length = 1;
while(fgets(Line_Buffer, LINESIZE, fptr) != NULL)
3O char * Limit;
char * P;
Line_Buffer_Length = strlen(Line_Buffer);
Limit = Line_BUffer + Line_Buffer_Length;
3 S // Search for NewLine Characters and replace with '10'
for(P = Line_BUffer: P != Limit; P++)
if ( *P =_{ ' \n' )
*P = MYNL;
3
4S // Perform CRC algorithm on 1 line of input data
for(int i = 0; i < Line_Buffer_Length; i++)
(
CRC Code = CRC_Table[lint)( (CRC_Codel ~ (Line Buffer[i))) & OxFF] ~
SO ( (CRC Code) » 8) & Ox00FFFFFFL);
if(Line_Buffer_Length != 1)
f
SS CRC Save = CRC_Code;
6O if(!Trailing && Line_Buffer_Length == 1)
CRC_Code = CRC_Save;
fcloselfptr);
6S
delete CRC_Table;
delete Line_Buffer;
delete First Line;
7O if(CRC Code != File_Check_Sum)
_{
return(INVALID_FILE_DATA);
)
7S //DO CRC CHECK HERE
status = NO_ERROR;
21


CA 02374782 2001-11-20
WO 00/72139 PCT/i1S00/13889
//Once CRC Check done, need to strip off first line of code from file
//(remember, this is a temp file. The 'real' file is still in the hicdl
directory)
strcpy(temp_filename,'c:\\hec\\temp\\temp.bak');
remove(temp_filename);
S infile.open(file, ios::in~ios::binary~ios::nocreate);
outfile.open(temp_filename, ios::out~ios::binary);
//read in first line of infile
char buf(80];
infile.getline(buf,79,'\n');
// Loop through input file and transfer remaining bytes to output file
char ch;
while(infile.get(ch))
1S [
if(infile.fail())
status = IN\IALID FILE_DATA;
]
outfile.put(ch);
]
// Close the I/O files
infile.close();
2S outfile.close();
//rename temp file to output file
remove(file);
}ename(temp_filename,file);
//make sure data is valid - check all characters then make sure segment IDs
are valid
char buffer[MAX LINE_SIZE];
3 S char temp_sect[3];
char temp_num(3];
int i;
if(status == NO_ERROR)
infile.open(file, ios::in~ios::binary~ios::nocreate);
infile.seekg(0);
while(!infile.eof())
i
4S //get line
infile.getline(buffer, MAX_LINE_SIZE);
buffer[CODE-LINE_SIZE] _ '\0';
SO //validate line size
if(strlen(buffer) < CODE_LINE_SIZE)
[
//make sure that we are not dealing with a last line that is just padded
//with blanks and newlines
SS for(i = 0; i < CODE_LINE_SIZE; i++)
[
//see if any valid chars - which there shouldn't be
if(isxdigit(buffer[i]))
status = INVALID_FILE_DATA;
60 break; //out of for loop
]
else if (buffer[i] _- '\0')
6S break; //out of for loop
//now see if there is actually another line to be read
7o if(!infile.eof())
f
status = INVALID_FILE DATA;
,75 //regardless of scenario, break out of while
break; //out of while
22


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
//check for valid chars - which they all should be
for(i = 0; i < CODE_LINE_SIZE; i++)
if(!isxdigit(buffer[i]))
status = INVALID_FILE_DATA;
break; //out of for loop
)
1~ )
if(status != NO_ERROR)
break; //out of while
15 )
//check the message number
temp_num[O] = buffer[0];
temp num[1] = buffer(1];
temp num(2] = W o~;
//convert the message number from a hex (radix161 val to a decimal and compare
//to valid CMI DL range
if( (((int)strtolltemp num,NULL,16)) < fut_enhc_dl msg)
25 ( (((int)strtol(temp_num,NULL,16)) > cmi cdl_reset) )
status = INVALID_FILE DATA;
break; //out of while
3~ //check the sector
temp_sect(0] = buffer[2];
temp_sect[1] = buffer[3];
temp_sect(2] _ '\0';
35 //convert the sector from a hex (radix16) val to a decimal and compare
if(((int)strtol(temp_sect,NULL,16)) > CHECKSUM-SECTOR)
status = INVALID_FILE_SEGMENT;
4o break; //out of while
)
)
infile.close();
)
45 return ( status ) ;
]
/***********************************************t*****************
* Name: Message_Returned
* Class: Download_CMI_Class
* Abstract: Function indicating that a D1 message has returned from HIC/CMI
* Rev History:
* PCR Number Date Engineer Description
" PCSC-152 3/31/98 Moody New
**w***w*************r*******x*************************************/
int
Download_CMI Class::Message_Returned(unsigned int data[], int failed_flag)
60 //retry counters
static int reset retries = 0;
static int calc_retries = 0;
//flag for use after the switch statement
65 int individual_flag = FALSE;
//status flag for function return
int status = NO_ERROR;
//Make a call to a function that will process the returned message -
//pass it the message and the failed flag
status = Handle_Return Data(data, failed_flag);
/Ja switch that is based on the mode that we are in at the time - only want to
//process if Handle_Return_Data didn't return an error indicating that the
message
75 //type was wrong for the mode we are in
if(status != INVALID_MESSAGE_TYPE)
23


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
switch(broadcast mode)
f
case (FIND CMIS):
case (TURN_FLAGS ON):
case (GET SECTOR XSUMS):
case (WAKE UP CMIS1:
case (VALIDATE CMI_DL):
reset_retries = 0;
calc_retries = 0;
//set flag for use after switch statement
individual_flag = TRUE;
break;
IS case (CALC_SECTOR_XSUMS):
iflstatus == BROADCAST_MSG_FAILED)
//see how many in a row
calc_retries++;
2o if(calc_retries == 3)
calc_retries = 0;
status = Perform_Next Step();
break;
25 ]
//retry message
status = Calc_Sector_Checksums();
)
30 else
i
calc_retries = 0;
status = Perform_Next_Step();
]
35 break;
case (RESET CMIS):
if(status == BROADCAST MSG_FAILED)
40 //see how many in a row
reset retries++;
if(reset_retries == 3)
reset_retries = 0;
status = Perform_Next_Step();
45 break;
]
//retry message
5o status = Perform_Resets();
]
else
reset_retries = 0;
55 status = Perform_Next Step();
]
break;
case (DL SECTOR XSUMS):
60 case (DOWNLOAD_MESSAGES):
case (FINISHED):
reset_retries = 0;
calc_retries = 0;
status = Perform_Next_Step();
65 break;
case (NONE):
default:
break;
//if the message returned was not a broadcast message (sent to an
//individual CMI), then we need to check some other stuff
,75 if(indi { dual_flag == TRUE)
//see which CMI is responding
int temp_sector = (data[DIN1] »6) & 0x03;
24


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
int cmi number = data[DINl] & Ox3F;
//verify that this CMI is supposed to be downloaded
if(cmi_number_array[temp_sector][cmi number] _= GO_DOWNLOAD)
(
//if we have found no errors above, then indicate a successful status
//otherwise set the status flag to whatever the error was
if~status == NO ERROR)
1~ [
if(cmi status_array[temp_sector][cmi number] _= OPEN_STATUS)
_[
cmi status array[temp_sector][cmi number] = GOOD_STATUS;
]
else if( (cmi_status_array[temp_sector][cmi number] _= CMI_DID NOT RESPOND)
&& (broadcast mode == VALIDATE CMI DL) )
cmi status array[temp_sector](cmi number) = GOOD_STATUS;
]
else ]
t
cmi status_array[temp_sector][cmi number] = status;
]
25 //turn the download flag off for this CMI only if we've failed to
//find the CMI through the RUA_LOST_CMI message - decrement the
//number of CMIS we wish to Download
if( (broadcast mode == FIND_CMIS) && (status != NO_ERROR) )
cmi number_array(temp_sector][cmi number] = DO_NOT DOWNLOAD;
num_cmis--,
]
else
(
3 5 //increment the counter
cmi counter++;
]
//see if we're ready to go to next step
if(cmi counter == num_cmis)
_{
//check to see if there are any CMIs to be downloaded (did they all
//not talk during FIND_CMIS stage???)
if(broadcast mode == FIND_CMIS)
(
status = COULDNT FIND_CMI;
for lint j = 0; j < NUM_SECTORS; j++)
5o for(int i = o; i < MAX CMIS; i++)
(
if(cmi number_array[j][i] _= GO_DOWNLOAD)
_{
status = NO_ERROR;
break;
]
]
if(status == NO_ERROR)
//go do the next step in the download process
status = Perform_Next Step();
]
else
Cancel_Download();
return (status);
]
]
7o else
status = Perform_Next_Step();
]
]
] ]
//make a call to the main window to indicate DL status


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
if( (broadcast mode != FINISHED) && (broadcast mode != NONE) )
{
parent class->Update_DL_Status(broadcast mode, lint **) cmi_status_array);
return (status);
0 /*******************************************x****************rr***
* Name: Handle_Return_Data
* Class: Download_CMI_Class
* Abstract: validate and process the return data from the CMis
* Rev History:
IS * PCR Number Date Engineer Description
* PCSC-152 4/30/98 Moody New
**********************************x*************x************x****/
int
Download CMI Class::Handle_Return_Datalunsigned int data[], int failed_flag)
20 (
int status = NO_ERROR;
//get CMI
25 lnt sect = (data[DIN1] »6) & 0x03;
int cminum = data[DIN1J & Ox3F;
CMI * temp_cmi = HIC_id->Child_CMIs(sect](cminum];
if(temp_cmi == NULL)
{
status = NULL CMI;
30 ]
//call function to make sure the message types) are valid for the mode we are
in
if(status == NO_ERROR)
{
35 status = Compare Message_Type(data[MESSAGE_ID], failed_flag);
]
//do any other validation of the data that needs to be done
if~status == NO_ERROR)
40 {
if (failed_flag == FAILED) //want to set status flag to an error condition
{
switch (broadcast mode)
case FIND CMIS:
45 { _
status = COULDNT_FIND_CMI;
break;
case TURN_FLAGS_ON:
SO case GET_SECTOR_XSUMS:
status = CMI DID NOT_RESPOND;
break;
55 case WAKE_UP_CMIS:
case VALIDATE CMI_DL:
status = INVALID_RETURN_DATA;
break;
6o default:
case DL_SECTOR_XSUMS:
case CALC_SECTOR_XSUMS:
case DOWNLOAD_MESSAGES:
case RESET_CMIS:
status = BROADCAST MSG_FAILED;
65 break;
]
]
else //not a failed situation - want to perform actions based on message type
70 {
switch(broadcast mode)
{
case TURN_FLAGS_ON:
//make sure message has flags set properly
if( (data[DIN3] != ACCEPT_BROADCAST_MSGS) ~~
7S (data[DINS] != ACCEPT_DL_MSGS)
(data[DIN7] != CLEAR_REPORT AREA) )
{
26


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
status = INVALID_RETURN_DATA;
break;
Case GET_SECTOR_XSUMS:
//store the sectors for which there are bad checksums to indicate which
//sectors to download
status = Store Download_Sectorsldata);
to break;
case DL_SECTOR_XSUMS:
case DOWNLOAD_MESSAGES:
case CALC SECTOR_XSUMS:
case RESET_CMIS:
case FIND_CMIS:
case WAKE_UP_CMIS:
case VALIDATE_CMI_DL:
default:
break;
]
return ( status ) ;
/*****rx***x*******x*x******************r*x************x****x**x*x
* Name: Compare_Message_Type
* Class: Download_CMI_Class
* Abstract: verify that the message type returned is valid for that phase
* Rev History:
* PCR Number Date Engineer Description
* PCSC-152 4/30/98 Moody New
***a****************w***x**********x*****x*************x**x*******/
int
3 5 Download_CMI Class::Compare_Message_Type(int data value, int failed_flag)
i
int status = NO_ERROR;
4o if(failed_flag != FAILED)
int success_flag = 0;
for (int i = 0; i < MAX MSG TYPES; i++)
if (data_value == Valid_Message_Types(broadcast mode](i])
t
success_flag = 1;
]
]
if(!success_flag)
(
status = INVALID_MESSAGE TYPE;
y ]
return status;
/***************x***x********xx*x********x****xx*********x*xr**x**
* Name: Store_Download_Sectors
* Class: Download_CMI_Class
* Abstract: store the sectors of the CMI that need to be downloaded
* Rev History:
* PCR Number Date Engineer Description
' PCSC-152 5/2/98 Moody New
****x**************xxxxx*r************xx*********************xx**+/
int
Download_CMI Class::Store_Download_Sectors(unsigned int data[])
int status = NO_ERROR;
,75 !/make sure that the message checksum matches the DF10 checksum
unsigned char checksum = 0;
for(int i = DIN2; i < DIN10; i++)
(
27


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
checksum += data[i];
if(checksum != data[DIN10))
(
status = ZNVALID_MESSAGE_CHECKSUM;
if(status ==
NO_ERROR)



//if data[DIN9) is VALID(0), then the checksum on sector-57
(which contains


//the checksums of the
other
56
sectors)
is
OK
and
we
can
trust
the
info
in


//the reset of thebitmap


ifldata[DIN91 =
= 0)


(
IS for(int i DIN2;i < DIN9; i++)
=


forlint= 0; j < 8; j++)
j



if( ((d
ta[i]j)&1) _= 1)


2o a


pages_to_download[8*(i-DIN2)+j)
) = GO_DOWNLOAD;

)


25 } )
else //sector that contains the checksums is bad
status = INVALID SECTOR_CHECKSUM;
)
return ( status ) ;
/**xx*wx*ax*x*x****x*****x***x****x***xx*+***********xx*x**x*xx***
* Name: Perform_Next_Step
' Class: Download_CMI_Class
* Abstract: do the next step in the download process
* Rev History:
* PCR Number Date Engineer Description
' PCSC-152 4/29/98 Moody New
*w*wxw***********x****x****xrx*********************************x**/
int
Download_CMI Class::Perform_Next_Step()
(
int status = NO_ERROR;
CO lflstep {flag != MANUAL_WAIT) //it must be in AUTO or MANUAL GO
J switch(broadcast mode)
i
case NONE:
status = Find_CMIs();
break;
case FIND_CMIS:
status = Set CMI Flags();
6o break;
case TURN_FLAGS_ON:
//set the parent class logging flag to FALSE
parent class->log_flag = FALSE;
status = DL_Sector Checksums();
break;
case DL_SECTOR XSUMS:
,70 //continue to download until an EOF is returned
status = DL_Sector_Checksums();
if (status == END_OF FILE)
,75 //set the parent class logging flag to ON
parent class->log_flag = TRUE;
//Download is complete, so turn off the broadcast and download flags
status = Calc_Sector_Checksums();
28


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
)


break;


case CALC_SECTOR_XSUMS:


//continue to download until an EOF is returned


if(dl_timer_flag == OFF)


f
//start the DL timer


status = Set_DL_Timer();
}


else


f


//turn off the reset timer flag


dl_timer_flag = OFF;


//this was a broadcast message - change all open CMIs back
to good


for (int j=O;j<NUM_SECTORS;j++)


(


2o for (int i = 0; i < MAX_CMIS; i++)


i


if(cmi status_array[j][i] _= OPEN_STATUS)
_


{


cmi_status_array[j][i] = GOOD_STATUS;


} }
)


//perform next step


status = Get_Sector_Checksums();


)


break;


case GET_SECTOR_XSUMS:


//set the parent class logging flag to FALSE


parent_class->log_flag = FALSE;


status = Download_File();


//in this special case,


if (status == ALL_SECTORS_DOWNLOADED)



//set the parent class logging flag to ON


parent class->log_flag = TRUE;


//Download is complete, so turn off the broadcast and download
flags


status = Perform_Resets();


)
break;


case DOWNL.OAD_MESSAGES:


//continue to download until an EOF or an ALL_SECTORS_DOWNLOADED
is returned


status = Download_File();


5 5 if (status == END_OF FILE)
f


//current sector is complete - download next sector


status = Download_File();


if (status == ALL SECTORS_DOWNLOADED)



//set the parent class logging flag to ON


parent class->log_flag = TRUE;


//Download is complete, so turn off the broadcast and download
65


flags


status = Perform_Resets();
)


]
break;


,7o


case RESET_CMIS:


if(dl_timer_flag == OFF)


f
,75 //start the lss reset timer


status = Set DL_Timer();


]


else


29


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
(
//turn off the reset timer flag
dl_timer_flag = OFF;
//this was a broadcast message - change all open CMIs back to good
for lint j=O;j<NUM_SECTORS;j++)
(
for lint i = 0; i < MAX_CMIS; i++)
i
if(cmi status array[j][i] _= OPEN_STATUS)
_i
cmi_status array[j][i) = GOOD_STATUS;
)
15 )
//perform next step
status = Wake Up CMIs();
break; )
case WAKE_UP_CMIS:
status = Validate CMI DL();
25 break;
case VALIDATE_CMI_DL:
status = Download_Complete();
break;
30 case FINISHED:
default:
break;
)
35 return status;
/*********************x************x**********r*x***w****x***x***x
' Name: Find_CMIs
40 * Class: Download_CMI Class
* Abstract: Send messages to all of the CMIs to find them
* Rev History:
° PCR Number Date Engineer Description
* PCSC-152 4/1/98 Moody New
*********x************x*********x***x*******************xx********/
int
Download_CMI Class::Find_CMIs()
i
CO int status = NO_ERROR;
J //build message to send to CMIs
MSG_PKT msg_out;
msg_out.message_id = rua_lost cmi;
msg_out.message_tag = 0;
55 for lint j = DOUT2; j < MAX DATA_BYTES; j++)
i
msg_out.data[j] = 0;
//set counter to 0
cmi counter = 0;
//set mode flag
65 broadcast mode = FIND_CMIS;
for (j = 0; j < NUM_SECTORS; j++)
i
msg_out.data(DOUT2] = HIC_id->US Primary_Channel[j];
,7o msg_out.data[DOUT3] = HIC_id->US_Diversity_Channel[j];
//send messages to CMI
for lint i = 0; i < MAX CMIS; i++)
i
if(cmi number_array(j][i] _= GO_DOWNLOAD)
_i
//set CMI id in datafield 1
msg out.data[DOUT1] _ (j«6) + i;


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
//start the CMIS out as all being open
cmi_status_array(j][i] = OPEN_STATUS;
//place messages into queue
parent class->Send_Messagelmsg_out, HIC_id, NO_POLL,INTERNAL,-1,-1, TRUE);
]
return ( status )
]
/************+++++++*++***++++******+r+r+*************+******+**+*
IS * Name: Set_CMI_Flags
+ Class: Download_CMI_Class
* Abstract: Send messages to all of the CMIs to set their Broadcast flags
* Rev History:
* PCR Number Date Engineer Description
* PCSC-152 3/31/98 Moody New
***************xx+*+******x******x****x*x**+*+*++*************++**/
int
Download_CMI_Class::Set CMI Flags()
int status = NO_ERROR;
//build message to send to CMIs
MSG_PKT msg_out;
msg_out.message_id = cmi cdl_stat_instr;
msg_out.message_tag = 0;
msg_out.data[DOUT2] = OxOB; //data integrity
msg_out.data[DOUT3] = ACCEPT_BROADCAST_MSGS;
msg_out.data[DOUT4] = OxOE; //data integrity
3 5 msg_out.data[DOUTS] = ACCEPT_DL MSGS;
msg_out.data[DOUT6] = OxOE; //data integrity
msg_out.data[DOUT7] = CLEAR_REPORT_AREA;
msg_out.data[DOUTB] = OxOF; //data integrity
msg_out.data[DOUT9] = 0;
4o msg_out.data(DOUT10] = 0;
//set counter to 0
cmi counter = 0;
//set mode flag
45 broadcast mode = TURN_FLAGS_ON;
for lint j = 0; j < NUM_SECTORS; j++)
c //send messages to CMI
J0 for lint i = 0; i < MAX CMIS; i++)
i
if(cmi number_array[j](i] _= GO_DOWNLOAD)
5 5 //set CMI id in datafield 1
msg_out.data[DOUT1] _ (j«6) + i;
//set status flag to 'open' if it hasn't failed any steps so far
if(cmi_status array(]][i] _= GOOD_STATUS)
cmi_status array[j][i] = OPEN_STATUS;
]
//place messages into queue
parent class->Send_Message(msg_out, HIC_id, NO_POLL,INTERNAL,-1,-1, TRUE);
}eturn (status);
/****+**++++****+*****+*+***+**************x*x*+*+****************
* Name: DL_Sector_Checksums
* Class: Download_CMI_Class
' Abstract: Send messages to the CMIs to download the sector checksums
* Rev History:
* PCR Number Date Engineer Description
31


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
* PCSC-152 4/30/98 Moody New
********x*xrr**x*x**********x**xxxx***x*x*xx**x***xxx*x*xxxxxxxxx+/
int
Download_CMI Class::DL_Sector_Checksums()
S c
int status = NO_ERROR;
int i. j;
//set broadcast mode
broadcast mode = DL_SECTOR_XSUMS;
//this function handles the downloading of a given sector. Need to scan the
//download file to find those lines
IS status = Download Sector(CHECKSUM_SECTOR);
//see if status returned indicates END_OF_FILE or an error
switch(status)
f
2O case COULDNT_FIND_FILE_SECTOR:
case INVALID_FILE_DATA
case INCORRECT_SECTOR_REQUEST:
//since this is a critical step in the download process, we need
//to abort if we got an error in the Download_Sector file
for (j = 0; j < NUM SECTORS; j++)
2S (
for (i = 0; i < MAX_CMIS; i++)
if(cmi_status_array[j](i] _= OPEN_STATUS)
cmi_status array[j][i] = status;
)
)
break;
3S
case NO_ERROR:
//this is a broadcast message - change all good CMIs to open
for (j = 0; j < NUM_SECTORS; j++)
for (i = 0; i < MAX_CMIS; i++)
if(cmi status_array[j][i] _= GOOD_STATUS)
_(
4S cmi_status_array[j][i] = OPEN_STATUS;
)
]
]
break;
SO case END_OF_FILE:
//this is a broadcast message - change all open CMIS back to good
for (j = 0; j < NUM_SECTORS; j++)
SS for (i = 0; i < MAX_CMIS; i++)
if(cmi status_array[j][i] _= OPEN_STATUS)
_{
cmi_status_array[j][i] = GOOD STATUS;
60 ]
]
break;
default:
6S //do nothing
break;
]
,70 }eturn (status);
/********r**xr*******xx****x***x**x*xx*********xxx*x****x**xx**x*x
* Name: Calc_Sector_Checksums
* Class: Download_CMI_Class
7S * Abstract: Send messages to the CMIs to instruct that they calculate
* the sector checksums
* Rev History:
32


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
* PCR Number Date Engineer Description


* PCSC-152 4/30/98 Moody New


*****x****************xxxx***********x*x*****************x**xxx*x*/


int


Download_CMI Class::Calc_Sector_Checksums()



int status = NO_ERROR;


//if user chose to force all checksumsaded, then ignore
to be downlo steps


1 //or asking CMIs to calculate them download step
0 and go right to


iflforce_state == TRUE)



for(int j = 0; j < NUM_DL_PAGES;
j++)



15
pages_to_download[j] = GO_DOWNLOAD;


]


Download_File();


return status;


20 ]


//set mode flag and make sure timer
flag is OFF


dl timer_flag = OFF;


broadcast mode = CALC_SECTOR XSUMS;


25 //build message to send to CMIs


MSG_PKT msg_out;


msg_out.message_id = cmi cdl calc_sect
xsum;


msg_out.message_tag = 0;


msg_out.data(DOUT2] = OxOB; //data integrity


30 msg_out.data(DOUT3] = 0;


msg_out.data(DOUT4] = OxOE; //data integrity


msg_out.data(DOUTS] = 0;


msg_out.data[DOUT6] = OxOE; //data integrity


msg_out.data[DOUT7] = 0;


3 msg_out.data[DOUTB] = OxOF; //data integrity



msg_out.data[DOUT9] = 0;


msg_out.data[DOUT10] = 0;


40 //set counter to 0
cmi counter = 0;
//broadcast message
msg_out.data[DOUT1] = BROADCAST_MASK;
45 parent class->Send_Message(msg_out, HIC_id, NO_POLL,INTERNAL,-1,-1, TRUE);
//this is a broadcast message - change all good CMIs to open
for (int j = 0; j < NLJM_SECTORS; j++)
5o for (int i = 0; i < MAX_CMIS; i++)
if(cmi status_array[j][i] _= GOOD_STATUS)
_{
cmi_status array[j][i] = OPEN_STATUS;
S$
return (status);
60 ]
/******x*x*****x*+***x+**++**x*xx*xx+++**+x++**x*x******x**++**x**
* Name: Get_Sector_Checksums
* Class: Download_CMI_Class
* Abstract: Send messages to the CMIs to get their sector xsum flags
65 * Rev History:
* PCR Number Date Engineer Description
* PCSC-152 4/30/98 Moody New
a**x***x***x**x+xx**x+xx******+*******x+**x****+******x+x**+**x***/
int
70 Download_CMI Class:: Get Sector_Checksums()
int status = NO_ERROR;
//build message to send to CMis
75 MSG_PKT msg_out;
ms_q_out.message_id = cmi cdl_rpt_sect xsum;
msg_out.message_tag = 0;
33


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
for(int i = DOUT2; i < MAX DATA_BYTES; i++)
msg_out.data[i] = 0;
]
//set counter to 0
cmi counter = 0;
//set mode flag
broadcast mode = GET_SECTOR_XSUMS;
for (int j = 0; j < NUM_SECTORS; j++)
//send messages to CMI
IS for (int i = D; i < MAX CMIS: i++)
if(cmi number_array(j][i] _= GO_DOWNLOAD)
_{
//set CMI id in datafield 1
2.0 msg_out.data[DOUT1] _ (j «6) + i;
//set status flag to 'open' if it hasn't failed any steps so far
if(cmi status_array[j][i] _= GOOD_STATUS)
_{
2.5 cmi_status_array[j][i] = OPEN_STATUS;
3
//place messages into queue
3n parent class->Send Message(msg_out, HIC_id, NO_POLL,INTERNAL,-1,-1, TRUE);
v )
]
35 }eturn (status>;
/********xx**xx***x*x***************r**x*******x******************
x Name: Download_File
x Class: Download_CMI_Class
40 * Abstract: Read download file and broadcast messages to the CMIs
* Rev History:
' PCR Number Date Engineer Description
* PCSC-152 4/7/98 Moody New
x**x****x************************x**xx***************x*x****x*****/
45 int
Download_CMI Class::Download_File()
int status = NO_ERROR;
5o int i , j ;
//a static variable to keep track of which sector we are downloading
static int dl_sector = -1;
//set the dl_sector
55 if(dl_sector =- -1)
int i = 0;
while( (pages_to_download[i] _= DO_NOT DOWNLOAD) && (i < NUM-DL_PAGES) )
60 ~++;
]
if(i != NUM_DL_PAGES)
65 //want to set the sector_to_dl flag to 'i', which was determined to
//be the next sector to download. Also want to set that sector's
//dl flag to false, so it won't get re-downloaded
dl_sector = i;
,7o pages_to_download[i] = DO_NOT_DOWNLOAD;
else
[
//no more sectors to download
status = ALL SECTORS DOWNLOADED;
] _
34


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
//set mode
broadcast mode = DOWNLOAD_MESSAGES;
iflstatus == NO_ERROR)
//this function handles the downloading of a given sector. Need to scan the
//download file to find those lines
status = Download_Sector(dl_sector);
//see if status returned indicates END_OF_FILE or an error
switchlstatus)
{
IS case END_OF_FILE:
case COULDNT_FIND_FILE_SECTOR:
case INVALID_FILE_DATA:
case INCORRECT_SECTOR_REQUEST:
//if END_OF_FILE, we want to set the dl_sector flag back to -1 so it will
//determine the next sector to download, if one of the error conditions,
//want to skip this sector and go to the next sector
dl sector = -1;
break;
case NO_ERROR:
//this is a broadcast message - change all good CMIs to open
for (j = 0; j < NUM_SECTORS; j++)
{
for (i = 0; i < MAX CMIS; i++)
{
if(cmi status_array[j][i] _= GOOD_STATUS)
_{
cmi_status array[j][i) = OPEN_STATUS;
]
break;
case ALL_SECTORS_DOWNLOADED:


//this is a broadcast message - change all open CMIs
back to good


for (j = 0; j < NUM_S ECTORS; j++)


{


for (i = 0; i < MAX_CMIS; i++)


{
if(cmi atus_array[j][i] _= OPEN_STATUS)
_


{


cmi_status array[j][i] = GOOD_STATUS;



]
dl_sector = -1;


break;


default:


//don't do anything - the sector is not finished
being downloaded


break;
]


return 1 status ) ;



/******rr******r***r**r*r*rrxx***r*****rrr***rxr*rxxxx*****r**x*x*


* Name: Perform_Resets


* Class: Download_CMI_Class


* Abstract: Function to
send reset messages to
all of the good CMIs


Rev History:


* PCR Number Date Engineer Description


' PCSC-152 3/31/98 Moody New


*x************x*****r******xrrrr***r*rx****x*x******x*******r*****/


int


Download CMI Class::Perform_Resets()


{


int status = NO_ERROR;


//build message to send
to CMIs


MSG_PKT msg_out;


msg_out.message_id = cmi_cdl;
reset


msg_out.message_tag =
0;




CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
msg_out.data[DOUT2) = OxOB; //data integrity
msg_out.data[DOUT3) = 0;
msg_out.data(DOUT4] = OxOE; //data integrity
msg_out.data[DOUTS] = RESET_FROM_EEPROM;
msg_out.data[DOUT6] = OxOE; //data integrity
msg_out.data[DOUT7] = DL_RESET; //perform reset
msg_out.data[DOUTB] = OxOF; //data integrity
msg_out.data[DOUT9] = 0;
to msg_out.data[DOUT10] = 0;
//set counter to 0
cmi_counter = 0;
//set mode flag
IS dl_timer_flag = OFF;
broadcast mode = RESET CMIS;
//broadcast message
2o msg_°ut.data[DOUT1] = BROADCAST_MASK;
parent class->Send_Message(msg_out, HIC_id, NO_POLL,INTERNAL,-1,-1, TRUE);
//this is a broadcast message - change all good CMIs to open
for dint j = 0; j < NUM_SECTORS; j++)
(
for (int i = 0; i < MAX_CMIS; i++)
[
if(cmi status_array[j][i] _= GOOD_STATUS)
_(
cmi_status array[j](i] = OPEN_STATUS;
30 ]
)
)
3 5 }eturn (status);
/ew**************w**x**xw****w****w**x***************x********xx**
* Name: Wake_Up_CMIs
* Class: Download CMI Class
40 * Abstract: Function to re-activate CMIs
* Rev History:
* PCR Number Date Engineer Description
****www*xw*****xxw*x*rx*x**********a*************x****************/
int
45 Download_CMI Class::Wake Up_CMIs()
[
int status = NO ERROR;
//build message to send to CMIs
50 CMI * temp_cmi;
MSG_PKT msg_out;
msg_out.message_id = act cmi msg;
msg_out.message_tag = 0;
5 for (int(j = DOUT2; j < MAX_DATA_BYTES; j++)
msg_out.data(j] = 0;
1
//set counter to 0
f)0 cmi counter = 0;
//set mode flag
broadcast mode = WAKE_UP_CMIS;
65 //build common part of message structure
msg out. data[4] = HIC_id->DS Channel;
msg_out.data[5] = HIC_id->DS Channel_Type;
msg_out.data[6] _ (HIC id->PCS Channel&1792) »8;
,7o msg_out.data[7] = HIC_id->PCS Channel&255;
msg_out.data(9) = 0;
for (j = 0; j < NUM_SECTORS; j++)
[
,75 //build sector portion of message structure
msg_out.data[2] = HIC_id->US Primary_Channel[j];
msg_out.data(3] = HIC_id->US_Diversity_Channel[j];
36


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
//loop thru CMIs
for lint i = 0; i < MAX_CMIS; i++)
if(cmi_number_array[j](i] _= GO_DOWNLOAD)
t
temp_cmi = HIC_id->Child_CMIs[j][i];
if(temp_cmi != NULL)
//set status flag to 'open' if it hasn't failed any steps so far
if(cmi status_array[j][i] _= GOOD_STATUS)
_{
cmi_status_array(j](i] = OPEN_STATUS;
]
IS //build CMI portion of message structure
msg_out.data(DOUT1] _ (j«6) + i;
msg_out.data[DOUT2] = temp_cmi->State +
20 (temp_cmi->Autostat«1) +
(temp_cmi->DS_Autogain«2) +
(LAST_KNO~ STATE«3) +
25 (temp_cmi->Alarm_Disposition«4) +
(temp_cmi->US_Autogain«5);
msg_out.data[DOUT9] = temp_cmi->PA_State +
(temp_cmi->Prim_Rcv_State«1) +
(temp_cmi->Div_Rcv_State«2);
//place messages into queue
35 parent class->Send_Messagelmsg_out, HIC_id, NO_POLL,INTERNAL,-1,-
1,TRUE);
]
else
4~ cmi_status_array[j][i] = COULDNT_FIND_CMI;
]
]
]
45 ]
return (status);
]
V /******x****x****x***********************xx***x****x**************
Name: Validate_CMI_DL
* Class: Download_CMI_Class
* Abstract: Function to get the updated checksum flags of the CMis
x Rev History:
55 * PCR Number Date Engineer Description
*************xx*x***************rx******x***********x*************/
int
Download_CMI Class::Validate_CMI DL()
int status = NO ERROR;
//build message to send to CMIs
MSG_PKT msg_out;
msg_out.message_id = cmi~ower_stat msg;
msg_out.message_tag = 0;
for(int i = DOUT2; i < MAX_DATA_BYTES; i++)
L
msg_out.data[i] = 0;
]
//set counter to 0
cmi counter = 0;
//set mode flag
75 broadcast mode = VALIDATE_CMI DL;
for lint j = 0; j < NUM_SECTORS; j++)
37


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
l
//send messages to CMI
for lint l = 0; l < MAX CMIS; i++)
l
if(cmi number_array[j][i] _= GO_DOWNLOAD)
_i
//set CMI id in datafield 1
msg_out.data[DOUT1] _ (j«6) + l;
//set status flag to 'open' if it hasn't failed any steps so far
if(cmi status_array[j][i] _= GOOD_STATUS)
_i
// cmi_status array(]][j] = OPEN_STATUS;
cmi_status array[j][i] = OPEN_STATUS;
]
//place messages into queue
parent class->Send_Message(msg_out, HIC_id, NO_POLL,INTERNAL,-1,-1, TRUE);
,
return Istatus);
/*********x***************r**********************************xx***
* Name: Download_Complete
* Class: Download_CMI_Class
* Abstract: Function to send status requests to CMI
* Rev History:
* PCR Number Date Engineer Description
" PCSC-152 4/10/98 Moody New
***r*******************x*****************************x************/
int
3 5 Download_CMI_Class::Download_Complete(int cancel_flag)
l
int status = NO_ERROR;
4o MSG_PKT msg_out;
msg_out.message_tag = 0;
for lint j = 0; j < MAX-DATA_BYTES; j++)
l
msg_out.data[j] = 0;
45 ]
if(cancel flag == NOT_CANCEL)
i_
//set mode flag
5o broadcast mode = FINISHED;
//need to finish by sending status messages to each of the CMIs
//to get the HECU updated
for lint j = 0; j < NUM_SECTORS; j++)
(
55 //now send out status update messages
msg_out.data[DOUT2] = HIC_id->US_Primary_Channel[j];
for lint l = 0; l < MAX CMIS; i++)
60 l
if(cmi number_array[j][i] _= GO DOWNLOAD)
l
msg-out.data[DOUT1] _ (j «6) + l;
65 // send attenuator status message
msg_out.message_id = cmi att_stat msg;
parent class->Send_Message(msg_out, HIC_id, NO_POLL,INTERNAL,-1,-1, TRUE);
// send cmi version number message
,7o msg_out.message_id = cmi_read_ver msg;
parent class->Send Message(msg_out, HIC_id, NO_POLL,INTERNAL,-1,-1, TRUE);
// send freq stat message
msg_out.message_id = cmi_freq_stat msg;
,75 parent class->Send_Message(msg_out, HIC_id. NO_POLL,INTERNAL,-1,-1, TRUE);
// send power status message
msg_out.message_id = cmi~ower_stat msg;
38


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
msg_out.data[DOUT3] = HIC_id->US_Diversity_Channel[j];
parent class->Send_Message(msg_out, HIC_id, NO_POLL,INTERNAL,-1,-1, TRUE);
// send message to get cmi faults in read mode


msg_out.message_id = cmi enable_faults;


msg_out.message_tag = 0;


msg_out.data[DOUT2] = 0;


msg_out.data[DOUT3] = 0;


msg_out.data[DOUT10] = 0;


parent class->Send_Message(msg_out, HIC_id, NO_POLL,INTERNAL,-1,-1,
TRUE);


// Send Messages to get cmi fault limits in read mode


msg_out.message_id = cmi set_fault limit 2;


msg_out.message_tag = 0;


msg_out.data[DOUT10] = 0;


parent class->Send_Message(msg_out, HIC_id, NO_POLL,INTERNAL,-1,-1,
TRUE);


msg_out.message_id = cmi_set_fault_limit;


Parent class->Send_Message(msg_out, HIC_id, NO_POLL,INTERNAL,-1,-1,
TRUE);


]
]


]


]
else


[


//set mode flag


broadcast mode = ABORT_MODE;


//send message out to turn off broadcast/download
flags


msg_out.message_id = cmi_cdl_stat_instr;


msg_out.data(DOUT2] = OxOB; //data integrity


msg_out.data[DOUT3] = DO_NOT_ACCEPT_BROADCAST
MSGS;


msg_out.data[DOUT4] = OxOE; //data integrity


msg_out.data[DOUTS] = DO_NOT_ACCEPT_DL_MSGS;


3 msg_out.data[DOUT6] = OxOE; //data integrity
5


msg_out.data[DOUT7] = DO_NOT_CLEAR_RPT_AREA;


msg_out.data[DOUTB] = OxOF; //data integrity


msg_out.data[DOUT9] = 0;


msg_out.data[DOUT10] = 0;



//broadcast message


msg out.data(DOUT1] = BROADCAST_MASK;


parent class->Send_Message(msg_out, HIC_id,
NO_POLL,INTERNAL,-1,-1, TRUE);


45 //need to reset function that handles downloading
of code


Download_Sector(O,TRUE);
]


//call function to notify parent class (HEC) complete
that the download is


50 parent class->Update_DL_Status(broadcast mode,array);
(int **) cmi_status


//turn off mode flag
parent class->System_Mode_Flag = NO MODE;
55 //call function to re-initialize all class members
Initialize_Class();
return (status);
60 ]
/r*x**rrxxrrrr***********x***********rr****x*xrx*x****r***rr****x*


* Name: Download Sector


* Class: Download
CMZ
Class


65 _ particular of the
_ sector CMI
* Abstract: Function
to download a


* Rev History:


* PCR Number Date Engineer Description


* PCSC-152 5/6/98 Moody New


*rr**rrxxx***xr*.*xxr*x***x*xx*x***x*******x********x*****x******x*/
70 int


Dowmload_CMI_Class::Download_Sector(int sector,cancel_flag)
int



//status flag to return


int status = NO
ERROR;


,75_


//temp buffers


char buffer(MAX_LINE_SIZE];


39


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
char temp_sect(31;
//this variable will let us know if we need to go to a different part of
//the file or continue with the portion we are working on
static int current sector = -1;
//if we cancelled the download, we want to set the "current_sector" flag
//to -1 so that on the next download we won't get errors.
to zf (cance{ _flag == TRUE)
current_sector = -1;
return status;
IS //get handle to file stream and create buffer for line of code
ifstream infile(dl_file, ios::in~ios::binary~ios::nocreate);
//if the current sector equals the sector passed in, it is a normal download
//else - if the current sector is NOT equal to the passes sector, then we need
20 //to check to be sure that current_sector is -1, indicating that there is
//not a DL in progress for a different sector
if(current_sector == sector)
//set the file pointer to the last known position, get the code,
25 //store the new position
infile.seekg(file,~os);
infile.getline(buffer,MAX_LINE SIZE);
buffer[CODE LINE SIZE] _ '\0';
file~os = infile.tellg();
//make sure buffer size is OK
if ( strlen(buffer) != CODE_LINE_SIZE )
(
35 //check code size
if( strlen(buffer) _= 0)
status = END_OF_FILE;
else
status = INVALID_FILE_DATA;
40 //whether or not line is good, set sector = -1
current sector = -1;
]
45 //see if the sector field is the same as the current sector
if(status == NO_ERROR)
i
temp_sect[0] = buffer(2];
temp_sect[1] = bufferf3];
5o temp_sect(2] _ '\o';
ifl((int)strtol(temp_sect,NULL,16)) != current_sector)
(
//reset the current sector and set status flag to indicate there
//are no more lines in this sector
55 current_sector = -1;
status = END OF FILE;
l
else //current sector != sector
60 c -
if(current_sector !_ -1)
//current sector was already set to a different sector
65 current_sector = -1;
status = INCORRECT_SECTOR REQUEST;
]
else //legitamately starting a new sector
,,O //reassign the current sector
current sector = sector;
//set the file pointer to the beginning of the file
file~os = 0;
infile.seekg(file~os);
//search through file until find a line with correct sector id
int success_flag = FALSE;


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
doi
//store current position, get line, store new position
infile.getlinelbuffer, MAX_LINE_SIZE);
buffer(CODE LINE_SIZE] _ '\0';
file~os = infile.tellg();
//get the sector
temp_sect[0] = buffer(2];
temp_sect(1] = buffer[3];
1~ temp_sect[2] _ '\0';
//convert the sector from a hex (radixl6) val to a decimal and compare
if(((int)strtol(temp_sect,NULL.16)) _= current_sector)
i
15 success_flag = TRUE;
break;
)
) while t strlen(buffer) _- (CODE_LINE_SIZE) );
//see if we did not break out of do/while loop
iflsuccess_flag == FALSE)
i
status = COULDNT_FIND_FILE_SECTOR;
25 ?urrent_sector = -1;
)
)
30 //close the file
infile.close();
//send message to the CMIs in broadcast mode
if(status == NO_ERROR)
35 i
int i = 0, j = 0, index = 0;
char temp_str(3];
int datafield[DATA_PACKET_SIZE];
//want to get two characters at a time, stopping at the return char - also
//use the check of 'i' for CODE_LINE_SIZE as a boundary check
while ( (buffer[i] !_ '\r') && (i < CODE_LINE_SIZE) )
i
while (j < 2)
i
45 temp_str[j] = buffer[i];
j++;
i++;
)
temp_str[j] _ '\0';
j = 0;
datafield(index] _ (unsigned char)strtol(temp_str,NULL,16);
index++;
]
//build the download message
MSG_PKT msg_out;
60 msg_out.message_id = (MSG_ID)datafield[MESSAGE_ID];
msg_out.message_tag = 0;
//set DF #2 thru DF #10
for(i = DOUT2; i < MAX_DATA_BYTES; i++)
65 i
msg_out.data[i] _ (unsigned char)datafield[i+OVERHEAD_BYTES];
)
!/broadcast message
7o msg_out.data(DOUT1] = BROADCAST_MASK;
parent class->Send_Message(msg_out, HIC_id, NO_POLL,INTERNAL~-1,-1, TRUE);
return (status);
75 )
/**r*r***r**rrrr*rrr*r****xxrr*****r*xr*w**x*xxxx**rr**rrrrx**xx*x
Name: Set DL_Timer
41


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
* Class: Download_CMI Class
* Abstract: Function to activate a timer to let the CMIs reset
Rev History:
° PCR Number Date Engineer Description
S * PCSC-152 4/10/98 Moody New
******r*rr*******r*xx******a*x***r******r**rr******************xx*/
int
Download_CMI Class:: Set DL_Timer()
int status = NO_ERROR;
//if SetTimer returns a 0, operaton has failed, so set status flag accordingly
if(parent class->Set DL_Timer() _= 0)
{_
IS status = COULDNT_SET_DL TIMER;
else
2o dl_timer_flag = ON;
return (status);
/**r*r**x***r*********r*a***ra*****rxaa*x*x*****aaaa**************
Name: Stop_Reset_Timer
* Class: Download_CMI_Class
* Abstract: Function to stop the CMI reset timer
* Rev History:
30 * PCR Number Date Engineer Description
* PCSC-152 5/13/98 Moody New
*x***r*rr*xr******raa***xx**********x**axxa*x******x******x*xxx***/
VOld
3 S Download_CMI Class::Stop_DL Timer()
//Call to parent class which will call parent window to stop timer
parent class->Stop DL_Timer();
0 /*r**wx**r*x*x*********r*********************x****************x***
* Name: DL_Timer_Complete
* Class: Download_CMI_Class
' Abstract: Outside class indicating that reset timer is complete
* Rev History:
4S * PCR Number Date Engineer Description
* PCSC-152 4/29/98 Moody New
**rx***r*w*x****xx*********x*******xx*******************x*****xx**/
int
SO Download_CMI Class::DL_Timer_Complete()
int status = NO_ERROR;
if(dl timer_flag == ON)
SS //make call to perform next step
status = Perform_Next Step();
)
60 iflstat { != NO_ERROR)
Cancel Download();
else
6S {_
parent class->Update_DL_Status(broadcast mode, lint '*) cmi_status array);
)
return 4 status ) ;
/rrr*rxr*****x**r*x*******x*****xa***x****x**r**a*x******x**r****x
* Name: Cancel_Download
* Class: Download_CMI_Class
* Abstract: Outside class indicating that reset timer is complete
7S * Rev History:
* PCR Number Date Engineer Description
* PCSC-152 4/29/98 Moody New
42


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
***********xxxx**xx**x***x******w*******x****x******x**x*xx****x**/
int
Download_CMI_Class::Cancel Download()
Stop_DL_Timer();
Download_Complete(CANCEL);
IO }eturn(NO_ERROR);
/**a*w*x*x*******ass**x****r**xx***************x*x**x**xr****r****


* Name: Get_Step_State


CMI Class
* Class: Download


I5 _
* Abstract: return the current step
state


* Rev History:


x PCR Number Date Engineer Description


' PCSC-152 4/29/98 Moody New


*x*******x**x*********x*x*x*x**x*x**************x**x***********xx*/
20 int


Download_CMI_Class::Get Step_State()


i


return(step_flag);


)


25


/****w*x*xxxxx*x****x***x***x***x***x**x**********************x***


* Name: Set_Step_State


x Class: Download_CMI_Class


* Abstract: set the current step
state


30 * Rev History:


* PCR Number Date Engineer Description


x PCSC-152 4/29/98 Moody New


********x********x**********x**xx***************x****************x/


int


3 Download_CMI_Class::Set Step_Statelint
flag)



step_flag = flag;


return(NO_ERROR);



40


It will be appreciated that the above described system is more efficient in
the downloading of
information to the cable microcell integrators due to the hybrid
unicastlbroadcast mode of operation.
Additional efficiencies in the downloading of information include the data
formatting techniques
indicated in the program listing below, written in C and batch instructions.
Of importance is one
45 efficiency due to the fact that in the broadcast mode addresses are not
necessary. This frees up the
address blocks so that data can be placed therein.
By way of overview, the purpose of the code referred to as HEX2CDL is to
convert the
output file of a cable microcell integrator compilation (HEX) to a CDL file
format that takes
advantage of the cable microcell integrator's broadcast download messages. CDL
messages are
50 ordered in the CDL file in such a way as to allow the head end control unit
to quickly download
checksums of a new image to the cable microcell integrators and to allow easy
access and sending
43


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
of any specific sector of the cable microcell integrator code. Each sector of
this code is represented
by the smallest number of CDL messages possible.
In detail, what follows is a list of the tasks that are done by the HEX2CDL
code. First, the
HEX2CDL code separates the ROM code from the EEPROM code. Note that ROM code
does not
get downloaded. The EEPROM is broken into Fifty-Seven 512 byte sectors (0-56
inclusive). A 32
bit checksum is calculated for each sector. A checksum is placed inside
messages marked as sector
56 (0x38). These checksum messages are in order, Sector 0 first, and are
placed at the top of the
CDL file. Each Sector of EEPROM code is processed to produce the minimum
number of CDL
messages and Run Length Encoding. All messages pertaining to a Sector are
grouped together. The
tag field of each message contains the sector number, which is how the head
end control unit can
download any specific sector. Each line of the CDL is a separate message all
ready to be sent by the
head end control unit.
More particularly, the following is a sample CDL Output file. Comments are to
the right of
// and are not part of the file. Typically there are about 3000 lines to a CDL
file. The 3rd and 4th
~15 Character in each line is considered to be the TAG byte, 0x38 = sector 56
which tells the HECU it is
checksum information The F000 is the address to write
3B3800FOOOE400010CD50001 //Checksum information in each line until the tag
- 0
37380003370000D2AFOOOOE9 //each checksum is 4 bytes,
37380029000107FDOOOOF8AD
3738000001FEOOOOO1FE0000
37380001FEOOOOO1FE000001
2S 373800FOA0000028C3000000
3B00008000F9E4906771FOE4 //first line of Sector 0, write it at address 0x8000
37000090676FFOE4906770F0 //The above message is a Start of block Ox3B, this
message is 0x37 Block
. //Continuation message
393500EAOOFCFF0000000000 // There is no code in sector 0x35 (53 decimal) FF
is the blank Character
44


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
393500EAFCFCFF0000000000 // One wants to erase anything that might have been
there before
393500EBF806FF0000000000 // One can accomplish replacing 512 bytes with these
3A3500EBFE02FFFF00000000 // 4 messages
393600ECOOFCFF0000000000 // Start of Sector 54, it too is blank
393600ECFCFCFF0000000000
393600EDF806FF0000000000
3A3600EDFE02FFFF00000000
393700EEOOFCFF0000000000
393700EF26D8FF0000000000
3B3700EEFC2AFFFFFFFF9066 // Some code exists in sector 55 starting at
address OxEEFF
373700DAEOFAA3EOFB9066DC
373700EOFD7COOEB2DFFEA3C
IS 373700FE9066D8EEFOA3EFF0
37370074002508F50822FFFF
3A3700EFFE02FFFF00000000
rem
rem BLOCKSEG.BAT
rem
rem The batchfile makes 55 calls of the blockout executable to process
rem all the files created by condseg.bat
rem
rem
blockout seg0000.zzc seg0000.b1o
blockout seg0001.zzc seg0001.b1o
blockout seg0002.zzc seg0002.b1o
blockout seg0003.zzc seg0003.b1o
blockout seg0004.zzc seg0004.b1o
blockout seg0005.zzc seg0005.b1o
blockout seg0006.zzc seg0006.b1o
blockout seg0007.zzc seg0007.b1o
blockout seg0008.zzc seg0008.b1o
blockout seg0009.zzc seg0009.b1o
blockout seg000A.zzc seg000A.blo
blockout seg000B.zzc seg000B.blo
blockout seg000C.zzc seg000C.blo
blockout seg000D.zzc seg000D.blo
blockout seg000E.zzc seg000E.blo
blockout seg000F.zzc seg000F.blo
blockout seg0010.zzc seg0010.b1o
blockout seg0011.zzc seg0011.b1o
blockout seg0012.zzc seg0012.b1o
blockout seg0013.zzc seg0013.b1o
blockout seg0014.zzc seg0014.b1o
blockout seg0015.zzc seg0015.b1o
blockout seg0016.zzc seg0016.b1o
blockout seg0017.zzc seg0017.b1o
blockout seg0018.zzc seg0018.b1o
blockout seg0019.zzc seg0019.b1o
blockout seg001A.zzc seg001A.blo
blockout seg001B.zzc seg001B.blo
SS blockout seg001C.zzc seg001C.blo
blockout seg001D.zzc seg001D.blo
blockout seg001E.zzc seg001E.blo
blockout seg001F.zzc seg001F.blo
blockout seg0020.zzc seg0020.b1o
blockout seg0021.zzc seg0021.b1o
blockout seg0022.zzc seg0022.b1o
blockout seg0023.zzc seg0023.b1o


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
blockoutseg0024.zzcseg0024.b1o


blockoutseg0025.zzcseg0025.b1o


blockoutseg0026.zzcseg0026.b1o


blockoutseg0027.zzcseg0027.b1o


S blockoutseg0028.zzcseg0028.b1o


blockoutseg0029.zzcseg0029.b1o


blockoutseg002A.zzcseg002A.blo


blockoutseg002B.zzcseg002B.blo


blockoutseg002C.zzcseg002C.blo


blockoutseg002D.zzcseg002D.blo


blockoutseg002E.zzcseg002E.blo


blockoutseg002F.zzcseg002F.blo


blockoutseg0030.zzcseg0030.b1o


blockoutseg0031.zzcseg0031.b1o


blockoutseg0032.zzcseg0032.b1o


blockoutseg0033.zzcseg0033.b1o


blockoutseg0034.zzcseg0034.b1o


blockoutseg0035.zzcseg0035.b1o


blockoutseg0036.zzcseg0036.b1o


blockoutseg0037.zzcseg0037.b1o


rem *********************************************************************
rem
rem CONDSEG.BAT
rem
rem This batch file makes a call to condence for each of the segment files
rem generated by GENSEGS
rem
rem


condenseseg0000.zzzFF seg0000.conseg0000.zzc


condenseseg0001.zzzFF seg0001.conseg0001.zzc


condenseseg0002.zzzFF seg0002.conseg0002.zzc


condenseseg0003.zzzFF seg0003.conseg0003.zzc


condenseseg0004.zzzFF seg0004.conseg0004.zzc


condenseseg0005.zzzFF seg0005.conseg0005.zzc


condenseseg0006.zzzFF seg0006.conseg0006.zzc


condenseseg0007.zzzFF seg0007.conseg0007.zzc


condenseseg0008.zzzFF seg0008.conseg0008.zzc


condenseseg0009.zzzFF seg0009.conseg0009.zzc


condenseseg000A.zzzFF seg000A.conseg000A.zzc


condenseseg000B.zzzFF seg000B.conseg000B.zzc


condenseseg000C.zzzFF seg000C.conseg000C.zzc


condenseseg000D.zzzFF seg000D.conseg000D.zzc


condenseseg000E.zzzFF seg000E.conseg000E.zzc


condenseseg000F.zzzFF seg000F.conseg000F.zzc


condenseseg0010.zzzFF seg0010.conseg0010.zzc


condenseseg0011.zzzFF seg0011.conseg0011.zzc


condenseseg0012.zzzFF seg0012.conseg0012.zzc


condenseseg0013.zzzFF seg0013.conseg0013.zzc


condenseseg0014.zzzFF seg0014.conseg0014.zzc


condenseseg0015.zzzFF seg0015.conseg0015.zzc


condenseseg0016.zzzFF seg0016.conseg0016.zzc


condenseseg0017.zzzFF seg0017.conseg0017.zzc


condenseseg0018.zzzFF seg0018.conseg0018.zzc


condenseseg0019.zzzFF seg0019.conseg0019.zzc


condenseseg001A.zzzFF seg001A.conseg001A.zzc


condenseseg001B.zzzFF seg001B.conseg001B.zzc


f)0condenseseg001C.zzzFF seg001C.conseg001C.zzc


condenseseg001D.zzzFF seg001D.conseg001D.zzc


condenseseg001E.zzzFF seg001E.conseg001E.zzc


46


CA 02374782 2001-11-20
WO 00/72139 PCT/iJS00/13889
condense seg001F.zzz FF seg001F.con seg001F.zzc
condense seg0020.zzz FF seg0020.con seg0020.zzc
condense seg0021.zzz FF seg0021.con seg0021.zzc
condense seg0022.zzz FF seg0022.con seg0022.zzc
condense seg0023.zzz FF seg0023.con seg0023.zzc
condense seg0024.zzz FF seg0024.con seg0024.zzc
condense seg0025.zzz FF seg0025.con seg0025.zzc
condense seg0026.zzz FF seg0026.con seg0026.zzc
condense seg0027.zzz FF seg0027.con seg0027.zzc
condense seg0028.zzz FF seg0028.con seg0028.zzc
condense seg0029.zzz FF seg0029.con seg0029.zzc
condense seg002A.zzz FF seg002A.con seg002A.zzc
condense seg002B.zzz FF seg002B.con seg002B.zzc
condense seg002C.zzz FF seg002C.con seg002C.zzc
condense seg002D.zzz FF seg002D.con seg002D.zzc
condense seg002E.zzz FF seg002E.con seg002E.zzc
condense seg002F.zzz FF seg002F.con seg002F.zzc
condense seg0030.zzz FF seg0030.con seg0030.zzc
condense seg0031.zzz FF seg0031.con seg0031.zzc
condense seg0032.zzz FF seg0032.con seg0032.zzc
condense seg0033.zzz FF seg0033.con seg0033.zzc
condense seg0034.zzz FF seg0034.con seg0034.zzc
condense seg0035.zzz FF seg0035.con seg0035.zzc
condense seg0036.zzz FF seg0036.con seg0036.zzc
condense seg0037.zzz FF seg0037.con seg0037.zzc
rem *********************************************************************
rem


rem GROUPOUT.BAT


rem


rem The batchfile put of ondence and blockout stages
group the out the c


3$ rem into one file rocessed TAGINC to set the tag
that can be p by field


rem to be the as the character efore the . in the filename.
same 2 HEX b


rem The last character nput file TAGINC will be changes
of the i to to a P.


rem to incate is will sed as the output file.
Processed, and be u
th


rem


rem


copy seg0000.con seg0000.b1oseg0000.zzc>nul
+


taginc seg0000.zzcfoo -N


copy seg0001.con seg0001.b1oseg0001.zzc>nul
+


taginc seg0001.zzcfoo -N


copy seg0002.con seg0002.b1oseg0002.zzc>nul
+


taginc seg0002.zzcfoo -N


copy seg0003.con seg0003.b1oseg0003.zzc>nul
+


taginc seg0003.zzcfoo -N


copy seg0004.cora.seg0004.b1oseg0004.zzc>nul
+


taginc seg0004.zzcfoo -N


copy seg0005.con seg0005.b1oseg0005.zzc>nul
+


taginc seg0005.zzcfoo -N


copy seg0006.con seg0006.b1oseg0006.zzc>nul
+


taginc seg0006.zzcfoo -N


copy seg0007.con seg0007.b1oseg0007.zzc>nul
+


taginc seg0007.zzcfoo -N


copy seg0008.con seg0008.b1oseg0008.zzc>nul
+


taginc seg0008.zzcfoo -N


copy seg0009.con seg0009.b1oseg0009.zzc>nul
+


f)0taginc seg0009.zzcfoo -N


copy seg000A.con seg000A.bloseg000A.zzc>nul
+


taginc seg000A.zzcfoo -N


47


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
copy seg000B.conseg000B.bloseg000B.zzc
+ >nul


taginc seg000B.zzcfoo -N


copy seg000C.conseg000C.bloseg000C.zzc
+ >nul


taginc seg000C.zzcfoo -N


copy seg000D.conseg000D.bloseg000D.zzc
+ >nul


taginc seg000D.zzcfoo -N


copy seg000E.conseg000E.bloseg000E.zzc
+ >nul


taginc seg000E.zzcfoo -N


copy seg000F.conseg000F.bloseg000F.zzc
+ >nul


taginc seg000F.zzcfoo -N


copy seg0010.conseg0010.b1oseg0010.zzc
+ >nul


taginc seg0010.zzcfoo -N


copy seg0011.conseg0011.b1oseg0011.zzc
+ >nul


taginc seg0011.zzcfoo -N


1$ copy seg0012.conseg0012.b1oseg0012.zzc
+ >nul


taginc seg0012.zzcfoo -N


copy seg0013.conseg0013.b1oseg0013.zzc
+ >nul


taginc seg0013.zzcfoo -N


copy seg0014.conseg0014.b1oseg0014.zzc
+ >nul


taginc seg0014.zzcfoo -N


copy seg0015.conseg0015.b1oseg0015.zzc
+ >nul


taginc seg0015.zzcfoo -N


copy seg0016.conseg0016.b1oseg0016.zzc
+ >nul


taginc seg0016.zzcfoo -N


copy seg0017.conseg0017.b1oseg0017.zzc
+ >nul


taginc seg0017.zzcfoo -N


copy seg0018.conseg0018.b1oseg0018.zzc
+ >nul


taginc seg0018.zzcfoo -N


copy seg0019.conseg0019.b1oseg0019.zzc
+ >nul


taginc seg0019.zzcfoo -N


copy seg001A.conseg001A.bloseg001A.zzc
+ >nul


taginc seg001A.zzcfoo -N


copy seg001B.conseg001B.bloseg001B.zzc
+ >nul


taginc seg001B.zzcfoo -N


copy seg001C.conseg001C.bloseg001C.zzc
+ >nul


taginc seg001C.zzcfoo -N


copy seg001D.conseg001D.bloseg001D.zzc
+ >nul


taginc seg001D.zzcfoo -N


copy seg001E.conseg001E.bloseg001E.zzc
+ >nul


4~ taginc seg001E.zzcfoo -N


copy seg001F.conseg001F.bloseg001F.zzc
+ >nul


taginc seg001F.zzcfoo -N


copy seg0020.conseg0020.b1oseg0020.zzc
+ >nul


taginc seg0020.zzcfoo -N


copy seg0021.conseg0021.b1oseg0021.zzc
+ >nul


taginc seg0021.zzcfoo -N


copy seg0022.conseg0022.b1oseg0022.zzc
+ >nul


taginc seg0022.zzcfoo -N


copy seg0023.conseg0023.b1oseg0023.zzc
+ >nul


taginc seg0023.zzcfoo -N


copy seg0024.conseg0024.b1oseg0024.zzc
+ >nul


taginc seg0024.zzcfoo -N


copy seg0025.conseg0025.b1oseg0025.zzc
+ >nul


taginc seg0025.zzcfoo -N


copy seg0026.conseg0026.b1oseg0026.zzc
+ >nul


taginc seg0026.zzcfoo -N


copy seg0027.conseg0027.b1oseg0027.zzc
+ >nul


taginc seg0027.zzcfoo -N


copy seg0028.conseg0028.b1oseg0028.zzc
+ >nul


taginc seg0028.zzcfoo -N


copy seg0029.conseg0029.b1oseg0029.zzc
+ >nul


taginc seg0029.zzcfoo -N


48


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
copy seg002A.conseg002A.bloseg002A.zzc
+ >nul


taginc seg002A.zzcfoo -N


copy seg002B.conseg002B.bloseg002B.zzc
+ >nul


taginc seg002B.zzcfoo -N


S copy seg002C.conseg002C.bloseg002C.zzc
+ >nul


taginc seg002C.zzcfoo -N


copy seg002D.conseg002D.bloseg002D.zzc
+ >nul


taginc seg002D.zzcfoo -N


copy seg002E.conseg002E.bloseg002E.zzc
+ >nul


taginc seg002E.zzcfoo -N


copy seg002F.conseg002F.bloseg002F.zzc
+ >nul


taginc seg002F.zzcfoo -N


copy seg0030.conseg0030.b1oseg0030.zzc
+ >nul


taginc seg0030.zzcfoo -N


1S copy seg0031.conseg0031.b1oseg0031.zzc
+ >nul


taginc seg0031.zzcfoo -N


copy seg0032.conseg0032.b1oseg0032.zzc
+ >nul


taginc seg0032.zzcfoo -N


copy seg0033.conseg0033.b1oseg0033.zzc
+ >nul


taginc seg0033.zzcfoo -N


copy seg0034.conseg0034.b1oseg0034.zzc
+ >nul


taginc seg0034.zzcfoo -N


copy seg0035.conseg0035.b1oseg0035.zzc
+ >nul


taginc seg0035.zzcfoo -N


2S copy seg0036.conseg0036.b1oseg0036.zzc
+ >nul


taginc seg0036.zzcfoo -N


copy seg0037.conseg0037.b1oseg0037.zzc
+ >nul


taginc seg0037.zzcfoo -N


rem ******j..IEX2CDL.BAT*******************************
@echo off
REM ---TEST THE INPUT PARAMETERS ---
3S IF $1NOTHING==NOTHING GOTO USAGE
IF $2NOTHING==NOTHING GOTO USAGE
rem Now clean up from before
if exist templ.hex del templ.hex
if exist chkmsg.msg del chkmsg.msg
for $$f in (*.zzp) do del $$f
for $$f in (*.zzc) do del $$f
for $$f in (*.con) do del $$f
for $$f in (*.blo) do del $$f
4S for $$f in (*.zzz) do del $$f
rem First convert to hex with width of 6
SO convert $1 templ.hex -N06
rem Then generate the CDL checksum messages for each code sector
cdlcheck templ.hex -M > chkmsg38.msg
rem foo is ignored, TAGINC w/ N as 3rd param generates its own filename
SS taginc chkmsg38.msg foo -N
rem Generate 55 file one for each segment of the EEPROM
rem filenames will be seg0000.zzz thru seg0037.zzz
rem the numbers in the filename are HEX indicating the segment number
f)0 gensegs templ.hex
rem Then remove the FF's from the 55 segment files
49


CA 02374782 2001-11-20
WO 00/72139 PCT/iJS00/13889
S
call condseg
rem Now remove all contigious download blocks into messages
call blockseg
rem now I need to group the output of condseg with blockseg then change the
tags
rem to indicate to the hecu which segment of EEPROM they are
call groupout
rem Now create the final output file from all the *.zzP files from taginc
rem the checksum messages head off the file
copy chkmsg38.msP ~2 >nul
for $$f in (*.zzp) do type ~~f » ~2
1S
rem Now clean up
if exist templ.hex del templ.hex
if exist chkmsg.msg del chkmsg.msg
for $~f in (*.zzp) do del ~~f
for $~f in (*.zzc) do del ~~f
for ~$f in (*.con) do del ~~f
for ~~f in (*.blo) do del ~~f
for ~~f in (*.zzz) do del ~~f
2S
goto END
:USAGE
ECHO.
ECHO.
ECHO.
ECHO. ERROR !!!
ECHO.
ECHO.
3S ECHO. USAGE:
ECHO.
ECHO. $0 FILE1 FILE2
ECHO.
ECHO. WHERE FILE1 = INPUT FILE: IN HEX FILE FORMAT
ECHO. FILE2 = OUTPUT FILE: SEGMENTED MESSAGE FILE F.~~..~.: -_ '10 DOWNLOAD
ECHO. '
ECHO.THIS UTILITY CONVERTS A HEX FILE TO A SEGMENTED MESSAGE FILE CONTAINING A
ECHO. SERIES OF DOWNLOAD MESSAGES WITH THE TAG FIELD INDICATING THE SEGMENT
NUMBER.
4S ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
SO ECHO.
ECHO.
ECHO.
:END
SS rem this causes CR before prompt
echo .
60 ~ * * * BLOCxotrr . c * * * i
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "constant. h"
SO


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
#include "helpers. c'
#include 'proto.h"
/* Function Prototypes */
long Locate(long Start, int which);
//int Hex_Value(char c);
//unsigned int Get Address(char *Line);
//int Get Byteslvoid);
//void Dump_Data(void);
1~ //int Generate_Hex_File(FILE *fpout, int OutputBytes);
int Generate_MSg_FileIFILE *fpout, int bufsize);
/*
#define ARRAY_SIZE 32768L //oxFFFF - 0x8000 Valid EEPROM Range
#define MAX BUFSIZE OxFF //CMI MAX Buffer size
IS #define MIN_BUFSIZE OxOF //CMI MIN Buffer size
#define DEF BUFSIZE OxFF //CMI DEFAULT Buffer size
#define CMI_CDL_CHECKSUM 0x38 //CMI Checksum msg
#define CMI_CDL FILL_PATT 0x39 //CMI Fill pattern msg (RLE)
2~ #define CMI_CDL_NORM Ox3A //CMI Nomral DL message
#define CMI_CDL_START CONT Ox3B //CMI Continuation msg started with START_CONT
#define CMI_CDL_CONT 0x37 //CMI Continuation msg started with START_CONT
#define CMI_CDL_STAT_INSTR 0x36 //CMI Download instructions/status
#define BYTES_IN NORM MSG 6
#define BYTES_IN_START_CONT_MSG 6
#define BYTES_IN_CONT MSG 9
#define END_OF_Z_STRING 0
#define START_OF_Z_STRING 1
//#define BYTES_PER_CONT_MSG 6 //number of bytes in a continuatin message
3 5 #define DATA_START 32768L //Decima; form of 0x$000
#define LINE_LENGTH 81 //Input and output line length
#define MAX_BYTES_PER_LINE 50 //If you up this best up line_length too !
*/
4o char Inline[LINE_LENGTH];
char Outline(LINE_LENGTH];
char c; //This is the character currently under evaluation
/* The [0] element of this arrary is the data at hex address 0x6000, which is
DATA_START (decimal) so, If I convert the 4 char Hex address to a decimal and
45 then subtract DATA_START I have the index to the array where the data for
the
hex record is to start. The data in the array is just hex characters.
Data[address][0] holds the Most significant hex character and Data[address][1]
holds the other character.
Jr~ * l
char huge Data[ARRAY SIZE](2];
unsigned int tempadd ;
unsigned int minadd, maxadd;
5 5 int Kbytes; //Number of data bytes on the line
unsigned int address; //Decimal version of address, remember to subtract
0x8000
//before using to index array
unsigned long File_Checksum;
//a 32 bit checksum will be appended to file & to screen, used by downloader
6o int OutputBytes; //Number of data bytes on the line of the output file
/***************r*******************************************r********/
int Generate Msg_File(FILE *fpout, int bufsize)
65 c
/*
This routine maximizes the use of the START CONT_MSG and CONT MSG messages to
minimize
the amount of messages sent to the CMI for a download.
*/
unsigned int i,j, address;
char done=0;
long startB, stopB; //start and stop of a block of contiguos code.
int Max_Bytes_Per_Block; //an int < 256
75 long size; //size in bytes of the contigious section of code
int blocks; //a block holds the maximum # of contig bytes we can send to CMI
buffer
int Max N of CONT Msgs;
51


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
int bytes_to send;
int num_CONT msgs;
Max_N_of CONT_Msgs = (int)Ilbufsize - BYTES_IN_START_CONT MSG ) / BYTES_IN
CONT MSG );
S Max_Bytes_Per_Block = (Max_N_of CONT Msgs * BYTES_IN_CONT MSG)+
BYTES_IN_START_CONT MSG;
i=0; startB=O;address=0;
if ( (Data[0][0] _- 'Z') && (Data[O][0] _- 'Z') )
to
//started with void area, look for non -Z starting point
startB=Locate(O,END_OF_Z_STRING):
address = startB;
while ( done != 1)
f
2~ //Starting at startB find the next ZZ that indicates the end of a contiuous
run of data
stopB=LOCatelstartB,START OF Z STRING); //find end of contig data
size = stopB - startH; /_/Num of contig bytes
if ( size > 0 )//end of array yet
25 (
address = startB;
if ( size > BYTES_IN NORM MSG)
(
//a full block is 255 bytes of data
blocks = (size / Max_Bytes Per_Block) ; //full blocks
//will we have a partial block ???
if ((size - (blocks * Max_Bytes_Per_Block)) > BYTES_IN NORM_MSG)
35 blocks++;
while ( (blocks > 0) && (size > BYTES_IN_NORM MSG) )
(
blocks--,
bytes_to_send = min(Max_Bytes Per_Block, size);
//first the START_CONT_MSG message
fprintf(fpout,"~2X",CMI CDL START CONT); //msg #
fprintf(fpout,"0000~4X",(address+DATA_START));
fprintf(fpout,"$02X", bytes_to_send);
for(i=0; i< BYTES_IN START_CONT_MSG; i++)
(
fprintflfpout,"$c~c",Data(address][0],Data[address][1]);
address++;
size--
bytes_to_send--,
}//end for
fprintf(fpout,"\n");
//now all the CONT_MSG messages
num_CONT msgs = (bytes_to_send /BYTES_IN_CONT_MSG);
//are we going to need a spill over message
if ((bytes to send - (num CONT msgs *BYTES IN CONT MSG)) > 0 )
num_CONT msgs++;
//limmit to the max
num_CONT ms.gs = min( num_CONT msgs, Max_N_of CONT Msgs);
for (i=0; i < num_CONT msgs; i++)
t
fprintf(fpout,"~2X",CMI CDL CONT); //msg
fprintf(fpout,"0000"); %/cmi # and tag
for (j=0; j< BYTES_IN CONT MSG; j++)
(
if ( address < stopB )
(
fprintf((pout,"~coc",Data[address][0],Data[address][1]);
address++;
size--,
52


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
)
else
fprintf(fpout."00"); //pad w/ 0's
}//end for
fprintf(fpout,~\n");
)//end for
}//end while (blocks < 0 )
if (size > OL)
//we have a case where we have less bytes than neeced to start
a block
//we will send a normal down load message
fprintf(fpout,~~2X".CMI CDL_NORM1;
fprintf(fpout,~0000$4X",(address+DATA_START));
if (size < 0x10)
fprintf(fpout,"D$X",size);
else
fprintflfpout.~$2X".size(;
for (i=O;i<size;i++)
f
//dump out the data bytes
25 fprintf(fpout,~~c~c",Data[address](0],Data(address](1]);
address++;
)
for (i=O;i<(BYTES IN NORM MSG - size);i++)
//padd the data if neccessary
fprintf(fpout,"00");
fprintf(fpout,"\n");
3 5 }//end if
)//end if ( size > BYTES_IN_NORM_MSG)
else
c
//need to generate a CMI CDL_NORM message
fprintflfpout,"$2X",CMI CDL NORM);
fprintf(fpout,~0000$4X" (address+DATA_START));
if (size < 0x10)
fprintf(fpout,"O~X",size);
else
fprintf(fpout,"~2X",size);
for (i=O;i<size;i++)
i
//dump out the data bytes
fprintf(fpout,"~c~c",Data[address][0],Data[address][1]);
address++;
)
for (i=O;i<(BYTES_IN NORM MSG - size);i++)
//padd the data if neccessary
fprintf(fpout,"00");
)
fprintf(fpout,"\n");
} //end else
startB = Locate(stopB, END_OF_Z_STRING); //find start of next run of contig
6$ data
)
else
done = 1; //we are outa here
)
}//end while
return(0);//success
) //end function Generate_MSg File
53


CA 02374782 2001-11-20
WO 00/72139
PCT/US00/13889


int mainlintargc, char *argv[])


( char
c;


long i;


FILE *fpin; //Input file pointer


FILE *fpout; //Output file pointer


int bufsize;


File_ Checksum = 0;


maxadd
= 0;


minadd
= OxFFFF;



if ( large < 3 ) ~~ (argc > 4)


( large == 4) && (argv[3][0] !_ '-') && (argv[3][1] !_ 'N')
)


c )


fprintf(stderr,"USAGE: $s Input_File Output File -Nxx\n~,
argv[0]);


fprintflstderr,"This utility will read in a partial HEX
file and generate\n");


fprintf(stderr,"Messages using CMI_CDL_START_CONT followed
by several\n");


fprintf(stderr,"CMI CDL CONT messages. The -Nxx option allows
the user to\n");


fprintflstderr,"specifiy the CMI buffer size. The xx in
the -Nxx are two HEX \n");


fprintf(stderr,'Characters that specify the number of bytes
in the CMI buffer. \n~);


fprintf(stderr,"Ex: -N64 (100 bytes) By Default 256 (()XFF)
byte buffer is used.\n");


fprintf(stderr,"Range of N : OxOF <= N <= OxFF \n\n~);


return 1;


]


if ( (fpin=fopen(argv[1],"rt") )


-= NULL)



fprintflstderr, "Cannot open input file $s\n",argv(1]);


return 1;
]


if I (fpout=fopen(argv[2],"wt") )


3S -= NULL)



fprintf(stderr, "Cannot open output file $s\n~,argv[2]);


return 1;


]



for (i=0; i< ARRAY_SIZE; i++)



c='F';


Data[i][0] = c; //remember it's characters and F's are blanks


Data[i][1] = c;


]


if ( large==4) ~& (argv(3][0] _- -') && largv(3][1] _- 'N')
)



if ( large==4) && (isxdigit(argv[3][2]) && isxdigit(argv[3]!:~]))
)


[
//the user is specifying the width


c = argv[3][2];


bufsize = 16 * Hex_Value(c);


c = argv[3][3];


bufsize += Hex Value(c);


if (bufsize > MAX_BUFSIZE )


i


fprintflstderr, "Error: N value > $d\n",MAX_BUFSIZE);


return 1;


]


if (bufsize < MIN_BUFSIZE )



fprintflstderr, "Error: N value < $d\n",MIN_BUFSIZE);


return 1;


]


]
else


fprintflstderr, "You must provide a valid 2 character HEX
value after -N\n");


return 1;
]



'75else


i


bufsize = DEF_BUFSIZE;
54


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
//blank out the array
for (i=0: i<ARRAY_SIZE; i++)
Js
Data[i][0]='Z';
Data[i][1]='Z';
]
while((fgets(Inline,LINE_LENGTH-l,fpin)))
if (Inline[81 !_ '1') //a 1 in this loc. indicates last line
//Process the input line
1 5 if (Inline[0] !_ '.')
l
fprintf(stderr,"Invalid Hex file ~s: ~s, \n",argv[1],Inline[0]);
return 1;
]
Nbytes=Get Bytes(&Inline[01):
address = Get Address(&Inline[O]); //starting address from HEX line
//Now for as many CHARACTERS in the input line, stuff them into the Data array
for (i=0; i<(Nbytes*2); i+=2) //each byte has 2 hex characters
c
if ( address >= DATA_START ) //then we need to put it into array
//otherwise it's ROM Code & we dont care
(
if (address > maxadd) maxadd = address;
if (address < minadd) minadd = address;
//Data always starts at the 9th character
c = Inline[9+i];
3 5 tempadd=address-DATA_START; //translate, ie 0x8000 -> 0x0000
Data[tempadd][0] = c; //Get the MS(Most signify Character
c = Inline[9+i+1]; //Get the LSiLeast Sig) Chatacter
Data(tempadd][1] = c;
] //end if
address++; /*when we have both characters */
] //end for
4Jr ]//end if
]//end while
//Generate_Hex File(fpout,0utputBytes);
Generate Msg_File(fpout,bufsize);
fcloselfpin);
fclose(fpout);
5 5 Printf(".");
return 0; /* indicate success to the world */
?//end main
0 /w*ww*ww**xw****x***w***w*r****x*w***w***w*x*****x****x*xx**x****xr******/
long Locate(long Start, int which)
//Either the address of the ZZ will be returned or ARRAY_SIZE will
65 //be indicating NOT found.
//if which = 1, start at Start+1 and look for next occurance of ZZ
//if which = 0, start at Start+1 and keep looking until it's NOT a ZZ
70 start++;
if (which == 1)
l
while (Start < ARRAY_SIZE)
if ( (Data(Startl[0] _ 'z') ~~ (Datafstart)(1] _ 'z') )
- -
(
return (Start);


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
)
Start++;
}//end while
)//end if
if (which == 0)
[
while ( (Start < ARRAY_SIZE) &&
(Data(Start][0] _- 'Z') &&
(Data[Start][1] _- 'Z') )
Start++;
}//end while
return (Start);
I~J )//end if
//should never get here
returnlARRAY_SIZE);
)
/*******x**w****w*******************x***w***x*******x******************x**xx**/

/***r******r******w**x*****x*w***x****x**xx**xx*******xxxx***********w********/

ZS /*** CDLCHECK.C ***/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "constant. h"
#include ~helpers.c"
#include "proto.h"
/* Function Prototypes
3 5 int Hex_Value(char c);
unsigned int Get Addresslchar *Line);
int Get Bytes(void);
*/
char huge Data[ARRAY_SIZE][2];
char Inline[LINE_LENGTH];
char Outline[LINE_LENGTH];
char bufl[600]; //256 bytes = 512 nibbles (hex characters) with extra
45 char c; //This is the character currently under evaluation
unsigned long checksum; //must be a 32 bit checksum
unsigned int tempadd ;
unsigned int minadd, maxadd;
char OK;
int Kbytes; //Number of data bytes on the line
unsigned int address; //Decimal version of address, remember to subtract
0x8000 before
//using to index array
void Usagelchar *Str)
fprintf(stderr,"USAGE: ~s Input_File [-X][-M]\n\n~, Str);
fprintflstderr,"This utility will generate 56 checksums for the EEPROM \n~);
fprintf(stderr,"of the hex file specified by Input File. The values are in
decimal
format\n");
fprintf(stderr,"and are one per line by default. The -X is optional, but if
provided
will\n");
fprintflstderr,"display the checksums in HEX format one on each line. The -M
option will\n");
fprintf(stderr,°generate a series of download messages that can be used
to download the.\n");
fprintf(stderr,"generated checksums to the CMI. You may use -X, or -M or
Neither,\n");
65 fprintf(stderr,"but NOT both.\n");
)
int main(int argc, char *argv[])
( char c;
long l;
long j;
long k;
75 long sector_checksum[577;
long foo ;
int a;
56


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
int buf~tr;
int temp;
unsigned int address;
unsigned char checksum;
FILE *fpin; //Input file pointer
// FILE *fpout; //Output file pointer
maxadd = 0;
minadd = ()XFFFF;
checksum=0;
if ( argc > 3 )
t
IS Usage (argv[0]);
return 1;
)
OK=0;
if ( (argc == 3) && lstrcmp(argv[2],"-X~) _= 0) )
OK =1 ;
if ( largc == 3) && (strcmp(argv[2],"-M") _= 0) )
OK =1:
if ( largc == 3) && (strcmplargv[2],"-H") _= 01 )
OK =1;
if ( argc == 2) //just the two imput files, def output is decimal
OK = 1;
if (ox == o)
c
Usage (argv[O]1;
return 1;
)
if ( (fpin=fopen(argv[1],"rt") )
-= NULL)
t
fprintf(stderr, "Cannot open input file $s",argv[1],".\n");
return 1:
)
//Read in the input HEX file
while((fgets(Inline,LINE_LENGTH-l,fpin)))
(
if (Inline[8] !_ '1') //a 1 in this loc. indicates last line
c
//Process the input line
if (Inline[0] !_ '.')
(
fprintf(stderr,"Invalid Hex file $s: $s, \n",argv(1],Inline[0]);
return 1;
Kbytes=Get Bytes(&Inline[0]);
address = Get Address(&Inline[0]); //starting address from HEX line
//Now for as many CHARACTERS in the input line, stuff them into the Data array
for (i=0; i<(Nbytes*2); i+=2) //each byte has 2 hex characters
if ( (address >= DATA_START) && (address <_ (long)MAX_CHECKSUM-ADDR) )
//then we need to put it into array
//otherwise it's ROM Code or DATA Page (>= OxF000) & we dont care
f
//Data always starts at the 9th character
c = Inline[9+i];
tempadd=address-DATA_START; //translate, ie 0x8000 -> 0x0000
Data[tempadd][0] = c; //Get the MS(Most signify Character
c = Inline[9+i+1]; //Get the LS(Least Sig) Chatacter
Data[tempadd][1] = c;
//fprintflfpout,~$X, $1X\n",address, checksum);
) //end if
address++; /*when we have both characters */
57


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
] //end for
]//end if
S ]//end while
1~ //Clear out the checksums
for (i=0; i<57; i++)
t
sector_checksum(i] = OL;
1S ]
#define KK 56 //the 57th (array location 56) sector is the checksum of the
chechsums
20 //Now generate the sector checksums
for (i=0; i<KK; i++)
j = i *512; //each sector is 512 bytes
for (k=0; k<512; k++)
25 (
c=Data[j][0];
temp = (Hex Value(c) «4);
c=Data(j](1];
temp += Hex Value(c);
sector_checksum[i] += temp;
/*
printf("j=$d",j);
printf(" val=Ox$c" Data[j](0]);
3 5 printf("$c",Data[j][1]);
printf(" _ $d ",temp );
printf(" \tSect 0 Check =");
printf("$ld".sector_checksum(i]);
printf(" _ $081X\n",sector_checksum[i]);
*/
j++;
]
]
//now for the checksum of the checksums
for (i=0; i<KK; i++)
//we wanted a bytewise checksum !!!
foo = (sector_checksum[i] & OxFF000000); //Mask off MSB
k=foo»24;
sector_checksum(KK1 += k;
foo = (sector_checksum[i] & Ox00FF0000);
k=foo»16;
J~J~ sector_checksum[KK] += k ;
foo = (sector_checksum[i] & Ox0000FF00);
k =foo»8;
sector checksum(KK] += k ;
6o foo = sector_checksum[i] & Ox000000FF;
sector checksum[KK] += foo ;
]
65 //We will now generate the user specified output format desired
if ( (argc == 3) && (strcmplargv[2],"-X")) _= 0 )
for (i=0; i<57; i++)
//NOTE !!! It took a LONG TIME to figure out that when displaying
//a long you MUST have it in a SEPARATE printf !!!!
printf("Sector $d checksum = i);
printf("$O81X \n",sector_checksum[i]);
75 ] ]
if ( (argc == 3) && (strcmp(argvf2],"-H")) _= 0 )
58


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
/.
I will generate a series of output hex formated data lines to the
output file. Each of the checksums will be on there own hex output line.
And of course to make things a little more interesting each of tese output
lines must have a checksum calculated for it...that is the variable checksum.
*/
address = OxF000; //Starting location for the checksum data
for (i=0; i<57; i++) //56 * 8 characters per Checksum = 448 HEX Chars = 229
bytes
//printf("$081X",sector checksum[i]);
sprintf(&bufl[0],~:04")
sprintf(&bufl[3],"$04X",address);
IS sprintf(&bufl[7],~00~);
sprintf(&bufl[9],'~O81X",sector checksum(i]);
//calculate bytewise checksum for output line
checksum = 0;
for ( j= 1; j<17; j+=2 ) //
c
checksum +_ (Hex Value(bufl(j]) «4); //the MSB
checksum +_ (Hex_Value(bufl[j+1])); //the LSB
]
checksum = -checksum + 1; //get the 1's comp
checksum = checksum & OXFF; //we only want this much
sprintf(&bufl(17],"~02X",checksum); //insert checksum into char string
printf(~~s\n",bufl); //barf it out
address += 4; //each checksum is a long...4 bytes... next checksum please..
]
] //end of Hex outputfile processing
if ( (argc == 3) && (strcmp(argv(2J,~-M")) _= 0 >
f
/*
generate a series of download messages to load the checksums.
I'll use a string to hold the checksums to make preping the messages easier
One Download code block will do it but there will need to be padding. The
DL block will contain 224 bytes (56 longs *4 bytes per long)=224 bytes.
We will need to transmit 231 bytes ( I25 * 9) + 6) so we will need to pad
231-224 = 7 bytes
* /
for (i=0; i<57; i++) //56 * 8 characters per Checksum = 448 HEX Chars = 224
bytes
l
//printf("~081X",sector_checksum(i]);
sprintf(&bufl[i*8],"~081X",sector_checksum[i]);
]
// sprintfl&bufl[56*8], "$081X", OL); //4 bytes of PAD !!
sprintfl&bufl[57*8], ~$081X~, OL); //4 more bytes of PAD !!
5 5 printf("3BOOOOFOOOE4"); //CMI CDL_START CNT address = F000, 228 bytes (57
* 4)
buf~tr =0; //which means the last byte of the last 37 message is pad
for (i=O;i<12;i++)
printf("~c",bufl(buf~tr]); //first 6 bytes of data from out buffer
buf~tr++;
]
printf(~\n");
for (i=0; i<25; i++) //25 0x37 messages please and thanks
65 c
printf(~370000");
for (j=O;j<18;j++)
printf("~c",bufl[buf~tr]); //9 bytes of data from out buffer
buf~tr++;
]
printf("\n"); //end of the line
75 ]
if (argc == 2)
59


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
for (i=0; i<57; i++)
t
printf(~sector checksum[~d] _ ",i);
printfl"old\n",sector_checksum[i]);
]
fclose(fpin);
return 0; /* indicate success to the world */
)//end main
/www******xx**x*rr******xx*rr*rww**xx*rr*********xr***x***********x*****x*****/

/*w*x**wrr**rr***x***x****x***w****xw*x*****************x*************x******r/

/*** CONDENSE.C ***/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "constant. h"
#include "helpers. c~
#include "proto.h~
/* Function Prototypes
int Lines_In_File(FILE *fp);
int Hex_Valuelchar c);
unsigned int Get_Address(char *Linel;
3o int Get Byteslchar *Line);
void Dump_Data(void);
x/
char Get Valid_Hex Record (FILE *fp, char *Line);
void dump me5sage_to_file(FILE *fpoutl, int FF_Count, int FF_Start Addr, char
*Str);
void Display_Condense_Usage(char *); // DIsplays usage information to user
/*
#define ARRAY_SIZE 32768L //oxFFFF - 0x8000 Valid EEPROM Range
#define DATA_START 32768L // Decimal form of 0x8000
#define LINE_LENGTH 150 // Input and output line length
#define TRUE 0
#define FALSE 1
#define MAX CMI BUFFSIZE 256
#define CMI CDL FILL PATT 0x39
*/ - _ _
char huge Data(ARRAY_SIZE][2];
char Inlinel(LINE_LENGTH]; // We will look at two lines at a time
//char Inline2[LINE LENGTH]; // We will look at two lines at a time
unsigned int addressl; //each line has an address
unsigned int address2; //each line has an address
char Outline(LINE_LENGTH]; //used to build up an ouput line
char c; // This is the character currently under evaluation
char Search Str(12]; // 6 occurances of the Search character from command line
5 5 int Nbytesl; // Number of data bytes on the line
int Nbytes2; // Number of data bytes on the line
//These are the input argument positions in argv[]
#define INPUT_FILE_ARG 1
#define HEX_STRING_ARG 2
#define MSG_OUTPUT_FILE_ARG 3
#define DATA_OUTPUT_FILE 4
//other Related input constants
#define REQUIRED_ARGS 5
#define REQUIRED BYTES_PER_LINE 6
/wwwxw*w******wr*****x********** ~ln() ****xx**********x*********x**/
(nt main(int argc, char *argv[])
long i;
FILE *fpin; //Input file pointer
FILE *fpoutl; //Output file pointer
FILE *fpout2; //Output file pointer
int Doing_a_Block;
int FF Count;
int FF_Start Addr;


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
int InputLines;
int Rtn;
unsigned int Last_line_addr, Current_line_addr;
int pattern_found
unsigned int bytes_written; //debug stuff
unsigned int bytes_read;
unsigned int bytes bypassed;
unsigned int bytes_msg;
bytes_msg=0;
bytes written=0;
bytes_read=0;
bytes_bypassed=0;
IS
if ( argc != REQUIRED_ARGS )
fprintf(stderr,"ERROR . Invalid Number of Aruments...\n\n");
Display_Condense_Usage(argv[0]1;
return 1;
]
if
(strlen(argv[HEX_STRING_ARG] ) != 2) ~~
!lisxdigitlargv[HEX STRING ARG][0]))
!(isxdigit(argv[HEX_STRING_ARG][1]))
(
fprintf(stderr,"ERROR : 'Hex_String' must be 2 Valid Hex characters describing
the
3~ data byte\n~);
fprintflstderr,~ERROR : 'Ex: FF\n\n");
Display_Condense_Usage(argv[O]);
return 1;
]
for (i=0; i<12; i+=2)
Search_Str[i]= argv(HEX_STRING_ARG][0]; //This is the pattern of 6 bytes
Search_Str[i+1]= argv[HEX_STRING_ARG][1]; //that we will look for in each
input line
]
if ( (fpin=fopen(argv[INPUT_FILE_ARG],"rt") )
-= NULL)
fprintf(stderr, "Cannot open input file ~s",argv[INPUT_FILE ARG],".\n\n");
Display_Condense_Usagelargv[0]);
return 1;
]
if ( (fpoutl=fopen(argv[MSG_OUTPUT_FILE_ARG],"wt") )
-= NULL)
(
fprintflstderr, "Cannot open $s as
output.",argv[MSG_OUTPUT_FILE_ARG],".\n\n");
5 5 Display_Condense Usage(argv[0]);
return 1;
]
if ( (fpout2=fopen(argv[DATA_OUTPUT_FILE],"wt") )
_= NULL)
c
fprintf(stderr, "Cannot open $s as output.",argv[DATA_OUTPUT_FILE],".\n\n~);
Display_Condense Usage(argv[0]);
return 1;
]
for (i=0; i<LINE_LENGTH; i++)
Inlinel[i] = 0;
]
Last line_addr = (0x8000 - 6); //force first line to be contig
Doing_a_Block = FALSE;
FF_Count = 0;
61


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
FF_Start Addr = NCTLL;
InputLines = Lines_In_File(fpin);
for (i=0: i< InputLines; i++) //process each line in the input file
Rtn = Get_Valid_Hex_Record (fpin, &Inlinel[0]); //read a line from input file
bytes_read +=Get Bytes(&Inlinel[0]); //debug
if( Rtn == 2)
//This should not happen check for EOF
fprintf(stderr,~Unexpected EOF encountered..terminating\n~);
exit(1);
]
if ( Rtn == 1 ) //this is either invalid hex or a hex line with > 6 data bytes
c
//just pass it on to the catch all file
fputs(&Inlinel[0],fpout2);
bytes_bypassed +=Get Bytes(&Inlinel(0]); //debug
2o bytes_written +=Get Bytes(&Inlinel[0]); //debug
continue; // start the for loop over again
]
Current_line_addr=Get Address(&Inlinel(0]);
//Check string just read in looking for our pattern
//data always starts at the 9th character for a hex record
pattern_found=strncmpi(Search_Str, &Inlinel(9], sizeof(Search_Str));
if (Last_line_addr + 6 == Current_line_addr ) //lines are contiguous
if (pattern_found==0) //we found the pattern
if (Doing_a_Block == TRUE )
c
//will our buffer be full
if ( FF_Count + 6 > MAX_CMI BUFFSIZE )
//we can't swueeze any more in time to dump & need to empty
buffer and reset
dump message_to_file(fpoutl,FF_Count,FF_Start Addr,Search_Str);
bytes_written+=FF_Count;//debug
bytes msg+=FF_Count;//debug
FF_Count = 6;
FF_Start Addr = Current_line_addr;
//Doing_a Block is STILL TRUE
]
else
FF_Count +=6; //just up the cou.:ut
]
else //we were NOT Doing_a_Block But now have at least 6 bytes of pattern
//while it is possible that we may only have a block of only one line
//it will generate 1 message either way...so we " generate this one
FF_Count =6;
FF_Start_Addr = Current_line_addr;
Doing_a_Block = TRUE;
]
)
else //Pattern not found
i
if (Doing_a_Block == TRUE ) //we're all done with that block
c
dump_message_to_filelfpoutl,FF Count,FF_Start Addr,Search_Str); //send
to file
bytes written+=FF_Count;//debug
bytes_msg+=FF Count;//debug
FF_COUnt = 0; //reset our ears
FF Start_Addr = 0;
Doing_a_Block = FALSE;
//just pass it through it's not what we are looking for
fputs(&Inlinel(0],fpout2);
bytes written+=6://debug
62


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
else //not contigious to last
{
if (Doing_a_Block == TRUE )
dump message_to file(fpoutl,FF Count,FF Start Addr,Search Str);
- - - - -
bytes_written+=FF-Count;//debug
FF Count = 0;
FF_Start_Addr = 0;
Doing_a-Block = FALSE;
) //end if
if (pattern-found==0) //so were not contig, we found our pattern
t
//while it is possible that we may only have a block of only one line
//it will generate 1 message either way... so what the heck
FF_Count =6;
FF Start_Addr = Current_line_addr;
Doing_a_Block = TRUE;
}
else
fputs(&Inlinel[0),fpout2); //dump
bytes-written+=6;//debug
}
}//end else not contig
//gear up for next line
Last line addr = Current-line-addr;
} //end for
//flush the buffer
if (Doing-a_Block == TRUE )
dump message_to_file(fpoutl,FF_Count,FF-Start Addr,Search_Str);
bytes written+=FF_Count;//debug
FF_Count = 0;
FF_Start_Addr = 0;
Doing-a_Block = FALSE;
} //end if
/*
printf("bytes written = ~u\n",bytes written);
printf("bytes read = ~u\n",bytes-read);
printf( _~bytes bypassed = ~u\n",bytes_bypassed);
*/
printf(".~);
fclose(fpin);
fclose(fpoutl);
fcloselfpout2);
return 0; /* indicate success to the world */
}//end main
/***********x******************************************************/
char Get Valid-Hex_Record (FILE *fp, char *Line)
{ / *
Input: fp : pointer to input file to read
Line: array of chars to read data into
Output: 0 if successful
1 if failed tests
2 EOF
*/
int Kbytes;
//read a line, if end of file, return fail status
if (fgets(Line,LINE-LENGTH-l,fp) _= NULL ) return (2);
63


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
if (Line[0] !_ '.') //Hex lines MUST start with : (cept for 1st)
return(1); //bad
}
Kbytes=Get Bytesl&Line(0]); //number of databytes in this line
if (Kbytes != REQUIRED_BYTES_PER_LINE )
return(1); //bad
(
return (0); //success
}//end function Get Valid_Hex_Record
/+++*+++******+*******+++**rx*******++****x*++*r*w*****/
void Display_Condense_Usage(char
*Str)


t


fprintf(stderr,"USAGE: $s
Input File Hex_String Msg_Output
File Data_Output File \n\n",
Str);


fprintf(stderr,"Input File MUST be Output File generated by the
: CONVERT Utility \n");


fprintf(stderr," using -N06 option !\n");


fprintf(stderr,~Hex String Is the 2 character HEX Value that is
. being stripped\n");
.


fprintflstderr," out. ex: FF\n");


fprintfstderr,"Msg_Output Name of the file created that contains
File : the RLE\n");


fprintflstderr," messages for each block removed from
input data file.\n~);


fprintf(stderr,"Data_Output Name of the file created that contains
File : the original\n");


fprintflstderr," input data minus the the striped out
blocks of\n"1;


fprintf(stderr," the 'Hex_String' character. \n\n");


fprintf(stderr,"This utility
parces the input file looking
for consecutive occurances\n");


fprintflstderr,"of 'Hex_String'the input data file. When it is possible
in to


eliminate\n");


fprintf(stderr,"2 or more from the input file, a RLE-type message
messages is sent to \n");


3 fprintf(stderr,"'MSg_Output
5 File' which describes start
address and length (up to
255)\n");


fprintf(stderr,"of this consecutive
occurance. The remaining
data, is sent to the\n");


fprintf(stderr,"'Data_Output .\n");
File'


} //end function Display_Usage


/+***r***x*r*x**xxrr*+****ra***+****r*x*+*+*********x**/
void dump_message_to_file(FILE *fpoutl, int FF_Count, int FF_Start Addr, char
*Str)
/* this function dumps an RLE message to the message file '/
fprintflfpoutl,"$2X",CMI CDL_FILL_PATT);
if (FF Count < 0x10
fprintfl -fpoutl,"0000$XO$X$c$c0000000000\n",FF_Start
Addr,FF_Count,Str[0],Str[1]);
else
fprintf(fpoutl,"0000$X$X$c$c0000000000\n",FF_Start Addr,FF
Count,Str(0],Str(1]);
rJ0 / / DF T 1 2 4 5 6 7 8 9 A
/*+***+a*+*****+rr***x*r**x*****+****rr+ra****r*r+**rr*****rr***+**+**********/

/***++*++********x+**+***+*r****a***rr*a+xx*x*+xxr*ra*arr**r**axx*******+*x*x*/

/**' CONVERT.C ***/
#include <stdio.h>
60 #include <stdlib.h>
#include <string.h>
#include ~constant.h"
#include "helpers. c~
65 #include "proto.h~
char Inline[LINE LENGTH];
char Outline(LINE_LENGTH];
char c; //This is the character currently under evaluation
70 /* The (0] element of this arrary is the data at hex address 0x6000, which
is
DATA_START (decimal) so, If I convert the 4 char Hex address to a decimal and
then subtract DATA_START I have the index to the array where the data for the
hex record is to start. The data in the array is just hex characters.
Data[address][0] holds the Most significant hex character and Data[address][1]
75 holds the other character.
*/
char huge Data[ARRAY_SIZE][2];
64


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
unsigned int tempadd ;
unsigned int minadd, maxadd:
int Kbytes: //Number of data bytes on the line
S unsigned int address; //Decimal version of address, remember to subtract
0x8000
//before using to index array
unsigned long File Checksum;
//a 32 bit checksum will be appended to file & to screen, used by downloader
int OutputBytes; //Number of data bytes on the line of the output file
l0 int mainfint argc, char *argv(])
( char c;
long i:
1S FILE *fpin; //Input file pointer
FILE *fpout: //Output file pointer
int supress; //supresses the printing of the end of file statment if = 1
File_Checksum = 0;
maxadd = 0;
minadd = OxFFFF;
supress = 0; //by default we will print the end of file line
2S if (


(argc < 3 ) ~~ (argc > 4) ~~
&& (argv[3]fOJ !_ '-') && (argv[3](1] !_ 'N')) ~~
4


)
((argc ==
&& largv(3][0] !_ '-') && large[3][1] !_ 'H')1
4


)
((argc ==


30 c _
rintf(stderr,"USAGE: $s Input File Output File -Nxx\n",
argv[0]);
f
")
\


p
n
;
rintf(stderr,"This utility will convert & sort the Input
hex file into a
f
")
\


p
n
;
rintf(stderr,"sorted(by address) output hex file containing
the entire
f
user
th
l


p
e
ows
ddress range (0x8000-I)XFFFF). The -Nxx option al
"


a
fprintf(stderr.


3S to\n"
) ; fprintflstderr,"control the Number of data bytes per line.
The xx in the -Nxx are two


HEX \n");
that specify the number of bytes. Ex: -N06 (6 bytes) -N15
t
"


ers
Charac
fprintflstderr,


(21 bytes)
\n"):
Default
6 (0x06)
bytes
per
line
is used.\n"1;
"


By
fprintf(stderr,
er line is 50. -H perfozms the same function


fprintflstderr,"The Max number of bytes p


as -N
\n"); fprintf(stderr,"except it supresses the HEX End of File
statement. \n"):


return 1;


4S )


if ( (fpin=fopenlargv[1],"rt") )


-= NULL)


f
fprintflstderr, "Cannot open input file ~s\n",argv[1]);


return 1;
)


if ( (fpout=fopenlargv(2],"wt") )


SS -= NULL)


fprintflstderr, "Cannot open output file ~s\n",argv[21);


return 1;


)
6o


for (i=0; i< ARRAY_SIZE; i++)



c='F':
it's characters and F's are blanks
b


er
Data(i][0] = c; //remem


6S Data(i][1] = c:


]
if ( (argc==4) && (argv[3](0] _- -'1 && large[3](1] _- N')
)


[
==4) && (isxdigit(argv[3](2]) && isxdigitlargv[3][3])) )


70 if ( (argc


(
//the user is specifying the width


c = argv(3][2];


OutputBytes = 16 * Hex_Valuelc);


'~S c = argV(3][3];


OutputBytes += Hex_Value(c);


if (OutputBytes > MAX_BYTES_PER_LINE )




CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
[
fprintflstderr. "Error: N value > $d\n",MAX BYTES_PER_LINE1;
return 1;
]
}
else
t
fprintflstderr, "You must provide a valid 2 character HEX value after -N\n");
return 1;
}
)
else
OutputBytes = DEFAULT DATA WIDTH;
IS { -
]
if ( (argc==4) && (argv(3][0] _- -') && (argv[3](1] _- 'H') )
if ( (argc==4) && (isxdigit(argv[3][2]) && isxdigit(argv[3][3])) )
[
//the user is specifying the width
supress = 1; //don't print end of file indicator
c = argv[3](2];
OutputBytes = 16 * Hex Value(c);
c = argv(3][3];
OutputBytes += Hex_Value(c);
if (OutputBytes > MAX BYTES_PER_LINE )
fprintflstderr, "Error: N value > ~d\n",MAX_BYTES PER LINE);
- -
return 1;
]
)
else
t
fprintflstderr, "You must provide a valid 2 character HEX value after -H\n");
return 1;
]
}
else
OutputBytes _= DEFAULT DATA WIDTH;
]
whilel((gets(Inline,LINE_LENGTH-l.fpin)))
if (Inline[8] !_ '1') //a 1 in this loc. indicates last line
(
//Process the input line
if (Inline[O] !_ '.')
i
fprintflstderr,"Invalid Hex file ~s: ~s, \n",argv(ll,Inline[0]);
return 1;
]
Nbytes=Get Bytes(&Inline[0]);
address = Get Address(&Inline[0]); //starting address from HEX line
//Now for as many CHARACTERS in the input line, stuff them into the Data array
for (i=0; i<(Nbytes*2); i+=2) //each byte has 2 hex characters
[
if ( (address >= DATA_START) && address <= MAX CHECKSUM_ADDR
5 //then we need to put it into array
//otherwise it's ROM or data Code & we dont care
t
if (address > maxadd) maxadd = address;
if (address < minadd) minadd = address;
//Data always starts at the 9th character
c = Inline[9+i];
tempadd=address-DATA_START; //translate, ie 0x8000 -> 0x0000
Data(tempadd](0] = c; //Get the MS(Most signify Character
c = Inline(9+i+1]; //Get the LS(Least Sigl Chatacter
75 Data[tempadd][1] = c;
} //end if
66


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
address++; /*when we have both characters */
} //end for
}//end if
}//end while
Generate_Hex File(fpout.0utputBytes,supress);
/*
printf("minaddr = $ud\n",minadd);
printf("maxaddr = dud\n".maxadd);
*/
printf('-");
fcloselfpin);
fclose(fpout);
return 0; /* indicate success to the world */
}//end main
/x*xxxxx*x*x**xx***x*xx*xx***x**x**xx**x***x*x*************x*x**xxrw**********/

/axxx*x*xx**x*x***x**xx**xx*x******x****x*xxxxx***x*xxx*x**xr***x*x*xx**x*****/

/*** GENSEGS.C ***/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include ~constant.h"
#include "helpers. c"
#include "proto.h"
char Inline(LINE_LENGTH];
char Outline[LINE_LENGTH];
char filename[20];
char c; //This is the character currently under evaluation
/* The [0] element of this arrary is the data at hex address 0x6000, which is
DATA_START (decimal) so, If I convert the 4 char Hex address to a decimal and
then subtract DATA_START I have the index to the array where the data for the
hex record is to start. The data in the array is just hex characters.
Data[address](0] holds the Most significant hex character and Data[address][1]
holds the other character.
*/
char huge Data(ARRAY_SIZE](2];
unsigned int tempadd ;
unsigned int minadd, maxadd;
5~ int Nbytes; //Number of data bytes on the line
unsigned int address; //Decimal version of address, remember to subtract
0x8000
//before using to index ar=ay
unsigned long File_Checksum;
//a 32 bit checksum will be appended to file & to screen, used by downloader
int OutputBytes; //Number of data bytes on the line of the output file
int main(int argc, char *argv[])
( char c;
l ong i ;
FILE *fpin; //Input file pointer
FILE *fpout; //Output file pointer
File Checksum = 0;
maxadd = o;
minadd = OxFFFF;
if ( largc != 2) )
fprintf(stderr,"USAGE: $s Input_File\n", argv(0]);
fprintflstderr."This utility will read the input hex file and create 55 hex
a\n~);
fprintf(stderr,"files, one for each 512 byte 'sector' off EEPROM. These
files\n~);
fprintf(stderr,"will later be post processed to build an INDEXED message
file\n");
fprintf(stderr,"which will allow the HECU to download A SPECIFIC sector \n");
fprintf(stderr,"(1/64th of EEPROM) with minimum number of messages.\n");
return 1;
67


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
}
if ( (fpin=fopenlargv[1],"rt") )
-= NULL)
$ [
fprintf(stderr, "Cannot open input file ~s\n",argv(1]);
return 1;
}
IO {or (i=0; i< ARRAY_SIZE; i++)
c='F';
Data(i](0] = c; //remember it's characters and F's are blanks
Data[i](1] = c;
1$ }
while((fgets(Inline,LINE_LENGTH-l,fpin)))
(
if (Inline[8] !_ '1') //a 1 in this loc. indicates last line
20 (
//Process the input line
if (Inline(0] !_ '.')
fprintf(stderr,"Invalid Hex file ~s: ~s, \n",argv(1],Inline[0]);
2$ return I;
}
Kbytes=Get Bytes(&Inline[0]);
address = Get Address(&Inline[O]); //starting address from HEX line
// if ((address > 0x8200) && (address < Ox82FF) )
// (
// address = address; //debug hook
// ]
3$ //Now for as many CHARACTERS in the input line, stuff them into the Data
array
for (i=0; i<(Nbytes*2); i+=2) //each byte has 2 hex characters
i
if ( address >= DATA_START ) //then we need to put it into array
//otherwise it's ROM Code & we dont care
if (address > maxadd) maxadd = address;
if (address < minadd) minadd = address;
4$ //Data always starts at the 9th character
c = Inline[9+i];
temoadd=address-DATA_START; //translate, ie 0x8000 -> 0x0000
Data[tempadd][0] = c; //Get the MS(Most signify Character
c = Inline[9+i+1]; //Get the LSILeast Sig) Chatacter
$0 Data(tempadd](1) = c;
} //end if
address++; /*when we have both characters */
$$ } //end for
}//end if
}//end while
60 for (i=O;i<56; i++) //0-55 inclusive
(
sprintfl&file name,"seg~04X.ZZZ",i);
if ( (fpout=fopen(file_name,"wt") ) _= NULL)
6$ fprintf(stderr, ~Cannot open output file ~s\n",argv(2]);
return 1;
}
Generate_Segment Hex File(fpout,i);
70 fclose(fpoutl;
} //end for
printf(".");
fclose(fpin);
7$
return 0; /* indicate success to the world */
}//end main
68


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
/r*****1r**f**xf*+x+*x1f**f+axxr*xxxxxf+**w*****************+*+***xxf**x++*w**/

/~11f****f****fx*++******x*+t+++********+++***+***++****+**x**i+**fi***+**xxxx*
/
/*** HELPERS.C ***/
#include "constant. h"
1~ #include 'proto.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern char huge Data(ARRAY_SIZE}(2];
/*****f*+*xxf**x******x****++++******xr*+*********x*x+***xx*x**x****/
int Get Bytes(char *Line)
char c;
int NBytes;
c = Line(1];
NBytes = 16 * Hex Value(c);
c = Line(2];
NBytes += Hex Value(c);
3o return(NSytes);
} //End function Get Bytes
/f***x**+*****+*+***+f*+******x**a++***+********++***x*++*******++/
int Generate_ROM_Hex_File(FILE *fpout, int OutputBytes)
40 //Address space 0x0000 => OxSFFF ROM Space
unsigned int i,j, tempadd;
unsigned char checksum; //0x00 - OxFF
unsigned char val;
45 char c ;
unsigned long File_Checksum;
i=0;
File Checksum = 0;
// while (i < ~tRAY_SIZE)
while (i < OxSFFF)
//Check for a short line that might happen at the end of the file
55 if ( (ARRAY_SIZE - i) < OutputBytes)
OutputBytes = (ARRAY_SIZE - i);
}
if (OutputBytes > 15)
()~ fprintf(fpout,':~2X",OutputBytes);
else
fprintf(fpout,':0$X",OutputBytes);
checksum = OutputBytes;
65 //Now for the address
tempadd=i;
// fprintflfpout,"~04X",tempadd); //this will work
7o val = (tempadd » 12); // divide by 4096
if ( val < 10) c=val+48; else c=val+55; //adjust to the ASCII char 0-9=48-57,
A-F=65-
tempadd = tempadd - ( val « 12);
fputc~c,fpout);
checksum += Hex Value(c) * 16; //MS Nibble High
val = (tempadd » 8); // divide by 256
69


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
if ( val < 101 c=val+48; else c=val+55; //adjust to the ASCII char
tempadd = tempadd - ( val « 8);
fputc(c,fpout);
checksum += Hex Value(c); //LS Nibble High
val = Itempadd » 4); // divide by 16
if ( val < 10) c=val+48; else c=val+55; //adjust to the ASCII char
tempadd = tempadd - ( val « 4);
fputc(c,fpout);
checksum += Hex_Value(c) * 16; //MS Nibble, Low
val = tempadd;
if ( val < 10) c=val+48; else c=val+55; //adjust to the ASCII char
IS fputc(c,fpout);
checksum += Hex Value(c); // LS Nibble low
//this is the record byte
fputc('0',fpout);
fputc('0',fpout);
//now for the data
for (j=0; j<OutputBytes; j++) //each line of hex holds OutputBytes data bytes
25 c = Data[i+j][0];
File_Checksum += Hex Value(c) * 16; //MS Nibble
fputc(c,fpout);
checksum +_ (Hex Value(c) « 4 ); //Most Sig Nibble
c = Data[i+j][1]
File_Checksum += Hex_Value(c); //LS Nibble
fputc(c,fpout);
checksum += Hex_Value(c); //Least Sig Nibble
}//end for
3 5 // now the ONE Comp of the checksum and a CR
checksum = checksum & OxFF; //mask off all but least sig byte
checksum = 0x100 - checksum;
val = checksum » 4 ;
if ( val < 10) c=val+48; else c=val+55; //adjust to the ASCII char
fputc(c,fpout);
val = checksum - (val «4);
if ( val < 10) c=val+48; else c=val+55; //adjust to the ASCII char
fputc(c,fpout);
fputc('\n',fpout); //end of line
45 i += OutputBytes;
} //end while
fputs(":OOOOOOO1FF\n",fpout); //indicates end of file
return(0); //success
} //end function Generate_Hex_File
/****************x**********x***************+*********x*************i,~
//int Generate_Hex File(FILE *fpout, int OutputBytes, char huge
*Data[ARRAY_SIZE][2])
5 int Generate_Hex_File(FILE *fpout, int OutputBytes, int supress)
tkdefine OUTPUT ONLY_CODE_PLEASE Ox6FFF //0 maps to 0x8000, this maps to
OxEFFF, last code address
unsigned int i,j, tempadd;
()~ unsigned char checksum; //0x00 - OxFF
unsigned char val;
char c;
unsigned long File Checksum;
65 i=0 ;
File_Checksum = 0;
// while (i < ARRAY_SIZE)
'O while (i < OUTPUT_ONLY CODE_PLEASE)
t
//Check for a short line that might happen at the end of the file
if ( (ARRAY_SIZE - i) < OutputBytes)
75 OutputBytes = (ARRAY_SIZE - i);
}
if (OutputBytes > 15)


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
else
fprintf(fpout,":0$X",OutputBytes);
fprintf(fpout,":~2X~,OutputBytes);
checksum = OutputBytes;


//Now for the address


tempadd=i+0x8000;


// fprintf(fpout,"~04X~,tempadd); //this
will work


to


val = (tempadd 12); // divide by 4096


if ( val < 10) c=val+48; else c=val+55;the ASCII char 0-9=43-57,
//adjust to A-F=65-


70


tempadd = tempadd - ( val 12);


IS fputclc,fpout);


checksum += Hex Value(c) * 16; //MS
Nibble High


val = (tempadd 8); // divide by 256


if ( val < 101 c=val+48; else c=val+55;the ASCII char
//adjust to


20


tempadd = tempadd - ( val 8);


fputc(c,fpout);


checksum += Hex_Value(c); //LS Nibble
High


25 val = (tempadd 4); // divide by 16


if ( val < 10) c=val+48; else c=val+55;the ASCII char
//adjust to


tempadd = tempadd - ( val 4);


fputc(c,fpout);


checksum += Hex Value(c) * 16; //MS
Nibble, Low


3 0


val = tempadd;


if ( val < 10) c=val+48; else c=val+55;the ASCII char
//adjust to


fputc(c,fpout);


checksum += Hex Value(c); // LS Nibble
low


35


//this is the record byte
fputc('0',fpout);
fputc('0',fpout);
40 //now for the data


for (j=0; j<OutputBytes; j++) //each line of hex holds OutputBytes
data bytes


f


c = Data[i+j][0];


File_Checksum += Hex_Value(c) * 16; //MS Nibble


45 fputc(c,fpout);


checksum +_ (Hex Value(c) 4 ); //Most Sig Nibble


c = Data[i+j][1]


File_Checksum += Hex_Value(c); //LS Nibble


fputc(c,fpout);


50 -
checksum += Hex Value(c); //Least Sig Nibble


}//end for


// now the ONE Comp of the checksum and a CR


checksum = checksum & OxFF; //mask off all but least sig byte


55 checksum = 0x100 - checksum;


val = checksum 4 ;


if ( val < 10) c=val+48; else c=val+55; //adjust to the ASCII
char


fputc(c,fpoutl;


val = checksum - (val 4);


6o if ( val < 101 c=val+48; else c=val+55; //adjust to the ASCII
char


fputc(c,fpout);


fputc('\n'~fpout); //end of line


i += OutputBytes;


] //end while


65 if (supress == 0)


fputs(":OOOOOOO1FF\n",fpout); //indicates end of file


}
//fprintf(fpout,~~1X $1d Download Checksum (Hex Decimal)\n",File_Checksum,
File Checksum);


70 //printf("$1X old Download Checksum (Hex Decimal)\n",File_Checksum,
File Checksum);


//printf("Done..\n");


//fclose(fpout);


return(0); //success


} //end function Generate Hex_File


7



/***********x*x*****x**x***x*x*********w*****************xx*******x/




CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
unsigned int Get Addresslchar *Line)
f
char c;
unsigned int address;
address =0;
c= Line[3];
address = 4096 * Hex_Valuelc);
c= Line[4];
address += 256 * Hex_Value(c);
c= Line[5];
address += 16 * Hex_Value(cl;
c= Line[6];
address += Hex_Valuelc);
IS return(address);
//End function Get Address
/aaaa**aa******a**a**a***x*axxx*****xx*x****ar*ax***xxx*******x*rxx****/
void Dump_Datalvoid)
f
long i;
FILE *fpout;
extern char huge Data[ARRAY SIZE][2];
if ((fpout = fopen("c:/tools/hex/outdata.txt~, "wt"))
-= NULL)
f
fprintf(stderr, "Cannot open output file c:/tools/hex/outdata.txt.\n");
)
for (i=1219; i<1319; i++)
f
fputc(Data[i](0],fpout);
fputc(Data(i](1],fpout);
if ( ( i > 0 ) && ( (i $ 9) _= 0) )
fputc('\n',fpout);
) //end for
fclose(fpout);
) //end function Dump data
/a***x***rr****xx*x***x*x**r*xx**xr*xxx*x*******x***************x*/
int Hex_Value(char c)
{ int val;
//This function returns the hex value of the input character
//If it is not a hex character then it retunrs -1
//printf("Hex Values char is $c\n",c);
switch ( c ) f
case '0':Val= O;break;
case '1':Val= l;break;
case '2':Val= 2; break;
case '3':Val= 3; break;
case '4':Val= 9; break;
case 'S':Val= S;break;
case '6':Val= 6; break;
case '7':Val= 7; break;
case '8':Val= 8; break;
case '9':Val= 9; break;
case 'A':Val= to;break;
case 'B':Val= ll;break;
case 'C':Val= l2;break;
case 'D':Val= l3;break;
case 'E':Val= l9;break;
case 'F':Val= l5;break;
case 'a':Val= l0;break;
case 'b':Val= ll;break;
case 'c':Val= l2;break;
,75 case 'd':Val= l3;break;
case 'e':Val= l4;break;
case 'f':Val= l5;break;
default: Val= -l; break;
72


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
}//end switch
//printf('Hex_Val Val= $d\n',Vall;
return ( Val ) ;
}//end function Hex_Value
/w*r***x*x**x*x**x**x***r***x******r**+r*xr*x***x****+x/
int Lines_In_File(FILE *fp)
/+ This function counts the number of lines in the file */
char Line[LINE_LENGTH1;
int i;
IS i=0;
//reset the fp
fseeklfp,O,SEEK_SET);
while ( (fgetslLine,LINE LENGTH-l,fp)) != NULL ) i++; //count the lines
fseek(fp,O,SEEK_SET); //rewind it
return ( i ) ;
} //end function Lines_In_File
~***r+******r*xr********rrw**xrx***x**r***r*****r****r******r*rx**/
int Generate_Segment Hex_File(FILE *fpout, int segment)
// The Caller should have a separate filename for each call to this
//routine. Each file can then be processed by "condense & blockout~ to
//optimize the download.
//This routine will not attemp to calculate the line checksum that is
//usually output as the last byte...I do not use this information in
3 5 //any of my tools. 00 will be output for this checksum.
unsigned int i,j, tempadd;
char c;
int OutputBytes;
OutputBytes = 6; //6 bytes per HEX line
i=0;
// while (i < ARRAY_SIZE)
while (i < 512) //this may need to be larger !!!!!!
//Check for a short line that might happen at the end of the file
if ( i == 510)
[
OutputBytes = 2; //last line wnats to have 2 bytes 85 lines of 6 then last
}
if (OutputBytes > 15)
fprintf(fpout,":$2X~,OutputBytes);
$5 else
fprintflfpout,':0$X",OutputBytes);
//Now for the address
tempadd=i+(segment*512)+ox8000;
if (segment == 1 )
t
5 tempadd = tempadd;
}
fprintf(fpout,"~04X",tempadd);
//this is the record byte
fputc('0',fpout);
fputc('0',fpout);
//now for the data
for (j=0; j<OUtputBytes; j++) //each line of hex holds OutputBytes data bytes
(
c = Data[tempadd-0x8000+j][0];
73


CA 02374782 2001-11-20
WO 00/72139 PCT/US00/13889
fputc(c,fpout);
c = Data(tempadd-0x8000+j][1];
fputc(c.fpout);
}//end for
//checksum bytes
fputc('0',fpout);
fputc('0',fpout);
1 O fputc('\n'.fpout); //end of line
i += OutputBytes;
} /lend while
fputs(~:OOOOOOO1FF\n~,fpout); //indicates end of file
return(0); //success
IS } //end function Generate_Hex File
Having now described a few embodiments of the invention, and some
modifications and
variations thereto, it should be apparent to those skilled in the art that the
foregoing is merely
20 illustrative and not limiting, having been presented by the way of example
only. Numerous
modifications and other embodiments are within the scope of one of ordinary
skill in the art and are
contemplated as falling within the scope of the invention as limited only by
the appended claims and
equivalents thereto.
74

Representative Drawing
A single figure which represents the drawing illustrating the invention.
Administrative Status

For a clearer understanding of the status of the application/patent presented on this page, the site Disclaimer , as well as the definitions for Patent , Administrative Status , Maintenance Fee  and Payment History  should be consulted.

Administrative Status

Title Date
Forecasted Issue Date Unavailable
(86) PCT Filing Date 2000-05-19
(87) PCT Publication Date 2000-11-30
(85) National Entry 2001-11-20
Examination Requested 2001-11-20
Dead Application 2003-05-20

Abandonment History

Abandonment Date Reason Reinstatement Date
2002-05-21 FAILURE TO PAY APPLICATION MAINTENANCE FEE

Payment History

Fee Type Anniversary Year Due Date Amount Paid Paid Date
Application Fee $300.00 2001-11-20
Registration of a document - section 124 $100.00 2001-11-20
Registration of a document - section 124 $100.00 2001-11-20
Request for Examination $400.00 2001-11-20
Owners on Record

Note: Records showing the ownership history in alphabetical order.

Current Owners on Record
TRANSCEPT, INC.
Past Owners on Record
HERBERT, THOMAS G.
LOCKHEED MARTIN CORPORATION
PELLETIER, JAMES A.
RIGAZIO, JOSEPH L., III
Past Owners that do not appear in the "Owners on Record" listing will appear in other documentation within the application.
Documents

To view selected files, please enter reCAPTCHA code :



To view images, click a link in the Document Description column. To download the documents, select one or more checkboxes in the first column and then click the "Download Selected in PDF format (Zip Archive)" or the "Download Selected as Single PDF" button.

List of published and non-published patent-specific documents on the CPD .

If you have any difficulty accessing content, you can call the Client Service Centre at 1-866-997-1936 or send them an e-mail at CIPO Client Service Centre.


Document
Description 
Date
(yyyy-mm-dd) 
Number of pages   Size of Image (KB) 
Description 2001-11-20 74 2,620
Representative Drawing 2002-05-09 1 6
Abstract 2001-11-20 2 73
Claims 2001-11-20 3 126
Drawings 2001-11-20 3 34
Cover Page 2002-05-10 1 45
PCT 2001-11-20 13 441
Assignment 2001-11-20 10 338