blob: 4ecaff66c31f3ec13c804cd4eac64619fee10cb1 [file] [log] [blame]
/**
* @file : gsw_hwpin_interface.h
* @brief : Gpio and mcu ctrl
* @date : 2022-07-05
* @author : Wind
* @version : v1.0
* @copyright Copyright(C) 2022,Geely
*/
#ifndef __GSW_HW_PIN_INTERFACE__H__
#define __GSW_HW_PIN_INTERFACE__H__
#include "gsw_hal_errcode.h"
#include <stdbool.h>
#define GSW_HAL_USB_SUCCESS (0x0001)
/**
* @brief hardware reset mcu only
* @param
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_mcu_reset(void);
/**
* @brief hold mcu boot pin then reset to bootmode
* @param
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_mcu_enter_bootmode(void);
/**
* @brief release mcu boot pin then reset to normalMode
* @param
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_mcu_exit_bootmode(void);
/**
* @brief hardware reset soc and mcu
* @param
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_tcam_reset(void);
/**
* @brief keep soc power
* @param
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_soc_power_keep(void);
/**
* @brief release soc power
* @param
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_soc_power_release(void);
/**
* @brief wakeup mcu through gpio
* @param
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_soc_wakeup_mcu(void);
/**
* @brief soc wakeup mcu gpio output low
* @param
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_soc_wakeup_mcu_gpio_set_low(void);
/**
* @brief get usb is connected or not
* @param
* @retval 1: connected
* @retval 0: disconnected
* @retval other: failed
*/
int gsw_hwpin_is_usb_connected(void);
/**
* @brief set red led ON
* @param
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_led_red_on(void);
/**
* @brief set red led OFF
* @param
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_led_red_off(void);
/**
* @brief set red led blink
* @param [in] delay_on: on time ms
* @param [in] delay_off: off time ms
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_led_red_blink(int delay_on, int delay_off);
/**
* @brief set green led ON
* @param
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_led_green_on(void);
/**
* @brief set green led OFF
* @param
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_led_green_off(void);
/**
* @brief set green led blink
* @param [in] delay_on: on time ms
* @param [in] delay_off: off time ms
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_led_green_blink(int delay_on, int delay_off);
/**
* @brief Get health status of EMMC.
* @param [out] written_mbytes: Mega-Bytes have been written.
* @param [out] health: value of EMMC health.
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_get_emmc_health(int* written_mbytes, int* health);
/**
* @brief Get readonly status of EMMC.
* @param
* @retval true: readonly happened; false: normal
* @retval other: fail
*/
bool gsw_hwpin_check_emmc_readonly(void);
/**
* @brief factory test control led
* @param [in] aging_flag: ture/false
* @param [in] delay_on: on time ms
* @param [in] delay_off: off time ms
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_factorytest_ctrl_led(bool aging_flag, int delay_on, int delay_off);
/**
* @brief MUTE test.
* @param [in] value: TRUE or FALSE.
* @retval 0: success
* @retval other: fail
*/
int gsw_hwpin_mute_test(int value);
/**
* @brief fstrim emmc.
* @param [in] emmc_path: example "/media"
* @retval 0: no need fstrim, 1: need fstrim(Currently only AN758 is required)
* @retval other: fail
*/
int gsw_hwpin_fstrim_emmc(const char *emmc_path);
#endif