1 /* 2 * Copyright (C) 2025-2025 Huawei Device Co., Ltd. 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 MOCK_FFRT_INNER_API_C_TYPE_DEF_H 16 #define MOCK_FFRT_INNER_API_C_TYPE_DEF_H 17 #include <stdint.h> 18 #include "c/type_def.h" 19 20 #ifdef __cplusplus 21 #define FFRT_C_API 22 #else 23 #define FFRT_C_API 24 #endif 25 26 typedef enum { 27 ffrt_qos_deadline_request = 4, 28 ffrt_qos_user_interactive, 29 ffrt_qos_max = ffrt_qos_user_interactive, 30 } ffrt_inner_qos_default_t; 31 32 typedef enum { ffrt_stack_protect_weak, ffrt_stack_protect_strong } ffrt_stack_protect_t; 33 34 typedef enum { 35 ffrt_thread_attr_storage_size = 64, 36 } ffrt_inner_storage_size_t; 37 38 typedef struct { 39 uint32_t storage[(ffrt_thread_attr_storage_size + sizeof(uint32_t) - 1) / sizeof(uint32_t)]; 40 } ffrt_thread_attr_t; 41 42 #define MAX_CPUMAP_LENGTH 100 43 typedef struct { 44 int shares; 45 int latency_nice; 46 int uclamp_min; 47 int uclamp_max; 48 int vip_prio; 49 char cpumap[MAX_CPUMAP_LENGTH]; 50 } ffrt_os_sched_attr; 51 52 typedef void *ffrt_thread_t; 53 54 typedef void *ffrt_interval_t; 55 56 typedef enum { 57 ffrt_sys_event_type_read, 58 } ffrt_sys_event_type_t; 59 60 typedef enum { ffrt_sys_event_status_no_timeout, ffrt_sys_event_status_timeout } ffrt_sys_event_status_t; 61 62 typedef void *ffrt_sys_event_handle_t; 63 64 typedef void *ffrt_config_t; 65 66 typedef enum { 67 ffrt_coroutine_stackless, 68 ffrt_coroutine_with_stack, 69 } ffrt_coroutine_t; 70 71 typedef enum { 72 ffrt_coroutine_pending = 0, 73 ffrt_coroutine_ready = 1, 74 } ffrt_coroutine_ret_t; 75 76 typedef ffrt_coroutine_ret_t (*ffrt_coroutine_ptr_t)(void *); 77 78 typedef struct { 79 int fd; 80 void *data; 81 void (*cb)(void *, uint32_t); 82 } ffrt_poller_t; 83 84 typedef enum { 85 ffrt_timer_notfound = -1, 86 ffrt_timer_not_executed = 0, 87 ffrt_timer_executed = 1, 88 } ffrt_timer_query_t; 89 90 typedef enum { 91 ffrt_sched_default_mode = 0, 92 ffrt_sched_performance_mode, 93 ffrt_sched_energy_saving_mode, 94 } ffrt_sched_mode; 95 96 #ifdef __cplusplus 97 namespace ffrt { 98 enum qos_inner_default { 99 qos_deadline_request = ffrt_qos_deadline_request, 100 qos_user_interactive = ffrt_qos_user_interactive, 101 qos_max = ffrt_qos_max, 102 }; 103 104 enum class stack_protect { 105 weak = ffrt_stack_protect_weak, 106 strong = ffrt_stack_protect_strong, 107 }; 108 109 enum class sched_mode_type : uint8_t { 110 sched_default_mode = ffrt_sched_default_mode, 111 sched_performance_mode = ffrt_sched_performance_mode, 112 sched_energy_saving_mode = ffrt_sched_energy_saving_mode, 113 }; 114 } // namespace ffrt 115 #endif 116 #endif