Statistics
| Branch: | Tag: | Revision:

amiro-blt / Host / Source / SerialBoot / srecord.h @ 69661903

History | View | Annotate | Download (3.962 KB)

1
/************************************************************************************//**
2
* \file         srecord.h
3
* \brief        Motorola S-record library header file.
4
* \ingroup      SerialBoot
5
* \internal
6
*----------------------------------------------------------------------------------------
7
*                          C O P Y R I G H T
8
*----------------------------------------------------------------------------------------
9
*   Copyright (c) 2014  by Feaser    http://www.feaser.com    All rights reserved
10
*
11
*----------------------------------------------------------------------------------------
12
*                            L I C E N S E
13
*----------------------------------------------------------------------------------------
14
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
15
* modify it under the terms of the GNU General Public License as published by the Free
16
* Software Foundation, either version 3 of the License, or (at your option) any later
17
* version.
18
*
19
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
20
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
21
* PURPOSE. See the GNU General Public License for more details.
22
*
23
* You should have received a copy of the GNU General Public License along with OpenBLT.
24
* If not, see <http://www.gnu.org/licenses/>.
25
*
26
* A special exception to the GPL is included to allow you to distribute a combined work 
27
* that includes OpenBLT without being obliged to provide the source code for any 
28
* proprietary components. The exception text is included at the bottom of the license
29
* file <license.html>.
30
* 
31
* \endinternal
32
****************************************************************************************/
33
#ifndef SRECORD_H
34
#define SRECORD_H
35

    
36

    
37
/****************************************************************************************
38
* Macro definitions
39
****************************************************************************************/
40
/** \brief Maximum number of characters that can be on a line in the firmware file. */
41
#define SRECORD_MAX_CHARS_PER_LINE        (512)
42

    
43
/** \brief Maximum number of data bytes that can be on a line in the firmware file
44
 *         (S-record).
45
 */
46
#define SRECORD_MAX_DATA_BYTES_PER_LINE   (SRECORD_MAX_CHARS_PER_LINE/2)
47

    
48

    
49
/****************************************************************************************
50
* Type definitions
51
****************************************************************************************/
52
/** \brief Structure type for grouping the parsing results of an S-record file. */
53
typedef struct
54
{
55
  sb_uint32 address_low;                          /**< lowest memory address           */
56
  sb_uint32 address_high;                         /**< lowest memory address           */
57
  sb_uint32 data_bytes_total;                     /**< total number of data bytes      */
58
} tSrecordParseResults;
59

    
60
/** \brief Structure type for grouping the parsing results of an S-record line. */
61
typedef struct
62
{
63
  sb_uint8 data[SRECORD_MAX_DATA_BYTES_PER_LINE]; /**< array for S1,S2 or S3 data bytes*/
64
  sb_uint32 address;                              /**< address on S1,S2 or S3 line     */
65
  sb_uint16 length;                               /**< number of bytes written to array */
66
} tSrecordLineParseResults;
67

    
68

    
69
/****************************************************************************************
70
* Function prototypes
71
****************************************************************************************/
72
sb_uint8 SrecordIsValid(const sb_char *srecordFile);
73
sb_file  SrecordOpen(const sb_char *srecordFile);
74
void     SrecordParse(sb_file srecordHandle, tSrecordParseResults *parseResults);
75
void     SrecordClose(sb_file srecordHandle);
76
sb_uint8 SrecordParseNextDataLine(sb_file srecordHandle, tSrecordLineParseResults *parseResults);
77

    
78

    
79
#endif /* SRECORD_H */
80
/*********************************** end of srecord.h **********************************/