INT32 wmt_ctrl_host_baudrate_set(P_WMT_CTRL_DATA pWmtCtrlData) { INT32 iRet = -1; char cmdStr[NAME_MAX + 1] = {0}; UINT32 u4Baudrate = pWmtCtrlData->au4CtrlData[0]; UINT32 u4FlowCtrl = pWmtCtrlData->au4CtrlData[1]; WMT_DBG_FUNC("baud(%d), flowctrl(%d) \n", u4Baudrate, u4FlowCtrl); if (osal_test_bit(WMT_STAT_STP_OPEN, &gDevWmt.state)) { osal_snprintf(cmdStr, NAME_MAX, "baud_%d_%d", u4Baudrate, u4FlowCtrl); iRet = wmt_ctrl_ul_cmd(&gDevWmt, cmdStr); if (iRet) { WMT_WARN_FUNC("CTRL_BAUDRATE baud(%d), flowctrl(%d) fail(%d) \n", u4Baudrate, pWmtCtrlData->au4CtrlData[1], iRet); } else { WMT_DBG_FUNC("CTRL_BAUDRATE baud(%d), flowctrl(%d) ok\n", u4Baudrate, u4FlowCtrl); } } else { WMT_INFO_FUNC("CTRL_BAUDRATE but invalid Handle of WmtStp \n"); } return iRet; }
INT32 wmt_ctrl_stp_open(P_WMT_CTRL_DATA pWmtCtrlData) { P_DEV_WMT pDev = &gDevWmt; /* single instance */ INT32 iRet; UCHAR cmdStr[NAME_MAX + 1] = {0}; if (WMT_HIF_UART == pDev->rWmtHifConf.hifType) { osal_snprintf(cmdStr, NAME_MAX, "open_stp"); iRet = wmt_ctrl_ul_cmd(pDev, cmdStr); if (iRet) { WMT_WARN_FUNC("wmt_ctrl_ul_cmd fail(%d)\n", iRet); return -1; } } /* register to STP-core for rx */ iRet = mtk_wcn_stp_register_event_cb(WMT_TASK_INDX, wmt_dev_rx_event_cb); /* mtk_wcn_stp_register_event_cb */ if (iRet) { WMT_WARN_FUNC("stp_reg cb fail(%d)\n", iRet); return -2; } osal_set_bit(WMT_STAT_STP_OPEN, &pDev->state); return 0; }
INT32 wmt_ctrl_stp_close(P_WMT_CTRL_DATA pWmtCtrlData) { P_DEV_WMT pDev = &gDevWmt; /* single instance */ INT32 iRet = 0; UINT8 cmdStr[NAME_MAX + 1] = { 0 }; /* un-register to STP-core for rx */ iRet = mtk_wcn_stp_register_event_cb(WMT_TASK_INDX, NULL); /* mtk_wcn_stp_register_event_cb */ if (iRet) { WMT_WARN_FUNC("stp_reg cb unregister fail(%d)\n", iRet); return -1; } if (WMT_HIF_UART == pDev->rWmtHifConf.hifType) { osal_snprintf(cmdStr, NAME_MAX, "close_stp"); iRet = wmt_ctrl_ul_cmd(pDev, cmdStr); if (iRet) { WMT_WARN_FUNC("wmt_ctrl_ul_cmd fail(%d)\n", iRet); return -2; } } osal_clear_bit(WMT_STAT_STP_OPEN, &pDev->state); return 0; }
INT32 wmt_ctrl_patch_search(P_WMT_CTRL_DATA pWmtCtrlData) { P_DEV_WMT pDev = &gDevWmt; /* single instance */ INT32 iRet; UCHAR cmdStr[NAME_MAX + 1] = {0}; osal_snprintf(cmdStr, NAME_MAX, "srh_patch"); iRet = wmt_ctrl_ul_cmd(pDev, cmdStr); if (iRet) { WMT_WARN_FUNC("wmt_ctrl_ul_cmd fail(%d)\n", iRet); return -1; } return 0; }
static PINT8 wmt_conf_write_int(P_DEV_WMT pWmtDev, const struct parse_data *data) { PINT32 src; INT32 res; PINT8 value; src = (PUINT32) (((PUINT8) pWmtDev) + (long)data->param1); value = osal_malloc(20); if (value == NULL) return NULL; res = osal_snprintf(value, 20, "0x%x", *src); if (res < 0 || res >= 20) { osal_free(value); return NULL; } value[20 - 1] = '\0'; return value; }
static PINT8 wmt_conf_write_short(P_DEV_WMT pWmtDev, const struct parse_data *data) { PINT16 src; INT32 res; PINT8 value; /* TODO: [FixMe][George] FIX COMPILE WARNING HERE! */ src = (PINT16) (((PUINT8) pWmtDev) + (long)data->param1); value = osal_malloc(20); if (value == NULL) return NULL; res = osal_snprintf(value, 20, "0x%x", *src); if (res < 0 || res >= 20) { osal_free(value); return NULL; } value[20 - 1] = '\0'; return value; }