Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

srec.h

Go to the documentation of this file.
00001 /*
00002  *  srec.h
00003  *
00004  *  Header file for s-record routines.
00005  *
00006  *  The contents of this file are subject to the Mozilla Public License
00007  *  Version 1.0 (the "License"); you may not use this file except in
00008  *  compliance with the License. You may obtain a copy of the License at
00009  *  http://www.mozilla.org/MPL/
00010  *
00011  *  Software distributed under the License is distributed on an "AS IS"
00012  *  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
00013  *  License for the specific language governing rights and limitations
00014  *  under the License.
00015  *
00016  *  The Original Code is Firmdl code, released October 3, 1998.
00017  *
00018  *  The Initial Developer of the Original Code is Kekoa Proudfoot.
00019  *  Portions created by Kekoa Proudfoot are Copyright (C) 1998, 1999
00020  *  Kekoa Proudfoot. All Rights Reserved.
00021  *
00022  *  Contributor(s): Kekoa Proudfoot <kekoa@graphics.stanford.edu>
00023  */
00024 
00025 #ifndef SREC_H_INCLUDED
00026 #define SREC_H_INCLUDED
00027 
00028 #ifdef SREC_STRICT
00029 #define SREC_DATA_SIZE 32
00030 #else
00031 #define SREC_DATA_SIZE 256
00032 #endif
00033 
00034 typedef struct {
00035     unsigned char type;
00036     unsigned long addr;
00037     unsigned char count;
00038     unsigned char data[SREC_DATA_SIZE];
00039 } srec_t;
00040 
00041 /* This function decodes a line into an srec; returns negative on error */
00042 extern int srec_decode (srec_t *srec, char *line);
00043 
00044 /* This function encodes an srec into a line; returns negative on error */
00045 extern int srec_encode (srec_t *srec, char *line);
00046 
00047 /* Error values */
00048 #define SREC_OK               0
00049 #define SREC_NULL            -1
00050 #define SREC_INVALID_HDR     -2
00051 #define SREC_INVALID_CHAR    -3
00052 #define SREC_INVALID_TYPE    -4
00053 #define SREC_TOO_SHORT       -5
00054 #define SREC_TOO_LONG        -6
00055 #define SREC_INVALID_LEN     -7
00056 #define SREC_INVALID_CKSUM   -8
00057 
00058 /* Use srec_strerror to convert error codes into strings */
00059 extern char *srec_strerror (int errno);
00060 
00061 #endif /* SREC_H_INCLUDED */
00062 

Generated on Fri Feb 25 08:02:40 2005 for brickos by  doxygen 1.3.9.1