File tree Expand file tree Collapse file tree 4 files changed +9
-2
lines changed
Expand file tree Collapse file tree 4 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,8 @@ typedef struct __attribute__((__packed__))
157157 chip_id_t nand_id ;
158158} np_resp_id_t ;
159159
160+ /* BB, write ack and error responses are aligned to the same size to avoid
161+ * receiver wait for additional data */
160162typedef struct __attribute__((__packed__ ))
161163{
162164 np_resp_t header ;
@@ -168,12 +170,14 @@ typedef struct __attribute__((__packed__))
168170{
169171 np_resp_t header ;
170172 uint64_t bytes_ack ;
173+ uint8_t dummy [4 ];
171174} np_resp_write_ack_t ;
172175
173176typedef struct __attribute__((__packed__ ))
174177{
175178 np_resp_t header ;
176179 uint8_t err_code ;
180+ uint8_t dummy [11 ];
177181} np_resp_err_t ;
178182
179183typedef struct __attribute__((__packed__ ))
Original file line number Diff line number Diff line change @@ -133,6 +133,8 @@ typedef struct __attribute__((__packed__))
133133 ChipId nandId;
134134} RespId;
135135
136+ /* BB, write ack and error responses are aligned to the same size to avoid
137+ * receiver wait for additional data */
136138typedef struct __attribute__ ((__packed__))
137139{
138140 RespHeader header;
@@ -144,12 +146,14 @@ typedef struct __attribute__((__packed__))
144146{
145147 RespHeader header;
146148 uint64_t ackBytes;
149+ uint8_t dummy[4 ];
147150} RespWriteAck;
148151
149152typedef struct __attribute__ ((__packed__))
150153{
151154 RespHeader header;
152155 uint8_t errCode;
156+ uint8_t dummy[11 ];
153157} RespError;
154158
155159typedef struct __attribute__ ((__packed__))
Original file line number Diff line number Diff line change @@ -301,7 +301,7 @@ int Writer::writeData()
301301 break ;
302302 }
303303
304- if (read (pbuf, writeDataAckLen ))
304+ if (read (pbuf, sizeof (RespWriteAck) ))
305305 return -1 ;
306306
307307 return 0 ;
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ class Writer : public QObject
1616 Q_OBJECT
1717
1818 static const uint32_t bufSize = 64 ;
19- static const uint32_t writeDataAckLen = 10 ;
2019
2120 SerialPort *serialPort = nullptr ;
2221 QString portName;
You can’t perform that action at this time.
0 commit comments