dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bl_messages.h
Go to the documentation of this file.
1 
11 /*
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20  * for more details.
21  *
22  * You should have received a copy of the GNU General Public License along
23  * with this program; if not, see <http://www.gnu.org/licenses/>
24  */
25 
26 #ifndef BL_MESSAGES_H_
27 #define BL_MESSAGES_H_
28 
29 #include <stdint.h> /* uint*_t */
30 #define BL_INCLUDE_CAP_EXTENSIONS
31 
32 /* Note:
33  * Writes are from PC -> FC
34  * Reads are from FC -> PC
35  */
51 
53 };
54 
55 #define BL_MSG_FLAGS_ECHO_REQ 0x80
56 #define BL_MSG_FLAGS_ECHO_REP 0x40
57 #define BL_MSG_FLAGS_MASK 0xC0
58 #define BL_MSG_COMMAND_MASK 0x3F
59 
60 /*
61  * Note: These enum values MUST NOT be changed or backward
62  * compatibility will be broken
63  */
72 } __attribute__((packed));
73 
74 #pragma pack(push) /* push current alignment to stack */
75 #pragma pack(1) /* set alignment to 1 byte boundary */
76 
77 struct bl_messages {
78  uint8_t flags_command;
79 
80  union {
82  uint8_t unused[4];
83  uint8_t device_number;
85 
87  uint8_t unused[4];
89  uint16_t wrflags;
91 
93  uint32_t fw_size;
94  uint8_t device_number;
95  uint8_t bl_version;
96  uint8_t desc_size;
97  uint8_t board_rev;
98  uint32_t fw_crc;
99  uint16_t device_id;
100 #if defined(BL_INCLUDE_CAP_EXTENSIONS)
101  /* Extensions to original protocol */
102 #define BL_CAP_EXTENSION_MAGIC 0x3456
104  uint32_t partition_sizes[10];
105 #endif /* BL_INCLUDE_CAP_EXTENSIONS */
108  struct msg_enter_dfu {
109  uint8_t unused[4];
110  uint8_t device_number;
113  struct msg_jump_fw {
114  uint8_t unused[4];
115  uint8_t unused2[2];
116  uint16_t safe_word;
118 
119  struct msg_reset {
120  /* No subfields */
121  } reset;
123  struct msg_op_abort {
124  /* No subfields */
126 
127  struct msg_op_end {
128  /* No subfields */
131  struct msg_xfer_start {
135  uint32_t expected_crc; /* only used in writes */
136  } xfer_start;
138 #define XFER_BYTES_PER_PACKET 56
139  struct msg_xfer_cont {
143 
144  struct msg_status_req {
145  /* No subfields */
148  struct msg_status_rep {
149  uint32_t unused;
150  uint8_t current_state;
153  struct msg_wipe_partition {
156 
157  uint8_t pad[62];
158  } __attribute__((aligned(1)))v;
159 } __attribute__((packed));
160 
161 #pragma pack(pop) /* restore original alignment from stack */
162 
163 #endif /* BL_MESSAGES_H_ */
164 
struct bl_messages::@23::msg_enter_dfu enter_dfu
enum dfu_partition_label __attribute__((packed))
Definition: serial_4way.h:38
struct bl_messages::@23::msg_xfer_start xfer_start
struct bl_messages::@23::msg_wipe_partition wipe_partition
struct bl_messages::@23::msg_reset reset
uint16_t number_of_devices
Definition: bl_messages.h:88
uint32_t unused
Definition: bl_messages.h:149
DFU_PARTITION_BL
Definition: bl_messages.h:66
uint32_t fw_crc
Definition: bl_messages.h:98
uint16_t device_id
Definition: bl_messages.h:99
uint8_t board_rev
Definition: bl_messages.h:97
bl_commands
Definition: bl_messages.h:36
union bl_messages::@23 __attribute__((aligned(1))) v
struct bl_messages::@23::msg_capabilities_rep_all cap_rep_all
#define XFER_BYTES_PER_PACKET
Definition: bl_messages.h:124
uint8_t unused2[2]
Definition: bl_messages.h:115
uint8_t desc_size
Definition: bl_messages.h:96
uint16_t cap_extension_magic
Definition: bl_messages.h:103
uint8_t current_state
Definition: bl_messages.h:150
struct bl_messages::@23::msg_capabilities_rep_specific cap_rep_specific
DFU_PARTITION_SETTINGS
Definition: bl_messages.h:66
uint8_t unused[4]
Definition: bl_messages.h:82
struct bl_messages::@23::msg_status_rep status_rep
uint8_t pad[62]
Definition: bl_messages.h:157
DFU_PARTITION_AUTOTUNE
Definition: bl_messages.h:66
DFU_PARTITION_LOG
Definition: bl_messages.h:66
DFU_PARTITION_LOADABLE_EXTENSION
Definition: bl_messages.h:66
uint16_t wrflags
Definition: bl_messages.h:89
uint32_t expected_crc
Definition: bl_messages.h:135
struct bl_messages::@23::msg_capabilities_req cap_req
struct bl_messages::@23::msg_op_end op_end
uint32_t packets_in_transfer
Definition: bl_messages.h:132
struct bl_messages::@23::msg_xfer_cont xfer_cont
DFU_PARTITION_FW
Definition: bl_messages.h:66
dfu_partition_label
Definition: bl_messages.h:64
uint8_t flags_command
Definition: bl_messages.h:78
enum dfu_partition_label label
Definition: bl_messages.h:133
uint32_t partition_sizes[10]
Definition: bl_messages.h:104
uint16_t safe_word
Definition: bl_messages.h:116
struct bl_messages::@23::msg_status_req status_req
uint8_t device_number
Definition: bl_messages.h:83
uint8_t bl_version
Definition: bl_messages.h:95
uint32_t current_packet_number
Definition: bl_messages.h:140
uint32_t fw_size
Definition: bl_messages.h:93
struct bl_messages::@23::msg_jump_fw jump_fw
uint8_t words_in_last_packet
Definition: bl_messages.h:134
uint8_t data[XFER_BYTES_PER_PACKET]
Definition: bl_messages.h:141
struct bl_messages::@23::msg_op_abort op_abort
DFU_PARTITION_DESC
Definition: bl_messages.h:66