-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqs_bootprotocolstruct.h
More file actions
101 lines (88 loc) · 3.41 KB
/
qs_bootprotocolstruct.h
File metadata and controls
101 lines (88 loc) · 3.41 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/**
* @file qs_bootprotocolstruct.h
* @author Fernando Morani
* @date 27 Mar 2022
* @brief Defines the boot protocol structure
*
*/
#ifndef QS_BOOTPROTOCOLSTRUCT_H
#define QS_BOOTPROTOCOLSTRUCT_H
#include <stdint.h>
#include "qs_bootprotocoldef.h"
/*!
* \typedef Stuctrured type to be used as payload in the following commands:
* READ_FW_VERSION
* READ_BOOT_VERSION.
*/
typedef struct
{
uint16_t FW_Erp_Identifier; /* codice identificativo del FW */
uint8_t FW_Erp_Version; /* Minor Version del FW */
uint8_t FW_Erp_BuildNumber; /* incremental Build Number del FW */
uint32_t FW_Erp_Crc32; /* CRC32 del FW */
/* 8 bytes */
} FW_SW_VERSION_T;
/*!
* \typedef Stuctrured type to be used as payload in the following commands:
* READ_REV_ID
* READ_DEV_ID.
*/
typedef struct
{
uint8_t ID_Info_Version; /* Info Version */
/* 8 bytes */
} ID_INFO_VERSION_T;
/*!
* \typedef Stuctrured type to be used as payload in the following commands:
* ERASE
* WRITE when coming from FW or BootLoader and it fails
*/
typedef struct
{
uint8_t BANK_Info_Ack; /* QS_BOOTP_OK if the command has been executed or requested
QS_BOOTP_FAIL if not*/
uint8_t BANK_Info_Number; /* Bank number to erase or WRITE */
} BANK_INFO_T;
/*!
* \typedef Stuctrured type to be used as payload in the following commands:
* READ when coming from FW or BootLoader and it fails
* If READ flash is OK, it fill the payloads with all the requested bytes *
*/
typedef struct
{
uint8_t READ_Info_Ack; /* QS_BOOTP_FAIL */
uint8_t READ_Info_Number; /* Number of bytes not red */
} READ_INFO_ANSWER_T;
/*!
* \typedef Stuctrured type to be used as payload in the following commands:
* READ when coming from SW
*/
typedef struct
{
uint16_t READ_Address; /* Flash Address to read */
uint16_t READ_Info_Number; /* Number of bytes to read */
} READ_FROM_FLASH_T;
/*!
* \typedef Stuctrured type to be used as payload in the following commands:
* WRITE when coming from SW
*/
typedef struct
{
uint8_t WRITE_Block; /* Block to write */
uint8_t WRITE_element; /* Element to write */
}WRITE_TO_FLASH_T;
typedef struct QS_bootProt{
uint8_t qs_Stx; /*STX: Start of Message*/
uint8_t qs_PayLen; /*Payload lenght from 1 to 240 ---> Expressed as 1 to 240*/
/*Minimum payload lenght = 1*/
/*In order to have max single packet = 255*/
uint8_t qs_Sender; /*Sender of the packet
sender Address (0x20 for SW, 0x23 for Bootloader-FW; not specified for Application-FW)*/
uint8_t qs_Policy; /* User define field*/
uint8_t qs_CmdId; /*Command identifier field*/
uint8_t qs_Payload[QS_BOOTP_MAX_PAY_LEN]; /*Payload field*/
uint8_t qs_CrcLow; /*CRC-16 low byte*/
uint8_t qs_CrcHigh; /*CRC-16 high byte*/
uint8_t qs_Etx; /*ETX: End of Message*/
} QS_BOOT_PROT_T;
#endif /* QS_BOOTPROTOCOLSTRUCT_H*/