• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
18 #ifndef _UPDATEUTIL_H_
19 #define _UPDATEUTIL_H_
20 
21 enum 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,
48 	UPDATE_FAIL_TIMEOUT_WAITING_FOR_ATTN,
49 	UPDATE_FAIL_ERASE_ALL,
50 	UPDATE_FAIL_FIRMWARE_IMAGE_IS_OLDER,
51 	UPDATE_FAIL_INVALID_PARAMETER,
52 	UPDATE_FAIL_OPEN_FIRMWARE_IMAGE,
53 };
54 
55 const char * update_err_to_string(int err);
56 
57 unsigned long extract_long(const unsigned char *data);
58 unsigned short extract_short(const unsigned char *data);
59 const char * StripPath(const char * path, ssize_t size);
60 
61 #endif // _UPDATEUTIL_H_