• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 
16  /**
17  * @file type_def.h
18  *
19  * @brief Declares common types.
20  *
21  * @since 10
22  * @version 1.0
23  */
24 #ifndef FFRT_INNER_API_C_TYPE_DEF_H
25 #define FFRT_INNER_API_C_TYPE_DEF_H
26 #include <stdint.h>
27 #include <errno.h>
28 #include "../../kits/c/type_def.h"
29 
30 #ifdef __cplusplus
31 #define FFRT_C_API  extern "C"
32 #else
33 #define FFRT_C_API
34 #endif
35 
36 /**
37  * @brief Enumerates the task QoS types.
38  *
39  */
40 typedef enum {
41     ffrt_qos_deadline_request = 4,
42     ffrt_qos_user_interactive,
43     ffrt_qos_max = ffrt_qos_user_interactive,
44 } ffrt_inner_qos_default_t;
45 
46 typedef enum {
47     ffrt_stack_protect_weak,
48     ffrt_stack_protect_strong
49 } ffrt_stack_protect_t;
50 
51 typedef enum {
52     ffrt_thread_attr_storage_size = 64,
53 } ffrt_inner_storage_size_t;
54 
55 typedef struct {
56     uint32_t storage[(ffrt_thread_attr_storage_size + sizeof(uint32_t) - 1) / sizeof(uint32_t)];
57 } ffrt_thread_attr_t;
58 
59 #define MAX_CPUMAP_LENGTH 100 // this is in c and code style
60 typedef struct {
61     int shares;
62     int latency_nice;
63     int uclamp_min;
64     int uclamp_max;
65     int vip_prio;
66     char cpumap[MAX_CPUMAP_LENGTH];
67 } ffrt_os_sched_attr;
68 
69 typedef void* ffrt_thread_t;
70 
71 typedef void* ffrt_interval_t;
72 
73 typedef enum {
74     ffrt_sys_event_type_read,
75 } ffrt_sys_event_type_t;
76 
77 typedef enum {
78     ffrt_sys_event_status_no_timeout,
79     ffrt_sys_event_status_timeout
80 } ffrt_sys_event_status_t;
81 
82 typedef void* ffrt_sys_event_handle_t;
83 
84 typedef void* ffrt_config_t;
85 
86 #ifdef __cplusplus
87 namespace ffrt {
88 enum qos_inner_default {
89     qos_deadline_request = ffrt_qos_deadline_request,
90     qos_user_interactive = ffrt_qos_user_interactive,
91     qos_max = ffrt_qos_max,
92 };
93 
94 enum class stack_protect {
95     weak = ffrt_stack_protect_weak,
96     strong = ffrt_stack_protect_strong,
97 };
98 }
99 #endif
100 #endif
101