-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrtx_const.h
85 lines (74 loc) · 2.66 KB
/
rtx_const.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
This file contains constants used by the rtx.
**/
#ifndef RTX_CONST_H
#define RTX_CONST_H
#ifdef _WIN32
#pragma once
#endif
// Number of trace entries for each trace buffer
#define TRACE_NUM 16
// Number of envelopes available for inter-process communication.
#define ENVELOPE_NUM 16
// The amount of data which a single message envelope can store (in bytes).
#define ENVELOPE_SIZE 1024
// The amount of data which a process' stack can store (in bytes).
#define PROCESS_STACK_SIZE 16384
// Each enum constains two special members:
// - invalid - represents an invalid member in the enum. It is always the first in the enum (ie. 0).
// - size - represents the number of members in the enum. It is placed at the end of the enum so that its value is always the number of members.
// The different types of priorities which a process can have. The processes higher in the list have a higher priority.
enum PROCESS_PRIORITY
{
INVALID_PROCESS_PRIORITY,
HIGH,
MEDIUM,
LOW,
IDLE, // Only null process would have this priority.
PROCESS_PRIORITY_SIZE
};
// The different types of identifiers a process can have. Each identifier can be used by at most one process.
enum PROCESS_ID
{
INVALID_PROCESS_ID,
PROCESS_NULL,
PROCESS_A,
PROCESS_B,
PROCESS_C,
PROCESS_CCI,
PROCESS_WALLCLOCK,
PROCESS_WELCOME,
I_PROCESS_TIMER,
I_PROCESS_KEYBOARD,
I_PROCESS_CRT,
I_PROCESS_TERMINATE,
PROCESS_ID_SIZE
};
// The different states a process can be in.
enum PROCESS_STATUS
{
INVALID_PROCESS_STATUS,
EXECUTING, // The process is being executed.
READY, // The process is ready for execution.
BLOCK_ENV_CLAIM, // The process is waiting for an available envelope.
BLOCK_ENV_RECEIVE, // The process is waiting for an envelope in its inbox.
INTERRUPTED, // The process is being interrupted.
PROCESS_STATUS_SIZE
};
// The different types of message envelopes
enum MESSAGE_TYPE
{
INVALID_MESSAGE_TYPE,
ALL_PROCESS, // Message contains the current status and priority of all the processes.
DISPLAY_REQ, // Message contains characters to be output to the crt.
DISPLAY_ACK, // Acknowledges transmission of message from UART.
CONSOLE_INPUT, // Message contains the characters received from the console.
TRACE_BUFFER, // Message contains the trace buffers for send and receive primitives.
CLOCK_TOGGLE, // Message contains instruction on whether to display the clock.
CLOCK_SET, // Message with value to set wall clock with.
ERROR_REASON, // Message with an error to send to the crt.
COUNT_REPORT, // Message is used for process a.
WAKEUP_CODE, // Notifies process that timeout delay is complete.
MESSAGE_TYPE_SIZE
};
#endif