1 |
786 |
skrzyp |
#ifndef _FIS_H_
|
2 |
|
|
#define _FIS_H_
|
3 |
|
|
//==========================================================================
|
4 |
|
|
//
|
5 |
|
|
// fis.h
|
6 |
|
|
//
|
7 |
|
|
// RedBoot - FLASH image directory layout
|
8 |
|
|
//
|
9 |
|
|
//==========================================================================
|
10 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
18 |
|
|
// version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
21 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
25 |
|
|
// You should have received a copy of the GNU General Public License
|
26 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use
|
30 |
|
|
// macros or inline functions from this file, or you compile this file
|
31 |
|
|
// and link it with other works to produce a work based on this file,
|
32 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
33 |
|
|
// the GNU General Public License. However the source code for this file
|
34 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
35 |
|
|
// General Public License v2.
|
36 |
|
|
//
|
37 |
|
|
// This exception does not invalidate any other reasons why a work based
|
38 |
|
|
// on this file might be covered by the GNU General Public License.
|
39 |
|
|
// -------------------------------------------
|
40 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
41 |
|
|
//==========================================================================
|
42 |
|
|
//#####DESCRIPTIONBEGIN####
|
43 |
|
|
//
|
44 |
|
|
// Author(s): gthomas
|
45 |
|
|
// Contributors: gthomas, tkoeller
|
46 |
|
|
// Date: 2000-07-28
|
47 |
|
|
// Purpose:
|
48 |
|
|
// Description:
|
49 |
|
|
//
|
50 |
|
|
// This code is part of RedBoot (tm).
|
51 |
|
|
//
|
52 |
|
|
//####DESCRIPTIONEND####
|
53 |
|
|
//
|
54 |
|
|
//==========================================================================
|
55 |
|
|
|
56 |
|
|
#include <pkgconf/redboot.h>
|
57 |
|
|
#ifdef CYGOPT_REDBOOT_FIS
|
58 |
|
|
#include <cyg/infra/cyg_type.h>
|
59 |
|
|
|
60 |
|
|
//the version can be tested via the VV calls to check for compatibility
|
61 |
|
|
#define CYG_REDBOOT_FIS_VERSION (1)
|
62 |
|
|
|
63 |
|
|
// the following defines will be used if RedBoot is configured
|
64 |
|
|
// with support for redundant FIS tables, which enable failsafe updating
|
65 |
|
|
#ifdef CYGOPT_REDBOOT_REDUNDANT_FIS
|
66 |
|
|
|
67 |
|
|
#define CYG_REDBOOT_RFIS_VALID_MAGIC_LENGTH 10
|
68 |
|
|
#define CYG_REDBOOT_RFIS_VALID_MAGIC ".FisValid" // exactly 10 bytes
|
69 |
|
|
|
70 |
|
|
#define CYG_REDBOOT_RFIS_VALID (0xa5) // this FIS table is valid, the only "good" value
|
71 |
|
|
#define CYG_REDBOOT_RFIS_IN_PROGRESS (0xfd) // this FIS table is being modified
|
72 |
|
|
#define CYG_REDBOOT_RFIS_EMPTY (0xff) // this FIS table is empty
|
73 |
|
|
|
74 |
|
|
struct fis_valid_info
|
75 |
|
|
{
|
76 |
|
|
char magic_name[CYG_REDBOOT_RFIS_VALID_MAGIC_LENGTH];
|
77 |
|
|
unsigned char valid_flag[2]; // one of the flags defined above
|
78 |
|
|
unsigned long version_count; // with each successfull update the version count will increase by 1
|
79 |
|
|
};
|
80 |
|
|
|
81 |
|
|
#endif // CYGOPT_REDBOOT_REDUNDANT_FIS
|
82 |
|
|
|
83 |
|
|
#define FIS_IMAGE_DESC_SIZE_UNPADDED \
|
84 |
|
|
(16 + 4 * sizeof(unsigned long) + 3 * sizeof(CYG_ADDRESS))
|
85 |
|
|
|
86 |
|
|
struct fis_image_desc {
|
87 |
|
|
union
|
88 |
|
|
{
|
89 |
|
|
char name[16]; // Null terminated name
|
90 |
|
|
#ifdef CYGOPT_REDBOOT_REDUNDANT_FIS
|
91 |
|
|
struct fis_valid_info valid_info;
|
92 |
|
|
#endif
|
93 |
|
|
} u;
|
94 |
|
|
CYG_ADDRESS flash_base; // Address within FLASH of image
|
95 |
|
|
CYG_ADDRESS mem_base; // Address in memory where it executes
|
96 |
|
|
unsigned long size; // Length of image
|
97 |
|
|
CYG_ADDRESS entry_point; // Execution entry point
|
98 |
|
|
unsigned long data_length; // Length of actual data
|
99 |
|
|
unsigned char _pad[CYGNUM_REDBOOT_FIS_DIRECTORY_ENTRY_SIZE-FIS_IMAGE_DESC_SIZE_UNPADDED];
|
100 |
|
|
unsigned long desc_cksum; // Checksum over image descriptor
|
101 |
|
|
unsigned long file_cksum; // Checksum over image data
|
102 |
|
|
};
|
103 |
|
|
|
104 |
|
|
struct fis_image_desc *fis_lookup(char *name, int *num);
|
105 |
|
|
|
106 |
|
|
#endif // CYGOPT_REDBOOT_FIS
|
107 |
|
|
#endif // _FIS_H_
|