1 /* 2 * Copyright (C) 2015-2017 Alibaba Group Holding Limited 3 */ 4 5 #ifndef K_SCHED_H 6 #define K_SCHED_H 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 /** @addtogroup aos_rhino sched 13 * Task schedule. 14 * 15 * @{ 16 */ 17 18 #define KSCHED_FIFO 0u 19 #define KSCHED_RR 1u 20 #define KSCHED_CFS 2u 21 22 #define SCHED_MAX_LOCK_COUNT 200u 23 #define NUM_WORDS ((RHINO_CONFIG_PRI_MAX + 31) / 32) 24 25 /** 26 * Ready tasks information 27 * 'cur_list_item' as task ready list per priority. 28 * When a task enters 'ready' from another state, it is put into the list; 29 * When a task leaves 'ready' to another state, it is get out of the list; 30 * The 'task_bit_map' is used to improve performance. 31 * The Nth bit in the bitmap starting from msb corresponds to the priority N-1. 32 */ 33 typedef struct { 34 klist_t *cur_list_item[RHINO_CONFIG_PRI_MAX]; 35 uint32_t task_bit_map[NUM_WORDS]; 36 uint8_t highest_pri; 37 } runqueue_t; 38 39 40 typedef struct { 41 /* to add */ 42 uint8_t dis_sched; 43 } per_cpu_t; 44 45 /** 46 * Disable task schedule 47 * 48 * @return the operation status, RHINO_SUCCESS is OK, others is error 49 */ 50 kstat_t krhino_sched_disable(void); 51 52 /** 53 * Enable task schedule 54 * 55 * @return the operation status, RHINO_SUCCESS is OK, others is error 56 */ 57 kstat_t krhino_sched_enable(void); 58 59 /** @} */ 60 61 #ifdef __cplusplus 62 } 63 #endif 64 65 #endif /* K_SCHED_H */ 66 67