Project

General

Profile

Statistics
| Revision:

root / proj / proj.c @ 147

History | View | Annotate | Download (1.45 KB)

1 144 up20180655
#include <lcom/lcf.h>
2
#include <lcom/proj.h>
3
#include <lcom/liblm.h>
4
5 147 up20180655
#include <stdbool.h>
6 144 up20180655
#include <stdint.h>
7
8 147 up20180655
9 144 up20180655
int main(int argc, char* argv[]) {
10
11
    lcf_set_language("EN-US");
12
13
    //lcf_trace_calls("/home/lcom/labs/proj/trace.txt");
14
15
    //lcf_log_output("/home/lcom/labs/proj/output.txt");
16
17
    if (lcf_start(argc, argv)) return 1;
18
19
    lcf_cleanup();
20
21
    return 0;
22
}
23 147 up20180655
24
static int print_usage() {
25
  printf("Usage: <mode - hex>\n");
26
27
  return 1;
28
}
29
30
int(proj_main_loop)(int argc, char *argv[]) {
31
    /// cycle
32
    int good = 1;
33
    while (good) {
34
        /* Get a request message. */
35
        if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
36
            printf("driver_receive failed with %d", r);
37
            continue;
38
        }
39
        if (is_ipc_notify(ipc_status)) { /* received notification */
40
            switch (_ENDPOINT_P(msg.m_source)) {
41
                case HARDWARE: /* hardware interrupt notification */
42
                    if (msg.m_notify.interrupts & kbc_irq) { /* subscribed interrupt */
43
                        kbc_ih();
44
                        if (scancode[0] == ESC_BREAK_CODE) good = 0;
45
                    }
46
                    break;
47
                default:
48
                    break; /* no other notifications expected: do nothing */
49
            }
50
        } else { /* received standart message, not a notification */
51
            /* no standart message expected: do nothing */
52
        }
53
    }
54
}