-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathOTATestUtil.h
49 lines (37 loc) · 1.47 KB
/
OTATestUtil.h
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
/*
* Copyright (c) 2020 Arduino. All rights reserved.
*/
#ifndef OTA_TEST_DATA_GENERATOR_H_
#define OTA_TEST_DATA_GENERATOR_H_
/**************************************************************************************
INCLUDE
**************************************************************************************/
#include <stdint.h>
/**************************************************************************************
NAMESPACE
**************************************************************************************/
namespace ota
{
/**************************************************************************************
TYPEDEF
**************************************************************************************/
union OTAData
{
struct __attribute__((packed))
{
uint32_t len;
uint32_t crc32;
uint8_t bin[256*1024]; /* Maximum flash size of ATSAMD21G18 is 256 KB */
} data;
uint8_t buf[sizeof(data)];
};
/**************************************************************************************
FUNCTION DECLARATION
**************************************************************************************/
void generate_valid_ota_data(OTAData & ota_data);
void generate_invalid_ota_data_crc_wrong(OTAData & ota_data);
/**************************************************************************************
NAMESPACE
**************************************************************************************/
} /* ota */
#endif /* OTA_TEST_DATA_GENERATOR_H_ */