• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __NANOHUBPACKET_H
18 #define __NANOHUBPACKET_H
19 
20 /**
21  * Formats and constants related to nanohub packets.  This header is intended
22  * to be shared between the host Linux kernel and the nanohub implementation.
23  */
24 #include "toolchain.h"
25 
26 #ifdef __KERNEL__
27 #include <linux/types.h>
28 #else
29 #include <hostIntf.h>
30 #include <stdint.h>
31 
32 typedef uint16_t __le16;
33 typedef uint16_t __be16;
34 typedef uint32_t __le32;
35 typedef uint32_t __be32;
36 typedef uint64_t __le64;
37 typedef uint64_t __be64;
38 #endif
39 
40 SET_PACKED_STRUCT_MODE_ON
41 struct NanohubPacket {
42     uint8_t sync;
43     __le32 seq;
44     __le32 reason;
45     uint8_t len;
46     uint8_t data[0];
47 } ATTRIBUTE_PACKED;
48 SET_PACKED_STRUCT_MODE_OFF
49 
50 SET_PACKED_STRUCT_MODE_ON
51 struct NanohubPacketFooter {
52     __le32 crc;
53 } ATTRIBUTE_PACKED;
54 SET_PACKED_STRUCT_MODE_OFF
55 
nanohubGetPacketFooter(struct NanohubPacket * packet)56 static inline struct NanohubPacketFooter *nanohubGetPacketFooter(struct NanohubPacket *packet)
57 {
58     return (struct NanohubPacketFooter *)(packet->data + packet->len);
59 }
60 
61 #define NANOHUB_PACKET_SIZE(len) \
62     (sizeof(struct NanohubPacket) + (len) + sizeof(struct NanohubPacketFooter))
63 
64 #define NANOHUB_PACKET_PAYLOAD_MAX    255
65 #define NANOHUB_PACKET_SIZE_MAX       NANOHUB_PACKET_SIZE(NANOHUB_PACKET_PAYLOAD_MAX)
66 #define NANOHUB_PACKET_SIZE_MIN       NANOHUB_PACKET_SIZE(0)
67 
68 #define NANOHUB_SYNC_BYTE             0x31
69 
70 #define NANOHUB_PREAMBLE_BYTE         0xFF
71 #define NANOHUB_ACK_PREAMBLE_LEN      16
72 #define NANOHUB_PAYLOAD_PREAMBLE_LEN  512
73 #define NANOHUB_RSA_KEY_CHUNK_LEN     64
74 
75 #define NANOHUB_INT_BOOT_COMPLETE     0
76 #define NANOHUB_INT_WAKE_COMPLETE     0
77 #define NANOHUB_INT_WAKEUP            1
78 #define NANOHUB_INT_NONWAKEUP         2
79 #define NANOHUB_INT_CMD_WAIT          3
80 
81 #define NANOHUB_REASON_ACK                    0x00000000
82 #define NANOHUB_REASON_NAK                    0x00000001
83 #define NANOHUB_REASON_NAK_BUSY               0x00000002
84 
85 /**
86  * INFORMATIONAL
87  */
88 
89 #define NANOHUB_REASON_GET_OS_HW_VERSIONS     0x00001000
90 #if defined(__GNUC__)
91 SET_PACKED_STRUCT_MODE_ON
92 struct NanohubOsHwVersionsRequest {
93 } ATTRIBUTE_PACKED;
94 SET_PACKED_STRUCT_MODE_OFF
95 #endif
96 
97 SET_PACKED_STRUCT_MODE_ON
98 struct NanohubOsHwVersionsResponse {
99     __le16 hwType;
100     __le16 hwVer;
101     __le16 blVer;
102     __le16 osVer;
103     __le32 variantVer;
104 } ATTRIBUTE_PACKED;
105 SET_PACKED_STRUCT_MODE_OFF
106 
107 #define NANOHUB_REASON_GET_APP_VERSIONS       0x00001001
108 
109 SET_PACKED_STRUCT_MODE_ON
110 struct NanohubAppVersionsRequest {
111     __le64 appId;
112 } ATTRIBUTE_PACKED;
113 SET_PACKED_STRUCT_MODE_OFF
114 
115 SET_PACKED_STRUCT_MODE_ON
116 struct NanohubAppVersionsResponse {
117     __le32 appVer;
118 } ATTRIBUTE_PACKED;
119 SET_PACKED_STRUCT_MODE_OFF
120 
121 #define NANOHUB_REASON_QUERY_APP_INFO         0x00001002
122 
123 SET_PACKED_STRUCT_MODE_ON
124 struct NanohubAppInfoRequest {
125     __le32 appIdx;
126 } ATTRIBUTE_PACKED;
127 SET_PACKED_STRUCT_MODE_OFF
128 
129 SET_PACKED_STRUCT_MODE_ON
130 struct NanohubAppInfoResponse {
131     __le64 appId;
132     __le32 appVer;
133     __le32 appSize;
134 } ATTRIBUTE_PACKED;
135 SET_PACKED_STRUCT_MODE_OFF
136 
137 #define NANOHUB_REASON_START_FIRMWARE_UPLOAD  0x00001040
138 
139 SET_PACKED_STRUCT_MODE_ON
140 struct NanohubStartFirmwareUploadRequest {
141     __le32 size;
142     __le32 crc;
143     uint8_t type;
144 } ATTRIBUTE_PACKED;
145 SET_PACKED_STRUCT_MODE_OFF
146 
147 SET_PACKED_STRUCT_MODE_ON
148 struct NanohubStartFirmwareUploadResponse {
149     uint8_t accepted;
150 } ATTRIBUTE_PACKED;
151 SET_PACKED_STRUCT_MODE_OFF
152 
153 #define NANOHUB_REASON_FIRMWARE_CHUNK         0x00001041
154 
155 SET_PACKED_STRUCT_MODE_ON
156 struct NanohubFirmwareChunkRequest {
157     __le32 offset;
158     uint8_t data[NANOHUB_PACKET_PAYLOAD_MAX-sizeof(__le32)];
159 } ATTRIBUTE_PACKED;
160 SET_PACKED_STRUCT_MODE_OFF
161 
162 enum NanohubFirmwareChunkReply {
163     NANOHUB_FIRMWARE_CHUNK_REPLY_ACCEPTED = 0,
164     NANOHUB_FIRMWARE_CHUNK_REPLY_WAIT,
165     NANOHUB_FIRMWARE_CHUNK_REPLY_RESEND,
166     NANOHUB_FIRMWARE_CHUNK_REPLY_RESTART,
167     NANOHUB_FIRMWARE_CHUNK_REPLY_CANCEL,
168     NANOHUB_FIRMWARE_CHUNK_REPLY_CANCEL_NO_RETRY,
169     NANOHUB_FIRMWARE_CHUNK_REPLY_NO_SPACE,
170 };
171 
172 SET_PACKED_STRUCT_MODE_ON
173 struct NanohubFirmwareChunkResponse {
174     uint8_t chunkReply;
175 } ATTRIBUTE_PACKED;
176 SET_PACKED_STRUCT_MODE_OFF
177 
178 #define NANOHUB_REASON_FINISH_FIRMWARE_UPLOAD 0x00001042
179 
180 #if defined(__GNUC__)
181 SET_PACKED_STRUCT_MODE_ON
182 struct NanohubFinishFirmwareUploadRequest {
183 } ATTRIBUTE_PACKED;
184 SET_PACKED_STRUCT_MODE_OFF
185 #endif
186 
187 enum NanohubFirmwareUploadReply {
188     NANOHUB_FIRMWARE_UPLOAD_SUCCESS = 0,
189     NANOHUB_FIRMWARE_UPLOAD_PROCESSING,
190     NANOHUB_FIRMWARE_UPLOAD_WAITING_FOR_DATA,
191     NANOHUB_FIRMWARE_UPLOAD_APP_SEC_KEY_NOT_FOUND,
192     NANOHUB_FIRMWARE_UPLOAD_APP_SEC_HEADER_ERROR,
193     NANOHUB_FIRMWARE_UPLOAD_APP_SEC_TOO_MUCH_DATA,
194     NANOHUB_FIRMWARE_UPLOAD_APP_SEC_TOO_LITTLE_DATA,
195     NANOHUB_FIRMWARE_UPLOAD_APP_SEC_SIG_VERIFY_FAIL,
196     NANOHUB_FIRMWARE_UPLOAD_APP_SEC_SIG_DECODE_FAIL,
197     NANOHUB_FIRMWARE_UPLOAD_APP_SEC_SIG_ROOT_UNKNOWN,
198     NANOHUB_FIRMWARE_UPLOAD_APP_SEC_MEMORY_ERROR,
199     NANOHUB_FIRMWARE_UPLOAD_APP_SEC_INVALID_DATA,
200     NANOHUB_FIRMWARE_UPLOAD_APP_SEC_VERIFY_FAILED,
201     NANOHUB_FIRMWARE_UPLOAD_APP_SEC_BAD,
202 };
203 
204 SET_PACKED_STRUCT_MODE_ON
205 struct NanohubFinishFirmwareUploadResponse {
206    uint8_t uploadReply;
207 } ATTRIBUTE_PACKED;
208 SET_PACKED_STRUCT_MODE_OFF
209 
210 #define NANOHUB_REASON_GET_INTERRUPT          0x00001080
211 
212 SET_PACKED_STRUCT_MODE_ON
213 struct NanohubGetInterruptRequest {
214     uint32_t clear[HOSTINTF_MAX_INTERRUPTS/(32*sizeof(uint8_t))];
215 } ATTRIBUTE_PACKED;
216 SET_PACKED_STRUCT_MODE_OFF
217 
218 SET_PACKED_STRUCT_MODE_ON
219 struct NanohubGetInterruptResponse {
220     uint32_t interrupts[HOSTINTF_MAX_INTERRUPTS/(32*sizeof(uint8_t))];
221 } ATTRIBUTE_PACKED;
222 SET_PACKED_STRUCT_MODE_OFF
223 
224 #define NANOHUB_REASON_MASK_INTERRUPT         0x00001081
225 
226 SET_PACKED_STRUCT_MODE_ON
227 struct NanohubMaskInterruptRequest {
228     uint8_t interrupt;
229 } ATTRIBUTE_PACKED;
230 SET_PACKED_STRUCT_MODE_OFF
231 
232 SET_PACKED_STRUCT_MODE_ON
233 struct NanohubMaskInterruptResponse {
234     uint8_t accepted;
235 } ATTRIBUTE_PACKED;
236 SET_PACKED_STRUCT_MODE_OFF
237 
238 #define NANOHUB_REASON_UNMASK_INTERRUPT       0x00001082
239 
240 SET_PACKED_STRUCT_MODE_ON
241 struct NanohubUnmaskInterruptRequest {
242     uint8_t interrupt;
243 } ATTRIBUTE_PACKED;
244 SET_PACKED_STRUCT_MODE_OFF
245 
246 SET_PACKED_STRUCT_MODE_ON
247 struct NanohubUnmaskInterruptResponse {
248     uint8_t accepted;
249 } ATTRIBUTE_PACKED;
250 SET_PACKED_STRUCT_MODE_OFF
251 
252 #define NANOHUB_REASON_READ_EVENT             0x00001090
253 
254 SET_PACKED_STRUCT_MODE_ON
255 struct NanohubReadEventRequest {
256     __le64 apBootTime;
257 } ATTRIBUTE_PACKED;
258 SET_PACKED_STRUCT_MODE_OFF
259 
260 SET_PACKED_STRUCT_MODE_ON
261 struct NanohubReadEventResponse {
262     __le32 evtType;
263     uint8_t evtData[NANOHUB_PACKET_PAYLOAD_MAX - sizeof(__le32)];
264 } ATTRIBUTE_PACKED;
265 SET_PACKED_STRUCT_MODE_OFF
266 
267 #define NANOHUB_REASON_WRITE_EVENT            0x00001091
268 
269 SET_PACKED_STRUCT_MODE_ON
270 struct NanohubWriteEventRequest {
271     __le32 evtType;
272     uint8_t evtData[NANOHUB_PACKET_PAYLOAD_MAX - sizeof(__le32)];
273 } ATTRIBUTE_PACKED;
274 SET_PACKED_STRUCT_MODE_OFF
275 
276 SET_PACKED_STRUCT_MODE_ON
277 struct NanohubWriteEventResponse {
278     uint8_t accepted;
279 } ATTRIBUTE_PACKED;
280 SET_PACKED_STRUCT_MODE_OFF
281 
282 // this behaves more stable w.r.t. endianness than bit field
283 // this is setting byte fields in MgmtStatus response
284 // the high-order bit, if set, is indication of counter overflow
285 #define SET_COUNTER(counter, val) (counter = (val & 0x7F) | (val > 0x7F ? 0x80 : 0))
286 
287 SET_PACKED_STRUCT_MODE_ON
288 struct MgmtStatus {
289     union {
290         __le32 value;
291         // NOTE: union fields are accessed in CPU native mode
292         struct {
293             uint8_t app;
294             uint8_t task;
295             uint8_t op;
296             uint8_t erase;
297         } ATTRIBUTE_PACKED;
298     };
299 } ATTRIBUTE_PACKED;
300 SET_PACKED_STRUCT_MODE_OFF
301 
302 #ifdef LEGACY_HAL_ENABLED
303 
304 SET_PACKED_STRUCT_MODE_ON
305 struct NanohubHalLegacyHdr {
306     uint64_t appId;
307     uint8_t len;
308     uint8_t msg;
309 } ATTRIBUTE_PACKED;
310 SET_PACKED_STRUCT_MODE_OFF
311 
312 #define NANOHUB_HAL_LEGACY_EXT_APPS_ON      0
313 #define NANOHUB_HAL_LEGACY_EXT_APPS_OFF     1
314 #define NANOHUB_HAL_LEGACY_EXT_APP_DELETE   2
315 
316 SET_PACKED_STRUCT_MODE_ON
317 struct NanohubHalLegacyMgmtRx {
318     __le64 appId;
319     struct MgmtStatus stat;
320 } ATTRIBUTE_PACKED;
321 SET_PACKED_STRUCT_MODE_OFF
322 
323 SET_PACKED_STRUCT_MODE_ON
324 struct NanohubHalLegacyMgmtTx {
325     struct NanohubHalLegacyHdr hdr;
326     __le32 status;
327 } ATTRIBUTE_PACKED;
328 SET_PACKED_STRUCT_MODE_OFF
329 
330 #define NANOHUB_HAL_LEGACY_QUERY_MEMINFO    3
331 #define NANOHUB_HAL_LEGACY_QUERY_APPS       4
332 
333 SET_PACKED_STRUCT_MODE_ON
334 struct NanohubHalLegacyQueryAppsRx {
335     __le32 idx;
336 } ATTRIBUTE_PACKED;
337 SET_PACKED_STRUCT_MODE_OFF
338 
339 SET_PACKED_STRUCT_MODE_ON
340 struct NanohubHalLegacyQueryAppsTx {
341     struct NanohubHalLegacyHdr hdr;
342     __le64 appId;
343     __le32 version;
344     __le32 flashUse;
345     __le32 ramUse;
346 } ATTRIBUTE_PACKED;
347 SET_PACKED_STRUCT_MODE_OFF
348 
349 #define NANOHUB_HAL_LEGACY_QUERY_RSA_KEYS   5
350 
351 SET_PACKED_STRUCT_MODE_ON
352 struct NanohubHalLegacyQueryRsaKeysRx {
353     __le32 offset;
354 } ATTRIBUTE_PACKED;
355 SET_PACKED_STRUCT_MODE_OFF
356 
357 SET_PACKED_STRUCT_MODE_ON
358 struct NanohubHalLegacyQueryRsaKeysTx {
359     struct NanohubHalLegacyHdr hdr;
360     uint8_t data[];
361 } ATTRIBUTE_PACKED;
362 SET_PACKED_STRUCT_MODE_OFF
363 
364 #define NANOHUB_HAL_LEGACY_START_UPLOAD     6
365 
366 SET_PACKED_STRUCT_MODE_ON
367 struct NanohubHalLegacyStartUploadRx {
368     uint8_t isOs;
369     __le32 length;
370 } ATTRIBUTE_PACKED;
371 SET_PACKED_STRUCT_MODE_OFF
372 
373 SET_PACKED_STRUCT_MODE_ON
374 struct NanohubHalLegacyStartUploadTx {
375     struct NanohubHalLegacyHdr hdr;
376     uint8_t success;
377 } ATTRIBUTE_PACKED;
378 SET_PACKED_STRUCT_MODE_OFF
379 
380 #define NANOHUB_HAL_LEGACY_CONT_UPLOAD      7
381 
382 SET_PACKED_STRUCT_MODE_ON
383 struct NanohubHalLegacyContUploadRx {
384     __le32 offset;
385     uint8_t data[];
386 } ATTRIBUTE_PACKED;
387 SET_PACKED_STRUCT_MODE_OFF
388 
389 SET_PACKED_STRUCT_MODE_ON
390 struct NanohubHalLegacyContUploadTx {
391     struct NanohubHalLegacyHdr hdr;
392     uint8_t success;
393 } ATTRIBUTE_PACKED;
394 SET_PACKED_STRUCT_MODE_OFF
395 
396 #define NANOHUB_HAL_LEGACY_FINISH_UPLOAD    8
397 
398 SET_PACKED_STRUCT_MODE_ON
399 struct NanohubHalLegacyFinishUploadTx {
400     struct NanohubHalLegacyHdr hdr;
401     uint8_t success;
402 } ATTRIBUTE_PACKED;
403 SET_PACKED_STRUCT_MODE_OFF
404 
405 #define NANOHUB_HAL_LEGACY_REBOOT           9
406 
407 SET_PACKED_STRUCT_MODE_ON
408 struct NanohubHalLegacyRebootTx {
409     struct NanohubHalLegacyHdr hdr;
410     __le32 reason;
411 } ATTRIBUTE_PACKED;
412 SET_PACKED_STRUCT_MODE_OFF
413 
414 #endif /* LEGACY_HAL_ENABLED */
415 
416 SET_PACKED_STRUCT_MODE_ON
417 struct NanohubHalHdr {
418     __le64 appId;
419     uint8_t len;
420     __le32 transactionId;
421     __le16 unused;
422 } ATTRIBUTE_PACKED;
423 SET_PACKED_STRUCT_MODE_OFF
424 
425 SET_PACKED_STRUCT_MODE_ON
426 struct NanohubHalRet {
427     uint8_t msg;
428     __le32 status;
429 } ATTRIBUTE_PACKED;
430 
431 #define NANOHUB_HAL_APP_MGMT            0x10
432 
433 SET_PACKED_STRUCT_MODE_ON
434 struct NanohubHalAppMgmtRx {
435     __le64 appId;
436     uint8_t cmd;
437 } ATTRIBUTE_PACKED;
438 SET_PACKED_STRUCT_MODE_OFF
439 
440 #define NANOHUB_HAL_APP_MGMT_START      0
441 #define NANOHUB_HAL_APP_MGMT_STOP       1
442 #define NANOHUB_HAL_APP_MGMT_UNLOAD     2
443 #define NANOHUB_HAL_APP_MGMT_DELETE     3
444 
445 SET_PACKED_STRUCT_MODE_ON
446 struct NanohubHalAppMgmtTx {
447     struct NanohubHalHdr hdr;
448     struct NanohubHalRet ret;
449     uint8_t cmd;
450     struct MgmtStatus stat;
451 } ATTRIBUTE_PACKED;
452 SET_PACKED_STRUCT_MODE_OFF
453 
454 #define NANOHUB_HAL_SYS_MGMT            0x11
455 
456 SET_PACKED_STRUCT_MODE_ON
457 struct NanohubHalSysMgmtRx {
458     uint8_t cmd;
459 } ATTRIBUTE_PACKED;
460 SET_PACKED_STRUCT_MODE_OFF
461 
462 #define NANOHUB_HAL_SYS_MGMT_ERASE      0
463 #define NANOHUB_HAL_SYS_MGMT_REBOOT     1
464 
465 SET_PACKED_STRUCT_MODE_ON
466 struct NanohubHalSysMgmtTx {
467     struct NanohubHalHdr hdr;
468     struct NanohubHalRet ret;
469     uint8_t cmd;
470 } ATTRIBUTE_PACKED;
471 SET_PACKED_STRUCT_MODE_OFF
472 
473 #define NANOHUB_HAL_APP_INFO            0x12
474 
475 SET_PACKED_STRUCT_MODE_ON
476 struct NanohubHalAppInfoRx {
477     __le32 addr;
478     uint8_t tags[HOST_HUB_CHRE_PACKET_MAX_LEN - sizeof(__le32)];
479 } ATTRIBUTE_PACKED;
480 SET_PACKED_STRUCT_MODE_OFF
481 
482 #define NANOHUB_HAL_APP_INFO_APPID          0x00
483 #define NANOHUB_HAL_APP_INFO_CRC            0x01
484 #define NANOHUB_HAL_APP_INFO_TID            0x02
485 #define NANOHUB_HAL_APP_INFO_VERSION        0x03
486 #define NANOHUB_HAL_APP_INFO_ADDR           0x04
487 #define NANOHUB_HAL_APP_INFO_SIZE           0x05
488 #define NANOHUB_HAL_APP_INFO_HEAP           0x06
489 #define NANOHUB_HAL_APP_INFO_DATA           0x07
490 #define NANOHUB_HAL_APP_INFO_BSS            0x08
491 #define NANOHUB_HAL_APP_INFO_CHRE_MAJOR     0x09
492 #define NANOHUB_HAL_APP_INFO_CHRE_MINOR     0x0A
493 #define NANOHUB_HAL_APP_INFO_END            0xFF
494 
495 SET_PACKED_STRUCT_MODE_ON
496 struct NanohubHalAppInfoTx {
497     struct NanohubHalHdr hdr;
498     struct NanohubHalRet ret;
499     uint8_t data[HOST_HUB_CHRE_PACKET_MAX_LEN - sizeof(struct NanohubHalRet)];
500 } ATTRIBUTE_PACKED;
501 SET_PACKED_STRUCT_MODE_OFF
502 
503 #define NANOHUB_HAL_SYS_INFO            0x13
504 
505 SET_PACKED_STRUCT_MODE_ON
506 struct NanohubHalSysInfoRx {
507     uint8_t tags[HOST_HUB_CHRE_PACKET_MAX_LEN];
508 } ATTRIBUTE_PACKED;
509 SET_PACKED_STRUCT_MODE_OFF
510 
511 #define NANOHUB_HAL_SYS_INFO_HEAP_FREE      0x0F
512 #define NANOHUB_HAL_SYS_INFO_RAM_SIZE       0x12
513 #define NANOHUB_HAL_SYS_INFO_EEDATA_SIZE    0x13
514 #define NANOHUB_HAL_SYS_INFO_EEDATA_FREE    0x14
515 #define NANOHUB_HAL_SYS_INFO_CODE_SIZE      0x15
516 #define NANOHUB_HAL_SYS_INFO_CODE_FREE      0x16
517 #define NANOHUB_HAL_SYS_INFO_SHARED_SIZE    0x17
518 #define NANOHUB_HAL_SYS_INFO_SHARED_FREE    0x18
519 #define NANOHUB_HAL_SYS_INFO_END            0xFF
520 
521 SET_PACKED_STRUCT_MODE_ON
522 struct NanohubHalSysInfoTx {
523     struct NanohubHalHdr hdr;
524     struct NanohubHalRet ret;
525     uint8_t data[HOST_HUB_CHRE_PACKET_MAX_LEN - sizeof(struct NanohubHalRet)];
526 } ATTRIBUTE_PACKED;
527 SET_PACKED_STRUCT_MODE_OFF
528 
529 #define NANOHUB_HAL_KEY_INFO            0x14
530 
531 SET_PACKED_STRUCT_MODE_ON
532 struct NanohubHalKeyInfoRx {
533     uint32_t keyNum;
534     uint32_t dataOffset;
535 } ATTRIBUTE_PACKED;
536 SET_PACKED_STRUCT_MODE_OFF
537 
538 SET_PACKED_STRUCT_MODE_ON
539 struct NanohubHalKeyInfoTx {
540     struct NanohubHalHdr hdr;
541     struct NanohubHalRet ret;
542     uint32_t keyLength;
543     uint8_t data[NANOHUB_RSA_KEY_CHUNK_LEN];
544 } ATTRIBUTE_PACKED;
545 SET_PACKED_STRUCT_MODE_OFF
546 
547 #define NANOHUB_HAL_START_UPLOAD        0x16
548 
549 SET_PACKED_STRUCT_MODE_ON
550 struct NanohubHalStartUploadRx {
551     uint8_t isOs;
552     __le32 length;
553 } ATTRIBUTE_PACKED;
554 SET_PACKED_STRUCT_MODE_OFF
555 
556 SET_PACKED_STRUCT_MODE_ON
557 struct NanohubHalStartUploadTx {
558     struct NanohubHalHdr hdr;
559     struct NanohubHalRet ret;
560 } ATTRIBUTE_PACKED;
561 SET_PACKED_STRUCT_MODE_OFF
562 
563 #define NANOHUB_HAL_CONT_UPLOAD         0x17
564 
565 SET_PACKED_STRUCT_MODE_ON
566 struct NanohubHalContUploadRx {
567     __le32 offset;
568     uint8_t data[HOST_HUB_CHRE_PACKET_MAX_LEN-sizeof(__le32)];
569 } ATTRIBUTE_PACKED;
570 SET_PACKED_STRUCT_MODE_ON
571 
572 SET_PACKED_STRUCT_MODE_ON
573 struct NanohubHalContUploadTx {
574     struct NanohubHalHdr hdr;
575     struct NanohubHalRet ret;
576 } ATTRIBUTE_PACKED;
577 SET_PACKED_STRUCT_MODE_OFF
578 
579 #define NANOHUB_HAL_FINISH_UPLOAD       0x18
580 
581 SET_PACKED_STRUCT_MODE_ON
582 struct NanohubHalFinishUploadTx {
583     struct NanohubHalHdr hdr;
584     struct NanohubHalRet ret;
585     __le32 addr;
586     __le32 crc;
587 } ATTRIBUTE_PACKED;
588 SET_PACKED_STRUCT_MODE_OFF
589 
590 #endif /* __NANOHUBPACKET_H */
591