From 68698c8536a1f86bdd642f58e6adbff98a751def Mon Sep 17 00:00:00 2001 From: YOUR_NAME Date: Thu, 20 May 2021 13:35:58 +0000 Subject: [PATCH] =?UTF-8?q?IssueNo=EF=BC=9A#I3S732=20Description:sync=20L2?= =?UTF-8?q?=20input=20and=20display=20to=20L1=20Feature=20or=20Bugfix:Bugf?= =?UTF-8?q?ix=20Binary=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/display/driver/hdf_disp.c | 275 ++++++++++++------ model/display/driver/hdf_disp.h | 11 +- model/display/driver/hi35xx_disp.c | 13 +- model/display/driver/lcd_abs_if.c | 18 +- model/display/driver/lcd_abs_if.h | 17 +- .../driver/lcdkit/lcdkit_parse_config.c | 11 +- model/display/driver/lcdkit/lite_lcdkit.c | 8 +- model/display/driver/panel/mipi_icn9700.c | 24 +- model/display/driver/panel/ssp_st7789.c | 8 +- model/display/driver/panel/ssp_st7789.h | 1 - model/input/driver/event_hub.c | 6 + .../driver/{hdf_hid.c => hdf_hid_adapter.c} | 116 ++++++++ model/input/driver/hdf_hid_adapter.h | 27 ++ model/input/driver/hdf_input_device_manager.c | 141 ++++++--- model/input/driver/hdf_input_device_manager.h | 35 ++- model/input/driver/hdf_key.c | 15 +- model/input/driver/hdf_touch.c | 66 +++-- model/input/driver/hdf_touch.h | 1 + model/input/driver/input_config_parser.c | 8 +- model/input/driver/touchscreen/touch_ft6336.c | 4 +- model/input/driver/touchscreen/touch_gt911.c | 22 +- model/input/driver/touchscreen/touch_gt911.h | 31 +- 22 files changed, 655 insertions(+), 203 deletions(-) rename model/input/driver/{hdf_hid.c => hdf_hid_adapter.c} (30%) mode change 100755 => 100644 create mode 100644 model/input/driver/hdf_hid_adapter.h diff --git a/model/display/driver/hdf_disp.c b/model/display/driver/hdf_disp.c index 910d5ffe3..49470eb97 100644 --- a/model/display/driver/hdf_disp.c +++ b/model/display/driver/hdf_disp.c @@ -13,103 +13,181 @@ #define OFFSET_TWO_BYTE 16 -struct DispOperations *g_dispOps = NULL; +static struct PlatformOps *g_platformOps = NULL; -int32_t DispRegister(struct DispOperations *ops) +int32_t PlatformRegister(struct PlatformOps *ops) { - if (g_dispOps == NULL) { - g_dispOps = ops; + if (g_platformOps == NULL) { + g_platformOps = ops; HDF_LOGI("%s: disp ops register success", __func__); return HDF_SUCCESS; } - HDF_LOGD("%s: disp ops registered", __func__); + HDF_LOGD("%s: success", __func__); return HDF_FAILURE; } +static struct PlatformOps *GetPlatformOps(void) +{ + return g_platformOps; +} + +static int32_t InitDisp(uint32_t devId); +static int32_t DispOn(uint32_t devId); +static int32_t DispOff(uint32_t devId); +static int32_t SetDispBacklight(uint32_t devId, uint32_t level); +static int32_t GetDispInfo(uint32_t devId, struct DispInfo *info); + struct DispOperations *GetDispOps(void) { - return g_dispOps; + static struct DispOperations dispOps = { + .init = InitDisp, + .on = DispOn, + .off = DispOff, + .setBacklight = SetDispBacklight, + .getDispInfo = GetDispInfo, + }; + return &dispOps; +} + +#ifdef __KERNEL__ +EXPORT_SYMBOL(GetDispOps); +#endif + +static int32_t InitDisp(uint32_t devId) +{ + return 0; } static int32_t DispOn(uint32_t devId) { - int32_t ret; - struct DispOperations *ops = NULL; + int32_t ret = HDF_FAILURE; + struct PlatformOps *ops = NULL; + + ops = GetPlatformOps(); + if (ops && ops->on) { + ret = ops->on(devId); + } + return ret; +} + +static int32_t DispOff(uint32_t devId) +{ + int32_t ret = HDF_FAILURE; + struct PlatformOps *ops = NULL; + + ops = GetPlatformOps(); + if (ops && ops->off) { + ret = ops->off(devId); + } + return ret; +} + +static int32_t SetDispBacklight(uint32_t devId, uint32_t level) +{ + int32_t ret = HDF_FAILURE; + struct PanelStatus *panelStatus = NULL; - ops = GetDispOps(); + struct PanelInfo *info = GetPanelInfo(devId); + if (info == NULL) { + HDF_LOGE("%s:GetPanelInfo failed", __func__); + return HDF_FAILURE; + } + if (level > info->blk.maxLevel) { + level = info->blk.maxLevel; + } else if (level < info->blk.minLevel && level != 0) { + level = info->blk.minLevel; + } + struct PlatformOps *ops = GetPlatformOps(); if (ops == NULL) { HDF_LOGE("%s: ops is null", __func__); return HDF_FAILURE; } - if (ops->on != NULL) { - ret = ops->on(devId); + if (ops->setBacklight != NULL) { + ret = ops->setBacklight(devId, level); if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: ops on failed", __func__); + HDF_LOGE("%s: setBacklight failed", __func__); return HDF_FAILURE; } } + if (ret == HDF_SUCCESS) { + panelStatus = GetPanelStatus(devId); + if (!panelStatus) { + HDF_LOGE("%s: panelStatus is null", __func__); + return HDF_FAILURE; + } + panelStatus->currLevel = level; + } + HDF_LOGI("%s:level = %u", __func__, level); return HDF_SUCCESS; } -static int32_t DispOff(uint32_t devId) +static int32_t GetDispInfo(uint32_t devId, struct DispInfo *info) { - int32_t ret; - struct DispOperations *ops = NULL; + struct PlatformOps *ops = NULL; - ops = GetDispOps(); + if (info == NULL) { + HDF_LOGE("%s:info is null", __func__); + return HDF_FAILURE; + } + ops = GetPlatformOps(); if (ops == NULL) { HDF_LOGE("%s: ops is null", __func__); return HDF_FAILURE; } - if (ops->off != NULL) { - ret = ops->off(devId); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: ops off failed", __func__); + if (ops->getDispInfo != NULL) { + if (ops->getDispInfo(devId, info)) { + HDF_LOGE("%s: getDispInfo failed", __func__); return HDF_FAILURE; } } return HDF_SUCCESS; } -static int32_t DispInit(struct HdfDeviceObject *device, struct HdfSBuf *reqData, struct HdfSBuf *rspData) +static int32_t SetPowerStatus(struct HdfDeviceObject *device, struct HdfSBuf *reqData, struct HdfSBuf *rspData) { + uint32_t para = 0; + int32_t ret = HDF_FAILURE; + struct PanelStatus *panelStatus = NULL; + (void)device; (void)rspData; - int32_t ret; - uint32_t devId = 0; - if (reqData == NULL) { return HDF_ERR_INVALID_PARAM; } - if (!HdfSbufReadUint32(reqData, &devId)) { + if (!HdfSbufReadUint32(reqData, ¶)) { HDF_LOGE("%s: HdfSbufReadBuffer failed", __func__); return HDF_FAILURE; } - - struct DispOperations *ops = NULL; - ops = GetDispOps(); - if (ops == NULL) { - HDF_LOGE("%s: ops is null", __func__); - return HDF_FAILURE; + uint32_t devId = (para >> OFFSET_TWO_BYTE) & 0xffff; + uint32_t powerStatus = para & 0xffff; + switch (powerStatus) { + case POWER_STATUS_ON: + ret = DispOn(devId); + break; + case POWER_STATUS_OFF: + ret = DispOff(devId); + break; + default: + HDF_LOGE("%s: not support powerStatus: %d", __func__, powerStatus); + break; } - if (ops->init != NULL) { - ret = ops->init(devId); - if (ret) { - HDF_LOGE("%s: init failed", __func__); + if (ret == HDF_SUCCESS) { + panelStatus = GetPanelStatus(devId); + if (panelStatus == NULL) { + HDF_LOGE("%s: panelStatus is null", __func__); return HDF_FAILURE; } + panelStatus->powerStatus = powerStatus; } - return HDF_SUCCESS; + return ret; } -static int32_t GetDispInfo(struct HdfDeviceObject *device, struct HdfSBuf *reqData, struct HdfSBuf *rspData) +static int32_t GetPowerStatus(struct HdfDeviceObject *device, struct HdfSBuf *reqData, struct HdfSBuf *rspData) { - (void)device; - (void)rspData; uint32_t devId = 0; - struct DispInfo info; - struct DispOperations *ops = NULL; + struct PanelStatus *panelStatus = NULL; + (void)device; if (reqData == NULL) { return HDF_ERR_INVALID_PARAM; } @@ -117,97 +195,95 @@ static int32_t GetDispInfo(struct HdfDeviceObject *device, struct HdfSBuf *reqDa HDF_LOGE("%s: HdfSbufReadBuffer failed", __func__); return HDF_FAILURE; } - - ops = GetDispOps(); - if (ops == NULL) { - HDF_LOGE("%s: ops is null", __func__); + panelStatus = GetPanelStatus(devId); + if (!panelStatus) { + HDF_LOGE("%s: panelStatus is null", __func__); return HDF_FAILURE; } - (void)memset_s(&info, sizeof(struct DispInfo), 0, sizeof(struct DispInfo)); - if (ops->getDispInfo != NULL) { - if (ops->getDispInfo(devId, &info)) { - HDF_LOGE("%s: getDispInfo failed", __func__); - return HDF_FAILURE; - } - } - if (!HdfSbufWriteBuffer(rspData, &info, sizeof(struct DispInfo)) != 0) { - HDF_LOGE("%s: copy info failed", __func__); + if (!HdfSbufWriteUint32(rspData, panelStatus->powerStatus)) { + HDF_LOGE("%s: HdfSbufWriteUint32 failed", __func__); return HDF_FAILURE; } return HDF_SUCCESS; } -static int32_t SetPowerMode(struct HdfDeviceObject *device, struct HdfSBuf *reqData, struct HdfSBuf *rspData) +static int32_t SetBacklight(struct HdfDeviceObject *device, struct HdfSBuf *reqData, struct HdfSBuf *rspData) { - uint32_t para = 0; + int32_t ret; (void)device; (void)rspData; if (reqData == NULL) { return HDF_ERR_INVALID_PARAM; } + uint32_t para = 0; if (!HdfSbufReadUint32(reqData, ¶)) { HDF_LOGE("%s: HdfSbufReadBuffer failed", __func__); return HDF_FAILURE; } uint32_t devId = (para >> OFFSET_TWO_BYTE) & 0xffff; - uint32_t mode = para & 0xffff; - if (mode == DISP_ON) { - return DispOn(devId); + uint32_t level = para & 0xffff; + ret = SetDispBacklight(devId, level); + return ret; +} + +static int32_t GetBacklight(struct HdfDeviceObject *device, struct HdfSBuf *reqData, struct HdfSBuf *rspData) +{ + uint32_t devId = 0; + struct PanelStatus *panelStatus = NULL; + + (void)device; + if (reqData == NULL) { + return HDF_ERR_INVALID_PARAM; } - if (mode == DISP_OFF) { - return DispOff(devId); + if (!HdfSbufReadUint32(reqData, &devId)) { + HDF_LOGE("%s: HdfSbufReadBuffer failed", __func__); + return HDF_FAILURE; } - HDF_LOGE("not support mode:%u", mode); - return HDF_FAILURE; + panelStatus = GetPanelStatus(devId); + if (!panelStatus) { + HDF_LOGE("%s: panelStatus is null", __func__); + return HDF_FAILURE; + } + if (!HdfSbufWriteUint32(rspData, panelStatus->currLevel)) { + HDF_LOGE("%s: HdfSbufWriteUint32 failed", __func__); + return HDF_FAILURE; + } + return HDF_SUCCESS; } -static int32_t SetBacklight(struct HdfDeviceObject *device, struct HdfSBuf *reqData, struct HdfSBuf *rspData) +static int32_t GetInfo(struct HdfDeviceObject *device, struct HdfSBuf *reqData, struct HdfSBuf *rspData) { - int32_t ret; (void)device; (void)rspData; + uint32_t devId = 0; + struct DispInfo info; + if (reqData == NULL) { return HDF_ERR_INVALID_PARAM; } - uint32_t para = 0; - if (!HdfSbufReadUint32(reqData, ¶)) { + if (!HdfSbufReadUint32(reqData, &devId)) { HDF_LOGE("%s: HdfSbufReadBuffer failed", __func__); return HDF_FAILURE; } - uint32_t devId = (para >> OFFSET_TWO_BYTE) & 0xffff; - uint32_t level = para & 0xffff; - struct PanelInfo *info = GetPanelInfo(devId); - if (info == NULL) { - HDF_LOGE("%s:GetPanelInfo failed", __func__); + (void)memset_s(&info, sizeof(struct DispInfo), 0, sizeof(struct DispInfo)); + if (GetDispInfo(devId, &info) != HDF_SUCCESS) { + HDF_LOGE("%s: GetDispInfo failed", __func__); return HDF_FAILURE; } - if (level > info->blk.maxLevel) { - level = info->blk.maxLevel; - } else if (level < info->blk.minLevel && level != 0) { - level = info->blk.minLevel; - } - struct DispOperations *ops = GetDispOps(); - if (ops == NULL) { - HDF_LOGE("%s: ops is null", __func__); + if (!HdfSbufWriteBuffer(rspData, &info, sizeof(struct DispInfo)) != 0) { + HDF_LOGE("%s: copy info failed", __func__); return HDF_FAILURE; } - if (ops->setBacklight != NULL) { - ret = ops->setBacklight(devId, level); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: setBacklight failed", __func__); - return HDF_FAILURE; - } - } - HDF_LOGI("%s:level = %u", __func__, level); return HDF_SUCCESS; } DispCmdHandle g_dispCmdHandle[] = { - DispInit, - GetDispInfo, - SetPowerMode, + GetPowerStatus, + GetInfo, + SetPowerStatus, SetBacklight, + GetBacklight, }; static int32_t DispCmdProcess(struct HdfDeviceObject *device, int32_t cmd, struct HdfSBuf *reqData, @@ -253,10 +329,27 @@ static int HdfDispBind(struct HdfDeviceObject *dev) static int32_t HdfDispEntryInit(struct HdfDeviceObject *object) { + int32_t ret; + int32_t i; + struct PlatformOps *ops = GetPlatformOps(); + if (object == NULL) { HDF_LOGE("%s: object is null!", __func__); return HDF_FAILURE; } + if (ops == NULL) { + HDF_LOGE("%s: ops is null", __func__); + return HDF_FAILURE; + } + if (ops->init != NULL) { + for (i = 0; i < g_numRegisteredPanel; i++) { + ret = ops->init(i); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: init failed", __func__); + return HDF_FAILURE; + } + } + } return HDF_SUCCESS; } diff --git a/model/display/driver/hdf_disp.h b/model/display/driver/hdf_disp.h index c2acd9a47..7a8a5015f 100644 --- a/model/display/driver/hdf_disp.h +++ b/model/display/driver/hdf_disp.h @@ -45,11 +45,20 @@ struct DispOperations { int32_t (*getDispInfo)(uint32_t devId, struct DispInfo *info); }; +struct PlatformOps { + int32_t (*init)(uint32_t devId); + int32_t (*on)(uint32_t devId); + int32_t (*off)(uint32_t devId); + int32_t (*setBacklight)(uint32_t devId, uint32_t level); + int32_t (*getDispInfo)(uint32_t devId, struct DispInfo *info); +}; + enum PowerMode { DISP_ON, DISP_OFF, }; -int32_t DispRegister(struct DispOperations *ops); +int32_t PlatformRegister(struct PlatformOps *ops); struct PanelInfo *GetPanelInfo(int32_t index); +struct PanelStatus *GetPanelStatus(int32_t index); #endif /* HDF_DISP_H */ diff --git a/model/display/driver/hi35xx_disp.c b/model/display/driver/hi35xx_disp.c index 18a314252..44665b150 100644 --- a/model/display/driver/hi35xx_disp.c +++ b/model/display/driver/hi35xx_disp.c @@ -6,6 +6,7 @@ * See the LICENSE file in the root of this repository for complete details. */ +#include "hi35xx_disp.h" #include #include "hdf_base.h" #include "hdf_device_desc.h" @@ -14,7 +15,6 @@ #include "lcd_abs_if.h" #include "osal_io.h" #include "pwm_if.h" -#include "hi35xx_disp.h" #define TRANSFORM_KILO 1000 #define TRANSFORM_MILL 1000000 @@ -186,10 +186,13 @@ static uint32_t CalcDataRate(struct PanelInfo *info) } else { bitClk = bitNum / TRANSFORM_MILL + 1; } + if (!info->mipi.lane) { + return HDF_FAILURE; + } if ((bitClk % info->mipi.lane) == 0) { return bitClk / info->mipi.lane; } - return bitClk / info->mipi.lane + 1; + return (bitClk / info->mipi.lane) + 1; } static int32_t MipiDsiInit(struct PanelInfo *info) @@ -225,7 +228,7 @@ static int32_t MipiDsiInit(struct PanelInfo *info) HDF_LOGE("%s:MipiDsiSetCfg failed", __func__); } MipiDsiClose(mipiHandle); - HDF_LOGI("%s:pixelClk = %d, phyDataRate = %d", __func__, cfg.pixelClk, cfg.phyDataRate); + HDF_LOGI("%s:pixelClk = %d, phyDataRate = %u", __func__, cfg.pixelClk, cfg.phyDataRate); return ret; } @@ -425,7 +428,7 @@ static int32_t Hi35xxSetBacklight(uint32_t devId, uint32_t level) return HDF_SUCCESS; } -struct DispOperations g_hi35xxOps = { +struct PlatformOps g_hi35xxOps = { .init = Hi35xxInit, .on = Hi35xxOn, .off = Hi35xxOff, @@ -439,7 +442,7 @@ static int32_t Hi35xxEntryInit(struct HdfDeviceObject *object) HDF_LOGE("%s: param is null!", __func__); return HDF_FAILURE; } - return DispRegister(&g_hi35xxOps); + return PlatformRegister(&g_hi35xxOps); } struct HdfDriverEntry g_hi35xxDevEntry = { diff --git a/model/display/driver/lcd_abs_if.c b/model/display/driver/lcd_abs_if.c index d414c216a..c95d2e50d 100644 --- a/model/display/driver/lcd_abs_if.c +++ b/model/display/driver/lcd_abs_if.c @@ -6,15 +6,15 @@ * See the LICENSE file in the root of this repository for complete details. */ +#include "lcd_abs_if.h" #include #include "hdf_device_desc.h" #include "osal.h" -#include "lcd_abs_if.h" /* support max panel number */ #define PANEL_MAX 2 static struct PanelData *g_panelData[PANEL_MAX]; -static int32_t numRegisteredPanel; +int32_t g_numRegisteredPanel; int32_t PanelDataRegister(struct PanelData *data) { @@ -24,10 +24,10 @@ int32_t PanelDataRegister(struct PanelData *data) HDF_LOGE("%s: panel data is null", __func__); return HDF_ERR_INVALID_PARAM; } - if (numRegisteredPanel == PANEL_MAX) { + if (g_numRegisteredPanel == PANEL_MAX) { return HDF_FAILURE; } - numRegisteredPanel++; + g_numRegisteredPanel++; for (i = 0; i < PANEL_MAX; i++) { if (g_panelData[i] == NULL) { break; @@ -60,3 +60,13 @@ struct PanelInfo *GetPanelInfo(int32_t index) return g_panelData[index]->info; } +struct PanelStatus *GetPanelStatus(const int32_t index) +{ + if ((index >= PANEL_MAX) || index < 0) { + return NULL; + } + if (g_panelData[index] == NULL) { + return NULL; + } + return g_panelData[index]->status; +} diff --git a/model/display/driver/lcd_abs_if.h b/model/display/driver/lcd_abs_if.h index e35ce204c..04ed31ae1 100644 --- a/model/display/driver/lcd_abs_if.h +++ b/model/display/driver/lcd_abs_if.h @@ -26,7 +26,7 @@ enum BacklightType { BLK_MIPI, }; -/* output timming */ +/* output timing */ enum IntfSync { OUTPUT_USER = 0, /* User timing */ OUTPUT_PAL, /* PAL standard */ @@ -85,6 +85,14 @@ struct MipiDsiDesc { enum DsiOutFormat format; }; +enum PowerStatus { + POWER_STATUS_ON, /* The power status is on */ + POWER_STATUS_STANDBY, /* The power status is standby */ + POWER_STATUS_SUSPEND, /* The power status is suspend */ + POWER_STATUS_OFF, /* The power status is off */ + POWER_STATUS_BUTT +}; + struct BlkDesc { uint32_t type; uint32_t minLevel; @@ -114,14 +122,21 @@ struct PanelInfo { struct PwmCfg pwm; }; +struct PanelStatus { + enum PowerStatus powerStatus; + uint32_t currLevel; +}; struct PanelData { struct PanelInfo *info; + struct PanelStatus *status; int32_t (*init)(void); int32_t (*on)(void); int32_t (*off)(void); int32_t (*setBacklight)(uint32_t level); }; +extern int32_t g_numRegisteredPanel; + int32_t PanelDataRegister(struct PanelData *data); #endif /* LCD_ABS_IF_H */ diff --git a/model/display/driver/lcdkit/lcdkit_parse_config.c b/model/display/driver/lcdkit/lcdkit_parse_config.c index 89a66d49c..64c3d3b8c 100644 --- a/model/display/driver/lcdkit/lcdkit_parse_config.c +++ b/model/display/driver/lcdkit/lcdkit_parse_config.c @@ -45,6 +45,8 @@ static int32_t ParseDsiCmd(struct PanelCmd *cmd, int32_t count, uint8_t *array, return HDF_FAILURE; } int32_t ret; + int32_t i; + int32_t num = 0; cmd->count = count; cmd->dsiCmd = dsiCmd; uint8_t *tmpArray = array; @@ -56,6 +58,9 @@ static int32_t ParseDsiCmd(struct PanelCmd *cmd, int32_t count, uint8_t *array, tmpCmd->payload = (uint8_t *)OsalMemCalloc(tmpCmd->dataLen * sizeof(uint8_t)); if (tmpCmd->payload == NULL) { HDF_LOGE("%s: OsalMemCalloc failed", __func__); + for (i = 0; i < num; i++) { + OsalMemFree(dsiCmd[i]->payload); + } OsalMemFree(array); OsalMemFree(dsiCmd); cmd->dsiCmd = NULL; @@ -63,9 +68,12 @@ static int32_t ParseDsiCmd(struct PanelCmd *cmd, int32_t count, uint8_t *array, return HDF_FAILURE; } - ret = memcpy_s(tmpCmd->payload, tmpCmd->dataLen, &tmpArray[DSI_CMD_HEAD], tmpCmd->dataLen); + ret = memcpy_s(tmpCmd->payload, tmpCmd->dataLen, &tmpArray[DSI_CMD_HEAD], DSI_CMD_HEAD); if (ret != EOK) { HDF_LOGE("%s: memcpy_s failed, ret %d", __func__, ret); + for (i = 0; i < num; i++) { + OsalMemFree(dsiCmd[i]->payload); + } OsalMemFree(array); OsalMemFree(dsiCmd); cmd->dsiCmd = NULL; @@ -76,6 +84,7 @@ static int32_t ParseDsiCmd(struct PanelCmd *cmd, int32_t count, uint8_t *array, tmpArray += DSI_CMD_HEAD + tmpCmd->dataLen; tmpCmd++; count--; + num++; len -= DSI_CMD_HEAD + tmpCmd->dataLen; } OsalMemFree(array); diff --git a/model/display/driver/lcdkit/lite_lcdkit.c b/model/display/driver/lcdkit/lite_lcdkit.c index 219543a67..c7db0d7b3 100644 --- a/model/display/driver/lcdkit/lite_lcdkit.c +++ b/model/display/driver/lcdkit/lite_lcdkit.c @@ -48,7 +48,7 @@ static int32_t LcdkitInit(void) struct PanelConfig *panelCfg = GetPanelCfg(); if (panelCfg->info.intfType != MIPI_DSI) { - HDF_LOGE("%s:not support intf: %d", __func__, panelCfg->info.intfType); + HDF_LOGE("%s:not support intf: %u", __func__, panelCfg->info.intfType); return HDF_FAILURE; } ret = PowerInit(); @@ -65,6 +65,8 @@ static int32_t LcdkitInit(void) if (panelCfg->info.blk.type == BLK_PWM) { panelCfg->pwmHandle = PwmOpen(panelCfg->info.pwm.dev); if (panelCfg->pwmHandle == NULL) { + MipiDsiClose(panelCfg->dsiHandle); + panelCfg->dsiHandle = NULL; HDF_LOGE("%s: PwmOpen failed", __func__); return HDF_FAILURE; } @@ -222,8 +224,8 @@ static int32_t SetBacklightByMipi(uint32_t level) { int32_t ret; struct PanelConfig *panelCfg = GetPanelCfg(); - uint8_t payLoad[] = { 0x51, 0x00 }; - struct DsiCmdDesc bklCmd = { 0x15, 0, sizeof(payLoad), payLoad }; + uint8_t payLoad[] = { 0x51, 0x00 }; // panel backlight cmd + struct DsiCmdDesc bklCmd = { 0x15, 0, sizeof(payLoad), payLoad }; // dsi backlight cmd if (panelCfg->dsiHandle == NULL) { HDF_LOGE("%s: dsiHandle is null", __func__); diff --git a/model/display/driver/panel/mipi_icn9700.c b/model/display/driver/panel/mipi_icn9700.c index d63f207f7..311e4c604 100644 --- a/model/display/driver/panel/mipi_icn9700.c +++ b/model/display/driver/panel/mipi_icn9700.c @@ -28,12 +28,12 @@ #define HORIZONTAL_BACK_PORCH 20 #define HORIZONTAL_FRONT_PORCH 20 #define HORIZONTAL_SYNC_WIDTH 10 -#define VERTIACL_BACK_PORCH 14 -#define VERTIACL_FRONT_PORCH 16 -#define VERTIACL_SYNC_WIDTH 2 +#define VERTICAL_BACK_PORCH 14 +#define VERTICAL_FRONT_PORCH 16 +#define VERTICAL_SYNC_WIDTH 2 #define FRAME_RATE 60 -/* panel on commond payload */ +/* panel on command payload */ static uint8_t g_payLoad0[] = { 0xF0, 0x5A, 0x5A }; static uint8_t g_payLoad1[] = { 0xF1, 0xA5, 0xA5 }; static uint8_t g_payLoad2[] = { 0xB3, 0x03, 0x03, 0x03, 0x07, 0x05, 0x0D, 0x0F, 0x11, 0x13, 0x09, 0x0B }; @@ -84,7 +84,7 @@ struct DsiCmdDesc g_OnCmd[] = { { 0x05, 120, sizeof(g_payLoad20), g_payLoad20 }, }; -/* panel off commond payload */ +/* panel off command payload */ static uint8_t g_offPayLoad0[] = { 0x28 }; static uint8_t g_offPayLoad1[] = { 0x10 }; struct DsiCmdDesc g_offCmd[] = { @@ -257,12 +257,12 @@ static struct PanelInfo g_panelInfo = { .hbp = HORIZONTAL_BACK_PORCH, /* horizontal back porch */ .hfp = HORIZONTAL_FRONT_PORCH, /* horizontal front porch */ .hsw = HORIZONTAL_SYNC_WIDTH, /* horizontal sync width */ - .vbp = VERTIACL_BACK_PORCH, /* vertiacl back porch */ - .vfp = VERTIACL_FRONT_PORCH, /* vertiacl front porch */ - .vsw = VERTIACL_SYNC_WIDTH, /* vertiacl sync width */ + .vbp = VERTICAL_BACK_PORCH, /* vertical back porch */ + .vfp = VERTICAL_FRONT_PORCH, /* vertical front porch */ + .vsw = VERTICAL_SYNC_WIDTH, /* vertical sync width */ .frameRate = FRAME_RATE, /* frame rate */ .intfType = MIPI_DSI, /* panel interface type */ - .intfSync = OUTPUT_USER, /* output timming type */ + .intfSync = OUTPUT_USER, /* output timing type */ /* mipi config info */ .mipi = { DSI_2_LANES, DSI_VIDEO_MODE, VIDEO_BURST_MODE, FORMAT_RGB_24_BIT }, /* backlight config info */ @@ -270,8 +270,14 @@ static struct PanelInfo g_panelInfo = { .pwm = { BLK_PWM1, PWM_MAX_PERIOD }, }; +static struct PanelStatus g_panelStatus = { + .powerStatus = POWER_STATUS_OFF, + .currLevel = MIN_LEVEL, +}; + static struct PanelData g_panelData = { .info = &g_panelInfo, + .status = &g_panelStatus, .init = Icn9700Init, .on = Icn9700On, .off = Icn9700Off, diff --git a/model/display/driver/panel/ssp_st7789.c b/model/display/driver/panel/ssp_st7789.c index e19a625b8..7dec843ab 100644 --- a/model/display/driver/panel/ssp_st7789.c +++ b/model/display/driver/panel/ssp_st7789.c @@ -124,24 +124,24 @@ static int32_t LcdResetOn(void) ret = GpioSetDir(RESET_GPIO, GPIO_DIR_OUT); if (ret != HDF_SUCCESS) { - HDF_LOGE("GpioSetDir failed, ret:%d", ret); + HDF_LOGE("set lcd reset dir failed, ret:%d", ret); return HDF_FAILURE; } ret = GpioWrite(RESET_GPIO, GPIO_VAL_HIGH); if (ret != HDF_SUCCESS) { - HDF_LOGE("GpioWrite failed, ret:%d", ret); + HDF_LOGE("set lcd reset hi failed, ret:%d", ret); return HDF_FAILURE; } ret = GpioWrite(RESET_GPIO, GPIO_VAL_LOW); if (ret != HDF_SUCCESS) { - HDF_LOGE("GpioWrite failed, ret:%d", ret); + HDF_LOGE("set lcd reset how failed, ret:%d", ret); return HDF_FAILURE; } /* delay 10ms */ OsalMSleep(10); ret = GpioWrite(RESET_GPIO, GPIO_VAL_HIGH); if (ret != HDF_SUCCESS) { - HDF_LOGE("GpioWrite failed, ret:%d", ret); + HDF_LOGE("set lcd reset hi after delay failed, ret:%d", ret); return HDF_FAILURE; } /* delay 120ms */ diff --git a/model/display/driver/panel/ssp_st7789.h b/model/display/driver/panel/ssp_st7789.h index 22f2356e5..b80cebe92 100644 --- a/model/display/driver/panel/ssp_st7789.h +++ b/model/display/driver/panel/ssp_st7789.h @@ -16,7 +16,6 @@ #define BITS_PER_BYTE 8 #define BITS_PER_WORD 9 #define SPI_MAX_SPEED 115200 -#define SYS_WRITEL(addr, value) ((*(volatile unsigned int *)(addr)) = (value)) struct LcdCmd { uint8_t cmd; diff --git a/model/input/driver/event_hub.c b/model/input/driver/event_hub.c index 3c11bc4c0..264e63c7f 100644 --- a/model/input/driver/event_hub.c +++ b/model/input/driver/event_hub.c @@ -26,6 +26,12 @@ void PushOnePackage(InputDevice *inputDev, uint32_t type, uint32_t code, int32_t { OsalTimespec time; EventPackage package = {0}; + + if (inputDev == NULL) { + HDF_LOGE("%s: parm is null", __func__); + return; + } + package.type = type; package.code = code; package.value = value; diff --git a/model/input/driver/hdf_hid.c b/model/input/driver/hdf_hid_adapter.c old mode 100755 new mode 100644 similarity index 30% rename from model/input/driver/hdf_hid.c rename to model/input/driver/hdf_hid_adapter.c index 5cd3ee271..b6e2218de --- a/model/input/driver/hdf_hid.c +++ b/model/input/driver/hdf_hid_adapter.c @@ -8,11 +8,127 @@ #include #include "hdf_device_desc.h" +#include "osal_mem.h" #include "hdf_log.h" +#include "event_hub.h" +#include "hdf_input_device_manager.h" +#include "hdf_hid_adapter.h" + +InputDevice *cachedHid[MAX_INPUT_DEV_NUM]; + +static bool HaveHidCache(void) +{ + if (cachedHid[0] == NULL) { + return false; + } + return true; +} + +static void LoadCachedHid(void) +{ + int32_t i = 0; + int32_t ret; + if (!HaveHidCache()) { + HDF_LOGI("%s: exit", __func__); + return; + } + while (i < MAX_INPUT_DEV_NUM && cachedHid[i] != NULL) { + ret = RegisterInputDevice(cachedHid[i]); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: add %s failed", __func__, cachedHid[i]->devName); + } + cachedHid[i] = NULL; + i++; + } +} + +static InputDevice* HidConstructInputDev(HidInfo info) +{ + InputDevice *inputDev = (InputDevice *)OsalMemAlloc(sizeof(InputDevice)); + if (inputDev == NULL) { + HDF_LOGE("%s: instance input device failed", __func__); + return NULL; + } + (void)memset_s(inputDev, sizeof(InputDevice), 0, sizeof(InputDevice)); + + inputDev->devType = info.devType; + inputDev->devName = info.devName; + return inputDev; +} + +static InputDevice* DoRegisterInputDev(InputDevice* inputDev) +{ + int32_t ret; + + ret = RegisterInputDevice(inputDev); + if (ret == HDF_SUCCESS) { + return inputDev; + } else { + OsalMemFree(inputDev); + inputDev = NULL; + return NULL; + } +} + +static InputDevice* CacheHid(InputDevice* inputDev) +{ + int32_t i = 0; + while ((i < MAX_INPUT_DEV_NUM) && (cachedHid[i] != NULL)) { + i++; + } + if (i < MAX_INPUT_DEV_NUM) { + cachedHid[i] = inputDev; + return inputDev; + } + return NULL; +} + +static bool InputDriverLoaded(void) +{ + InputManager* g_inputManager = GetInputManager(); + if ((g_inputManager != NULL) && (g_inputManager->initialized != false)) { + return true; + } + return false; +} + +void* HidRegisterHdfInputDev(HidInfo info) +{ + InputDevice* inputDev = HidConstructInputDev(info); + if (inputDev == NULL) { + HDF_LOGE("%s: hid construct input Dev failed", __func__); + return NULL; + } + + if (InputDriverLoaded()) { + return DoRegisterInputDev(inputDev); + } else { + return CacheHid(inputDev); + } +} + +void HidUnregisterHdfInputDev(const void *inputDev) +{ + if (inputDev == NULL) { + HDF_LOGE("%s: inputDev is null", __func__); + } + UnregisterInputDevice((InputDevice *)inputDev); + inputDev = NULL; +} + +void HidReportEvent(const void *inputDev, uint32_t type, uint32_t code, int32_t value) +{ + PushOnePackage((InputDevice *)inputDev, type, code, value); +} static int32_t HdfHIDDriverInit(struct HdfDeviceObject *device) { (void)device; + static bool cachedHidRegistered = false; + if (!cachedHidRegistered) { + cachedHidRegistered = true; + LoadCachedHid(); + } return HDF_SUCCESS; } diff --git a/model/input/driver/hdf_hid_adapter.h b/model/input/driver/hdf_hid_adapter.h new file mode 100644 index 000000000..fc2aac7b3 --- /dev/null +++ b/model/input/driver/hdf_hid_adapter.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * + * HDF is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * See the LICENSE file in the root of this repository for complete details. + */ + +#ifndef HDF_HID_ADAPTER_H +#define HDF_HID_ADAPTER_H +typedef struct HidInformation { + uint32_t devType; + const char *devName; +} HidInfo; + +enum HidType { + HID_TYPE_BEGIN_POS = 33, /* HID type start position */ + HID_TYPE_MOUSE, /* Mouse */ + HID_TYPE_KEYBOARD, /* Keyboard */ + HID_TYPE_UNKNOWN, /* Unknown input device type */ +}; + +void* HidRegisterHdfInputDev(HidInfo dev); +void HidUnregisterHdfInputDev(const void *inputDev); +void HidReportEvent(const void *inputDev, uint32_t type, uint32_t code, int32_t value); + +#endif \ No newline at end of file diff --git a/model/input/driver/hdf_input_device_manager.c b/model/input/driver/hdf_input_device_manager.c index f0b0b37a8..83aedce52 100644 --- a/model/input/driver/hdf_input_device_manager.c +++ b/model/input/driver/hdf_input_device_manager.c @@ -16,22 +16,25 @@ #include "hdf_input_device_manager.h" #define NODE_MODE 0660 -#define SERVICE_NAME_LEN 16 +#define SERVICE_NAME_LEN 24 #define INPUT_DEV_EXIST 1 #define INPUT_DEV_NOT_EXIST 0 -#define MOUSE_DEV_ID 2 -#define MAX_INPUT_DEV_NUM 32 #define INPUTDEV_FIRST_ID 1 #define FILLER_FLAG 1 +#define PLACEHOLDER_LENGTH 2 +#define PLACEHOLDER_LIMIT 10 -InputManager *g_inputManager; +static InputManager *g_inputManager; + +InputManager* GetInputManager(void) +{ + return g_inputManager; +} #ifndef __KERNEL__ int32_t TouchIoctl(InputDevice *inputdev, int32_t cmd, unsigned long arg); uint32_t TouchPoll(struct file *filep, InputDevice *inputDev, poll_table *wait); -#endif -#ifndef __KERNEL__ static int32_t InputDevIoctl(struct file *filep, int32_t cmd, unsigned long arg) { int32_t ret; @@ -76,7 +79,7 @@ static int32_t InputDevClose(struct file *filep) static int32_t InputDevPoll(struct file *filep, poll_table *wait) { uint32_t pollMask = 0; - InputDevice *inputdev = (InputDevice *)((struct drv_data*)filep->f_vnode->data)->priv; + InputDevice *inputdev = (InputDevice *)(InputDevice *)((struct drv_data*)filep->f_vnode->data)->priv; switch (inputdev->devType) { case INDEV_TYPE_TOUCH: pollMask = TouchPoll(filep, inputdev, wait); @@ -102,7 +105,7 @@ static const struct file_operations_vfs inputDevOps = { static bool IsHidDevice(uint32_t devType) { - if (devType == INDEV_TYPE_MOUSE) { + if ((devType > INDEV_TYPE_HID_BEGIN_POS) && (devType < INDEV_TYPE_UNKNOWN)) { return true; } return false; @@ -113,7 +116,10 @@ static struct HdfDeviceObject *HidRegisterHdfDevice(InputDevice *inputDev) char svcName[SERVICE_NAME_LEN] = {0}; const char *moduleName = "HDF_HID"; struct HdfDeviceObject *hdfDev = NULL; - int32_t ret = snprintf_s(svcName, SERVICE_NAME_LEN, strlen("event") + 1, "%s%u", "event", MOUSE_DEV_ID); + + int32_t len = (inputDev->devId < PLACEHOLDER_LIMIT) ? 1 : PLACEHOLDER_LENGTH; + int32_t ret = snprintf_s(svcName, SERVICE_NAME_LEN, strlen("hdf_input_event") + len, "%s%u", + "hdf_input_event", inputDev->devId); if (ret < 0) { HDF_LOGE("%s: snprintf_s failed", __func__); return NULL; @@ -127,6 +133,33 @@ static struct HdfDeviceObject *HidRegisterHdfDevice(InputDevice *inputDev) return hdfDev; } +static void HotPlugNotify(const InputDevice *inputDev, bool status) +{ + struct HdfSBuf *sbuf = NULL; + HotPlugEvent event = {0}; + int32_t ret; + + sbuf = HdfSBufObtain(sizeof(HotPlugEvent)); + if (sbuf == NULL) { + HDF_LOGE("%s: obtain buffer failed", __func__); + return; + } + event.devId = inputDev->devId; + event.devType = inputDev->devType; + event.status = status; + + if (!HdfSbufWriteBuffer(sbuf, &event, sizeof(HotPlugEvent))) { + HDF_LOGE("%s: write buffer failed", __func__); + goto EXIT; + } + ret = HdfDeviceSendEvent(g_inputManager->hdfDevObj, 0, sbuf); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: send event failed", __func__); + } +EXIT: + HdfSBufRecycle(sbuf); +} + static int32_t CreateDeviceNode(InputDevice *inputDev) { if (IsHidDevice(inputDev->devType)) { @@ -135,13 +168,14 @@ static int32_t CreateDeviceNode(InputDevice *inputDev) if (inputDev->hdfDevObj == NULL) { return HDF_DEV_ERR_NO_DEVICE; } - inputDev->devId = MOUSE_DEV_ID; } #ifndef __KERNEL__ - char devNode[INPUT_DEV_PATH_LEN] = {0}; - int32_t ret = snprintf_s(devNode, INPUT_DEV_PATH_LEN, strlen("/dev/input/event") + 1, - "%s%u", "/dev/input/event", inputDev->devId); + char *devNode = (char *)malloc(INPUT_DEV_PATH_LEN); + (void)memset_s(devNode, INPUT_DEV_PATH_LEN, 0, INPUT_DEV_PATH_LEN); + + int32_t ret = snprintf_s(devNode, INPUT_DEV_PATH_LEN, strlen("/dev/input/hdf_input_event") + 1, + "%s%u", "/dev/input/hdf_input_event", inputDev->devId); if (ret < 0) { HDF_LOGE("%s: snprintf_s failed", __func__); return HDF_FAILURE; @@ -164,7 +198,10 @@ static void DeleteDeviceNode(InputDevice *inputDev) if (IsHidDevice(inputDev->devType)) { char svcName[SERVICE_NAME_LEN] = {0}; const char *moduleName = "HDF_HID"; - int32_t ret = snprintf_s(svcName, SERVICE_NAME_LEN, strlen("event") + 1, "%s%u", "event", MOUSE_DEV_ID); + + int32_t len = (inputDev->devId < PLACEHOLDER_LIMIT) ? 1 : PLACEHOLDER_LENGTH; + int32_t ret = snprintf_s(svcName, SERVICE_NAME_LEN, strlen("hdf_input_event") + len, "%s%u", + "hdf_input_event", inputDev->devId); if (ret < 0) { HDF_LOGE("%s: snprintf_s failed", __func__); return; @@ -174,18 +211,12 @@ static void DeleteDeviceNode(InputDevice *inputDev) } #ifndef __KERNEL__ - char devNode[INPUT_DEV_PATH_LEN] = {0}; - int32_t ret = snprintf_s(devNode, INPUT_DEV_PATH_LEN, strlen("/dev/input/event") + 1, "%s%u", - "/dev/input/event", inputDev->devId); - if (ret < 0) { - HDF_LOGE("%s: snprintf_s failed", __func__); - return; - } - inputDev->devNode = devNode; - ret = unregister_driver(inputDev->devNode); + int32_t ret = unregister_driver(inputDev->devNode); if (ret != HDF_SUCCESS) { HDF_LOGE("%s: delete dev node failed, ret %d", __func__, ret); } + free((void *)inputDev->devNode); + inputDev->devNode = NULL; #endif HDF_LOGI("%s: delete node succ, devId is %d", __func__, inputDev->devId); } @@ -208,6 +239,7 @@ static void AddInputDevice(InputDevice *inputDev) } } g_inputManager->devCount++; + HotPlugNotify(inputDev, ONLINE); } static int32_t CheckInputDevice(InputDevice *inputDev) @@ -254,12 +286,14 @@ static int32_t DeleteInputDevice(InputDevice *inputDev) EXIT: g_inputManager->devCount--; + HotPlugNotify(inputDev, OFFLINE); return HDF_SUCCESS; } #define DEFAULT_TOUCH_BUF_PKG_NUM 50 #define DEFAULT_KEY_BUF_PKG_NUM 10 #define DEFAULT_MOUSE_BUF_PKG_NUM 30 +#define DEFAULT_KEYBOARD_BUF_PKG_NUM 20 #define DEFAULT_CROWN_BUF_PKG_NUM 20 #define DEFAULT_ENCODER_BUF_PKG_NUM 20 @@ -276,6 +310,9 @@ static int32_t AllocPackageBuffer(InputDevice *inputDev) case INDEV_TYPE_MOUSE: pkgNum = DEFAULT_MOUSE_BUF_PKG_NUM; break; + case INDEV_TYPE_KEYBOARD: + pkgNum = DEFAULT_KEYBOARD_BUF_PKG_NUM; + break; case INDEV_TYPE_CROWN: pkgNum = DEFAULT_CROWN_BUF_PKG_NUM; break; @@ -309,14 +346,12 @@ static uint32_t AllocDeviceID(InputDevice *inputDev) tmpDev = tmpDev->next; } for (id = INPUTDEV_FIRST_ID; id < MAX_INPUT_DEV_NUM + 1; id++) { - if (id == MOUSE_DEV_ID) { - continue; - } if (idList[id] == 0) { inputDev->devId = id; return HDF_SUCCESS; } } + HDF_LOGE("%s: alloc device id failed", __func__); return HDF_FAILURE; } @@ -330,7 +365,7 @@ int32_t RegisterInputDevice(InputDevice *inputDev) return HDF_ERR_INVALID_PARAM; } - if (g_inputManager == NULL || g_inputManager->initialized == false) { + if ((g_inputManager == NULL) || (g_inputManager->initialized == false)) { HDF_LOGE("%s: dev manager is null or initialized failed", __func__); return HDF_FAILURE; } @@ -362,18 +397,18 @@ EXIT: return ret; } -int32_t UnregisterInputDevice(InputDevice *inputDev) +void UnregisterInputDevice(InputDevice *inputDev) { - int ret = HDF_FAILURE; + int32_t ret; HDF_LOGI("%s: enter", __func__); if (inputDev == NULL) { HDF_LOGE("%s: inputdev is null", __func__); - return HDF_ERR_INVALID_PARAM; + return; } - if (g_inputManager == NULL || g_inputManager->initialized == false) { + if ((g_inputManager == NULL) || (g_inputManager->initialized == false)) { HDF_LOGE("%s: dev manager is null or initialized failed", __func__); - return HDF_FAILURE; + return; } OsalMutexLock(&g_inputManager->mutex); @@ -389,14 +424,15 @@ int32_t UnregisterInputDevice(InputDevice *inputDev) if (ret != HDF_SUCCESS) { goto EXIT; } - + OsalMemFree(inputDev); + inputDev = NULL; OsalMutexUnlock(&g_inputManager->mutex); HDF_LOGI("%s: exit succ, devCount is %d", __func__, g_inputManager->devCount); - return HDF_SUCCESS; + return; EXIT: OsalMutexUnlock(&g_inputManager->mutex); - return ret; + return; } static uint32_t GetDeviceCount(void) @@ -405,6 +441,40 @@ static uint32_t GetDeviceCount(void) return g_inputManager->devCount; } +static int32_t ScanAllDev(struct HdfSBuf *reply) +{ + DevDesc sta; + InputDevice *tmpDev = g_inputManager->inputDevList; + while (tmpDev != NULL) { + sta.devType = tmpDev->devType; + sta.devId = tmpDev->devId; + + if (!HdfSbufWriteBuffer(reply, &sta, sizeof(DevDesc))) { + HDF_LOGE("%s: HdfSbufWriteBuffer failed", __func__); + return HDF_FAILURE; + } + tmpDev = tmpDev->next; + } + HdfSbufWriteBuffer(reply, NULL, 0); // end flag + return HDF_SUCCESS; +} + +static int32_t ScanDevice(struct HdfDeviceIoClient *client, int32_t cmd, + struct HdfSBuf *data, struct HdfSBuf *reply) +{ + (void)cmd; + int32_t ret; + if ((client == NULL) || (data == NULL) || (reply == NULL)) { + HDF_LOGE("%s: param is null", __func__); + return HDF_FAILURE; + } + ret = ScanAllDev(reply); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: scan all dev failed", __func__); + } + return ret; +} + static int32_t HdfInputManagerBind(struct HdfDeviceObject *device) { if (device == NULL) { @@ -414,6 +484,7 @@ static int32_t HdfInputManagerBind(struct HdfDeviceObject *device) static IInputManagerService managerService = { .getDeviceCount = GetDeviceCount, + .ioService.Dispatch = ScanDevice, }; device->service = &managerService.ioService; diff --git a/model/input/driver/hdf_input_device_manager.h b/model/input/driver/hdf_input_device_manager.h index 93c540496..417986618 100644 --- a/model/input/driver/hdf_input_device_manager.h +++ b/model/input/driver/hdf_input_device_manager.h @@ -19,7 +19,10 @@ #endif #define HDF_LOG_TAG HDF_INPUT_DRV #define INPUT_DEV_PATH_LEN 64 +#define MAX_INPUT_DEV_NUM 32 #define DEV_NAME_LEN 16 +#define ONLINE 0 +#define OFFLINE 1 #define CHECK_RETURN_VALUE(ret) do { \ if ((ret) != HDF_SUCCESS) { \ @@ -27,6 +30,17 @@ } \ } while (0) +typedef struct { + uint32_t devId; + uint32_t devType; +} DevDesc; + +typedef struct { + uint32_t devId; + uint32_t devType; + uint32_t status; +} HotPlugEvent; + typedef struct { struct IDeviceIoService ioService; uint32_t (*getDeviceCount)(void); @@ -55,14 +69,15 @@ typedef struct { } InputManager; enum InputDevType { - INDEV_TYPE_TOUCH, /* Touchscreen */ - INDEV_TYPE_KEY, /* Physical key */ - INDEV_TYPE_KEYBOARD, /* Keyboard */ - INDEV_TYPE_MOUSE, /* Mouse */ - INDEV_TYPE_BUTTON, /* Virtual button */ - INDEV_TYPE_CROWN, /* Watch crown */ - INDEV_TYPE_ENCODER, /* Customized type of a specific function or event */ - INDEV_TYPE_UNKNOWN, /* Unknown input device type */ + INDEV_TYPE_TOUCH, /* Touchscreen */ + INDEV_TYPE_KEY, /* Physical key */ + INDEV_TYPE_BUTTON, /* Virtual button */ + INDEV_TYPE_CROWN, /* Watch crown */ + INDEV_TYPE_ENCODER, /* Customized type of a specific function or event */ + INDEV_TYPE_HID_BEGIN_POS = 33, /* HID type start position */ + INDEV_TYPE_MOUSE, /* Mouse */ + INDEV_TYPE_KEYBOARD, /* Keyboard */ + INDEV_TYPE_UNKNOWN, /* Unknown input device type */ }; enum InputIOsvcCmdId { @@ -89,8 +104,8 @@ enum TouchIoctlCmd { INPUT_IOCTL_RUN_CAPACITANCE_TEST, INPUT_IOCTL_RUN_EXTRA_CMD, }; - +InputManager* GetInputManager(void); int32_t RegisterInputDevice(InputDevice *device); -int32_t UnregisterInputDevice(InputDevice *device); +void UnregisterInputDevice(InputDevice *device); #endif \ No newline at end of file diff --git a/model/input/driver/hdf_key.c b/model/input/driver/hdf_key.c index 8b07dacd2..154df2df1 100644 --- a/model/input/driver/hdf_key.c +++ b/model/input/driver/hdf_key.c @@ -14,8 +14,8 @@ #include "event_hub.h" #include "hdf_key.h" -#define CHECK_PARSER_RET(ret, str) do { \ - if (ret != HDF_SUCCESS) { \ +#define CHECK_PARSER_RET(ret, str) do { \ + if ((ret) != HDF_SUCCESS) { \ HDF_LOGE("%s: %s failed, ret = %d!", __func__, str, ret); \ return HDF_FAILURE; \ } \ @@ -40,7 +40,10 @@ static int32_t IoctlReadKeyEvent(KeyDriver *driver, unsigned long arg) int32_t KeyIoctl(InputDevice *inputdev, int32_t cmd, unsigned long arg) { - int32_t ret; + int32_t ret = HDF_FAILURE; + if (inputdev == NULL) { + return ret; + } KeyDriver *driver = (KeyDriver *)inputdev->pvtData; switch (cmd) { case INPUT_IOCTL_GET_EVENT_DATA: @@ -58,7 +61,13 @@ int32_t KeyIrqHandle(uint16_t intGpioNum, void *data) { uint16_t gpioValue; KeyDriver *driver = (KeyDriver *)data; + if (driver == NULL) { + return HDF_FAILURE; + } KeyEventData *event = &driver->eventData; + if (event == NULL) { + return HDF_FAILURE; + } int32_t ret = GpioDisableIrq(intGpioNum); if (ret != HDF_SUCCESS) { diff --git a/model/input/driver/hdf_touch.c b/model/input/driver/hdf_touch.c index edb8fcf39..b129da732 100644 --- a/model/input/driver/hdf_touch.c +++ b/model/input/driver/hdf_touch.c @@ -6,13 +6,13 @@ * See the LICENSE file in the root of this repository for complete details. */ +#include "hdf_touch.h" #include "gpio_if.h" #include "hdf_device_desc.h" #include "hdf_log.h" #include "osal_mem.h" #include "osal_io.h" #include "event_hub.h" -#include "hdf_touch.h" #define I2C_TYPE 0 #define SPI_TYPE 1 @@ -79,7 +79,10 @@ static int32_t IoctlGetChipName(TouchDriver *driver, unsigned long arg) int32_t TouchIoctl(InputDevice *inputdev, int32_t cmd, unsigned long arg) { - int32_t ret; + int32_t ret = HDF_FAILURE; + if (inputdev == NULL || inputdev->pvtData == NULL) { + return ret; + } ChipDevice *device = (ChipDevice *)inputdev->pvtData; TouchDriver *driver = device->driver; switch (cmd) { @@ -104,6 +107,9 @@ int32_t TouchIoctl(InputDevice *inputdev, int32_t cmd, unsigned long arg) uint32_t TouchPoll(FAR struct file *filep, InputDevice *inputDev, poll_table *wait) { uint32_t pollMask = 0; + if (filep == NULL || filep->f_vnode == NULL) { + return pollMask; + } InputDevice *inputdev = (InputDevice *)((struct drv_data*)filep->f_vnode->data)->priv; if (inputdev == NULL) { HDF_LOGE("%s: inputdev is null", __func__); @@ -124,7 +130,7 @@ uint32_t TouchPoll(FAR struct file *filep, InputDevice *inputDev, poll_table *wa static int32_t SetGpioDirAndLevel(int gpio, int dir, int level) { int32_t ret; - if (dir == GPIO_DIR_IN || dir == GPIO_DIR_OUT) { + if ((dir == GPIO_DIR_IN) || (dir == GPIO_DIR_OUT)) { ret = GpioSetDir(gpio, dir); if (ret != HDF_SUCCESS) { HDF_LOGE("%s: set gpio%d to %d dir failed, ret %d", __func__, gpio, dir, ret); @@ -132,7 +138,7 @@ static int32_t SetGpioDirAndLevel(int gpio, int dir, int level) } } - if (level == GPIO_VAL_LOW || level == GPIO_VAL_HIGH) { + if ((level == GPIO_VAL_LOW) || (level == GPIO_VAL_HIGH)) { ret = GpioWrite(gpio, level); if (ret != HDF_SUCCESS) { HDF_LOGE("%s: pull gpio%d to %d level failed, ret %d", __func__, gpio, level, ret); @@ -161,15 +167,20 @@ static int32_t SetGpio(uint16_t gpio, uint32_t dir, uint32_t status) return HDF_SUCCESS; } -int32_t HandlePowerEvent(ChipDevice *chipDev, uint32_t *timing) +static int32_t HandlePowerEvent(ChipDevice *chipDev, uint32_t *timing, uint32_t length) { int32_t ret = 0; uint16_t gpio; + + if (length <= PWR_DELAY_INDEX) { + HDF_LOGE("%s: invalid param", __func__); + return HDF_FAILURE; + } uint32_t type = timing[PWR_TYPE_INDEX]; uint32_t status = timing[PWR_STATUS_INDEX]; uint32_t dir = timing[PWR_DIR_INDEX]; uint32_t delay = timing[PWR_DELAY_INDEX]; - HDF_LOGD("%s: type = %d, status = %d, dir = %d, delay = %d", __func__, type, status, dir, delay); + HDF_LOGD("%s: type = %u, status = %u, dir = %u, delay = %u", __func__, type, status, dir, delay); switch (type) { case TYPE_VCC: @@ -253,7 +264,7 @@ static int32_t SetPowerOnTiming(ChipDevice *chipDev) } for (i = 0; i < pwrOnTiming.count / PWR_CELL_LEN; i++) { - ret = HandlePowerEvent(chipDev, pwrOnTiming.buf); + ret = HandlePowerEvent(chipDev, pwrOnTiming.buf, PWR_CELL_LEN); CHECK_RETURN_VALUE(ret); pwrOnTiming.buf = pwrOnTiming.buf + PWR_CELL_LEN; } @@ -273,12 +284,13 @@ static void EventHandle(TouchDriver *driver, ChipDevice *chipDev) } } -int32_t IrqHandle(uint16_t intGpioNum, void *data) +static int32_t IrqHandle(uint16_t intGpioNum, void *data) { TouchDriver *driver = (TouchDriver *)data; int ret = GpioDisableIrq(intGpioNum); if (ret != HDF_SUCCESS) { HDF_LOGE("%s: disable irq failed, ret %d", __func__, ret); + return HDF_FAILURE; } EventHandle(driver, driver->device); @@ -286,6 +298,7 @@ int32_t IrqHandle(uint16_t intGpioNum, void *data) ret = GpioEnableIrq(intGpioNum); if (ret != HDF_SUCCESS) { HDF_LOGE("%s: enable irq failed, ret %d", __func__, ret); + return HDF_FAILURE; } return HDF_SUCCESS; } @@ -302,6 +315,7 @@ static void InputFrameReport(TouchDriver *driver) input_report_abs(dev, ABS_MT_POSITION_X, frame->fingers[i].x); input_report_abs(dev, ABS_MT_POSITION_Y, frame->fingers[i].y); input_report_abs(dev, ABS_MT_TRACKING_ID, frame->fingers[i].trackId); + input_mt_sync(dev); } } @@ -320,8 +334,12 @@ static int32_t SetupChipIrq(ChipDevice *chipDev) uint16_t intGpioNum = chipDev->boardCfg->pins.intGpio; uint16_t irqFlag = chipDev->chipCfg->bus.chipI2c.irqFlag; + if (chipDev->driver == NULL) { + HDF_LOGE("%s: invalid param", __func__); + return HDF_FAILURE; + } irqFlag |= GPIO_IRQ_USING_THREAD; - HDF_LOGD("%s: gpioNum = %d, irqFlag = %d", __func__, intGpioNum, irqFlag); + HDF_LOGD("%s: gpioNum = %u, irqFlag = %u", __func__, intGpioNum, irqFlag); ret = GpioSetIrq(intGpioNum, irqFlag, IrqHandle, chipDev->driver); if (ret != 0) { HDF_LOGE("%s: register irq failed, ret %d", __func__, ret); @@ -349,6 +367,10 @@ static int32_t ChipDriverInit(ChipDevice *chipDev) CHECK_RETURN_VALUE(ret); HDF_LOGI("%s: chipDetect succ, ret = %d ", __func__, ret); + ret = chipDev->ops->UpdateFirmware(chipDev); + CHECK_RETURN_VALUE(ret); + HDF_LOGI("%s: update firmware success", __func__); + ret = SetupChipIrq(chipDev); CHECK_RETURN_VALUE(ret); return HDF_SUCCESS; @@ -377,12 +399,12 @@ static int32_t ChipMatchCheck(const ChipDevice *chipDev, const TouchDriver *driv const struct DeviceResourceNode *boardNode = driver->boardCfg->boardNode; const struct DeviceResourceNode *chipNode = chipDev->chipCfg->chipNode; - if (boardNode == NULL || boardNode->parent == NULL) { + if ((boardNode == NULL) || (boardNode->parent == NULL)) { HDF_LOGE("%s: board node or upper node is null", __func__); return HDF_FAILURE; } - if (chipNode == NULL || chipNode->parent == NULL || chipNode->parent->parent == NULL) { + if ((chipNode == NULL) || (chipNode->parent == NULL) || (chipNode->parent->parent == NULL)) { HDF_LOGE("%s: chip node or upper node is null ", __func__); return HDF_FAILURE; } @@ -410,7 +432,7 @@ static int32_t DeviceBindDriver(ChipDevice *chipDev) } } - if (ret == HDF_FAILURE || driver == NULL) { + if ((ret == HDF_FAILURE) || (driver == NULL)) { return HDF_FAILURE; } @@ -462,7 +484,7 @@ EXIT: static int32_t TouchGetDevType(TouchDriver *driver, struct HdfSBuf *reply) { uint32_t devType = driver->devType; - HDF_LOGI("%s: enter, devType is %d", __func__, devType); + HDF_LOGI("%s: enter, devType is %u", __func__, devType); bool ret = HdfSbufWriteUint32(reply, devType); if (!ret) { HDF_LOGE("%s: HdfSbufWriteUint32 failed", __func__); @@ -480,7 +502,7 @@ static int32_t TouchSetPowerStatus(TouchDriver *driver, struct HdfSBuf *data) return HDF_FAILURE; } driver->pwrStatus = pwrStatus; - HDF_LOGI("%s: set power status is %d", __func__, pwrStatus); + HDF_LOGI("%s: set power status is %u", __func__, pwrStatus); return HDF_SUCCESS; } @@ -492,14 +514,14 @@ static int32_t TouchGetPowerStatus(TouchDriver *driver, struct HdfSBuf *reply) HDF_LOGE("%s: HdfSbufWriteUint32 failed", __func__); return HDF_FAILURE; } - HDF_LOGI("%s: get power status is %d", __func__, pwrStatus); + HDF_LOGI("%s: get power status is %u", __func__, pwrStatus); return HDF_SUCCESS; } static int32_t TouchGetDeviceInfo(TouchDriver *driver, int32_t cmd, struct HdfSBuf *reply) { - const char *info; - if (driver->device == NULL || driver->device->chipCfg == NULL) { + const char *info = NULL; + if ((driver->device == NULL) || (driver->device->chipCfg == NULL)) { HDF_LOGE("%s: parameter invalid", __func__); return HDF_ERR_INVALID_PARAM; } @@ -537,7 +559,7 @@ static int32_t TouchSetGestureMode(TouchDriver *driver, struct HdfSBuf *data) return HDF_FAILURE; } driver->gestureMode = gestureMode; - HDF_LOGD("%s: set gesture mode is %d", __func__, gestureMode); + HDF_LOGD("%s: set gesture mode is %u", __func__, gestureMode); return HDF_SUCCESS; } @@ -560,7 +582,7 @@ static int32_t TouchSelfCapacitance(TouchDriver *driver, struct HdfSBuf *data, s HDF_LOGE("%s: HdfSbufWriteString failed", __func__); return HDF_FAILURE; } - HDF_LOGD("%s: capac test type is %d, test result is %s", __func__, capacTest.testType, capacTest.testResult); + HDF_LOGD("%s: capac test type is %u, test result is %s", __func__, capacTest.testType, capacTest.testResult); return HDF_SUCCESS; } @@ -585,10 +607,9 @@ static int32_t TouchRunExtraCmd(TouchDriver *driver, struct HdfSBuf *data) static int32_t HdfTouchDispatch(struct HdfDeviceIoClient *client, int32_t cmd, struct HdfSBuf *data, struct HdfSBuf *reply) { - (void)cmd; int32_t ret; TouchDriver *touchDriver = NULL; - if (client == NULL || client->device == NULL || data == NULL || reply == NULL) { + if ((client == NULL) || (client->device == NULL) || (data == NULL) || (reply == NULL)) { HDF_LOGE("%s: param is null", __func__); return HDF_FAILURE; } @@ -809,8 +830,7 @@ static void HdfTouchDriverRelease(struct HdfDeviceObject *device) } if (inputDev != NULL) { - (void)UnregisterInputDevice(inputDev); - OsalMemFree(inputDev); + UnregisterInputDevice(inputDev); driver->inputDev = NULL; } diff --git a/model/input/driver/hdf_touch.h b/model/input/driver/hdf_touch.h index 18f31a0f1..968f8201e 100644 --- a/model/input/driver/hdf_touch.h +++ b/model/input/driver/hdf_touch.h @@ -96,6 +96,7 @@ struct TouchChipOps { int32_t (*Resume)(ChipDevice *device); int32_t (*Suspend)(ChipDevice *device); int32_t (*DataHandle)(ChipDevice *device); + int32_t (*UpdateFirmware)(ChipDevice *device); }; typedef struct { diff --git a/model/input/driver/input_config_parser.c b/model/input/driver/input_config_parser.c index d6fb06e8d..f6c49ebab 100644 --- a/model/input/driver/input_config_parser.c +++ b/model/input/driver/input_config_parser.c @@ -20,6 +20,8 @@ #define DEFAULT_I2C_SPEED 400 #define DEFAULT_SPI_SPEED 10000 +#define I2C 0 +#define SPI 1 int32_t ParseKeyConfig(const struct DeviceResourceNode *node, KeyChipCfg *config) { @@ -71,7 +73,7 @@ static int32_t ParseBus(struct DeviceResourceIface *parser, const struct DeviceR ret = parser->GetUint8(busNode, "busType", &bus->busType, 0); CHECK_PARSER_RET(ret, "GetUint8"); - if (bus->busType == 0) { + if (bus->busType == I2C) { ret = parser->GetUint8(busNode, "busNum", &bus->i2c.busNum, 0); CHECK_PARSER_RET(ret, "GetUint8"); ret = parser->GetUint16(busNode, "clkGpio", &bus->i2c.clkGpio, 0); @@ -82,7 +84,7 @@ static int32_t ParseBus(struct DeviceResourceIface *parser, const struct DeviceR CHECK_PARSER_RET(ret, "GetUint32Array"); ret = parser->GetUint32Array(busNode, "i2cDataIomux", bus->i2c.i2cDataReg, REG_CONFIG_LEN, 0); CHECK_PARSER_RET(ret, "GetUint32Array"); - } else if (bus->busType == 1) { + } else if (bus->busType == SPI) { ret = parser->GetUint8(busNode, "busNum", &bus->spi.busNum, 0); CHECK_PARSER_RET(ret, "GetUint8"); ret = parser->GetUint16(busNode, "clkGpio", &bus->spi.clkGpio, 0); @@ -274,7 +276,7 @@ int32_t ParseTouchChipConfig(const struct DeviceResourceNode *node, TouchChipCfg CHECK_PARSER_RET(ret, "GetUint16"); ret = parser->GetUint8(node, "busType", &config->bus.busType, 0); CHECK_PARSER_RET(ret, "GetUint8"); - if (config->bus.busType == 0) { + if (config->bus.busType == I2C) { ret = parser->GetUint16(node, "irqFlag", &config->bus.chipI2c.irqFlag, 0); CHECK_PARSER_RET(ret, "GetUint16"); ret = parser->GetUint32(node, "deviceAddr", &config->bus.chipI2c.commAddr, 0); diff --git a/model/input/driver/touchscreen/touch_ft6336.c b/model/input/driver/touchscreen/touch_ft6336.c index cf99b79bd..87a006fbe 100644 --- a/model/input/driver/touchscreen/touch_ft6336.c +++ b/model/input/driver/touchscreen/touch_ft6336.c @@ -41,7 +41,7 @@ static int32_t ChipDetect(ChipDevice *device) CHIP_CHECK_RETURN(ret); ret = InputI2cRead(i2cClient, ®Addr, 1, ®Value, 1); CHIP_CHECK_RETURN(ret); - HDF_LOGI("%s: Report rate is %d * 10", __func__, regValue); + HDF_LOGI("%s: Report rate is %u * 10", __func__, regValue); regAddr = FTS_REG_FW_VER; ret = InputI2cWrite(i2cClient, ®Addr, 1); @@ -55,7 +55,7 @@ static int32_t ChipDetect(ChipDevice *device) CHIP_CHECK_RETURN(ret); ret = InputI2cRead(i2cClient, ®Addr, 1, ®Value, 1); CHIP_CHECK_RETURN(ret); - HDF_LOGI("%s: Chip ID is %d", __func__, regValue); + HDF_LOGI("%s: Chip ID is %u", __func__, regValue); (void)ChipInit(device); (void)ChipResume(device); diff --git a/model/input/driver/touchscreen/touch_gt911.c b/model/input/driver/touchscreen/touch_gt911.c index 04edebf49..9736112ef 100644 --- a/model/input/driver/touchscreen/touch_gt911.c +++ b/model/input/driver/touchscreen/touch_gt911.c @@ -80,6 +80,8 @@ static int ChipCleanBuffer(InputI2cClient *i2cClient) return ret; } +#define X_OFFSET 1 + static void ParsePointData(ChipDevice *device, FrameData *frame, uint8_t *buf, uint8_t pointNum) { int32_t chipVer = device->chipCfg->chipVersion; @@ -89,10 +91,15 @@ static void ParsePointData(ChipDevice *device, FrameData *frame, uint8_t *buf, u for (i = 0; i < pointNum; i++) { if (chipVer == 0) { // chipversion A:gt911_zsj5p5 + frame->fingers[i].trackId = buf[GT_POINT_SIZE * i + GT_TRACK_ID]; frame->fingers[i].y = (buf[GT_POINT_SIZE * i + GT_X_LOW] & ONE_BYTE_MASK) | ((buf[GT_POINT_SIZE * i + GT_X_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET); frame->fingers[i].x = (buf[GT_POINT_SIZE * i + GT_Y_LOW] & ONE_BYTE_MASK) | ((buf[GT_POINT_SIZE * i + GT_Y_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET); + if (frame->fingers[i].x == 0) { + frame->fingers[i].x = X_OFFSET; + } + HDF_LOGD("%s: x = %d, y = %d", __func__, frame->fingers[i].x, frame->fingers[i].y); } else if (chipVer == 1) { // chipversion B:gt911_zsj4p0 frame->fingers[i].x = resX - 1 - ((buf[GT_POINT_SIZE * i + GT_X_LOW] & ONE_BYTE_MASK) | ((buf[GT_POINT_SIZE * i + GT_X_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET)); @@ -137,7 +144,7 @@ static int32_t ChipDataHandle(ChipDevice *device) reg[1] = GT_X_LOW_BYTE_BASE & ONE_BYTE_MASK; pointNum = touchStatus & GT_FINGER_NUM_MASK; if (pointNum == 0 || pointNum > MAX_SUPPORT_POINT) { - HDF_LOGE("%s: pointNum is invalid, %d", __func__, pointNum); + HDF_LOGE("%s: pointNum is invalid, %u", __func__, pointNum); (void)ChipCleanBuffer(i2cClient); OsalMutexUnlock(&device->driver->mutex); return HDF_FAILURE; @@ -155,12 +162,25 @@ EXIT: return HDF_SUCCESS; } +static int32_t UpdateFirmware(ChipDevice *device) +{ + int32_t ret; + InputI2cClient *i2cClient = &device->driver->i2cClient; + ret = InputI2cWrite(i2cClient, firmWareParm, FIRMWARE_LEN); + if (ret < 0) { + return HDF_FAILURE; + } + HDF_LOGI("%s: update firmware success\n", __func__); + return HDF_SUCCESS; +} + static struct TouchChipOps g_gt911ChipOps = { .Init = ChipInit, .Detect = ChipDetect, .Resume = ChipResume, .Suspend = ChipSuspend, .DataHandle = ChipDataHandle, + .UpdateFirmware = UpdateFirmware, }; static TouchChipCfg *ChipConfigInstance(struct HdfDeviceObject *device) diff --git a/model/input/driver/touchscreen/touch_gt911.h b/model/input/driver/touchscreen/touch_gt911.h index c89a344db..ebb3abf01 100644 --- a/model/input/driver/touchscreen/touch_gt911.h +++ b/model/input/driver/touchscreen/touch_gt911.h @@ -10,20 +10,21 @@ #define TOUCH_GT911_H /* the macro defines of GT911 */ -#define MAX_SUPPORT_POINT 10 +#define MAX_SUPPORT_POINT 5 #define ONE_BYTE_MASK 0xFF #define ONE_BYTE_OFFSET 8 #define GT_EVENT_UP 0x80 #define GT_EVENT_INVALID 0 #define GT_POINT_SIZE 8 -#define GT_X_LOW 0 -#define GT_X_HIGH 1 -#define GT_Y_LOW 2 -#define GT_Y_HIGH 3 +#define GT_TRACK_ID 0 +#define GT_X_LOW 1 +#define GT_X_HIGH 2 +#define GT_Y_LOW 3 +#define GT_Y_HIGH 4 #define GT_ADDR_LEN 2 #define GT_BUF_STATE_ADDR 0x814E -#define GT_X_LOW_BYTE_BASE 0x8150 +#define GT_X_LOW_BYTE_BASE 0x814F #define GT_FINGER_NUM_MASK 0x0F #define GT_CLEAN_DATA_LEN 3 #define GT_REG_HIGH_POS 0 @@ -43,5 +44,23 @@ #define GT_SOLU_X_HIGH 7 #define GT_SOLU_Y_LOW 8 #define GT_SOLU_Y_HIGH 9 +#define FIRMWARE_LEN 188 + +uint8_t firmWareParm[FIRMWARE_LEN] = { + 0x80, 0x47, 0x45, 0xC0, 0x03, 0xE0, 0x01, 0x05, 0x3D, 0x00, 0x01, 0x08, 0x28, 0x0F, + 0x50, 0x32, 0x03, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1A, 0x1E, + 0x14, 0x86, 0x26, 0x08, 0x55, 0x57, 0xB2, 0x04, 0x00, 0x00, 0x00, 0x42, 0x02, 0x11, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x78, 0x94, + 0xD5, 0x02, 0x07, 0x00, 0x00, 0x04, 0x97, 0x40, 0x00, 0x8A, 0x4A, 0x00, 0x80, 0x55, + 0x00, 0x77, 0x61, 0x00, 0x6F, 0x70, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x0E, 0x0C, 0x0A, 0x08, 0x06, 0x04, 0x02, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1D, 0x00, 0x02, 0x04, 0x06, + 0x08, 0x0A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5C, 0x01 +}; #endif \ No newline at end of file -- Gitee