• 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 "../../kits/c/type_def.h"
28 
29 #ifdef __cplusplus
30 #define FFRT_C_API  extern "C"
31 #else
32 #define FFRT_C_API
33 #endif
34 
35 /**
36  * @brief Enumerates the task QoS types.
37  *
38  */
39 typedef enum {
40     ffrt_qos_deadline_request = 4,
41     ffrt_qos_user_interactive,
42     ffrt_qos_max = ffrt_qos_user_interactive,
43 } ffrt_inner_qos_default_t;
44 
45 typedef enum {
46     ffrt_stack_protect_weak,
47     ffrt_stack_protect_strong
48 } ffrt_stack_protect_t;
49 
50 typedef enum {
51     ffrt_thread_attr_storage_size = 64,
52 } ffrt_inner_storage_size_t;
53 
54 typedef struct {
55     uint32_t storage[(ffrt_thread_attr_storage_size + sizeof(uint32_t) - 1) / sizeof(uint32_t)];
56 } ffrt_thread_attr_t;
57 
58 #define MAX_CPUMAP_LENGTH 100 // this is in c and code style
59 typedef struct {
60     int shares;
61     int latency_nice;
62     int uclamp_min;
63     int uclamp_max;
64     int vip_prio;
65     char cpumap[MAX_CPUMAP_LENGTH];
66 } ffrt_os_sched_attr;
67 
68 typedef void* ffrt_thread_t;
69 
70 typedef void* ffrt_interval_t;
71 
72 typedef enum {
73     ffrt_sys_event_type_read,
74 } ffrt_sys_event_type_t;
75 
76 typedef enum {
77     ffrt_sys_event_status_no_timeout,
78     ffrt_sys_event_status_timeout
79 } ffrt_sys_event_status_t;
80 
81 typedef void* ffrt_sys_event_handle_t;
82 
83 typedef void* ffrt_config_t;
84 
85 typedef enum {
86     DEV_CPU,
87     DEV_GPU,
88     DEV_NPU_HWTS,
89     DEV_NPU_TSCPU,
90     DEV_HTS,
91     DEV_ISP,
92     DEV_DSS,
93     DEV_VENC,
94     DEV_AUDIO,
95     DEV_SENSERHUB,
96     DEV_DEVMAX,
97 } dev_type;
98 
99 #ifdef __cplusplus
100 namespace ffrt {
101 enum qos_inner_default {
102     qos_deadline_request = ffrt_qos_deadline_request,
103     qos_user_interactive = ffrt_qos_user_interactive,
104     qos_max = ffrt_qos_max,
105 };
106 
107 enum class stack_protect {
108     weak = ffrt_stack_protect_weak,
109     strong = ffrt_stack_protect_strong,
110 };
111 }
112 #endif
113 #endif
114