-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.h
More file actions
executable file
·51 lines (39 loc) · 969 Bytes
/
types.h
File metadata and controls
executable file
·51 lines (39 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* Immortal Operating System - immortalOS
*
*/
#ifndef TYPES_H
#define TYPES_H
#include <xc.h>
//#define STACK_SIZE 31
const int STACK_SIZE = 31;
#define MAX_TASKS 10
#define ei() INTCONbits.GIE = 1
#define di() INTCONbits.GIE = 0
typedef unsigned int u_int;
typedef unsigned char byte;
typedef void(*f_ptr)(void);
typedef enum {READY = 1, RUNNING, SLEEPING, WAITING, WAITING_PIPE, FINISHED} state_t;
typedef struct stack_data {
byte TOSU_register;
byte TOSL_register;
byte TOSH_register;
} stack_data_t;
typedef struct stack {
stack_data_t STACK[STACK_SIZE];
u_int stack_size;
} stack_t;
typedef struct tcb {
// Parâmetros da tarefa
u_int task_id;
u_int task_prior;
f_ptr *task_f;
u_int delay_time;
// Dados do contexto da tarefa
state_t task_state;
stack_t task_stack;
byte BSR_register;
byte STATUS_register;
byte WORK_register;
} tcb_t;
#endif /* TYPES_H */