blob: 690778155d7cb49604b966e620244aa296ee1697 [file] [log] [blame]
Andrew Duggan052556f2014-04-16 11:32:30 -07001/*
2 * Copyright (C) 2014 Andrew Duggan
3 * Copyright (C) 2014 Synaptics Inc
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
Andrew Duggan4e811252014-04-03 15:17:57 -070018#ifndef _UPDATEUTIL_H_
19#define _UPDATEUTIL_H_
20
21enum update_error {
22 UPDATE_SUCCESS = 0,
23 UPDATE_FAIL,
24 UPDATE_FAIL_TIMEOUT,
25 UPDATE_FAIL_VERIFY_IMAGE,
26 UPDATE_FAIL_VERIFY_CHECKSUM,
27 UPDATE_FAIL_VERIFY_FIRMWARE_SIZE,
28 UPDATE_FAIL_VERIFY_CONFIG_SIZE,
29 UPDATE_FAIL_UNSUPPORTED_IMAGE_VERSION,
30 UPDATE_FAIL_NO_FUNCTION_01,
31 UPDATE_FAIL_NO_FUNCTION_34,
32 UPDATE_FAIL_QUERY_BASIC_PROPERTIES,
33 UPDATE_FAIL_READ_F34_QUERIES,
34 UPDATE_FAIL_READ_BOOTLOADER_ID,
35 UPDATE_FAIL_READ_F34_CONTROLS,
36 UPDATE_FAIL_WRITE_BOOTLOADER_ID,
37 UPDATE_FAIL_ENABLE_FLASH_PROGRAMMING,
38 UPDATE_FAIL_NOT_IN_IDLE_STATE,
39 UPDATE_FAIL_PROGRAMMING_NOT_ENABLED,
40 UPDATE_FAIL_SCAN_PDT,
41 UPDATE_FAIL_READ_DEVICE_STATUS,
42 UPDATE_FAIL_DEVICE_NOT_IN_BOOTLOADER,
43 UPDATE_FAIL_READ_F01_CONTROL_0,
44 UPDATE_FAIL_WRITE_F01_CONTROL_0,
45 UPDATE_FAIL_WRITE_INITIAL_ZEROS,
46 UPDATE_FAIL_WRITE_BLOCK,
47 UPDATE_FAIL_WRITE_FLASH_COMMAND,
Andrew Duggan62137912014-05-06 16:06:19 -070048 UPDATE_FAIL_TIMEOUT_WAITING_FOR_ATTN,
Andrew Duggan4e811252014-04-03 15:17:57 -070049 UPDATE_FAIL_ERASE_ALL,
50 UPDATE_FAIL_FIRMWARE_IMAGE_IS_OLDER,
51 UPDATE_FAIL_INVALID_PARAMETER,
52 UPDATE_FAIL_OPEN_FIRMWARE_IMAGE,
53};
54
55const char * update_err_to_string(int err);
56
57unsigned long extract_long(const unsigned char *data);
58unsigned short extract_short(const unsigned char *data);
Andrew Duggan049b7872014-08-05 13:11:19 -070059const char * StripPath(const char * path, ssize_t size);
Andrew Duggan4e811252014-04-03 15:17:57 -070060
61#endif // _UPDATEUTIL_H_