1 /* 2 // Copyright (C) 2022 Beken Corporation 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef _PM_H_ 16 #define _PM_H_ 17 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 #include <driver/int.h> 24 #include "common/bk_err.h" 25 26 27 #define PARAM_DATA_VALID (0xFFFF) 28 29 typedef enum 30 { 31 GPIO_TRIGGER_INTERRUPE_LEVEL_LOW_ACTIVE = 0, 32 GPIO_TRIGGER_INTERRUPE_LEVEL_HIGH_ACTIVE, 33 GPIO_TRIGGER_INTERRUPE_EDGE_RISING, 34 GPIO_TRIGGER_INTERRUPE_EDGE_FALLING, 35 }gpio_trigger_interrupt_type_e; 36 37 typedef struct 38 { 39 uint32_t gpio_id; 40 gpio_trigger_interrupt_type_e gpio_trigger_interrupt_type; 41 int_group_isr_t isr_callback; 42 uint32_t gpio_valid; //PARAM_DATA_VALID 43 }gpio_wakeup_param_t; 44 typedef struct 45 { 46 uint32_t period; 47 int_group_isr_t isr_callback; 48 uint32_t rtc_valid; //PARAM_DATA_VALID 49 }rtc_wakeup_param_t; 50 typedef enum 51 { 52 WIFI_WAKEUP = 1, 53 BT_WAKEUP, 54 }wifi_bt_wakeup_type_e; 55 typedef struct 56 { 57 wifi_bt_wakeup_type_e wifi_bt_wakeup; 58 uint32_t sleep_time; 59 int_group_isr_t isr_callback; 60 }system_wakeup_param_t; 61 typedef struct 62 { 63 int_group_isr_t isr_callback; 64 }usbplug_wakeup_param_t; 65 typedef struct 66 { 67 uint32_t touch_channel; 68 int_group_isr_t isr_callback; 69 }touch_wakeup_param_t; 70 typedef enum 71 { 72 PM_MODE_NORMAL_SLEEP = 0, 73 PM_MODE_LOW_VOLTAGE , 74 PM_MODE_DEEP_SLEEP , 75 PM_MODE_DEFAULT 76 }pm_sleep_mode_e; 77 78 typedef enum 79 { 80 PM_WAKEUP_SOURCE_INT_GPIO = 0, 81 PM_WAKEUP_SOURCE_INT_RTC , 82 PM_WAKEUP_SOURCE_INT_SYSTEM_WAKE , 83 PM_WAKEUP_SOURCE_INT_USBPLUG , 84 PM_WAKEUP_SOURCE_INT_TOUCHED , 85 PM_WAKEUP_SOURCE_INT_NONE , 86 }pm_wakeup_source_e; 87 typedef enum 88 { 89 PM_POWER_MODULE_NAME_MEM1 = 0, // 0 90 PM_POWER_MODULE_NAME_MEM2, // 1 91 PM_POWER_MODULE_NAME_MEM3, // 2 92 PM_POWER_MODULE_NAME_ENCP, // 3 93 PM_POWER_MODULE_NAME_BAKP, // 4 94 PM_POWER_MODULE_NAME_AHBP, // 5 95 PM_POWER_MODULE_NAME_AUDP, // 6 96 PM_POWER_MODULE_NAME_VIDP, // 7 97 PM_POWER_MODULE_NAME_BTSP, // 8 98 PM_POWER_MODULE_NAME_WIFIP_MAC, // 9 99 PM_POWER_MODULE_NAME_PHY, // 10 100 PM_POWER_MODULE_NAME_CPU1 , // 11 101 PM_POWER_MODULE_NAME_APP , // 12 app not power domain 102 PM_POWER_SUB_MODULE_NAME_AUDP_FFT , // 13 103 PM_POWER_SUB_MODULE_NAME_AUDP_SBC , // 14 104 PM_POWER_SUB_MODULE_NAME_AUDP_AUDIO , // 15 105 PM_POWER_SUB_MODULE_NAME_AUDP_I2S , // 16 106 PM_POWER_SUB_MODULE_NAME_VIDP_JPEG_EN , // 17 107 PM_POWER_SUB_MODULE_NAME_VIDP_JPEG_DE , // 18 108 PM_POWER_SUB_MODULE_NAME_VIDP_DMA2D , // 19 109 PM_POWER_SUB_MODULE_NAME_VIDP_LCD , // 20 110 PM_POWER_SUB_MODULE_NAME_PHY_BT , // 21 111 PM_POWER_SUB_MODULE_NAME_PHY_WIFI , // 22 112 PM_POWER_SUB_MODULE_NAME_AHBP_CAN , // 23 113 PM_POWER_SUB_MODULE_NAME_AHBP_QSPI , // 24 114 PM_POWER_SUB_MODULE_NAME_AHBP_USB , // 25 115 PM_POWER_SUB_MODULE_NAME_AHBP_PSRAM , // 26 116 117 PM_POWER_MODULE_NAME_NONE // 27 118 }pm_power_module_name_e; 119 typedef enum 120 { 121 PM_SLEEP_MODULE_NAME_MEM1 = 0, // 0 122 PM_SLEEP_MODULE_NAME_MEM2, // 1 123 PM_SLEEP_MODULE_NAME_MEM3, // 2 124 PM_SLEEP_MODULE_NAME_ENCP, // 3 125 PM_SLEEP_MODULE_NAME_BAKP, // 4 126 PM_SLEEP_MODULE_NAME_AHBP, // 5 127 PM_SLEEP_MODULE_NAME_AUDP, // 6 128 PM_SLEEP_MODULE_NAME_VIDP, // 7 129 PM_SLEEP_MODULE_NAME_BTSP, // 8 130 PM_SLEEP_MODULE_NAME_WIFIP_MAC, // 9 131 PM_SLEEP_MODULE_NAME_WIFI_PHY, // 10 132 PM_SLEEP_MODULE_NAME_CPU1 , // 11 133 PM_SLEEP_MODULE_NAME_APP , // 12 134 PM_SLEEP_MODULE_NAME_APP1 , // 13 135 PM_SLEEP_MODULE_NAME_APP2 , // 14 136 PM_SLEEP_MODULE_NAME_APP3 , // 15 137 PM_SLEEP_MODULE_NAME_APP4 , // 16 138 PM_SLEEP_MODULE_NAME_APP5 , // 17 139 PM_SLEEP_MODULE_NAME_APP6 , // 18 140 PM_SLEEP_MODULE_NAME_APP7 , // 19 141 PM_SLEEP_MODULE_NAME_APP8 , // 20 142 PM_SLEEP_SUB_MODULE_NAME_AUDP_FFT , // 21 143 PM_SLEEP_SUB_MODULE_NAME_AUDP_SBC , // 22 144 PM_SLEEP_SUB_MODULE_NAME_AUDP_AUDIO , // 23 145 PM_SLEEP_SUB_MODULE_NAME_AUDP_I2S , // 24 146 PM_SLEEP_SUB_MODULE_NAME_VIDP_JPEG_EN , // 25 147 PM_SLEEP_SUB_MODULE_NAME_VIDP_JPEG_DE , // 26 148 PM_SLEEP_SUB_MODULE_NAME_VIDP_DMA2D , // 27 149 PM_SLEEP_SUB_MODULE_NAME_VIDP_LCD , // 28 150 PM_SLEEP_MODULE_NAME_NONE // 29 151 }pm_sleep_module_name_e; 152 typedef enum 153 { 154 PM_POWER_MODULE_STATE_ON = 0, 155 PM_POWER_MODULE_STATE_OFF, 156 PM_POWER_MODULE_STATE_NONE 157 }pm_power_module_state_e; 158 typedef enum 159 { 160 PM_MODULE_NAME_WIFI = 0, 161 PM_MODULE_NAME_BT, 162 PM_MODULE_NAME_NONE 163 }pm_module_name_e; 164 typedef enum 165 { 166 PM_LPO_SRC_DIVD = 0,//32K from 26m 167 PM_LPO_SRC_X32K, //extern 32k 168 PM_LPO_SRC_ROSC, //32K from ROSC 169 PM_LPO_SRC_DEFAULT //32K from ROSC 170 }pm_lpo_src_e; 171 typedef enum 172 { 173 PM_CLK_ID_I2C1 = 0, // 0 174 PM_CLK_ID_SPI_1, // 1 175 PM_CLK_ID_UART1, // 2 176 PM_CLK_ID_PWM_1, // 3 177 PM_CLK_ID_TIMER_1, // 4 178 PM_CLK_ID_SARADC, // 5 179 PM_CLK_ID_IRDA, // 6 180 PM_CLK_ID_EFUSE, // 7 181 PM_CLK_ID_I2C2, // 8 182 PM_CLK_ID_SPI_2, // 9 183 PM_CLK_ID_UART2, // 10 184 PM_CLK_ID_UART3, // 11 185 PM_CLK_ID_PWM_2, // 12 186 PM_CLK_ID_TIMER_2, // 13 187 PM_CLK_ID_TIMER_3, // 14 188 PM_CLK_ID_OTP, // 15 189 PM_CLK_ID_I2S_1, // 16 190 PM_CLK_ID_USB_1, // 17 191 PM_CLK_ID_CAN, // 18 192 PM_CLK_ID_PSRAM, // 19 193 PM_CLK_ID_QSPI_1, // 20 194 PM_CLK_ID_QSPI_2, // 21 195 PM_CLK_ID_SDIO, // 22 196 PM_CLK_ID_AUXS, // 23 197 PM_CLK_ID_BTDM, // 24 198 PM_CLK_ID_XVR, // 25 199 PM_CLK_ID_MAC, // 26 200 PM_CLK_ID_PHY, // 27 201 PM_CLK_ID_JPEG, // 28 202 PM_CLK_ID_DISP, // 29 203 PM_CLK_ID_AUDIO, // 30 204 PM_CLK_ID_WDG_CPU, // 31 205 206 PM_CLK_ID_NONE 207 }pm_dev_clk_e; 208 typedef enum 209 { 210 PM_CLK_CTRL_PWR_DOWN = 0, 211 PM_CLK_CTRL_PWR_UP, 212 }pm_dev_clk_pwr_e; 213 typedef enum 214 { 215 PM_DEV_ID_I2C1 = 0, // 0 216 PM_DEV_ID_SPI_1, // 1 217 PM_DEV_ID_UART1, // 2 218 PM_DEV_ID_PWM_1, // 3 219 PM_DEV_ID_TIMER_1, // 4 220 PM_DEV_ID_SARADC, // 5 221 PM_DEV_ID_IRDA, // 6 222 PM_DEV_ID_EFUSE, // 7 223 PM_DEV_ID_I2C2, // 8 224 PM_DEV_ID_SPI_2, // 9 225 PM_DEV_ID_UART2, // 10 226 PM_DEV_ID_UART3, // 11 227 PM_DEV_ID_PWM_2, // 12 228 PM_DEV_ID_TIMER_2, // 13 229 PM_DEV_ID_TIMER_3, // 14 230 PM_DEV_ID_OTP, // 15 231 PM_DEV_ID_I2S_1, // 16 232 PM_DEV_ID_USB_1, // 17 233 PM_DEV_ID_CAN, // 18 234 PM_DEV_ID_PSRAM, // 19 235 PM_DEV_ID_QSPI_1, // 20 236 PM_DEV_ID_QSPI_2, // 21 237 PM_DEV_ID_SDIO, // 22 238 PM_DEV_ID_AUXS, // 23 239 PM_DEV_ID_BTDM, // 24 240 PM_DEV_ID_XVR, // 25 241 PM_DEV_ID_MAC, // 26 242 PM_DEV_ID_PHY, // 27 243 PM_DEV_ID_JPEG, // 28 244 PM_DEV_ID_DISP, // 29 245 PM_DEV_ID_AUDIO, // 30 246 PM_DEV_ID_WDG, // 31 247 248 PM_DEV_ID_DEFAULT, // 32 it is used by pm module set default cpu frequency 249 250 PM_DEV_ID_MAX 251 }pm_dev_id_e; 252 typedef enum 253 { 254 PM_CPU_FRQ_26M = 0, // 0:CPU:26M,BUS:26M 255 PM_CPU_FRQ_120M, // 1:CPU:120M,BUS:120M 256 PM_CPU_FRQ_240M, // 2:CPU:240M,BUS:120M 257 PM_CPU_FRQ_320M, // 3:CPU:320M,BUS:160M 258 PM_CPU_FRQ_DEFAULT // default cpu frequency which control by pm module 259 }pm_cpu_freq_e; 260 261 typedef int (*pm_cb)(uint64_t sleep_time, void *args); 262 typedef struct { 263 pm_cb cb; 264 void *args; 265 } pm_cb_conf_t; 266 267 /** 268 * @brief using the gpio to control the external ldo 269 * 270 * control the external ldo 271 * 272 * @attention 273 * - This API is used to use the specific gpio(define in GPIO_CTRL_LDO_OUTPUT_HIGH_MAP or GPIO_CTRL_LDO_OUTPUT_LOW_MAP in gpio_map.h) control the external ldo 274 * 275 * @param 276 * -value:0x1:output high; 0x0:output low 277 * @return 278 * - BK_OK: succeed 279 * - others: other errors. 280 */ 281 bk_err_t bk_pm_external_ldo_ctrl(uint32_t value); 282 /** 283 * @brief get the state of phy calibration 284 * 285 * get the state of phy calibration 286 * 287 * @attention 288 * - This API is used to get the state of phy calibration 289 * 290 * @param 291 * -void 292 * @return 293 * - the state of phy calibration(0x1:have calibration;0x0:not calibration) 294 */ 295 uint32_t bk_pm_phy_cali_state_get(); 296 /** 297 * @brief get the flag of phy reinit part1 298 * 299 * get the flag of phy reinit part1 300 * 301 * @attention 302 * - This API is used to get the flag of phy reinit part1 303 * 304 * @param 305 * -void 306 * @return 307 * - the flag of phy reinit part1 (True:have part1;false:not do it) 308 */ 309 bool bk_pm_phy_reinit_flag_get(); 310 /** 311 * @brief clear the flag of phy reinit part1 312 * 313 * clear the flag of phy reinit part1 314 * 315 * @attention 316 * - This API is used to clear the flag of phy reinit part1 317 * 318 * @param 319 * -void 320 * @return 321 * -void 322 */ 323 void bk_pm_phy_reinit_flag_clear(); 324 /** 325 * @brief get the consume time from lowvol wakeup 326 * 327 * the consume time from lowvol wakeup 328 * 329 * @attention 330 * - This API is used to get the consume time from lowvol wakeup 331 * 332 * @param 333 * -void 334 * @return 335 * - the consume time of wakeup from lowvol 336 */ 337 uint32_t bk_pm_wakeup_from_lowvol_consume_time_get(); 338 /** 339 * @brief register sleep mode(low voltage and deepsleep) config 340 * 341 * register sleep config(include callback function and parameter) 342 * 343 * @attention 344 * - This API is used to register low voltage and deepsleep config 345 * 346 * @param 347 * -sleep_mode:low voltage or deepsleep mode 348 * -dev_id:dev id 349 * -enter_config:enter sleep config 350 * -exit_config:exit sleep config 351 * @return 352 * - BK_OK: succeed 353 * - others: other errors. 354 */ 355 bk_err_t bk_pm_sleep_register_cb(pm_sleep_mode_e sleep_mode,pm_dev_id_e dev_id,pm_cb_conf_t *enter_config, pm_cb_conf_t *exit_config); 356 /** 357 * @brief unregister sleep mode(low voltage and deepsleep) config 358 * 359 * unregister sleep config(include callback function and parameter) 360 * 361 * @attention 362 * - This API is used to unregister low voltage and deepsleep config 363 * 364 * @param 365 * -sleep_mode:low voltage or deepsleep mode 366 * -dev_id:dev id 367 * -enter_cb:whether unregister the enter call back 368 * -exit_cb:whether unregister the exit call back 369 * @return 370 * - BK_OK: succeed 371 * - others: other errors. 372 */ 373 bk_err_t bk_pm_sleep_unregister_cb(pm_sleep_mode_e sleep_mode,pm_dev_id_e dev_id,bool enter_cb, bool exit_cb); 374 /** 375 * @brief register light sleep config 376 * 377 * register light sleep config(include callback function and parameter) 378 * 379 * @attention 380 * - This API is used to register light sleep config 381 * 382 * @param 383 * -enter_config:enter light sleep config 384 * -exit_config:exit light sleep config 385 * @return 386 * - BK_OK: succeed 387 * - others: other errors. 388 */ 389 bk_err_t bk_pm_light_sleep_register_cb(pm_cb_conf_t *enter_config, pm_cb_conf_t *exit_config); 390 /** 391 * @brief unregister light sleep callback 392 * 393 * unregister light sleep callback(enter light sleep callback and exit light sleep callback) 394 * 395 * @attention 396 * - This API is used to unregister light sleep callback 397 * 398 * @param 399 * -enter_cb:whether unregister the enter call back 400 * -exit_cb:whether unregister the exit call back 401 * @return 402 * - BK_OK: succeed 403 * - others: other errors. 404 */ 405 bk_err_t bk_pm_light_sleep_unregister_cb(bool enter_cb, bool exit_cb); 406 /** 407 * @brief get power domain of module state 408 * 409 * get the power domain state 410 * 411 * @attention 412 * - This API is used to get the power domain state 413 * 414 * @param 415 * -module:module name 416 * @return 417 * -the state of power domain state 418 * 419 */ 420 int32 bk_pm_module_power_state_get(pm_power_module_name_e module); 421 /** 422 * @brief get the cpu frequency of the module vote 423 * 424 * get the module voting cpu frequency 425 * 426 * @attention 427 * - This API is used to get the module voting cpu frequency 428 * 429 * @param 430 * -module:module id 431 * @return 432 * - the cpu frequency of the module vote 433 * 434 */ 435 pm_cpu_freq_e bk_pm_module_current_cpu_freq_get(pm_dev_id_e module); 436 /** 437 * @brief get the current max and used cpu frequency 438 * 439 * select the cpu frequency 440 * 441 * @attention 442 * - This API is used to get the current max and used cpu frequency 443 * 444 * @param 445 * -void 446 * @return 447 * - get the current max and used cpu frequency 448 * 449 */ 450 pm_cpu_freq_e bk_pm_current_max_cpu_freq_get(); 451 /** 452 * @brief vote cpu frequency 453 * 454 * select the cpu frequency 455 * 456 * @attention 457 * - This API is used to vote ,then select the cpu frequency 458 * 459 * @param 460 * -module:module id;cpu_freq:cpu frequency(320M,240M,120M,26M) 461 * @return 462 * - BK_OK: succeed 463 * - others: other errors. 464 */ 465 bk_err_t bk_pm_module_vote_cpu_freq(pm_dev_id_e module,pm_cpu_freq_e cpu_freq); 466 /** 467 * @brief clock ctrl 468 * 469 * enable or disable dev clock 470 * 471 * @attention 472 * - This API is used to enable or disable dev clock 473 * 474 * @param 475 * -module:device id;clock_state:PM_CLK_CTRL_PWR_DOWN or PM_CLK_CTRL_PWR_DOWN 476 * @return 477 * - BK_OK: succeed 478 * - others: other errors. 479 */ 480 bk_err_t bk_pm_clock_ctrl(pm_dev_clk_e module,pm_dev_clk_pwr_e clock_state); 481 /** 482 * @brief lp voltage set 483 * 484 * set the lp voltage 485 * 486 * @attention 487 * - This API is used to set lp voltage when enter low voltage 488 * 489 * @param 490 * -uint32_t:0x0:0.6v;0x1:0.7v;0x2:0.8v;0x3:0.9v;0x4:1.0v;0x5:1.1v;0x6:1.2v;0x7:1.3v; 491 * @return 492 * - BK_OK: succeed 493 * - others: other errors. 494 * 495 */ 496 bk_err_t bk_pm_lp_vol_set( uint32_t lp_vol); 497 498 /** 499 * @brief lp voltage get 500 * 501 * get the lpo voltage 502 * 503 * @attention 504 * - This API is used to get lpo voltage value 505 * 506 * @param 507 * -void 508 * @return 509 * - the lp voltage value 510 * 511 */ 512 uint32_t bk_pm_lp_vol_get(); 513 /** 514 * @brief lpo source set 515 * 516 * set the lpo source 517 * 518 * @attention 519 * - This API is used to select 32k source when enter low voltage and deepsleep 520 * 521 * @param 522 * -lpo_src:0x0:32K from 26m;0x1:32K from 26m;0x2:32K from ROSC;0x3:32K from ROSC 523 * @return 524 * - BK_OK: succeed 525 * - others: other errors. 526 */ 527 bk_err_t bk_pm_lpo_src_set(pm_lpo_src_e lpo_src); 528 529 /** 530 * @brief lpo source get 531 * 532 * get the lpo source 533 * 534 * @attention 535 * - This API is used to get 32k lpo source 536 * 537 * @param 538 * void 539 * @return 540 * -lpo_src:0x0:32K from 26m;0x1:32K from 26m;0x2:32K from ROSC;0x3:32K from ROSC 541 * 542 */ 543 pm_lpo_src_e bk_pm_lpo_src_get(); 544 /** 545 * @brief mcu pm ctrl 546 * 547 * enabel and disable the mcu power manage 548 * 549 * @attention 550 * - This API is used to enabel and disable the mcu power manage 551 * 552 * @param 553 * -power_state:0x0:enable the mcu power manage;0x1:disable the mcu power manage 554 * @return 555 * - BK_OK: succeed 556 * - others: other errors. 557 */ 558 bk_err_t bk_pm_mcu_pm_ctrl(uint32_t power_state); 559 560 /** 561 * @brief get the mcu power feature state 562 * 563 * get the mcu power feature state 564 * 565 * @attention 566 *-This API is used to get the mcu power manage feature state(open or close) 567 * 568 * @param 569 * none 570 * @return 571 *-mcu power manage state(0x0:enable the mcu power manage;0x1:disable the mcu power manage) 572 * 573 */ 574 uint32_t bk_pm_mcu_pm_state_get(); 575 576 /** 577 * @brief set sleep mode 578 * 579 * set sleep mode. 580 * 581 * @attention 582 * - This API set sleep mode 583 * 584 * @param sleep mode:0x0:NORMAL_SLEEP;0x1:LOW_VOLTAGE;0x2:DEEP_SLEEP;0x3:DEFAULT(if it meet low voltage,enter low voltage,otherwise enter normal sleep); 585 * 586 * @return 587 * - BK_OK: succeed 588 * - others: other errors. 589 */ 590 bk_err_t bk_pm_sleep_mode_set(pm_sleep_mode_e sleep_mode); 591 592 /** 593 * @brief set wakeup source 594 * 595 * set wakeup source(eg.rtc,gpio) 596 * 597 * @attention 598 * - This API set wakeup source,wifi and bt themselves not need set wakup source when in volatage 599 * 600 * @param 601 * -wakeup_source:wake up source 602 * -source_param: the wakeup source parameter 603 * @return 604 * - BK_OK: succeed 605 * - others: other errors. 606 */ 607 bk_err_t bk_pm_wakeup_source_set(pm_wakeup_source_e wakeup_source, void* source_param); 608 609 /** 610 * @brief module vote sleep ctrl 611 * 612 * other module tell pm module, they have entered sleep.(eg.wifi or bt enter sleep,then call the function ,tell pm it have entered sleep) 613 * 614 * @attention 615 * - This API is used by wifi or bt... let pm module know them(wifi or bt...) enter sleep or exit sleep 616 * - if all the specific module enter sleep, the mcu will enter low voltage 617 * 618 * @param 619 * -module:module name 620 * -sleep_state:0x1:enter sleep;0x0:exit sleep 621 * -sleep_time: sleep time 622 * @return 623 * - BK_OK: succeed 624 * - others: other errors. 625 */ 626 bk_err_t bk_pm_module_vote_sleep_ctrl(pm_sleep_module_name_e module,uint32_t sleep_state,uint32_t sleep_time); 627 628 /** 629 * @brief pm module vote power ctrl 630 * 631 * ther module tell pm module, they can enter power on or power off 632 * 633 * @attention 634 * - This API is used for the module power on and power off. 635 * - if all the specific module power off, the mcu will enter deep sleep 636 * @param 637 * -module:module name 638 * -power_state:0x1:power off;0x0:power on 639 * @return 640 * - BK_OK: succeed 641 * - others: other errors. 642 */ 643 bk_err_t bk_pm_module_vote_power_ctrl(pm_power_module_name_e module,pm_power_module_state_e power_state); 644 645 /** 646 * @brief pm suppress ticks and sleep 647 * 648 * when the rtos enter idle task and sleep time > 2*(time per tick),it will call the function enter power manager 649 * 650 * @attention 651 * - This API is used for power manager. 652 * 653 * @param 654 * -sleep_ticks:sleep time using tick unit 655 * @return 656 * - BK_OK: succeed 657 * - others: other errors. 658 */ 659 bk_err_t bk_pm_suppress_ticks_and_sleep(uint32_t sleep_ticks); 660 /** 661 * @brief enter sleep 662 * 663 * the function is for adapting harmony os 664 * 665 * @attention 666 * - This API is used for power manager. 667 * 668 * @param 669 * - void 670 * @return 671 * - void 672 * 673 */ 674 void bk_pm_enter_sleep(); 675 676 #ifdef __cplusplus 677 } 678 #endif 679 680 #endif 681