-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtx.h
executable file
·76 lines (59 loc) · 1.31 KB
/
rtx.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
/**
* @file: rtx.h
* @brief: primatives for rtx
* @author:
* @date: 05/27/2011
*/
#ifndef _RTX_H_
#define _RTX_H_
#include "globals.h"
/*
* Message Envelope
*/
enum message_type {
MESSAGE_CMD_REG = 0,
MESSAGE_KEY_INPUT,
MESSAGE_OUTPUT,
MESSAGE_OUTPUT_NO_NEWLINE,
MESSAGE_COUNT_REPORT,
MESSAGE_WAKE_UP_10
};
typedef struct _message_envelope {
int sender_pid;
int receiver_pid;
enum message_type type;
struct _message_envelope* next;
struct _message_envelope* previous;
int delay;
int delay_start;
unsigned char padding[36];
unsigned char data[64];
} message_envelope;
/*
* Processor Management
*/
int release_processor();
/*
* Process Priority
*/
int set_process_priority(int pid, int priority);
int get_process_priority(int pid);
/*
* Memory Management
*/
void* request_memory_block();
int release_memory_block(void* memory_block);
/*
* Interprocess Communication
*/
int send_message(int process_id, void* message_envelope);
void* receive_message(int* sender_id);
int delayed_send(int process_id, void* message_envelope, int delay);
#ifdef _DEBUG_HOTKEYS
int debug_prt_rdy_q();
int debug_prt_blk_mem_q();
int debug_prt_blk_rec_q();
int debug_prt_mem_blks_free();
int debug_prt_message_history();
#endif /*_DEBUG_HOTKEYS*/
#endif /* _RTX_H_ */