4 * Redistribution and use in source and binary forms, with or without modification,
5 * are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice, this
11 * list of conditions and the following disclaimer in the documentation and/or
12 * other materials provided with the distribution.
14 * Neither the name of the NXP Semiconductor nor the names of its
15 * contributors may be used to endorse or promote products derived from this
16 * software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
38 #define EXT extern "C"
44 * Get Last error string
45 * @return last error string
47 EXT
const char * uuu_get_last_err_string();
51 * @return last error code
53 EXT
int uuu_get_last_err();
55 EXT
const char * uuu_get_version_string();
59 * bit[31:24].bit[23:12].bit[11:0]
62 EXT
int uuu_get_version();
71 NOTIFY_CMD_START
, /* str is command name*/
72 NOTIFY_CMD_END
, /* status show command finish status. 0 is success. Other failure.*/
73 NOTIFY_CMD_INDEX
, /*Current running command index*/
75 NOTIFY_CMD_INFO
, /* Status info string */
78 NOTIFY_PHASE_INDEX
, /*Current running phase*/
80 NOTIFY_TRANS_SIZE
, /*Total size*/
81 NOTIFY_TRANS_POS
, /*Current finished transfer pos*/
86 NOTIFY_DECOMPRESS_START
,
87 NOTIFY_DECOMPRESS_SIZE
,
88 NOTIFY_DECOMPRESS_POS
,
90 NOTIFY_DOWNLOAD_START
,
109 typedef int (*uuu_notify_fun
)(struct uuu_notify
, void *data
);
111 int uuu_register_notify_callback(uuu_notify_fun f
, void *data
);
112 int uuu_unregister_notify_callback(uuu_notify_fun f
);
114 typedef int(*uuu_show_cfg
)(const char *pro
, const char *chip
, const char *comp
, uint16_t vid
, uint16_t pid
, uint16_t bcdlow
, uint16_t bcdhigh
, void *p
);
115 int uuu_for_each_cfg(uuu_show_cfg fn
, void *p
);
117 typedef int(*uuu_ls_file
)(const char *path
, void *p
);
118 int uuu_for_each_ls_file(uuu_ls_file fn
, const char *path
, void *p
);
120 typedef int(*uuu_ls_usb_devices
)(const char *path
, const char *chip
, const char *pro
, uint16_t vid
, uint16_t pid
, uint16_t bcd
, const char *serial_no
, void *p
);
121 int uuu_for_each_devices(uuu_ls_usb_devices fn
, void *p
);
123 int uuu_run_cmd(const char * cmd
, int dry
);
124 int uuu_run_cmd_script(const char *script
, int dry
);
126 int uuu_auto_detect_file(const char * filename
);
127 int uuu_wait_uuu_finish(int deamon
, int dry
);
128 int uuu_add_usbpath_filter(const char *path
);
129 int uuu_add_usbserial_no_filter(const char *serial_no
);
131 /*Set timeout wait for known devices appeared*/
132 int uuu_set_wait_timeout(int timeout_in_seconds
);
133 /*Set timeout wait for next devices appeared, e.g. FB -> FBK*/
134 int uuu_set_wait_next_timeout(int timeout_in_seconds
);
135 /*Set usb device polling period */
136 void uuu_set_poll_period(int period_in_milliseconds
);
138 * bit 0:15 for libusb
141 void uuu_set_debug_level(uint32_t mask
);
144 * 0 disable small memory mode, buffer all data, it is used for multi-board program.
146 void uuu_set_small_mem(uint32_t val
);
148 #define MAX_USER_LEN 128
149 typedef int (*uuu_askpasswd
)(char* prompt
, char user
[MAX_USER_LEN
], char passwd
[MAX_USER_LEN
]);
150 int uuu_set_askpasswd(uuu_askpasswd ask
);
152 enum class bmap_mode
{
158 /*Get .bmap handling mode*/
159 static inline bmap_mode
uuu_get_bmap_mode() {
160 extern bmap_mode g_bmap_mode
;
164 static inline int uuu_force_bmap() {
165 return uuu_get_bmap_mode() == bmap_mode::Force
;
168 static inline int uuu_ignore_bmap() {
169 return uuu_get_bmap_mode() == bmap_mode::Ignore
;