-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
91 lines (72 loc) · 2.92 KB
/
Copy pathmain.c
File metadata and controls
91 lines (72 loc) · 2.92 KB
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
86
87
88
89
90
91
#include <stdio.h>
#include "task.h"
#include "schedular.h"
#include "timer.h"
#include "ipc.h"
#include "storage.h"
#include "shell.h"
// ANSI terminal colors
#define C_RESET "\x1b[0m"
#define C_TITLE "\x1b[38;5;39m"
#define C_INFO "\x1b[38;5;111m"
#define C_OK "\x1b[38;5;76m"
#define C_HEAD "\x1b[38;5;250m"
#define C_BOLD "\x1b[1m"
void task1() {
printf("[TASK 1] SensorTask : Reading sensor data...\n");
write_logs("[Task 1] Sensor data logged.");
}
void task2() {
printf("[TASK 2] UARTTask : Transmitting data...\n");
write_logs("[Task 2] UART transmission logged.");
}
void task3() {
printf("[TASK 3] LEDTask : Toggling LED...\n");
write_logs("[Task 3] LED blink event logged.");
}
int main()
{
printf("\n" C_TITLE "==================================================" C_RESET "\n");
printf(C_TITLE " MINI RTOS BOOT " C_RESET "\n");
printf(C_TITLE "==================================================" C_RESET "\n");
printf(C_HEAD "System Version : v1.0.0\n" C_RESET);
printf(C_HEAD "Build Date : %s %s\n" C_RESET, __DATE__, __TIME__);
printf(C_HEAD "Target MCU : Simulation\n" C_RESET);
printf(C_HEAD "--------------------------------------------------\n" C_RESET);
printf(C_INFO "[BOOT] Initializing Core Services...\n" C_RESET);
MessageQueue q;
init_queue(&q);
printf(C_OK "[ OK ] IPC Message Queue Initialized\n" C_RESET);
init_storage();
printf(C_OK "[ OK ] Storage Subsystem Ready\n" C_RESET);
init_timer();
printf(C_OK "[ OK ] Timer Service Active\n" C_RESET);
Schedular sched;
init_schedular(&sched);
printf(C_OK "[ OK ] Task Scheduler Loaded\n" C_RESET);
Task t1, t2, t3;
create_task(&t1, 1, "SensorTask", task1);
create_task(&t2, 2, "UARTTask", task2);
create_task(&t3, 3, "LEDTask", task3);
printf("\n" C_INFO "[INFO] Task Registration\n" C_RESET);
printf(" > SensorTask\n");
printf(" > UARTTask\n");
printf(" > LEDTask\n");
add_tasks(&sched, &t1);
add_tasks(&sched, &t2);
add_tasks(&sched, &t3);
printf("\n" C_TITLE "==================================================" C_RESET "\n");
printf(C_BOLD " SYSTEM STATUS : RUNNING\n" C_RESET);
printf(" Scheduler Started Successfully\n");
printf(C_TITLE "==================================================" C_RESET "\n\n");
start_schedular(&sched);
printf("\n" C_HEAD "--------------------------------------------------\n" C_RESET);
printf(C_BOLD " SYSTEM LOG OUTPUT\n" C_RESET);
printf(C_HEAD "--------------------------------------------------\n" C_RESET);
read_logs();
printf("\n" C_HEAD "--------------------------------------------------\n" C_RESET);
printf(C_BOLD " ENTERING COMMAND SHELL\n" C_RESET);
printf(C_HEAD "--------------------------------------------------\n" C_RESET);
init_shell(&sched);
return 0;
}