blob: 9df7b33db8c0097a5af9a53913d94d09da33060e (
plain)
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
|
#include "../sys/core.h"
#include "../sys/timer.h"
#include "../util/time.h"
#include "../util/mutex.h"
#include "../drivers/uart.a.h"
#include "../drivers/uart.h"
#define SYS_TIMER_C
extern char* os_info_v;
unsigned long exe_cnt = 0;
struct Mutex exe_cnt_m = {.addr = &exe_cnt, .pid = NULL_PID};
void c_timer() {
// Reset the counter
write_cntv_tval(cntfrq);
// Output the value
//uart_string((char*)"Timer Value: ");
//unsigned long v = read_cntv_tval();
//uart_10(v);
//uart_char(0x20);
//uart_hexn(v);
// Lock the execution counter
if (lock_mutex(&exe_cnt_m, SCHED_PID) == 0) {
*(exe_cnt_m.addr) += 1;
#ifndef NOANSI
uart_string("\033[?25l\033[s\033[1;1H\033[91mDendritOS \033[96mv");
#else
uart_string("\033[?25l\033[1;1H\033[91mDendritOS \033[96mv");
#endif
uart_string(os_info_v);
uart_string("\033[0m #");
uart_10(*(exe_cnt_m.addr));
#ifndef NOANSI
uart_string("\033[u\033[?25h");
#else
uart_string("\033[8;1H\033[?25h> ");
#endif
release_mutex(&exe_cnt_m, SCHED_PID);
}
}
|