diff --git a/common/inc/pwrbuffer.h b/common/inc/pwrbuffer.h index d0a51c2439d462cfc767fd2d73662543d6b3df1b..0dac160fcdc38576dfc6f08a3dffeecab2f8297b 100644 --- a/common/inc/pwrbuffer.h +++ b/common/inc/pwrbuffer.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: diff --git a/common/inc/pwrdata.h b/common/inc/pwrdata.h index e7ec89b1c683305a435d39c9ebe9cbbebfbc1485..32198c23b110917d5bf7e7e3dde2b20b558261d6 100644 --- a/common/inc/pwrdata.h +++ b/common/inc/pwrdata.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: @@ -68,12 +68,66 @@ typedef enum PWR_CPU_FREQ_GOV { PWR_CPU_FREQ_GOV_PERFORMANCE = 5, // performance governor PWR_CPU_FREQ_GOV_SCHEDUTIL, // schedutil governor PWR_CPU_FREQ_GOV_SEEP, // seep governor -} PWR_CPU_FREQ_GOV;*/ +} PWR_CPU_FREQ_GOV; */ + typedef struct PWR_CPU_FreqAbility { char curDriver[MAX_ELEMENT_NAME_LEN]; - int avGovNum; + int avGovNum; int avGovList[MAX_GOV_NUM][MAX_ELEMENT_NAME_LEN]; + int freqDomainNum; + int freqDomainStep; + char freqDomain[0]; } PWR_CPU_FreqAbility; + +typedef struct PWR_CPU_CurFreq { + int policyId; + int curFreq; +} PWR_CPU_CurFreq; + +typedef struct PWR_NET_Eth { + char ethName[MAX_ELEMENT_NAME_LEN]; + int ethMaxSpeed; + int ethCurSpeed; +} PWR_NET_Eth; + +typedef struct PWR_NET_Info { + int ethNum; + PWR_NET_Eth eth[]; +} PWR_NET_Info; + +typedef struct PWR_NET_Through { + double rx; + double tx; +} PWR_NET_Through; + +// DISK + +typedef struct PWR_DISK_Load { + char diskId[MAX_ELEMENT_NAME_LEN]; + uint32_t rLoad; + uint32_t wLoad; +} PWR_DISK_Load; + +typedef struct PWR_DISK_PwrLevel { + char diskId[MAX_ELEMENT_NAME_LEN]; + uint16_t powerLevel; + uint16_t spindownLevel; +} PWR_DISK_PwrLevel; + + +typedef struct PWR_DISK_ScsiPolicy { + char scsiId[MAX_ELEMENT_NAME_LEN]; + int alpm; +} PWR_DISK_ScsiPolicy; + +// USB +typedef struct PWR_USB_AutoSuspend { + char usbId[MAX_ELEMENT_NAME_LEN]; + int control; + int autoSuspendDelay; + int wakeup; +} PWR_USB_AutoSuspend; + #endif diff --git a/common/inc/pwrerr.h b/common/inc/pwrerr.h index 4c5f77285e9e260df0e8d84886ffa3330edcec9a..0a659fafae7843d7cd38692e67250973322472c2 100644 --- a/common/inc/pwrerr.h +++ b/common/inc/pwrerr.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: @@ -15,6 +15,9 @@ #ifndef __POWERAPI_ERR_H__ #define __POWERAPI_ERR_H__ +#define TRUE 1 +#define FALSE 0 + enum RtnCode { SUCCESS = 0, ERR_COMMON = 1, diff --git a/common/inc/pwrmsg.h b/common/inc/pwrmsg.h index 19e4b3e62e97c77738da6a3abf06e26ec83c4098..3fb39d6184d8e74328efacb5cdb3bfb400191c25 100644 --- a/common/inc/pwrmsg.h +++ b/common/inc/pwrmsg.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: @@ -47,15 +47,29 @@ typedef struct PwrMsg { } PwrMsg; enum OperationType { - CPU_GET_INFO = 1, + CPU_GET_INFO = 100, CPU_GET_USAGE, CPU_GET_CACHE_MISS, CPU_GET_FREQ_ABILITY, CPU_GET_FREQ_GOVERNOR, CPU_SET_FREQ_GOVERNOR, + CPU_GET_CUR_FREQ, + CPU_SET_CUR_FREQ, CPU_GET_DMA_LATENCY, CPU_SET_DMA_LATENCY, - DISK_GET_IO_RATE = 30, + DISK_GET_IO_RATE = 200, + DISK_GET_LIST, + DISK_GET_LOAD, + DISK_GET_POWER_LEVEL, + DISK_SET_POWER_LEVEL, + DISK_GET_SCSI_POLICY, + DISK_SET_SCSI_POLICY, + NET_GET_INFO = 300, + NET_GET_THROUGH, + NET_GET_SPEED_MOD, + NET_SET_SPEED_MOD, + USB_GET_AUTO_SUSPEND = 400, + USB_SET_AUTO_SUSPEND, // todo }; enum DataFormat { @@ -85,8 +99,7 @@ int InitMsgFactory(); void DestroyMsgFactory(); int GenerateRspMsg(PwrMsg *req, PwrMsg *rsp, int rspCode, char *data, int dataLen); -#define TRUE 1 -#define FALSE 0 + typedef struct ThreadInfo { pthread_t tid; int keepRunning; diff --git a/pwrapic/inc/powerapi.h b/pwrapic/inc/powerapi.h index 5d3121f471012aa39de2e968e039fa09f97e13ba..ed80017f80e37474e56396e5b725c55b89d7d5cf 100644 --- a/pwrapic/inc/powerapi.h +++ b/pwrapic/inc/powerapi.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: @@ -35,13 +35,32 @@ PWR_API int PWR_UnRegister(); // CPU PWR_API int PWR_CPU_GetInfo(PWR_CPU_Info *cpuInfo); PWR_API int PWR_CPU_GetUsage(PWR_CPU_Usage *usage, uint32_t bufferSize); -PWR_API int PWR_CPU_GetFreqAbility(PWR_CPU_FreqAbility *freqAbi); -PWR_API int PWR_CPU_GetFreqGovernor(char gov[], uint32_t size); // len: MAX_ELEMENT_LEN +PWR_API int PWR_CPU_GetFreqAbility(PWR_CPU_FreqAbility *freqAbi, uint32_t bufferSize); +PWR_API int PWR_CPU_GetFreqGovernor(char gov[], uint32_t size); // len: MAX_ELEMENT_NAME_LEN PWR_API int PWR_CPU_SetFreqGovernor(char gov[]); - -PWR_API int PWR_CPU_DmaGetLatency(int *latency); // unit: us +PWR_API int PWR_CPU_GetFreq(PWR_CPU_CurFreq curFreq[], uint32_t *len, int spec); +PWR_API int PWR_CPU_SetFreq(PWR_CPU_CurFreq curFreq[], uint32_t len); +PWR_API int PWR_CPU_DmaGetLatency(int *latency); // unit: us PWR_API int PWR_CPU_DmaSetLatency(int latency); +// Disk +PWR_API int PWR_DISK_GetList(char diskList[][MAX_ELEMENT_NAME_LEN], uint32_t *len); +PWR_API int PWR_DISK_GetLoad(PWR_DISK_Load load[], uint32_t *len, int spec); +PWR_API int PWR_DISK_GetPwrLevel(PWR_DISK_PwrLevel pwrLevel[], uint32_t *len, int spec); +PWR_API int PWR_DISK_SetPwrLevel(PWR_DISK_PwrLevel pwrLevel[], uint32_t len); +PWR_API int PWR_DISK_GetScsiPolicy(PWR_DISK_ScsiPolicy scsiPolicy[], uint32_t *len, int spec); +PWR_API int PWR_DISK_SetScsiPolicy(PWR_DISK_ScsiPolicy scsiPolicy[], uint32_t len); + +// NET +PWR_API int PWR_NET_GetInfo(PWR_NET_Info *netInfo, uint32_t bufferSize); +PWR_API int PWR_NET_GetThrouth(char ethName[], PWR_NET_Through *ethThrough); +PWR_API int PWR_NET_GetSpeedMod(char ethName[], uint32_t *speedMod); +PWR_API int PWR_NET_SetSpeedMod(char ethName[], uint32_t speedMod); + +// USB +PWR_API int PWR_USB_GetAutoSuspend(PWR_USB_AutoSuspend usbAts[], uint32_t *len); +PWR_API int PWR_USB_SetAutoSuspend(PWR_USB_AutoSuspend usbAts[], uint32_t len); + #ifdef __cplusplus } #endif diff --git a/pwrapic/inc/pwrcpu.h b/pwrapic/inc/pwrcpu.h index 9380a31811875f508d3b42e9ac45f8bfae283689..1781f82bf261ba4ba24905d90d7534039761f7a8 100644 --- a/pwrapic/inc/pwrcpu.h +++ b/pwrapic/inc/pwrcpu.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: @@ -18,9 +18,11 @@ #include "powerapi.h" int GetCpuInfo(PWR_CPU_Info *cpuInfo); int GetCpuUsage(PWR_CPU_Usage *usage, uint32_t bufferSize); -int GetCpuFreqAbility(PWR_CPU_FreqAbility *freqAbi); +int GetCpuFreqAbility(PWR_CPU_FreqAbility *freqAbi, uint32_t bufferSize); int GetCpuFreqGovernor(char gov[], uint32_t size); int SetCpuFreqGovernor(char gov[], uint32_t size); +int GetCpuCurFreq(PWR_CPU_CurFreq curFreq[], uint32_t *len, int spec); +int SetCpuCurFreq(PWR_CPU_CurFreq curFreq[], uint32_t len); int GetCpuDmaLatency(int *latency); int SetCpuDmaLatency(int latency); #endif diff --git a/pwrapic/inc/pwrdisk.h b/pwrapic/inc/pwrdisk.h new file mode 100644 index 0000000000000000000000000000000000000000..314c00fb876b6ca058dd8b08c380cf8c71ae2de9 --- /dev/null +++ b/pwrapic/inc/pwrdisk.h @@ -0,0 +1,26 @@ +/* ***************************************************************************** + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. + * PowerAPI licensed under the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR + * PURPOSE. + * See the Mulan PSL v2 for more details. + * Author: queyanwen + * Create: 2022-06-23 + * Description: Provide service for PowerAPI refer to disk. + * **************************************************************************** */ +#ifndef __POWERAPI_DISK_H__ +#define __POWERAPI_DISK_H__ + +#include "powerapi.h" + +int GetDiskList(char diskList[][MAX_ELEMENT_NAME_LEN], uint32_t *len); +int GetDiskLoad(PWR_DISK_Load load[], uint32_t *len, int spec); +int GetDiskPwrLevel(PWR_DISK_PwrLevel pwrLevel[], uint32_t *len, int spec); +int SetDiskPwrLevel(PWR_DISK_PwrLevel pwrLevel[], uint32_t len); +int GetDiskScsiPolicy(PWR_DISK_ScsiPolicy scsiPolicy[], uint32_t *len, int spec); +int SetDiskScsiPolicy(PWR_DISK_ScsiPolicy scsiPolicy[], uint32_t len); +#endif diff --git a/pwrapic/inc/pwrlog.h b/pwrapic/inc/pwrlog.h index f882d0fc634d1fd0da660f669f03201e72653490..c8a570a18929456ca65545b6860b1ea8bfa71d45 100644 --- a/pwrapic/inc/pwrlog.h +++ b/pwrapic/inc/pwrlog.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: diff --git a/pwrapic/inc/pwrnet.h b/pwrapic/inc/pwrnet.h new file mode 100644 index 0000000000000000000000000000000000000000..ffda8fe3a26e89016ef2b9d4a3afdbf17c3d3d1e --- /dev/null +++ b/pwrapic/inc/pwrnet.h @@ -0,0 +1,25 @@ +/* ***************************************************************************** + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. + * PowerAPI licensed under the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR + * PURPOSE. + * See the Mulan PSL v2 for more details. + * Author: queyanwen + * Create: 2022-06-23 + * Description: Provide service for PowerAPI refer to NET. + * **************************************************************************** */ +#ifndef __POWERAPI_NET_H__ +#define __POWERAPI_NET_H__ + +#include "powerapi.h" + +int GetNetInfo(PWR_NET_Info *netInfo, uint32_t bufferSize); +int GetNetThrough(char ethName[], PWR_NET_Through *ethThrough); +int GetNetSpeedMod(char ethName[], uint32_t *speedMod); +int SetNetSpeedMod(char ethName[], uint32_t speedMod); + +#endif diff --git a/pwrapic/inc/pwrusb.h b/pwrapic/inc/pwrusb.h new file mode 100644 index 0000000000000000000000000000000000000000..87e3eb1d65a16a7b4a3391590003ae9df32438ff --- /dev/null +++ b/pwrapic/inc/pwrusb.h @@ -0,0 +1,22 @@ +/* ***************************************************************************** + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. + * PowerAPI licensed under the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR + * PURPOSE. + * See the Mulan PSL v2 for more details. + * Author: queyanwen + * Create: 2022-06-23 + * Description: Provide service for PowerAPI refer to USB. + * **************************************************************************** */ +#ifndef __POWERAPI_USB_H__ +#define __POWERAPI_USB_H__ + +#include "powerapi.h" + +int GetUsbAutoSuspend(PWR_USB_AutoSuspend usbAts[], uint32_t *len); +int SetUsbAutoSuspend(PWR_USB_AutoSuspend usbAts[], uint32_t len); +#endif diff --git a/pwrapic/inc/sockclient.h b/pwrapic/inc/sockclient.h index 7cd957cfb596a02dff4d44a952e85a9fd4d07b26..87bc601cd4c45084b7ad330032e9749ec2013055 100644 --- a/pwrapic/inc/sockclient.h +++ b/pwrapic/inc/sockclient.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: @@ -25,7 +25,7 @@ typedef struct ReqInputParam { typedef struct RspOutputParam { uint32_t *rspBuffSize; - char * rspData; + char *rspData; } RspOutputParam; int InitSockClient(); diff --git a/pwrapic/src/powerapi.c b/pwrapic/src/powerapi.c index 20cf1e4d7ccc187e807eb69a6fa3325e6457beae..e20a77a9fb5f6284cb6d64d1abf13a144e4d9ed8 100644 --- a/pwrapic/src/powerapi.c +++ b/pwrapic/src/powerapi.c @@ -19,21 +19,26 @@ #include "pwrlog.h" #include "sockclient.h" #include "pwrcpu.h" +#include "pwrdisk.h" +#include "pwrnet.h" +#include "pwrusb.h" static int g_registed = 0; -#define CHECK_STATUS() { \ - if (!g_registed) { \ - PwrLog(ERROR, "Not Registed."); \ - return ERR_NOT_REGISTED; \ - } \ -} +#define CHECK_STATUS() \ + { \ + if (!g_registed) { \ + PwrLog(ERROR, "Not Registed."); \ + return ERR_NOT_REGISTED; \ + } \ + } -#define CHECK_NULL_POINTER(p) { \ - if (!(p)) { \ - return ERR_NULL_POINTER; \ - } \ -} +#define CHECK_NULL_POINTER(p) \ + { \ + if (!(p)) { \ + return ERR_NULL_POINTER; \ + } \ + } static void DefaultLogCallback(int level, const char *fmt, va_list vl) { @@ -81,20 +86,23 @@ int PWR_CPU_GetUsage(PWR_CPU_Usage *usage, uint32_t bufferSize) { CHECK_STATUS(); CHECK_NULL_POINTER(usage); - if (bufferSize < sizeof(PWR_CPU_Usage)) { return ERR_INVALIDE_PARAM; } - return GetCpuUsage(usage, bufferSize);; + return GetCpuUsage(usage, bufferSize); + ; } -int PWR_CPU_GetFreqAbility(PWR_CPU_FreqAbility *freqAbi) +int PWR_CPU_GetFreqAbility(PWR_CPU_FreqAbility *freqAbi, uint32_t bufferSize) { CHECK_STATUS(); CHECK_NULL_POINTER(freqAbi); + if (bufferSize < sizeof(PWR_CPU_FreqAbility)) { + return ERR_INVALIDE_PARAM; + } - return GetCpuFreqAbility(freqAbi); + return GetCpuFreqAbility(freqAbi, bufferSize); } int PWR_CPU_GetFreqGovernor(char gov[], uint32_t size) @@ -119,6 +127,28 @@ int PWR_CPU_SetFreqGovernor(char gov[]) return SetCpuFreqGovernor(gov, strlen(gov) + 1); } +int PWR_CPU_GetFreq(PWR_CPU_CurFreq curFreq[], uint32_t *len, int spec) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(curFreq); + if (!len || *len == 0 || (spec != TRUE && spec != FALSE)) { + return ERR_INVALIDE_PARAM; + } + + return GetCpuCurFreq(curFreq, len, spec); +} + +int PWR_CPU_SetFreq(PWR_CPU_CurFreq curFreq[], uint32_t len) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(curFreq); + if (len == 0) { + return ERR_INVALIDE_PARAM; + } + + return SetCpuCurFreq(curFreq, len); +} + int PWR_CPU_DmaGetLatency(int *latency) { CHECK_STATUS(); @@ -136,3 +166,140 @@ int PWR_CPU_DmaSetLatency(int latency) return SetCpuDmaLatency(latency); } + + +// Disk +int PWR_DISK_GetList(char diskList[][MAX_ELEMENT_NAME_LEN], uint32_t *len) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(diskList); + if (!len || *len == 0) { + return ERR_INVALIDE_PARAM; + } + + return GetDiskList(diskList, len); +} + +int PWR_DISK_GetLoad(PWR_DISK_Load load[], uint32_t *len, int spec) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(load); + if (!len || *len == 0 || (spec != TRUE && spec != FALSE)) { + return ERR_INVALIDE_PARAM; + } + + return GetDiskLoad(load, len, spec); +} + +int PWR_DISK_GetPwrLevel(PWR_DISK_PwrLevel pwrLevel[], uint32_t *len, int spec) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(pwrLevel); + if (!len || *len == 0 || (spec != TRUE && spec != FALSE)) { + return ERR_INVALIDE_PARAM; + } + + return GetDiskPwrLevel(pwrLevel, len, spec); +} + +int PWR_DISK_SetPwrLevel(PWR_DISK_PwrLevel pwrLevel[], uint32_t len) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(pwrLevel); + if (len == 0) { + return ERR_INVALIDE_PARAM; + } + + return SetDiskPwrLevel(pwrLevel, len); +} + +int PWR_DISK_GetScsiPolicy(PWR_DISK_ScsiPolicy scsiPolicy[], uint32_t *len, int spec) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(scsiPolicy); + if (!len || *len == 0 || (spec != TRUE && spec != FALSE)) { + return ERR_INVALIDE_PARAM; + } + + return GetDiskScsiPolicy(scsiPolicy, len, spec); +} + +int PWR_DISK_SetScsiPolicy(PWR_DISK_ScsiPolicy scsiPolicy[], uint32_t len) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(scsiPolicy); + if (len == 0) { + return ERR_INVALIDE_PARAM; + } + + return SetDiskScsiPolicy(scsiPolicy, len); +} + + +// NET +int PWR_NET_GetInfo(PWR_NET_Info *netInfo, uint32_t bufferSize) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(netInfo); + if (bufferSize <= sizeof(PWR_NET_Info)) { + return ERR_INVALIDE_PARAM; + } + + return GetNetInfo(netInfo, bufferSize); +} + +int PWR_NET_GetThrouth(char ethName[], PWR_NET_Through *ethThrough) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(ethName); + CHECK_NULL_POINTER(ethThrough); + + if (strlen(ethName) == 0 || strlen(ethName) >= MAX_ELEMENT_NAME_LEN) { + return ERR_INVALIDE_PARAM; + } + + return GetNetThrough(ethName, ethThrough); +} + +int PWR_NET_GetSpeedMod(char ethName[], uint32_t *speedMod) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(ethName); + CHECK_NULL_POINTER(speedMod); + if (strlen(ethName) == 0 || strlen(ethName) >= MAX_ELEMENT_NAME_LEN) { + return ERR_INVALIDE_PARAM; + } + return GetNetSpeedMod(ethName, speedMod); +} + +int PWR_NET_SetSpeedMod(char ethName[], uint32_t speedMod) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(ethName); + // todo 限制speedMod取值 100 1000 10000 + return SetNetSpeedMod(ethName, speedMod); +} + + +// USB +int PWR_USB_GetAutoSuspend(PWR_USB_AutoSuspend usbAts[], uint32_t *len) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(usbAts); + if (!len || *len == 0) { + return ERR_INVALIDE_PARAM; + } + + return GetUsbAutoSuspend(usbAts, len); +} + +int PWR_USB_SetAutoSuspend(PWR_USB_AutoSuspend usbAts[], uint32_t len) +{ + CHECK_STATUS(); + CHECK_NULL_POINTER(usbAts); + if (len == 0) { + return ERR_INVALIDE_PARAM; + } + + return SetUsbAutoSuspend(usbAts, len); +} diff --git a/pwrapic/src/pwrcpu.c b/pwrapic/src/pwrcpu.c index 89fe49af62c702fa7b9e79650c10dcab4e1d74b8..753693975122ab76b29ed361f6f9103a8c1af42e 100644 --- a/pwrapic/src/pwrcpu.c +++ b/pwrapic/src/pwrcpu.c @@ -62,20 +62,24 @@ int GetCpuUsage(PWR_CPU_Usage *usage, uint32_t bufferSize) return SUCCESS; } -int GetCpuFreqAbility(PWR_CPU_FreqAbility *freqAbi) +int GetCpuFreqAbility(PWR_CPU_FreqAbility *freqAbi, uint32_t bufferSize) { ReqInputParam input; input.optType = CPU_GET_FREQ_ABILITY; input.dataLen = 0; input.data = NULL; RspOutputParam output; - uint32_t size = sizeof(PWR_CPU_FreqAbility); + uint32_t size = bufferSize; output.rspBuffSize = &size; output.rspData = (void *)freqAbi; int ret = SendReqAndWaitForRsp(input, output); if (ret != SUCCESS) { PwrLog(ERROR, "GetCpuFreqAbility failed. ret:%d", ret); + if (freqAbi->freqDomainStep != 0) { + // Remediate the data to avoid error happens in buffersize is smaller then real data length. + freqAbi->freqDomainNum = (size - sizeof(PWR_CPU_FreqAbility)) / freqAbi->freqDomainStep; + } } else { PwrLog(DEBUG, "GetCpuFreqAbility Succeed."); } @@ -126,6 +130,52 @@ int SetCpuFreqGovernor(char gov[], uint32_t size) return ret; } +int GetCpuCurFreq(PWR_CPU_CurFreq curFreq[], uint32_t *len, int spec) +{ + uint32_t size = sizeof(PWR_CPU_CurFreq) * (*len); + ReqInputParam input; + input.optType = CPU_GET_CUR_FREQ; + if (spec) { + input.dataLen = size; + input.data = (char *)curFreq; + } else { + input.dataLen = 0; + input.data = NULL; + } + + RspOutputParam output; + output.rspBuffSize = &size; + output.rspData = (void *)curFreq; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "SetCpuCurFreq failed. ret:%d", ret); + *len = size / sizeof(PWR_CPU_CurFreq); + } else { + PwrLog(DEBUG, "SetCpuCurFreq Succeed."); + } + return ret; +} + +int SetCpuCurFreq(PWR_CPU_CurFreq curFreq[], uint32_t len) +{ + ReqInputParam input; + input.optType = CPU_SET_CUR_FREQ; + input.dataLen = sizeof(PWR_CPU_CurFreq) * len; + input.data = (char *)curFreq; + RspOutputParam output; + output.rspBuffSize = NULL; + output.rspData = NULL; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "SetCpuCurFreq failed. ret:%d", ret); + } else { + PwrLog(DEBUG, "SetCpuCurFreq Succeed."); + } + return ret; +} + int GetCpuDmaLatency(int *latency) { ReqInputParam input; diff --git a/pwrapic/src/pwrdisk.c b/pwrapic/src/pwrdisk.c new file mode 100644 index 0000000000000000000000000000000000000000..83d272245ed601c20d3de4c3e688baa4a3626e03 --- /dev/null +++ b/pwrapic/src/pwrdisk.c @@ -0,0 +1,158 @@ +/* ***************************************************************************** + * Copyright (c) Huawei Technologies Co., Ltd. 2021-2022 All rights reserved. + * PowerAPI licensed under the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR + * PURPOSE. + * See the Mulan PSL v2 for more details. + * Author: queyanwen + * Create: 2022-06-23 + * Description: Provide service for PowerAPI refer to disk. + * **************************************************************************** */ + +#include "pwrdisk.h" +#include +#include "pwrlog.h" +#include "pwrerr.h" +#include "sockclient.h" + +int GetDiskList(char diskList[][MAX_ELEMENT_NAME_LEN], uint32_t *len) +{ + ReqInputParam input; + input.optType = DISK_GET_LIST; + input.dataLen = 0; + input.data = NULL; + + RspOutputParam output; + uint32_t size = MAX_ELEMENT_NAME_LEN * (*len); + output.rspBuffSize = &size; + output.rspData = (void *)diskList; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "GetDiskList failed. ret:%d", ret); + *len = size / MAX_ELEMENT_NAME_LEN; + } else { + PwrLog(DEBUG, "GetDiskList Succeed."); + } + return ret; +} + +int GetDiskLoad(PWR_DISK_Load load[], uint32_t *len, int spec) +{ + uint32_t size = sizeof(PWR_DISK_Load) * (*len); + ReqInputParam input; + input.optType = DISK_GET_LOAD; + if (spec) { + input.dataLen = size; + input.data = (char *)load; + } else { + input.dataLen = 0; + input.data = NULL; + } + RspOutputParam output; + output.rspBuffSize = &size; + output.rspData = (void *)load; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "GetDiskLoad failed. ret:%d", ret); + *len = size / sizeof(PWR_DISK_Load); + } else { + PwrLog(DEBUG, "GetDiskLoad Succeed."); + } + return ret; +} + +int GetDiskPwrLevel(PWR_DISK_PwrLevel pwrLevel[], uint32_t *len, int spec) +{ + uint32_t size = sizeof(PWR_DISK_PwrLevel) * (*len); + ReqInputParam input; + input.optType = DISK_GET_POWER_LEVEL; + if (spec) { + input.dataLen = size; + input.data = (char *)pwrLevel; + } else { + input.dataLen = 0; + input.data = NULL; + } + RspOutputParam output; + output.rspBuffSize = &size; + output.rspData = (void *)pwrLevel; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "GetDiskPwrLevel failed. ret:%d", ret); + *len = size / sizeof(PWR_DISK_PwrLevel); + } else { + PwrLog(DEBUG, "GetDiskPwrLevel Succeed."); + } + return ret; +} + +int SetDiskPwrLevel(PWR_DISK_PwrLevel pwrLevel[], uint32_t len) +{ + ReqInputParam input; + input.optType = DISK_SET_POWER_LEVEL; + input.dataLen = sizeof(PWR_DISK_PwrLevel) * len; + input.data = (char *)pwrLevel; + RspOutputParam output; + output.rspBuffSize = NULL; + output.rspData = NULL; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "SetDiskPwrLevel failed. ret:%d", ret); + } else { + PwrLog(DEBUG, "SetDiskPwrLevel Succeed."); + } + return ret; +} + +int GetDiskScsiPolicy(PWR_DISK_ScsiPolicy scsiPolicy[], uint32_t *len, int spec) +{ + uint32_t size = sizeof(PWR_DISK_ScsiPolicy) * (*len); + ReqInputParam input; + input.optType = DISK_GET_SCSI_POLICY; + if (spec) { + input.dataLen = size; + input.data = (char *)scsiPolicy; + } else { + input.dataLen = 0; + input.data = NULL; + } + RspOutputParam output; + output.rspBuffSize = &size; + output.rspData = (void *)scsiPolicy; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "GetDiskScsiPolicy failed. ret:%d", ret); + *len = size / sizeof(PWR_DISK_ScsiPolicy); + } else { + PwrLog(DEBUG, "GetDiskScsiPolicy Succeed."); + } + return ret; +} + +int SetDiskScsiPolicy(PWR_DISK_ScsiPolicy scsiPolicy[], uint32_t len) +{ + ReqInputParam input; + input.optType = DISK_SET_SCSI_POLICY; + input.dataLen = sizeof(PWR_DISK_ScsiPolicy) * len; + input.data = (char *)scsiPolicy; + RspOutputParam output; + output.rspBuffSize = NULL; + output.rspData = NULL; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "SetDiskScsiPolicy failed. ret:%d", ret); + } else { + PwrLog(DEBUG, "SetDiskScsiPolicy Succeed."); + } + return ret; +} \ No newline at end of file diff --git a/pwrapic/src/pwrnet.c b/pwrapic/src/pwrnet.c new file mode 100644 index 0000000000000000000000000000000000000000..5153242d38513afb87a6458bb4dee1cd3803f533 --- /dev/null +++ b/pwrapic/src/pwrnet.c @@ -0,0 +1,110 @@ +/* ***************************************************************************** + * Copyright (c) Huawei Technologies Co., Ltd. 2021-2022 All rights reserved. + * PowerAPI licensed under the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR + * PURPOSE. + * See the Mulan PSL v2 for more details. + * Author: queyanwen + * Create: 2022-06-23 + * Description: Provide service for PowerAPI refer to NET. + * **************************************************************************** */ + +#include "pwrnet.h" +#include +#include "pwrlog.h" +#include "pwrerr.h" +#include "sockclient.h" + +int GetNetInfo(PWR_NET_Info *netInfo, uint32_t bufferSize) +{ + ReqInputParam input; + input.optType = NET_GET_INFO, input.dataLen = 0; + input.data = NULL; + RspOutputParam output; + uint32_t size = bufferSize; + output.rspBuffSize = &size; + output.rspData = (void *)netInfo; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "GetNetInfo failed. ret:%d", ret); + return ret; + } + + // Remediate coreNum + netInfo->ethNum = (size - sizeof(PWR_NET_Info)) / sizeof(PWR_NET_Eth); + PwrLog(DEBUG, "GetNetInfo succeed."); + return SUCCESS; +} + +int GetNetThrough(char ethName[], PWR_NET_Through *ethThrough) +{ + ReqInputParam input; + input.optType = NET_GET_THROUGH; + input.dataLen = strlen(ethName) + 1; + input.data = (char *)ethName; + RspOutputParam output; + uint32_t size = sizeof(PWR_NET_Through); + output.rspBuffSize = &size; + output.rspData = (void *)ethThrough; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "GetNetThrough failed. ret:%d", ret); + } else { + PwrLog(DEBUG, "GetNetThrough Succeed."); + } + return ret; +} + +int GetNetSpeedMod(char ethName[], uint32_t *speedMod) +{ + ReqInputParam input; + input.optType = NET_GET_SPEED_MOD; + input.dataLen = strlen(ethName) + 1; + input.data = (char *)ethName; + RspOutputParam output; + uint32_t size = sizeof(uint32_t); + output.rspBuffSize = &size; + output.rspData = (void *)speedMod; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "GetNetSpeedMod failed. ret:%d", ret); + } else { + PwrLog(DEBUG, "GetNetSpeedMod Succeed."); + } + return ret; +} + +int SetNetSpeedMod(char ethName[], uint32_t speedMod) +{ + ReqInputParam input = { 0 }; + input.optType = NET_SET_SPEED_MOD; + uint32_t dlen = sizeof(speedMod) + strlen(ethName) + 1; + input.dataLen = dlen; + input.data = (char *)malloc(dlen); + if (!input.data) { + return ERR_SYS_EXCEPTION; + } + bzero(input.data, dlen); + memcpy(input.data, &speedMod, sizeof(speedMod)); + memcpy(input.data + sizeof(speedMod), ethName, strlen(ethName)); + + RspOutputParam output; + output.rspBuffSize = NULL; + output.rspData = NULL; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "SetNetSpeedMod failed. ret:%d", ret); + } else { + PwrLog(DEBUG, "SetNetSpeedMod Succeed."); + } + free(input.data); + return ret; +} \ No newline at end of file diff --git a/pwrapic/src/pwrusb.c b/pwrapic/src/pwrusb.c new file mode 100644 index 0000000000000000000000000000000000000000..8e4df13e96db646195c477ec73c703f763615aa1 --- /dev/null +++ b/pwrapic/src/pwrusb.c @@ -0,0 +1,61 @@ +/* ***************************************************************************** + * Copyright (c) Huawei Technologies Co., Ltd. 2021-2022 All rights reserved. + * PowerAPI licensed under the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR + * PURPOSE. + * See the Mulan PSL v2 for more details. + * Author: queyanwen + * Create: 2022-06-23 + * Description: Provide service for PowerAPI refer to USB. + * **************************************************************************** */ + +#include "pwrusb.h" +#include +#include "pwrlog.h" +#include "pwrerr.h" +#include "sockclient.h" + +int GetUsbAutoSuspend(PWR_USB_AutoSuspend usbAts[], uint32_t *len) +{ + ReqInputParam input; + input.optType = USB_GET_AUTO_SUSPEND; + input.dataLen = 0; + input.data = NULL; + + RspOutputParam output; + uint32_t size = sizeof(PWR_USB_AutoSuspend) * (*len); + output.rspBuffSize = &size; + output.rspData = (void *)usbAts; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "GetUsbAutoSuspend failed. ret:%d", ret); + *len = size / sizeof(PWR_USB_AutoSuspend); + } else { + PwrLog(DEBUG, "GetUsbAutoSuspend Succeed."); + } + return ret; +} + +int SetUsbAutoSuspend(PWR_USB_AutoSuspend usbAts[], uint32_t len) +{ + ReqInputParam input; + input.optType = USB_SET_AUTO_SUSPEND; + input.dataLen = sizeof(PWR_USB_AutoSuspend) * len; + input.data = (char *)usbAts; + RspOutputParam output; + output.rspBuffSize = NULL; + output.rspData = NULL; + + int ret = SendReqAndWaitForRsp(input, output); + if (ret != SUCCESS) { + PwrLog(ERROR, "SetUsbAutoSuspend failed. ret:%d", ret); + } else { + PwrLog(DEBUG, "SetUsbAutoSuspend Succeed."); + } + return ret; +} \ No newline at end of file diff --git a/pwrapic/src/sockclient.c b/pwrapic/src/sockclient.c index af7ab25959cd4d2aa050f62e8c3f1c044ce5f0cf..4a4297fa533e906c3903334877505e503f41efa4 100644 --- a/pwrapic/src/sockclient.c +++ b/pwrapic/src/sockclient.c @@ -343,7 +343,7 @@ int SendReqAndWaitForRsp(ReqInputParam input, RspOutputParam output) char *inputData = NULL; if (input.data && input.dataLen != 0) { - inputData = (char*) malloc(input.dataLen); + inputData = (char *)malloc(input.dataLen); bzero(inputData, input.dataLen); memcpy(inputData, input.data, input.dataLen); } diff --git a/pwrapic/test/demo_main.c b/pwrapic/test/demo_main.c index 69d18e4e0cce90da7dc7c273a8322f7d96e7e3ec..84eb39a9dbdb9cb1c4ed9ac3166055989dde4d48 100644 --- a/pwrapic/test/demo_main.c +++ b/pwrapic/test/demo_main.c @@ -101,29 +101,28 @@ static void TEST_PWR_CPU_GetUsage() } // PWR_CPU_GetFreqAbility -static void TEST_PWR_CPU_GetFreqAbility() +static void TEST_PWR_CPU_GetFreqAbility(void) { int ret = 0; - PWR_CPU_FreqAbility freqAbi; - bzero(&freqAbi, sizeof(PWR_CPU_FreqAbility)); - ret = PWR_CPU_GetFreqAbility(&freqAbi); - printf("PWR_CPU_GetFreqAbility ret: %d, freqDrv:%s, govNum: %d \n", ret, freqAbi.curDriver, freqAbi.avGovNum); - for (int i = 0; i < freqAbi.avGovNum; i++) { - printf("index: %d, gov: %s\n", i, freqAbi.avGovList[i]); + int len = sizeof(PWR_CPU_FreqAbility) + 5 * 128; + PWR_CPU_FreqAbility *freqAbi = (PWR_CPU_FreqAbility *)malloc(len); + if(!freqAbi) { + return -1; } -} - -static void TEST_PWR_CPU_DmaSetAndGetLatency() -{ - int ret = 0; - int la = -1; - ret = PWR_CPU_DmaGetLatency(&la); - printf("PWR_CPU_DmaGetLatency ret: %d, Latency:%d\n", ret, la); - ret = PWR_CPU_DmaSetLatency(2000); - printf("PWR_CPU_DmaSetLatency ret: %d\n", ret); - la = -1; - ret = PWR_CPU_DmaGetLatency(&la); - printf("PWR_CPU_DmaGetLatency ret: %d, Latency:%d\n", ret, la); + bzero(freqAbi, len); + ret = PWR_CPU_GetFreqAbility(freqAbi, len); + printf("PWR_CPU_GetFreqAbility ret: %d, freqDrv:%s, govNum: %d, freqDomainNum:%d \n", ret, freqAbi->curDriver, + freqAbi->avGovNum, freqAbi->freqDomainNum); + for (int i = 0; i < freqAbi->avGovNum; i++) { + printf("gov index: %d, gov: %s\n", i, freqAbi->avGovList[i]); + } + for (int i = 0; i < freqAbi->freqDomainNum; i++) { + char *freqDomainInfo = freqAbi->freqDomain + i * freqAbi->freqDomainStep; + int policyId = *((int *)freqDomainInfo); + char *affectCpuList = freqDomainInfo + sizeof(int); + printf("FreqDomain %d, affectCpuList:%s\n", policyId, affectCpuList); + } + free(freqAbi); } static void TEST_PWR_CPU_SetAndGetFreqGov() @@ -140,6 +139,46 @@ static void TEST_PWR_CPU_SetAndGetFreqGov() printf("PWR_CPU_GetFreqGovernor ret: %d, gov:%s\n", ret, gov); } +// PWR_CPU_GetFreq PWR_CPU_SetFreq +#define TEST_FREQ 2400; +static void TEST_PWR_CPU_SetAndGetCurFreq() +{ + int ret = 0; + uint32_t len = 128; + PWR_CPU_CurFreq curFreq[len]; + bzero(curFreq, len * sizeof(PWR_CPU_CurFreq)); + int spec = 0; + ret = PWR_CPU_GetFreq(curFreq, &len, spec); + printf("PWR_CPU_GetFreq ret: %d, len:%d\n", ret, len); + for (int i = 0; i < len; i++) { + printf("Freq Policy %d curFreq:%d\n", curFreq[i].policyId, curFreq[i].curFreq); + } + len = 128; + bzero(curFreq, len * sizeof(PWR_CPU_CurFreq)); + curFreq[0].policyId = 0; + curFreq[0].curFreq = TEST_FREQ; + ret = PWR_CPU_SetFreq(curFreq, 1); + printf("PWR_CPU_SetFreq ret: %d\n", ret); + len = 1; + spec = 1; + curFreq[0].curFreq = 0; + ret = PWR_CPU_GetFreq(curFreq, &len, spec); + printf("Freq Policy %d curFreq:%d\n", curFreq[0].policyId, curFreq[0].curFreq); +} + +static void TEST_PWR_CPU_DmaSetAndGetLatency() +{ + int ret = 0; + int la = -1; + ret = PWR_CPU_DmaGetLatency(&la); + printf("PWR_CPU_DmaGetLatency ret: %d, Latency:%d\n", ret, la); + ret = PWR_CPU_DmaSetLatency(2000); + printf("PWR_CPU_DmaSetLatency ret: %d\n", ret); + la = -1; + ret = PWR_CPU_DmaGetLatency(&la); + printf("PWR_CPU_DmaGetLatency ret: %d, Latency:%d\n", ret, la); +} + int main(int argc, const char *args[]) { PWR_SetLogCallback(LogCallback); @@ -156,11 +195,15 @@ int main(int argc, const char *args[]) // PWR_CPU_GetFreqAbility TEST_PWR_CPU_GetFreqAbility(); + // PWR_CPU_GetFreqGovernor PWR_CPU_SetFreqGovernor + TEST_PWR_CPU_SetAndGetFreqGov(); + + // PWR_CPU_GetCurFreq PWR_CPU_SetCurFreq + TEST_PWR_CPU_SetAndGetCurFreq(); + // PWR_CPU_DmaSetLatency PWR_CPU_DmaGetLatency TEST_PWR_CPU_DmaSetAndGetLatency(); - // PWR_CPU_GetFreqGovernor - TEST_PWR_CPU_SetAndGetFreqGov(); // todo: 其他接口测试 while (g_run) { diff --git a/pwrapis/inc/common.h b/pwrapis/inc/common.h index 3af82085a647a016d7e7b075cdfc13027f70d52f..5459c579caa5fdac1079b7447cb82f9cb204b0ef 100644 --- a/pwrapis/inc/common.h +++ b/pwrapis/inc/common.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: diff --git a/pwrapis/inc/config.h b/pwrapis/inc/config.h index 2e32baa6c97222290247e52547cad27fcf7e911c..acc298f61a2c96276e3baae488549a639bafa4ee 100644 --- a/pwrapis/inc/config.h +++ b/pwrapis/inc/config.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: diff --git a/pwrapis/inc/cpuservice.h b/pwrapis/inc/cpuservice.h index 05ffc6d5496d7e231a88280c436bb77581acb95a..cca63db1a1aeb33ed2ebc75e7a5899cc4fd42f07 100644 --- a/pwrapis/inc/cpuservice.h +++ b/pwrapis/inc/cpuservice.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: diff --git a/pwrapis/inc/log.h b/pwrapis/inc/log.h index fabd583362712d97541e00adf64ce53b623ebc71..80ca50b19046601b967f6788b91415f90b042e13 100644 --- a/pwrapis/inc/log.h +++ b/pwrapis/inc/log.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: diff --git a/pwrapis/inc/pwrclient.h b/pwrapis/inc/pwrclient.h index 41ee1a8ffebf31d086282d51a8ca707962d39707..a162e93e20d7c3e5d272029ff65cdbd746d936b2 100644 --- a/pwrapis/inc/pwrclient.h +++ b/pwrapis/inc/pwrclient.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: diff --git a/pwrapis/inc/server.h b/pwrapis/inc/server.h index abfbace796cd077f00668942183433c45e8f630b..972898138435a69b8479e402ea0bcaab0b366d7b 100644 --- a/pwrapis/inc/server.h +++ b/pwrapis/inc/server.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: diff --git a/pwrapis/inc/utils.h b/pwrapis/inc/utils.h index 43f879d70341d246a1517b601ab9cb7373ad66db..ce9efdd99a69535b3ba23d9e8eb23a037a95234e 100644 --- a/pwrapis/inc/utils.h +++ b/pwrapis/inc/utils.h @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: diff --git a/pwrapis/src/log.c b/pwrapis/src/log.c index a1bbf77e9eab23f0a18d21781dd7d8d894cd96fe..478cb68e60f7407beb480d8127a1e8141d18a410 100644 --- a/pwrapis/src/log.c +++ b/pwrapis/src/log.c @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: diff --git a/pwrapis/src/server.c b/pwrapis/src/server.c index e9d0d779358aa291be4c0e01e16a00fd964581e9..91861423c2206fc32aac4d9465db80caccfc45ea 100644 --- a/pwrapis/src/server.c +++ b/pwrapis/src/server.c @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: diff --git a/pwrapis/src/utils.c b/pwrapis/src/utils.c index d9d5c5250548a09523cbd01bca329a4343dfbd27..ba6c4c209d19ae2ec1070485c4f7aedfc414bc4b 100644 --- a/pwrapis/src/utils.c +++ b/pwrapis/src/utils.c @@ -1,5 +1,5 @@ /* ***************************************************************************** - * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. * PowerAPI licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: