📄 uem_utility.c
字号:
/*****************************************************************************
* FUNCTION
* uem_set_datetime_format
* DESCRIPTION
*
* PARAMETERS
* is_date_set [IN]
* format [IN]
* RETURNS
* void
*****************************************************************************/
void uem_set_datetime_format(kal_bool is_date_set, kal_uint8 format)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* ref: date_format_enum */
if (is_date_set == KAL_TRUE)
{
g_uem_cntx_p->rmi_data.date_mode = format;
}
/* ref: time_format_enum */
else
{
g_uem_cntx_p->rmi_data.time_mode = format;
}
}
/*****************************************************************************
* Function
* uem_get_datetime_format
* DESCRIPTION
* L4C requests UEM to store date format. Please reference the AT command "+CSDF"
* PARAMETERS
* is_date_set IN
* RETURNS
* void
* GLOBALS AFFECTED
*****************************************************************************/
/*****************************************************************************
* FUNCTION
* uem_get_datetime_format
* DESCRIPTION
*
* PARAMETERS
* is_date_set [IN]
* RETURNS
*
*****************************************************************************/
kal_uint8 uem_get_datetime_format(kal_bool is_date_set)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* ref: date_format_enum */
if (is_date_set == KAL_TRUE)
{
return g_uem_cntx_p->rmi_data.date_mode;
}
/* ref: time_format_enum */
else
{
return g_uem_cntx_p->rmi_data.time_mode;
}
}
/*****************************************************************************
* Function
* uem_set_state
* DESCRIPTION
* NVRAM state
* PARAMETERS
* state IN
* RETURNS
* void
* GLOBALS AFFECTED
*****************************************************************************/
/*****************************************************************************
* FUNCTION
* uem_set_state
* DESCRIPTION
*
* PARAMETERS
* state [IN]
* RETURNS
* void
*****************************************************************************/
void uem_set_state(uem_status_enum state)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_uem_cntx_p->state = state;
}
/*****************************************************************************
* Function
* uem_get_state
* DESCRIPTION
* NVRAM state
* PARAMETERS
*
* RETURNS
* NVRAM state
* GLOBALS AFFECTED
*****************************************************************************/
/*****************************************************************************
* FUNCTION
* uem_get_state
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
*
*****************************************************************************/
kal_uint8 uem_get_state(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
return g_uem_cntx_p->state;
}
/*****************************************************************************
* Function
* uem_alarm_set_time
* DESCRIPTION
* set alarm time
* PARAMETERS
* void
* RETURNS
* void
* GLOBALS AFFECTED
*****************************************************************************/
/*****************************************************************************
* FUNCTION
* uem_alarm_set_time
* DESCRIPTION
*
* PARAMETERS
* rtc_alarm_id [IN]
* alarm_info [IN]
* RETURNS
* void
*****************************************************************************/
void uem_alarm_set_time(kal_uint8 rtc_alarm_id, rtc_alarm_info_struct alarm_info)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (rtc_alarm_id < MAX_ALARM_NUM)
{
kal_mem_cpy(&(g_uem_cntx_p->rmi_data.alarm_info[rtc_alarm_id]), &alarm_info, sizeof(rtc_alarm_info_struct));
}
}
/*****************************************************************************
* Function
* uem_rtc_delete
* DESCRIPTION
*
* PARAMETERS
* rtc_type IN
* rtc_alarm_id IN
* RETURNS
* void
* GLOBALS AFFECTED
*****************************************************************************/
/*****************************************************************************
* FUNCTION
* uem_rtc_delete
* DESCRIPTION
*
* PARAMETERS
* rtc_type [IN]
* rtc_alarm_id [IN]
* RETURNS
* void
*****************************************************************************/
void uem_rtc_delete(kal_uint8 rtc_type, kal_uint8 rtc_alarm_id)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
switch (rtc_type)
{
case RTC_TIME_CLOCK_IND:
break;
case RTC_ALARM_IND:
if (rtc_alarm_id < MAX_ALARM_NUM)
{
g_uem_cntx_p->rmi_data.alarm_info[rtc_alarm_id].alarm_format = DEVICE_TC_EN_None;
}
break;
default:
break;
}
}
/*****************************************************************************
* Function
* uem_get_vbat_percentage
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* kal_uint32
* GLOBALS AFFECTED
*****************************************************************************/
/*****************************************************************************
* FUNCTION
* uem_get_vbat_percentage
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
*
*****************************************************************************/
kal_uint32 uem_get_vbat_percentage(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
uem_bmt_struct bmt_status;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
uem_get_bat_status(&bmt_status);
return custom_cfg_vbat_percentage_convert(bmt_status.volt);
}
#ifdef __USB_ENABLE__
/*****************************************************************************
* Function
* uem2l4_usb_detect_action_convert
* DESCRIPTION
*
* PARAMETERS
* action IN
* RETURNS
* kal_uint8
* GLOBALS AFFECTED
*****************************************************************************/
/*****************************************************************************
* FUNCTION
* uem2l4_usb_detect_action_convert
* DESCRIPTION
*
* PARAMETERS
* action [IN]
* RETURNS
*
*****************************************************************************/
kal_uint8 uem2l4_usb_detect_action_convert(kal_uint8 action)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
USB_DETECT_ACTION_ID usb_action = (USB_DETECT_ACTION_ID) action;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
switch (usb_action)
{
case DETECT_ACTION_PLUGIN:
return DEVUSB_DETECT_ACTION_PLUGIN;
case DETECT_ACTION_PLUGOUT:
return DEVUSB_DETECT_ACTION_PLUGOUT;
default:
return DETECT_ACTION_UNKNOWN;
}
}
/*****************************************************************************
* Function
* uem2l4_usb_config_action_convert
* DESCRIPTION
*
* PARAMETERS
* action IN
* RETURNS
* kal_uint8
* GLOBALS AFFECTED
*****************************************************************************/
/*****************************************************************************
* FUNCTION
* uem2l4_usb_config_action_convert
* DESCRIPTION
*
* PARAMETERS
* action [IN]
* RETURNS
*
*****************************************************************************/
kal_uint8 uem2l4_usb_config_action_convert(kal_uint8 action)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
USB_DEVICE_TYPE usb_action = (USB_DEVICE_TYPE) action;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
switch (usb_action)
{
case USB_CDC_ACM:
return DEVUSB_CFG_ACTION_CDC_ACM;
case USB_MASS_STORAGE:
return DEVUSB_CFG_ACTION_MASS_STORAGE;
case USB_COMPOSITE:
return DEVUSB_CFG_ACTION_COMPOSITE;
case USB_VIDEO:
return DEVUSB_CFG_ACTION_WEBCAM;
case USB_STOP_MS:
return DEVUSB_CFG_ACTION_STOP_MS;
case USB_CDC_ACM_IRDBG:
return DEVUSB_CFG_ACTION_IRDBG;
default:
return DEVUSB_CFG_ACTION_UNKNOWN;
}
}
/*****************************************************************************
* Function
* uem2drv_usb_config_action_convert
* DESCRIPTION
*
* PARAMETERS
* action IN
* RETURNS
* kal_uint8
* GLOBALS AFFECTED
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -