1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 #ifndef __APP_UTILS_H__
5 #define __APP_UTILS_H__
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
11 #include "hal_sysfreq.h"
12 
13 // APP_SYSFREQ_USER_APP_0 is APP_MAIN
14 #define APP_SYSFREQ_USER_BT_MAIN            APP_SYSFREQ_USER_APP_1
15 #define APP_SYSFREQ_USER_HCI                APP_SYSFREQ_USER_APP_2
16 #define APP_SYSFREQ_USER_BT_A2DP            APP_SYSFREQ_USER_APP_3
17 #define APP_SYSFREQ_USER_UNUSED             APP_SYSFREQ_USER_APP_4
18 #define APP_SYSFREQ_USER_APP_KWS            APP_SYSFREQ_USER_APP_5
19 #define APP_SYSFREQ_USER_BT_SCO             APP_SYSFREQ_USER_APP_6
20 #define APP_SYSFREQ_USER_VOICEPATH          APP_SYSFREQ_USER_APP_7
21 #define APP_SYSFREQ_USER_OTA                APP_SYSFREQ_USER_APP_8
22 #define APP_SYSFREQ_USER_AI_VOICE           APP_SYSFREQ_USER_APP_9
23 #define APP_SYSFREQ_USER_PROMPT_MIXER       APP_SYSFREQ_USER_APP_10
24 #define APP_SYSFREQ_USER_APP_NT             APP_SYSFREQ_USER_APP_11
25 #define APP_SYSFREQ_USER_ANC_WNR            APP_SYSFREQ_USER_APP_13
26 
27 /*
28  * Pseudo user, if one of user is belong to qos(quality of service) user,
29  * when request cpu freq, it will changed to this user
30  */
31 #define APP_SYSFREQ_USER_QOS             APP_SYSFREQ_USER_APP_12
32 
33 enum APP_SYSFREQ_USER_T {
34     APP_SYSFREQ_USER_APP_INIT = HAL_SYSFREQ_USER_INIT,
35     APP_SYSFREQ_USER_APP_0    = HAL_SYSFREQ_USER_APP_0,
36     APP_SYSFREQ_USER_APP_1    = HAL_SYSFREQ_USER_APP_1,
37     APP_SYSFREQ_USER_APP_2    = HAL_SYSFREQ_USER_APP_2,
38     APP_SYSFREQ_USER_APP_3    = HAL_SYSFREQ_USER_APP_3,
39     APP_SYSFREQ_USER_APP_4    = HAL_SYSFREQ_USER_APP_4,
40     APP_SYSFREQ_USER_APP_5    = HAL_SYSFREQ_USER_APP_5,
41     APP_SYSFREQ_USER_APP_6    = HAL_SYSFREQ_USER_APP_6,
42     APP_SYSFREQ_USER_APP_7    = HAL_SYSFREQ_USER_APP_7,
43     APP_SYSFREQ_USER_APP_8    = HAL_SYSFREQ_USER_APP_8,
44     APP_SYSFREQ_USER_APP_9    = HAL_SYSFREQ_USER_APP_9,
45     APP_SYSFREQ_USER_APP_10   = HAL_SYSFREQ_USER_APP_10,
46     APP_SYSFREQ_USER_APP_11   = HAL_SYSFREQ_USER_APP_11,
47     APP_SYSFREQ_USER_APP_12   = HAL_SYSFREQ_USER_APP_12,
48     APP_SYSFREQ_USER_APP_13   = HAL_SYSFREQ_USER_APP_13,
49     APP_SYSFREQ_USER_APP_14   = HAL_SYSFREQ_USER_APP_14,
50     APP_SYSFREQ_USER_APP_15   = HAL_SYSFREQ_USER_APP_15,
51     APP_SYSFREQ_USER_QTY
52 };
53 
54 enum APP_SYSFREQ_FREQ_T {
55     APP_SYSFREQ_32K =  HAL_CMU_FREQ_32K,
56     APP_SYSFREQ_26M =  HAL_CMU_FREQ_26M,
57     APP_SYSFREQ_52M =  HAL_CMU_FREQ_52M,
58     APP_SYSFREQ_78M =  HAL_CMU_FREQ_78M,
59     APP_SYSFREQ_104M = HAL_CMU_FREQ_104M,
60     APP_SYSFREQ_208M = HAL_CMU_FREQ_208M,
61     APP_SYSFREQ_390M = HAL_CMU_FREQ_390M,
62 
63     APP_SYSFREQ_FREQ_QTY =  HAL_CMU_FREQ_QTY
64 };
65 
66 enum APP_WDT_THREAD_CHECK_USER_T {
67     APP_WDT_THREAD_CHECK_USER_APP,
68     APP_WDT_THREAD_CHECK_USER_AF,
69     APP_WDT_THREAD_CHECK_USER_BT,
70     APP_WDT_THREAD_CHECK_USER_3,
71     APP_WDT_THREAD_CHECK_USER_4,
72     APP_WDT_THREAD_CHECK_USER_5,
73     APP_WDT_THREAD_CHECK_USER_6,
74     APP_WDT_THREAD_CHECK_USER_7,
75     APP_WDT_THREAD_CHECK_USER_8,
76     APP_WDT_THREAD_CHECK_USER_9,
77     APP_WDT_THREAD_CHECK_USER_10,
78 
79     APP_WDT_THREAD_CHECK_USER_QTY
80 };
81 
82 int app_sysfreq_req(enum APP_SYSFREQ_USER_T user, enum APP_SYSFREQ_FREQ_T freq);
83 
84 int app_wdt_open(int seconds);
85 
86 int app_wdt_reopen(int seconds);
87 
88 int app_wdt_close(void);
89 
90 void app_wdt_ping(void);
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif//__FMDEC_H__
97