MOTOROLA AN1230/D
10
#include "bdmcalls.h"
void FillLong (LONG
Where, LONG Data);
Performs a longword write at location 'Where',
writing the value 'Data'.
On CPU16 targets, this call is identical to
PutLong (). On CPU32 targets, a special BDM
command is used which is faster than a normal
memory access. PutByte (), PutWord (), or
PutLong () should be called first, to set the initial
address for memory subsequent memory writes;
then any number of FillByte (), FillWord (),
or FillLong () calls may be made to write to fol-
lowing locations of memory
Nothing.
#include “bdm-calls.h”
#include "bdm-util.h"
#include <stdio.h>
int do_srec (srecord
*where, FILE *infile);
Reads one S-record from the file addressed by
'infile' and writes the contents into the srecord
structure '*where' in memory. The 'srecord'
structure is defined in the include file "bdm-
util.h".
When do_srec () returns indicating either no er-
ror or SREC_S9 (end of file record), the structure
'*where' contains the following information:
where->rectype holds the contents of the S-
record type field, one of the following values: 0, 1,
2, 3, 7, 8, or 9. (Note that a type 0 field is a header
field and should be ignored; types 7, 8, and 9 are
end-of-file records, causing do_srec to return
SREC_S9 instead of 0.)
where->reclen holds the contents of the record
length field of the S-record.
where->address holds the contents of the ad-
dress field of the S-record.
where->bytes [] holds the contents (if any) of the
data field of the S-record. The number of valid
bytes will be: where->reclen, minus the size of
the address field (2 for types 0, 1, and 9; 3 for
types 2 and 8; 4 for types 3 and 7), minus one.
Returns a status code representing
the success or failure of the read.
The codes are defined in the in-
clude file "bdm-util.h".
0: S-record was read OK -memory
structure contains valid data.
SREC_EOF: file ended before
end-of-file record found
SREC_FORMAT: file does not
match defined S-record format.
SREC_CHECKSUM: checksum
error in S-record.
SREC_S9: this S-record is the
end-of-file record as defined in the
Motorola S-record spec. This sta-
tus is not an error, but rather an in-
dication that the last record was
read from the file, and the user pro-
gram should not continue to call
do_srec ().
#include "bdm-calls.h"
#include "bdm-util.h"
void put_srec (srecord
*data, LONG
load_offset);
Writes the data contained in data->bytes to mem-
ory in the target system, at the address specified
by data->address plus load_offset. Type 0
records are ignored; type 7, 8, and 9 records
cause the global variable ExecuteAddress to be
set to the value data->address plus load_offset.
Nothing.
#include "bdm-calls.h"
#include "bdm-util.h"
int do_load (LONG
load_offset, char *in-
filename);
Opens the disk file named by 'infilename', reads
S-records from the file on at a time using do_srec
(), and writes the contents of the S-records to tar-
get memory using put_srec ().
Returns the same error codes as
do_srec (), with one addition: if
the file specified by 'infilename'
cannot be opened, do_load re-
turns the value -1.
Table 4 BDM Driver Package Function Reference (Continued)
Prototype Description Return Value