int (*get_boot_mode)(char *buffer, int len);
int (*get_boot_reason)(char *buffer, int len);
+ int (*get_current_partition)(char *partition_ab);
int (*switch_partition)(char partition_ab);
int (*set_partition_ab_cloned)(void);
int (*clear_partition_ab_cloned)(void);
/**
- * @brief Switch partition to partition_ab ('a' or 'b')
+ * @brief Get partition_ab ('a' or 'b')
*
- * @param[in] partition_ab Partition name to switch to ('a' or 'b')
+ * @param[in] partition_ab Current partition name ('a' or 'b')
+ *
+ * @return 0 on success, otherwise a negative error value
+ */
+int hal_device_board_get_current_partition(char *partition_ab);
+
+/**
+ * @brief Switch partition to partition_ab ('a' or 'b') or toggle partition if partition_ab is '\0'
+ *
+ * @param[in] partition_ab Partition name to switch to ('a' or 'b') or '\0'(toggle)
*
* @return 0 on success, otherwise a negative error value
*/
return hal_board_funcs->get_boot_reason(buffer, len);
}
+int hal_device_board_get_current_partition(char *partition_ab)
+{
+ int ret;
+
+ if (!hal_board_funcs && !hal_initialized) {
+ if ((ret = hal_device_board_get_backend()) < 0)
+ return ret;
+ }
+
+ if (!hal_board_funcs ||
+ !hal_board_funcs->get_current_partition)
+ return -ENODEV;
+
+ return hal_board_funcs->get_current_partition(partition_ab);
+}
+
int hal_device_board_switch_partition(char partition_ab)
{
int ret;