summaryrefslogtreecommitdiff
path: root/cleopatre/linux-2.6.25.10-spc300/tools/mkimagedesc/image_desc.h
blob: 74134750bb37651239a8cfcab512a6c3fbf8ee56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef _IMAGE_DESC_H_
#define _IMAGE_DESC_H_

#include <stdint.h>

#define SPIDCOM_IMG_DESC_MTD_NAME_0 "/dev/mtd3"
#define SPIDCOM_IMG_DESC_MTD_NAME_1 "/dev/mtd4"

#define SPIDCOM_IMG_DESC_SPC300 0x00
#define SPIDCOM_IMG_DESC_UNKNOWN 0x01

#define SPIDCOM_IMG_DESC_MAGIC "SPIDIMG\0"
#define SPIDCOM_IMG_DESC_SIZE  1024

#define SPIDCOM_IMG_DESC_INVALID_INDEX 0x8fffffff
#define SPIDCOM_IMG_DESC_ORIGIN_INDEX 0xffffffff

#define SPIDCOM_IMG_DESC_NORMAL_TYPE    0x0

#define SPIDCOM_IMG_DESC_PLC_RAM 0x400000 /* 4M */

#define SPIDCOM_IMG_DESC_IS_VALID(desc) (   !memcmp((desc)->magic, SPIDCOM_IMG_DESC_MAGIC, 8) && \
                                            (desc)->is_valid && \
                                            ( (desc)->index != SPIDCOM_IMG_DESC_INVALID_INDEX )     )

/* /!\ All values are LITTLE-ENDIAN */
typedef struct {
    char     magic[8];              /* Magic number = "SPIDIMG\0"
                                     * = { 0x53, 0x50, 0x49, 0x44,
                                     *     0x49, 0x4d, 0x47, 0x00 } */
    uint32_t index;                 /* The biggest one is the image to boot */
    uint32_t is_valid:1;            /* Is image valid (bootable ?) */
    uint32_t is_1st_boot:1;         /* Is first image boot ? */
    uint32_t is_not_success:1;      /* Is first boot successful ? */
    uint32_t is_not_update:1;       /* Is update process finished correctly? */
    uint32_t size;                  /* Firmware size (descriptor included) */
    uint32_t type;                  /* Image type :  0 is normal image */
    uint8_t  md5_sum[16];           /* MD5 checksum of the whole firmware */
    char     version[16];           /* Image version string */
    char     description[64];       /* Image description string */
    uint32_t arch;	            /* spc300 or unknown */
    uint32_t plc_ram;               /* RAM size needed for the PLC processor */
    char     reserved[900];
    char     image[0];              /* Used in bootloader  to mark beging of the payload */
} spidcom_image_desc_t;

#endif